use of org.wso2.carbon.apimgt.rest.api.publisher.dto.Scope_bindingsDTO in project carbon-apimgt by wso2.
the class MappingUtil method scopeDto.
/**
* used to convert {@link Scope} to {@link ScopeDTO}
* @param scope scope Object
* @param scopeBindingType type of bindings
* @return ScopeDTO object
*/
public static ScopeDTO scopeDto(Scope scope, String scopeBindingType) {
ScopeDTO scopeDTO = new ScopeDTO();
scopeDTO.setName(scope.getName());
scopeDTO.setDescription(scope.getDescription());
Scope_bindingsDTO scopeBindingsDTO = new Scope_bindingsDTO();
scopeBindingsDTO.setType(scopeBindingType);
if (scope.getBindings() != null) {
scopeBindingsDTO.setValues(scope.getBindings());
} else {
scopeBindingsDTO.setValues(Collections.emptyList());
}
scopeDTO.setBindings(scopeBindingsDTO);
return scopeDTO;
}
use of org.wso2.carbon.apimgt.rest.api.publisher.dto.Scope_bindingsDTO in project carbon-apimgt by wso2.
the class MappingUtil method toScope.
/**
* This method convert {@link ScopeDTO} to {@link Scope}
* @param body scopeDto Object
* @return scope object
*/
public static Scope toScope(ScopeDTO body) {
Scope scope = new Scope();
scope.setName(body.getName());
scope.setDescription(body.getDescription());
Scope_bindingsDTO scopeBindingsDTO = body.getBindings();
if (scopeBindingsDTO != null) {
scope.setBindings(scopeBindingsDTO.getValues());
}
return scope;
}
Aggregations