use of org.apache.chemistry.opencmis.commons.data.Properties 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.data.Properties in project copper-cms by PogeyanOSS.
the class ServletHelpers method getStringPropertyValue.
/**
* Extracts a property from an object.
*/
static String getStringPropertyValue(ObjectData object, String name) {
if (object == null) {
return null;
}
Properties propData = object.getProperties();
if (propData == null) {
return null;
}
Map<String, PropertyData<?>> properties = propData.getProperties();
if (properties == null) {
return null;
}
PropertyData<?> property = properties.get(name);
if (property == null) {
return null;
}
Object value = property.getFirstValue();
if (!(value instanceof String)) {
return null;
}
return (String) value;
}
Aggregations