use of com.emc.vipr.model.catalog.ApprovalList in project coprhd-controller by CoprHD.
the class ApprovalService method getApprovals.
/**
* Gets the list of approvals
*
* @param tenantId the URN of a tenant
* @brief List Approvals
* @return a list of approvals
* @throws DatabaseException when a DB error occurs
*/
@GET
@Path("")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public ApprovalList getApprovals(@DefaultValue("") @QueryParam(SearchConstants.TENANT_ID_PARAM) String tenantId) throws DatabaseException {
StorageOSUser user = getUserFromContext();
if (StringUtils.isBlank(tenantId)) {
tenantId = user.getTenantId();
}
verifyAuthorizedInTenantOrg(uri(tenantId), getUserFromContext());
List<ApprovalRequest> approvals = approvalManager.getApprovals(uri(tenantId));
ApprovalList approvalList = new ApprovalList();
for (ApprovalRequest approval : approvals) {
NamedRelatedResourceRep approvalRestRep = toNamedRelatedResource(ResourceTypeEnum.APPROVAL, approval.getId(), approval.getLabel());
approvalList.getApprovals().add(approvalRestRep);
}
return approvalList;
}
use of com.emc.vipr.model.catalog.ApprovalList in project coprhd-controller by CoprHD.
the class Approvals2 method listByTenant.
@Override
public List<NamedRelatedResourceRep> listByTenant(URI tenantId) {
UriBuilder uriBuilder = client.uriBuilder(PathConstants.APPROVALS2_URL);
if (tenantId != null) {
uriBuilder = uriBuilder.queryParam(SearchConstants.TENANT_ID_PARAM, tenantId);
}
ApprovalList response = client.getURI(ApprovalList.class, uriBuilder.build());
return ResourceUtils.defaultList(response.getApprovals());
}
Aggregations