Search in sources :

Example 31 with DateTimeFormat

use of org.apache.chemistry.opencmis.commons.enums.DateTimeFormat in project copper-cms by PogeyanOSS.

the class VersioningActor method getPropertiesOfLatestVersion.

private JSONObject getPropertiesOfLatestVersion(QueryGetRequest request) throws CmisObjectNotFoundException, CmisRuntimeException {
    String permission = request.getUserObject().getPermission();
    if (!Helpers.checkingUserPremission(permission, "get")) {
        throw new CmisRuntimeException(request.getUserName() + " is not authorized to applyAcl.");
    }
    boolean succinct = request.getBooleanParameter(QueryGetRequest.PARAM_SUCCINCT, false);
    DateTimeFormat dateTimeFormat = request.getDateTimeFormatParameter();
    String objectId = request.getObjectId();
    String versionSeriesId = request.getParameter(QueryGetRequest.PARAM_VERSION_SERIES_ID);
    String filter = request.getParameter(QueryGetRequest.PARAM_FILTER);
    Boolean major = request.getBooleanParameter(QueryGetRequest.PARAM_MAJOR);
    String userName = request.getUserName();
    Properties properties = CmisVersioningServices.Impl.getPropertiesOfLatestVersion(request.getRepositoryId(), objectId, versionSeriesId, major, filter, null, userName);
    if (properties == null) {
        throw new CmisRuntimeException("properties is not present!");
    }
    JSONObject jsonObject = JSONConverter.convert(properties, objectId, null, JSONConverter.PropertyMode.OBJECT, succinct, dateTimeFormat);
    return jsonObject;
}
Also used : CmisRuntimeException(org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException) JSONObject(org.apache.chemistry.opencmis.commons.impl.json.JSONObject) Properties(org.apache.chemistry.opencmis.commons.data.Properties) DateTimeFormat(org.apache.chemistry.opencmis.commons.enums.DateTimeFormat)

Example 32 with DateTimeFormat

use of org.apache.chemistry.opencmis.commons.enums.DateTimeFormat in project copper-cms by PogeyanOSS.

the class NavigationActor method getParent.

private JSONObject getParent(QueryGetRequest request) throws CmisInvalidArgumentException, CmisRuntimeException {
    String permission = request.getUserObject().getPermission();
    if (!Helpers.checkingUserPremission(permission, "get")) {
        throw new CmisRuntimeException(request.getUserName() + " is not authorized to applyAcl.");
    }
    String objectId = request.getObjectId();
    String filter = request.getParameter(QueryGetRequest.PARAM_FILTER);
    boolean succinct = request.getBooleanParameter(QueryGetRequest.PARAM_SUCCINCT, false);
    DateTimeFormat dateTimeFormat = request.getDateTimeFormatParameter();
    ObjectData parent = CmisNavigationService.Impl.getFolderParent(request.getRepositoryId(), objectId, filter, null, request.getUserObject().getUserDN());
    if (parent == null) {
        throw new CmisRuntimeException("Parent is null!");
    }
    JSONObject jsonObject = JSONConverter.convert(parent, CmisTypeCacheService.get(request.getRepositoryId()), JSONConverter.PropertyMode.OBJECT, succinct, dateTimeFormat);
    return jsonObject;
}
Also used : CmisRuntimeException(org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException) JSONObject(org.apache.chemistry.opencmis.commons.impl.json.JSONObject) ObjectData(org.apache.chemistry.opencmis.commons.data.ObjectData) DateTimeFormat(org.apache.chemistry.opencmis.commons.enums.DateTimeFormat)

Example 33 with DateTimeFormat

use of org.apache.chemistry.opencmis.commons.enums.DateTimeFormat in project copper-cms by PogeyanOSS.

the class NavigationActor method getChildren.

