use of com.emc.vipr.client.ViPRCatalogClient2 in project coprhd-controller by CoprHD.
the class CatalogServiceUtils method moveUpService.
public static void moveUpService(URI catalogServiceId) {
ViPRCatalogClient2 catalog = getCatalogClient();
catalog.services().moveUp(catalogServiceId);
}
use of com.emc.vipr.client.ViPRCatalogClient2 in project coprhd-controller by CoprHD.
the class CatalogServiceUtils method moveUpServiceField.
public static void moveUpServiceField(URI catalogServiceId, String fieldName) {
ViPRCatalogClient2 catalog = getCatalogClient();
catalog.services().moveUpField(catalogServiceId, fieldName);
}
use of com.emc.vipr.client.ViPRCatalogClient2 in project coprhd-controller by CoprHD.
the class CatalogServiceUtils method getCatalogService.
public static CatalogServiceRestRep getCatalogService(URI id) {
ViPRCatalogClient2 catalog = getCatalogClient();
CatalogServiceRestRep service = null;
try {
service = catalog.services().get(id);
} catch (ViPRHttpException e) {
if (e.getHttpCode() == 404) {
service = null;
} else {
throw e;
}
}
return service;
}
use of com.emc.vipr.client.ViPRCatalogClient2 in project coprhd-controller by CoprHD.
the class Approvals method edit.
public static void edit(String id) {
ViPRCatalogClient2 catalog = getCatalogClient();
ApprovalRestRep approval = catalog.approvals().get(uri(id));
if (!approval.getTenant().getId().toString().equals(Security.getUserInfo().getTenant())) {
Result result = new Unauthorized(MessagesUtils.get("approval.noTenantAccess", approval.getTenant().getId()));
renderTemplate("errors/401.html", result);
}
OrderRestRep order = null;
ScheduledEventRestRep scheduledEvent = null;
Date scheduleStartDateTime = null;
CatalogServiceRestRep service = null;
if (approval != null) {
order = getOrder(approval.getOrder());
if (order != null) {
service = getCatalogService(order.getCatalogService());
URI scheduledEventId = order.getScheduledEventId();
if (scheduledEventId != null) {
scheduledEvent = getCatalogClient().orders().getScheduledEvent(scheduledEventId);
String isoDateTimeStr = String.format("%sT%02d:%02d:00Z", scheduledEvent.getScheduleInfo().getStartDate(), scheduledEvent.getScheduleInfo().getHourOfDay(), scheduledEvent.getScheduleInfo().getMinuteOfHour());
DateTime startDateTime = DateTime.parse(isoDateTimeStr);
scheduleStartDateTime = startDateTime.toDate();
}
}
}
render(approval, order, service, scheduledEvent, scheduleStartDateTime);
}
use of com.emc.vipr.client.ViPRCatalogClient2 in project coprhd-controller by CoprHD.
the class Approvals method submit.
public static void submit(String id, ApprovalsForm approval) {
ViPRCatalogClient2 catalog = getCatalogClient();
ApprovalRestRep approvalRep = catalog.approvals().get(uri(id));
OrderRestRep order = getOrder(approvalRep.getOrder());
if (approvalRep.isPending()) {
approval.validate("approval");
if (Validation.hasErrors()) {
Common.handleError();
}
if (isApprove(approval.getSubmit())) {
approve(approvalRep, approval.getMessage());
flash.put("success", MessagesUtils.get("approval.approve.message", order.getSubmittedBy()));
} else if (isReject(approval.getSubmit())) {
reject(approvalRep, approval.getMessage());
flash.put("warn", MessagesUtils.get("approval.reject.message", order.getSubmittedBy()));
}
} else {
flash.error(MessagesUtils.get("approval.notPending.error", order.getOrderNumber()));
}
index();
}
Aggregations