Search in sources :

Example 6 with UIRequest

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));
    }
}
Also used : UIRequest(org.collectionspace.csp.api.ui.UIRequest) Request(org.collectionspace.chain.csp.webui.main.Request) UIRequest(org.collectionspace.csp.api.ui.UIRequest)

Example 7 with UIRequest

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));
    }
}
Also used : UIRequest(org.collectionspace.csp.api.ui.UIRequest) Request(org.collectionspace.chain.csp.webui.main.Request) UIRequest(org.collectionspace.csp.api.ui.UIRequest)

Example 8 with UIRequest

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);
    }
}
Also used : JSONObject(org.json.JSONObject) UISession(org.collectionspace.csp.api.ui.UISession) UIRequest(org.collectionspace.csp.api.ui.UIRequest) Request(org.collectionspace.chain.csp.webui.main.Request) UIRequest(org.collectionspace.csp.api.ui.UIRequest)

Example 9 with UIRequest

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);
    }
}
Also used : UIRequest(org.collectionspace.csp.api.ui.UIRequest) Request(org.collectionspace.chain.csp.webui.main.Request) UIRequest(org.collectionspace.csp.api.ui.UIRequest)

Example 10 with UIRequest

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");
}
Also used : CSPRequestCache(org.collectionspace.csp.api.core.CSPRequestCache) RequestCache(org.collectionspace.csp.helper.core.RequestCache) UIRequest(org.collectionspace.csp.api.ui.UIRequest) UnauthorizedException(org.collectionspace.csp.api.persistence.UnauthorizedException) UIException(org.collectionspace.csp.api.ui.UIException) CSPRequestCache(org.collectionspace.csp.api.core.CSPRequestCache) UIException(org.collectionspace.csp.api.ui.UIException) CSPDependencyException(org.collectionspace.csp.api.core.CSPDependencyException) UnauthorizedException(org.collectionspace.csp.api.persistence.UnauthorizedException)

Aggregations

UIRequest (org.collectionspace.csp.api.ui.UIRequest)11 Request (org.collectionspace.chain.csp.webui.main.Request)7 JSONObject (org.json.JSONObject)5 UIException (org.collectionspace.csp.api.ui.UIException)4 UISession (org.collectionspace.csp.api.ui.UISession)3 JSONException (org.json.JSONException)3 HttpSession (javax.servlet.http.HttpSession)1 CSPDependencyException (org.collectionspace.csp.api.core.CSPDependencyException)1 CSPRequestCache (org.collectionspace.csp.api.core.CSPRequestCache)1 ExistException (org.collectionspace.csp.api.persistence.ExistException)1 Storage (org.collectionspace.csp.api.persistence.Storage)1 UnauthorizedException (org.collectionspace.csp.api.persistence.UnauthorizedException)1 UnderlyingStorageException (org.collectionspace.csp.api.persistence.UnderlyingStorageException)1 UnimplementedException (org.collectionspace.csp.api.persistence.UnimplementedException)1 RequestCache (org.collectionspace.csp.helper.core.RequestCache)1 StructuredDateFormatException (org.collectionspace.services.structureddate.StructuredDateFormatException)1 StructuredDateInternal (org.collectionspace.services.structureddate.StructuredDateInternal)1