private JSONObject getChildren(QueryGetRequest request) throws CmisObjectNotFoundException, CmisRuntimeException {
    String permission = request.getUserObject().getPermission();
    if (!Helpers.checkingUserPremission(permission, "get")) {
        throw new CmisRuntimeException(request.getUserName() + " is not authorized to applyAcl.");
    }
    String folderId = request.getObjectId();
    String filter = request.getParameter(QueryGetRequest.PARAM_FILTER);
    String orderBy = request.getParameter(QueryGetRequest.PARAM_ORDER_BY);
    Boolean includeAllowableActions = request.getBooleanParameter(QueryGetRequest.PARAM_ALLOWABLE_ACTIONS);
    includeAllowableActions = includeAllowableActions == null ? false : includeAllowableActions;
    IncludeRelationships includeRelationships = request.getEnumParameter(QueryGetRequest.PARAM_RELATIONSHIPS, IncludeRelationships.class);
    String renditionFilter = request.getParameter(QueryGetRequest.PARAM_RENDITION_FILTER);
    Boolean includePathSegment = request.getBooleanParameter(QueryGetRequest.PARAM_PATH_SEGMENT);
    BigInteger maxItems = request.getBigIntegerParameter(QueryGetRequest.PARAM_MAX_ITEMS);
    BigInteger skipCount = request.getBigIntegerParameter(QueryGetRequest.PARAM_SKIP_COUNT);
    boolean succinct = request.getBooleanParameter(QueryGetRequest.PARAM_SUCCINCT, false);
    DateTimeFormat dateTimeFormat = request.getDateTimeFormatParameter();
    ObjectInFolderList children = CmisNavigationService.Impl.getChildren(request.getRepositoryId(), folderId, filter, orderBy, includeAllowableActions, includeRelationships, renditionFilter, includePathSegment, maxItems, skipCount, null, request.getUserObject());
    if (children == null) {
        throw new CmisRuntimeException("Children are null!");
    }
    JSONObject jsonChildren = JSONConverter.convert(children, CmisTypeCacheService.get(request.getRepositoryId()), succinct, dateTimeFormat);
    return jsonChildren;
}
Also used : CmisRuntimeException(org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException) JSONObject(org.apache.chemistry.opencmis.commons.impl.json.JSONObject) ObjectInFolderList(org.apache.chemistry.opencmis.commons.data.ObjectInFolderList) IncludeRelationships(org.apache.chemistry.opencmis.commons.enums.IncludeRelationships) BigInteger(java.math.BigInteger) DateTimeFormat(org.apache.chemistry.opencmis.commons.enums.DateTimeFormat)

Example 34 with DateTimeFormat

use of org.apache.chemistry.opencmis.commons.enums.DateTimeFormat in project copper-cms by PogeyanOSS.

the class NavigationActor method getParents.

private JSONArray getParents(QueryGetRequest request) throws CmisRuntimeException {
    String permission = request.getUserObject().getPermission();
    if (!Helpers.checkingUserPremission(permission, "get")) {
        throw new CmisRuntimeException(request.getUserName() + " is not authorized to applyAcl.");
    }
    String objectId = request.getObjectId();
    String filter = request.getParameter(QueryGetRequest.PARAM_FILTER);
    Boolean includeAllowableActions = request.getBooleanParameter(QueryGetRequest.PARAM_ALLOWABLE_ACTIONS);
    IncludeRelationships includeRelationships = request.getEnumParameter(QueryGetRequest.PARAM_RELATIONSHIPS, IncludeRelationships.class);
    String renditionFilter = request.getParameter(QueryGetRequest.PARAM_RENDITION_FILTER);
    Boolean includeRelativePathSegment = request.getBooleanParameter(QueryGetRequest.PARAM_RELATIVE_PATH_SEGMENT);
    boolean succinct = request.getBooleanParameter(QueryGetRequest.PARAM_SUCCINCT, false);
    DateTimeFormat dateTimeFormat = request.getDateTimeFormatParameter();
    List<ObjectParentData> parents = CmisNavigationService.Impl.getObjectParents(request.getRepositoryId(), objectId, filter, includeAllowableActions, includeRelationships, renditionFilter, includeRelativePathSegment, null, request.getUserObject().getUserDN());
    if (parents == null) {
        throw new CmisRuntimeException("Parents are null!");
    }
    JSONArray jsonParents = new JSONArray();
    for (ObjectParentData parent : parents) {
        jsonParents.add(JSONConverter.convert(parent, CmisTypeCacheService.get(request.getRepositoryId()), succinct, dateTimeFormat));
    }
    return jsonParents;
}
Also used : ObjectParentData(org.apache.chemistry.opencmis.commons.data.ObjectParentData) CmisRuntimeException(org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException) JSONArray(org.apache.chemistry.opencmis.commons.impl.json.JSONArray) IncludeRelationships(org.apache.chemistry.opencmis.commons.enums.IncludeRelationships) DateTimeFormat(org.apache.chemistry.opencmis.commons.enums.DateTimeFormat)

