use of play.mvc.Util in project coprhd-controller by CoprHD.
the class Common method toSafeRedirectURL.
@Util
public static String toSafeRedirectURL(String url) {
String cleanUrl = "";
try {
// Remove Host and port from referrer
URI uriObject = new URI(url);
cleanUrl += uriObject.getPath();
String query = uriObject.getQuery();
if (!StringUtils.isBlank(query)) {
cleanUrl += "?" + query;
}
} catch (URISyntaxException ignore) {
Logger.error(ignore.getMessage());
}
return cleanUrl;
}
use of play.mvc.Util in project coprhd-controller by CoprHD.
the class TaskUtils method getTaskSummary.
@Util
public static TaskSummary getTaskSummary(TaskResourceRep task) {
TaskSummary taskSummary = new TaskSummary(task);
if (task != null && task.getResource() != null && task.getResource().getId() != null) {
ResourceType resourceType = ResourceType.fromResourceId(task.getResource().getId().toString());
taskSummary.resourceType = resourceType.name();
}
taskSummary.orderId = TagUtils.getOrderIdTagValue(task);
taskSummary.orderNumber = TagUtils.getOrderNumberTagValue(task);
if (Security.isSystemAdmin() || Security.isSystemMonitor()) {
if (task.getWorkflow() != null && task.getWorkflow().getId() != null) {
taskSummary.steps = getWorkflowSteps(task.getWorkflow().getId());
}
}
return taskSummary;
}
use of play.mvc.Util in project coprhd-controller by CoprHD.
the class VirtualArrays method getVirtualArray.
/**
* Gets the given virtual array. If the array cannot be found, an error is show and redirects back to the referrer
* or to the list page.
*
* @param id
* the virtual array ID.
* @return the virtual array.
*/
@Util
public static VirtualArrayRestRep getVirtualArray(String id) {
VirtualArrayRestRep virtualArray = VirtualArrayUtils.getVirtualArray(id);
if (virtualArray == null) {
flash.error(MessagesUtils.get(UNKNOWN, id));
backToReferrer();
list();
}
return virtualArray;
}
use of play.mvc.Util in project coprhd-controller by CoprHD.
the class Common method handleExpiredToken.
@Util
public static void handleExpiredToken(Throwable throwable) {
if (throwable instanceof ViPRHttpException) {
ViPRHttpException ve = (ViPRHttpException) throwable;
if (ve.getHttpCode() == HttpStatus.SC_UNAUTHORIZED) {
Logger.info("Clearing auth token");
// Auth token may have expired
Security.clearAuthToken();
Security.redirectToAuthPage();
}
}
}
use of play.mvc.Util in project coprhd-controller by CoprHD.
the class BlockVolumes method createCopiesParam.
@Util
private static CopiesParam createCopiesParam(String continuousCopyId) {
Copy copy = new Copy();
copy.setType(COPY_NATIVE);
copy.setCopyID(uri(continuousCopyId));
List<Copy> copies = Lists.newArrayList();
copies.add(copy);
CopiesParam input = new CopiesParam(copies);
return input;
}
Aggregations