Search in sources :

Example 1 with RelationshipDirection

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

the class RelationshipActor method getRelationships.

private JSONObject getRelationships(QueryGetRequest request) throws CmisObjectNotFoundException, MongoException, 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();
    Boolean includeSubRelationshipTypes = request.getBooleanParameter(QueryGetRequest.PARAM_SUB_RELATIONSHIP_TYPES);
    RelationshipDirection relationshipDirection = request.getEnumParameter(QueryGetRequest.PARAM_RELATIONSHIP_DIRECTION, RelationshipDirection.class);
    String renditionFilter = request.getParameter(QueryGetRequest.PARAM_RENDITION_FILTER);
    Boolean includeAllowableActions = request.getBooleanParameter(QueryGetRequest.PARAM_ALLOWABLE_ACTIONS);
    BigInteger maxItems = request.getBigIntegerParameter(QueryGetRequest.PARAM_MAX_ITEMS);
    BigInteger skipCount = request.getBigIntegerParameter(QueryGetRequest.PARAM_SKIP_COUNT);
    boolean succinct = request.getBooleanParameter(QueryGetRequest.PARAM_SUCCINCT, false);
    String typeId = request.getParameter(QueryGetRequest.PARAM_TYPE_ID);
    DateTimeFormat dateTimeFormat = request.getDateTimeFormatParameter();
    ObjectList relationships = CmisRelationshipService.Impl.getObjectRelationships(request.getRepositoryId(), objectId, includeSubRelationshipTypes, relationshipDirection, typeId, renditionFilter, includeAllowableActions, maxItems, skipCount, null, request.getUserName());
    if (relationships == null) {
        throw new CmisRuntimeException("Relationships are null!");
    }
    JSONObject jsonChildren = JSONConverter.convert(relationships, null, JSONConverter.PropertyMode.OBJECT, succinct, dateTimeFormat);
    return jsonChildren;
}
Also used : RelationshipDirection(org.apache.chemistry.opencmis.commons.enums.RelationshipDirection) CmisRuntimeException(org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException) JSONObject(org.apache.chemistry.opencmis.commons.impl.json.JSONObject) BigInteger(java.math.BigInteger) ObjectList(org.apache.chemistry.opencmis.commons.data.ObjectList) DateTimeFormat(org.apache.chemistry.opencmis.commons.enums.DateTimeFormat)

Aggregations

BigInteger (java.math.BigInteger)1 ObjectList (org.apache.chemistry.opencmis.commons.data.ObjectList)1 DateTimeFormat (org.apache.chemistry.opencmis.commons.enums.DateTimeFormat)1 RelationshipDirection (org.apache.chemistry.opencmis.commons.enums.RelationshipDirection)1 CmisRuntimeException (org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException)1 JSONObject (org.apache.chemistry.opencmis.commons.impl.json.JSONObject)1