use of org.collectionspace.csp.api.ui.UIRequest in project application by collectionspace.
the class UserDetailsSearchList method run.
public void run(Object in, String[] tail) throws UIException {
Request q = (Request) in;
UIRequest uir = q.getUIRequest();
if (search) {
search_or_list(q.getStorage(), uir, uir.getRequestArgument(SEARCH_QUERY_PARAM), uir.getRequestArgument(PAGE_SIZE_PARAM), uir.getRequestArgument(PAGE_NUM_PARAM));
} else {
search_or_list(q.getStorage(), uir, null, uir.getRequestArgument(PAGE_SIZE_PARAM), uir.getRequestArgument(PAGE_NUM_PARAM));
}
}
use of org.collectionspace.csp.api.ui.UIRequest in project application by collectionspace.
the class UserRolesSearchList method run.
public void run(Object in, String[] tail) throws UIException {
Request q = (Request) in;
UIRequest uir = q.getUIRequest();
if (search) {
search_or_list(q.getStorage(), uir, uir.getRequestArgument(SEARCH_QUERY_PARAM), uir.getRequestArgument(PAGE_SIZE_PARAM), uir.getRequestArgument(PAGE_NUM_PARAM));
} else {
search_or_list(q.getStorage(), uir, null, uir.getRequestArgument(PAGE_SIZE_PARAM), uir.getRequestArgument(PAGE_NUM_PARAM));
}
}
use of org.collectionspace.csp.api.ui.UIRequest in project application by collectionspace.
the class UISchema method run.
@Override
public void run(Object in, String[] tail) throws UIException, UnauthorizedException {
Request q = (Request) in;
JSONObject out;
if (this.record != null) {
if (this.spectype.equals("search")) {
out = uisearchschema(q.getStorage(), this.record);
} else {
out = uirecordschema(q.getStorage(), this.record);
}
} else {
UISession session = q.getUIRequest().getSession();
out = uiotherschema(session, q.getStorage(), StringUtils.join(tail, "/"));
}
UIRequest uir = q.getUIRequest();
uir.sendJSONResponse(out);
int cacheMaxAgeSeconds = spec.getAdminData().getUiSpecSchemaCacheAge();
if (cacheMaxAgeSeconds > 0) {
uir.setCacheMaxAgeSeconds(cacheMaxAgeSeconds);
}
}
use of org.collectionspace.csp.api.ui.UIRequest in project application by collectionspace.
the class RelateSearchList method run.
public void run(Object in, String[] tail) throws UIException {
Request q = (Request) in;
UIRequest uir = q.getUIRequest();
if (search) {
search_or_list(q.getStorage(), uir, uir.getRequestArgument(RELATION_SOURCE_PARAM), uir.getRequestArgument(RELATION_TARGET_PARAM), uir.getRequestArgument(RELATION_TYPE_PARAM));
} else {
search_or_list(q.getStorage(), uir, null, null, null);
}
}
use of org.collectionspace.csp.api.ui.UIRequest in project application by collectionspace.
the class WebUI method serviceRequest.
@Override
public void serviceRequest(UIRequest ui) throws UIException, UnauthorizedException {
CSPRequestCache cache = new RequestCache();
String[] path = ui.getPrincipalPath();
Request r = new Request(xxx_storage, cache, ui);
String test = ui.getRequestedOperation().toString();
log.debug("ServiceRequest path: " + StringUtils.join(path, "/"));
log.debug(test);
try {
if (tries.get(ui.getRequestedOperation()).call(path, r))
return;
} catch (UIException e) {
throw e;
} catch (UnauthorizedException ue) {
throw ue;
} catch (Exception e) {
log.error("Error in WebUI.serviceRequest", e);
log.error(String.format("Request body= %s", ui.getBody()));
throw new UIException("Error in read", e);
}
throw new UIException("path not used");
}
Aggregations