use of play.mvc.Util in project coprhd-controller by CoprHD.
the class ResourceController method validateActiveProjectId.
@Util
private static boolean validateActiveProjectId(String activeProjectId) {
if (StringUtils.isNotBlank(activeProjectId)) {
URI activeProjectIdUri = URI.create(activeProjectId);
String tenantId = Models.currentAdminTenant();
List<ProjectRestRep> projects = getProjects(tenantId);
for (ProjectRestRep project : projects) {
if (project.getId().equals(activeProjectIdUri)) {
return true;
}
}
}
return false;
}
use of play.mvc.Util in project coprhd-controller by CoprHD.
the class Projects method saveProjectACLs.
@Util
private static void saveProjectACLs(String projectId, List<AclEntryForm> aclEntries) {
List<ACLEntry> currentProjectAcls = ProjectUtils.getACLs(projectId);
ACLAssignmentChanges changes = new ACLAssignmentChanges();
changes.getAdd().addAll(AclEntryForm.getAddedAcls(currentProjectAcls, aclEntries));
changes.getRemove().addAll(AclEntryForm.getRemovedAcls(currentProjectAcls, aclEntries));
try {
ProjectUtils.updateACLs(projectId, changes);
} catch (ViPRException e) {
Logger.error(e, "Failed to update Project ACLs");
String errorDesc = e.getMessage();
if (e instanceof ServiceErrorException) {
errorDesc = ((ServiceErrorException) e).getDetailedMessage();
}
flash.error(MessagesUtils.get("projects.updateProjectACLs.failed", errorDesc));
}
}
use of play.mvc.Util in project coprhd-controller by CoprHD.
the class Tenants method addRenderArgs.
@Util
private static void addRenderArgs(TenantForm tenant) {
List<String> domains = Lists.newArrayList();
for (AuthnProviderRestRep authProvider : AuthnProviderUtils.getAuthnProviders()) {
if (!authProvider.getDisable()) {
domains.addAll(authProvider.getDomains());
}
}
Gson g = new Gson();
renderArgs.put("domainsJson", g.toJson(domains));
List<StringOption> allNamespace = TenantUtils.getUnmappedNamespace();
renderArgs.put("namespaceOptions", allNamespace);
}
use of play.mvc.Util in project coprhd-controller by CoprHD.
the class Notifications method getNotifications.
@Util
public static List<Notification> getNotifications() {
ViPRCatalogClient2 catalog = getCatalogClient();
List<Notification> notifications = Lists.newArrayList();
List<ApprovalRestRep> approvals = catalog.approvals().search().byStatus(ApprovalRestRep.PENDING).run();
for (ApprovalRestRep approval : approvals) {
if (approval.getOrder() != null) {
OrderRestRep order = getOrder(approval.getOrder());
if (order != null) {
CatalogServiceRestRep service = getCatalogService(order.getCatalogService());
Notification notification = new Notification();
notification.id = approval.getId().toString();
notification.orderId = order.getId().toString();
if (service != null) {
notification.image = service.getImage();
notification.message = MessagesUtils.get("notification.approvalPending", service.getTitle(), order.getSubmittedBy());
}
notification.lastUpdated = approval.getDateActioned() != null ? approval.getDateActioned() : approval.getCreationTime().getTime();
notifications.add(notification);
}
}
}
return notifications;
}
use of play.mvc.Util in project coprhd-controller by CoprHD.
the class FileProtectionPolicies method addRenderArgs.
@Util
private static void addRenderArgs() {
List<StringOption> policyTypeOptions = Lists.newArrayList();
policyTypeOptions.add(new StringOption("file_snapshot", MessagesUtils.get("schedulePolicy.snapshot")));
policyTypeOptions.add(new StringOption("file_replication", MessagesUtils.get("schedulePolicy.replication")));
renderArgs.put("policyTypeOptions", policyTypeOptions);
List<StringOption> replicationTypeOptions = Lists.newArrayList();
replicationTypeOptions.add(new StringOption("REMOTE", MessagesUtils.get("schedulePolicy.replicationRemote")));
replicationTypeOptions.add(new StringOption("LOCAL", MessagesUtils.get("schedulePolicy.replicationLocal")));
renderArgs.put("replicationTypeOptions", replicationTypeOptions);
List<StringOption> replicationCopyTypeOptions = Lists.newArrayList();
replicationCopyTypeOptions.add(new StringOption("ASYNC", MessagesUtils.get("schedulePolicy.replicationAsync")));
renderArgs.put("replicationCopyTypeOptions", replicationCopyTypeOptions);
List<StringOption> policyPriorityOptions = Lists.newArrayList();
policyPriorityOptions.add(new StringOption("Normal", MessagesUtils.get("schedulePolicy.priorityNormal")));
policyPriorityOptions.add(new StringOption("High", MessagesUtils.get("schedulePolicy.priorityHigh")));
renderArgs.put("policyPriorityOptions", policyPriorityOptions);
}
Aggregations