Search in sources :

Example 1 with PolicyDevelopmentEntity

use of io.gravitee.rest.api.model.PolicyDevelopmentEntity in project gravitee-management-rest-api by gravitee-io.

the class PoliciesResource method convert.

private PolicyListItem convert(PolicyEntity policy) {
    PolicyListItem item = new PolicyListItem();
    item.setId(policy.getId());
    item.setName(policy.getName());
    item.setDescription(policy.getDescription());
    item.setVersion(policy.getVersion());
    item.setType(policy.getType());
    item.setCategory(policy.getCategory());
    PolicyDevelopmentEntity development = policy.getDevelopment();
    if (development != null) {
        item.setOnRequest(development.getOnRequestMethod() != null);
        item.setOnResponse(development.getOnResponseMethod() != null);
    } else {
        item.setOnRequest(false);
        item.setOnResponse(false);
    }
    return item;
}
Also used : PolicyListItem(io.gravitee.rest.api.model.PolicyListItem) PolicyDevelopmentEntity(io.gravitee.rest.api.model.PolicyDevelopmentEntity)

Aggregations

PolicyDevelopmentEntity (io.gravitee.rest.api.model.PolicyDevelopmentEntity)1 PolicyListItem (io.gravitee.rest.api.model.PolicyListItem)1