use of org.apache.chemistry.opencmis.commons.enums.DateTimeFormat in project copper-cms by PogeyanOSS.
the class PolicyActor method removePolicy.
private JSONObject removePolicy(PostRequest request) throws CmisInvalidArgumentException, CmisObjectNotFoundException, CmisRuntimeException {
String permission = request.getUserObject().getPermission();
if (!Helpers.checkingUserPremission(permission, "post")) {
throw new CmisRuntimeException(request.getUserName() + " is not authorized to applyAcl.");
}
String objectId = request.getObjectId();
boolean succinct = request.getBooleanParameter(QueryGetRequest.CONTROL_SUCCINCT, false);
DateTimeFormat dateTimeFormat = request.getDateTimeFormatParameter();
CmisPolicyService.Impl.removePolicy(request.getRepositoryId(), request.getPolicyId(), objectId, request.getUserObject().getUserDN());
ObjectData object = CmisObjectService.Impl.getSimpleObject(request.getRepositoryId(), objectId, request.getUserObject().getUserDN(), BaseTypeId.CMIS_POLICY);
if (object == null) {
throw new CmisRuntimeException("Object is null!");
}
JSONObject jsonObject = JSONConverter.convert(object, null, JSONConverter.PropertyMode.OBJECT, succinct, dateTimeFormat);
return jsonObject;
}
use of org.apache.chemistry.opencmis.commons.enums.DateTimeFormat in project copper-cms by PogeyanOSS.
the class RepositoryActor method getTypeDescendants.
private JSONArray getTypeDescendants(QueryGetRequest request) throws IllegalArgumentException, CmisInvalidArgumentException, CmisRuntimeException {
String permission = request.getUserObject().getPermission();
if (!Helpers.checkingUserPremission(permission, "get")) {
throw new CmisRuntimeException(request.getUserName() + " is not authorized to applyAcl.");
}
String typeId = request.getParameter(QueryGetRequest.PARAM_TYPE_ID);
DateTimeFormat dateTimeFormat = request.getDateTimeFormatParameter();
BigInteger depth = request.getBigIntegerParameter(QueryGetRequest.PARAM_DEPTH);
boolean includePropertyDefinitions = request.getBooleanParameter(QueryGetRequest.PARAM_PROPERTY_DEFINITIONS, false);
List<TypeDefinitionContainer> typeTree = CmisTypeServices.Impl.getTypeDescendants(request.getRepositoryId(), typeId, depth, includePropertyDefinitions, null);
if (typeTree == null) {
throw new CmisRuntimeException("Type tree is null!");
}
JSONArray jsonTypeTree = new JSONArray();
for (TypeDefinitionContainer container : typeTree) {
jsonTypeTree.add(JSONConverter.convert(container, dateTimeFormat));
}
return jsonTypeTree;
}
use of org.apache.chemistry.opencmis.commons.enums.DateTimeFormat in project copper-cms by PogeyanOSS.
the class RepositoryActor method getTypeDefinition.
private JSONObject getTypeDefinition(QueryGetRequest request) throws CmisRuntimeException, IllegalArgumentException {
String permission = request.getUserObject().getPermission();
if (!Helpers.checkingUserPremission(permission, "get")) {
throw new CmisRuntimeException(request.getUserName() + " is not authorized to applyAcl.");
}
String typeId = request.getParameter(QueryGetRequest.PARAM_TYPE_ID);
DateTimeFormat dateTimeFormat = request.getDateTimeFormatParameter();
TypeDefinition type = CmisTypeServices.Impl.getTypeDefinition(request.getRepositoryId(), typeId, null);
JSONObject resultType = JSONConverter.convert(type, dateTimeFormat);
return resultType;
}
use of org.apache.chemistry.opencmis.commons.enums.DateTimeFormat in project copper-cms by PogeyanOSS.
the class VersioningActor method getObjectOfLatestVersion.
private JSONObject getObjectOfLatestVersion(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);
boolean majorVersion = request.getBooleanParameter(QueryGetRequest.PARAM_MAJOR, 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 includeAllowableActions = request.getBooleanParameter(QueryGetRequest.PARAM_ALLOWABLE_ACTIONS);
String renditionFilter = request.getParameter(QueryGetRequest.PARAM_RENDITION_FILTER);
Boolean includePolicyIds = request.getBooleanParameter(QueryGetRequest.PARAM_POLICY_IDS);
Boolean includeAcl = request.getBooleanParameter(QueryGetRequest.PARAM_ACL);
String userName = request.getUserName();
ObjectData object = CmisVersioningServices.Impl.getObjectOfLatestVersion(request.getRepositoryId(), objectId, versionSeriesId, majorVersion, filter, includeAllowableActions, renditionFilter, includePolicyIds, includeAcl, null, null, userName);
if (object == null) {
throw new CmisRuntimeException("object is not present!");
}
JSONObject jsonObject = JSONConverter.convert(object, null, JSONConverter.PropertyMode.OBJECT, succinct, dateTimeFormat);
return jsonObject;
}
use of org.apache.chemistry.opencmis.commons.enums.DateTimeFormat in project copper-cms by PogeyanOSS.
the class DiscoveryActor method getContentChanges.
private JSONObject getContentChanges(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 changeLogToken = request.getParameter(QueryGetRequest.PARAM_CHANGE_LOG_TOKEN);
Boolean includeProperties = request.getBooleanParameter(QueryGetRequest.PARAM_PROPERTIES);
String filter = request.getParameter(QueryGetRequest.PARAM_FILTER);
Boolean includePolicyIds = request.getBooleanParameter(QueryGetRequest.PARAM_POLICY_IDS);
Boolean includeAcl = request.getBooleanParameter(QueryGetRequest.PARAM_ACL);
BigInteger maxItems = request.getBigIntegerParameter(QueryGetRequest.PARAM_MAX_ITEMS);
boolean succinct = request.getBooleanParameter(QueryGetRequest.PARAM_SUCCINCT, false);
DateTimeFormat dateTimeFormat = request.getDateTimeFormatParameter();
Holder<String> changeLogTokenHolder = new Holder<String>(changeLogToken);
ObjectList changes = CmisDiscoveryService.Impl.getContentChanges(request.getRepositoryId(), changeLogTokenHolder, includeProperties, filter, includePolicyIds, includeAcl, maxItems, null, request.getUserObject());
JSONObject jsonChanges = JSONConverter.convert(changes, CmisTypeCacheService.get(request.getRepositoryId()), JSONConverter.PropertyMode.CHANGE, succinct, dateTimeFormat);
jsonChanges.put(JSONConstants.JSON_OBJECTLIST_CHANGE_LOG_TOKEN, changeLogTokenHolder.getValue());
return jsonChanges;
}
Aggregations