Example 35 with DateTimeFormat

use of org.apache.chemistry.opencmis.commons.enums.DateTimeFormat in project copper-cms by PogeyanOSS.

the class NavigationActor method getCheckedOutDocs.

private JSONObject getCheckedOutDocs(QueryGetRequest request) throws CmisObjectNotFoundException, CmisRuntimeException {
    String permission = request.getUserObject().getPermission();
    if (!Helpers.checkingUserPremission(permission, "get")) {
        throw new CmisRuntimeException(request.getUserName() + " is not authorized to applyAcl.");
    }
    String folderId = request.getObjectId();
    String filter = request.getParameter(QueryGetRequest.PARAM_FILTER);
    String orderBy = request.getParameter(QueryGetRequest.PARAM_ORDER_BY);
    Boolean includeAllowableActions = request.getBooleanParameter(QueryGetRequest.PARAM_ALLOWABLE_ACTIONS);
    includeAllowableActions = includeAllowableActions == null ? false : includeAllowableActions;
    IncludeRelationships includeRelationships = request.getEnumParameter(QueryGetRequest.PARAM_RELATIONSHIPS, IncludeRelationships.class);
    String renditionFilter = request.getParameter(QueryGetRequest.PARAM_RENDITION_FILTER);
    BigInteger maxItems = request.getBigIntegerParameter(QueryGetRequest.PARAM_MAX_ITEMS);
    BigInteger skipCount = request.getBigIntegerParameter(QueryGetRequest.PARAM_SKIP_COUNT);
    boolean succinct = request.getBooleanParameter(QueryGetRequest.PARAM_SUCCINCT, false);
    DateTimeFormat dateTimeFormat = request.getDateTimeFormatParameter();
    ObjectList docs = CmisNavigationService.Impl.getCheckedOutDocs(request.getRepositoryId(), folderId, filter, orderBy, includeAllowableActions, includeRelationships, renditionFilter, maxItems, skipCount, null, null, request.getUserObject());
    if (docs == null) {
        throw new CmisRuntimeException("Children are null!");
    }
    JSONObject jsonDocs = JSONConverter.convert(docs, CmisTypeCacheService.get(request.getRepositoryId()), JSONConverter.PropertyMode.OBJECT, succinct, dateTimeFormat);
    return jsonDocs;
}
Also used : CmisRuntimeException(org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException) JSONObject(org.apache.chemistry.opencmis.commons.impl.json.JSONObject) IncludeRelationships(org.apache.chemistry.opencmis.commons.enums.IncludeRelationships) BigInteger(java.math.BigInteger) ObjectList(org.apache.chemistry.opencmis.commons.data.ObjectList) DateTimeFormat(org.apache.chemistry.opencmis.commons.enums.DateTimeFormat)

Aggregations

DateTimeFormat (org.apache.chemistry.opencmis.commons.enums.DateTimeFormat)35 CmisRuntimeException (org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException)35 JSONObject (org.apache.chemistry.opencmis.commons.impl.json.JSONObject)29 ObjectData (org.apache.chemistry.opencmis.commons.data.ObjectData)22 Properties (org.apache.chemistry.opencmis.commons.data.Properties)9 BigInteger (java.math.BigInteger)8 Holder (org.apache.chemistry.opencmis.commons.spi.Holder)8 IUserGroupObject (com.pogeyan.cmis.api.auth.IUserGroupObject)6 Acl (org.apache.chemistry.opencmis.commons.data.Acl)6 IncludeRelationships (org.apache.chemistry.opencmis.commons.enums.IncludeRelationships)6 JSONArray (org.apache.chemistry.opencmis.commons.impl.json.JSONArray)6 Map (java.util.Map)3 ObjectList (org.apache.chemistry.opencmis.commons.data.ObjectList)3 TypeDefinition (org.apache.chemistry.opencmis.commons.definitions.TypeDefinition)3 CmisInvalidArgumentException (org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException)3 IBaseObject (com.pogeyan.cmis.api.data.IBaseObject)2 LinkedHashMap (java.util.LinkedHashMap)2 ObjectInFolderContainer (org.apache.chemistry.opencmis.commons.data.ObjectInFolderContainer)2 VersioningState (org.apache.chemistry.opencmis.commons.enums.VersioningState)2 ReturnVersion (org.apache.chemistry.opencmis.commons.impl.ReturnVersion)2