use of com.emc.storageos.db.client.model.uimodels.CatalogService in project coprhd-controller by CoprHD.
the class ServiceRunner method createService.
private static CatalogService createService(String name) {
CatalogService service = new CatalogService();
service.setLabel(name);
service.setTitle(name);
service.setBaseService(name);
return save(service);
}
use of com.emc.storageos.db.client.model.uimodels.CatalogService in project coprhd-controller by CoprHD.
the class ServiceRunner method dumpOrder.
public static void dumpOrder(Order order) {
print("Order: %s", order.getId());
print(" Status: %s", order.getOrderStatus());
print(" Message: %s", order.getMessage());
CatalogService service = load(order.getCatalogServiceId(), CatalogService.class);
print(" Service: %s (%s)", service.getLabel(), service.getBaseService());
ExecutionState state = load(order.getExecutionStateId(), ExecutionState.class);
print(" Time: %s -> %s (%.1f s)", state.getStartDate(), state.getEndDate(), (state.getEndDate().getTime() - state.getStartDate().getTime()) / 1000.0);
List<ExecutionLog> logs = load(state.getLogIds(), ExecutionLog.class);
Collections.sort(logs, LOG_COMPARATOR);
if (!logs.isEmpty()) {
print(" Logs");
for (ExecutionLog log : logs) {
print(" - %s\t%s\t%s", log.getDate(), log.getLevel(), log.getMessage());
}
}
List<ExecutionTaskLog> taskLogs = load(state.getTaskLogIds(), ExecutionTaskLog.class);
Collections.sort(taskLogs, LOG_COMPARATOR);
if (!taskLogs.isEmpty()) {
print(" Task Logs");
for (ExecutionTaskLog log : taskLogs) {
print(" - %s\t%s\t%s\t%s", log.getDate(), log.getLevel(), log.getMessage(), log.getDetail());
}
}
}
use of com.emc.storageos.db.client.model.uimodels.CatalogService in project coprhd-controller by CoprHD.
the class CatalogCategoryService method filterServicesByACLs.
/**
* filter out the services which user don't have access to
*
* @param services
* @return
*/
private List<CatalogService> filterServicesByACLs(List<CatalogService> services) {
List<CatalogService> filteredCatalogServices = Lists.newArrayList();
StorageOSUser storageOSUser = getUserFromContext();
String username = storageOSUser.getName();
if (isAdministrator(storageOSUser)) {
log.debug(username + " has SystemAdmin or TenantAdmin Role, can view all categories.");
filteredCatalogServices.addAll(services);
return filteredCatalogServices;
}
for (CatalogService service : services) {
if (hasAccess(storageOSUser, service)) {
filteredCatalogServices.add(service);
}
}
return filteredCatalogServices;
}
use of com.emc.storageos.db.client.model.uimodels.CatalogService in project coprhd-controller by CoprHD.
the class CatalogServiceService method createCatalogService.
/**
* Creates a new catalog service
*
* @param createParam
* the parameter to create a new catalog service
* @prereq none
* @brief Create Catalog Service
* @return none
*/
@POST
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@CheckPermission(roles = { Role.TENANT_ADMIN }, acls = { ACL.OWN })
@Path("")
public CatalogServiceRestRep createCatalogService(CatalogServiceCreateParam createParam) {
StorageOSUser user = getUserFromContext();
CatalogCategory parentCatalogCategory = catalogCategoryManager.getCatalogCategoryById(createParam.getCatalogCategory());
verifyAuthorizedInTenantOrg(uri(parentCatalogCategory.getTenant()), user);
validateParam(createParam, null);
CatalogService catalogService = createNewObject(createParam, parentCatalogCategory);
List<CatalogServiceField> catalogServiceFields = createNewObjectList(catalogService, createParam.getCatalogServiceFields());
catalogServiceManager.createCatalogService(catalogService, catalogServiceFields);
auditOpSuccess(OperationTypeEnum.CREATE_CATALOG_SERVICE, catalogService.auditParameters());
// Refresh Objects
catalogService = catalogServiceManager.getCatalogServiceById(catalogService.getId());
catalogServiceFields = catalogServiceManager.getCatalogServiceFields(catalogService.getId());
ServiceDescriptor serviceDescriptor = getServiceDescriptor(catalogService);
return map(catalogService, serviceDescriptor, catalogServiceFields);
}
use of com.emc.storageos.db.client.model.uimodels.CatalogService in project coprhd-controller by CoprHD.
the class CatalogServiceService method getTenantOwner.
@Override
protected URI getTenantOwner(URI id) {
CatalogService catalogService = queryResource(id);
CatalogCategory parentCatalogCategory = catalogCategoryManager.getCatalogCategoryById(catalogService.getCatalogCategoryId().getURI());
return uri(parentCatalogCategory.getTenant());
}
Aggregations