use of org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException in project copper-cms by PogeyanOSS.
the class VersioningActor method checkOut.
private JSONObject checkOut(PostRequest request) throws CmisObjectNotFoundException, CmisUpdateConflictException, CmisNotSupportedException, CmisInvalidArgumentException, 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();
Holder<String> objectsId = new Holder<String>(objectId.toString());
String pwcId = CmisVersioningServices.Impl.checkOut(request.getRepositoryId(), objectsId, null, null, request.getUserName());
ObjectData object = CmisObjectService.Impl.getSimpleObject(request.getRepositoryId(), pwcId, request.getUserName(), BaseTypeId.CMIS_DOCUMENT);
if (object == null) {
throw new CmisRuntimeException("New document is null!");
}
// return object
JSONObject jsonObject = JSONConverter.convert(object, CmisTypeCacheService.get(request.getRepositoryId()), JSONConverter.PropertyMode.OBJECT, succinct, dateTimeFormat);
return jsonObject;
}
use of org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException 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;
}
use of org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException in project copper-cms by PogeyanOSS.
the class AclActor method applyACL.
private JSONObject applyACL(PostRequest t) throws CmisObjectNotFoundException, CmisRuntimeException {
String permission = t.getUserObject().getPermission();
if (!Helpers.checkingUserPremission(permission, "post")) {
throw new CmisRuntimeException(t.getUserName() + " is not authorized to applyAcl.");
}
String aclPro = t.getAclPropagation();
String objectId = t.getObjectId();
Acl objectAcl = CmisAclServices.Impl.applyAcl(t.getRepositoryId(), objectId, t.getAddAcl(), t.getRemoveAcl(), AclPropagation.fromValue(aclPro), null, null, CapabilityAcl.NONE, t.getUserObject().getUserDN());
if (objectAcl == null) {
throw new CmisRuntimeException("object acl is null!");
}
JSONObject jsonObject = JSONConverter.convert(objectAcl);
return jsonObject;
}
use of org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException 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;
}
use of org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException 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;
}
Aggregations