public ObjectData build( CallContext context, Record record, Set<String> filter, boolean includeAllowableActions, boolean includeAcl, ObjectInfoHandler objectInfos) { ObjectDataImpl result = new ObjectDataImpl(); ObjectInfoImpl objectInfo = new ObjectInfoImpl(); result.setProperties(compileProperties(record, filter, objectInfo)); if (includeAllowableActions) { result.setAllowableActions(new AllowableActionsBuilder(repository, record).build()); } // if (includeAcl) { // result.setAcl(new AclBuilder(repository).build(file)); // result.setIsExactAcl(true); // } if (context.isObjectInfoRequired()) { objectInfo.setObject(result); objectInfos.addObjectInfo(objectInfo); } return result; }
@Override protected void compileProperties( PropertiesImpl properties, Set<String> filter, ObjectInfoImpl objectInfo) throws RepositoryException { super.compileProperties(properties, filter, objectInfo); objectInfo.setHasContent(false); objectInfo.setSupportsDescendants(true); objectInfo.setSupportsFolderTree(true); String typeId = getTypeIdInternal(); addPropertyString(properties, typeId, filter, PropertyIds.PATH, pathManager.getPath(getNode())); // folder properties if (pathManager.isRoot(getNode())) { objectInfo.setHasParent(false); } else { objectInfo.setHasParent(true); addPropertyId(properties, typeId, filter, PropertyIds.PARENT_ID, getParent().getObjectId()); } }
private void setupObjectInfo(ObjectInfoImpl objectInfo, String typeId) { objectInfo.setBaseType(BaseTypeId.CMIS_FOLDER); objectInfo.setTypeId(typeId); objectInfo.setContentType(null); objectInfo.setFileName(null); objectInfo.setHasAcl(false); objectInfo.setHasContent(false); objectInfo.setVersionSeriesId(null); objectInfo.setIsCurrentVersion(true); objectInfo.setRelationshipSourceIds(null); objectInfo.setRelationshipTargetIds(null); objectInfo.setRenditionInfos(null); objectInfo.setSupportsDescendants(true); objectInfo.setSupportsFolderTree(true); objectInfo.setSupportsPolicies(false); objectInfo.setSupportsRelationships(false); objectInfo.setWorkingCopyId(null); objectInfo.setWorkingCopyOriginalId(null); }
private Properties compileProperties( Record record, Set<String> orgfilter, ObjectInfoImpl objectInfo) { if (record == null) { throw new IllegalArgumentException("File must not be null!"); } Set<String> filter = (orgfilter == null ? null : new HashSet<String>(orgfilter)); String typeId = record.getSchemaCode(); setupObjectInfo(objectInfo, typeId); try { PropertiesImpl result = new PropertiesImpl(); String id = record.getId(); addPropertyId(result, typeId, filter, PropertyIds.OBJECT_ID, id); objectInfo.setId(id); String name = record.get(Schemas.TITLE); addPropertyString(result, typeId, filter, PropertyIds.NAME, name); objectInfo.setName(name); addPropertyString( result, typeId, filter, PropertyIds.CREATED_BY, (String) record.get(Schemas.CREATED_BY)); addPropertyString( result, typeId, filter, PropertyIds.LAST_MODIFIED_BY, (String) record.get(Schemas.MODIFIED_BY)); objectInfo.setCreatedBy(USER_UNKNOWN); GregorianCalendar creationDate = getGregorianCalendar(record.get(Schemas.CREATED_ON)); GregorianCalendar lastModified = getGregorianCalendar(record.get(Schemas.MODIFIED_ON)); addPropertyDateTime(result, typeId, filter, PropertyIds.CREATION_DATE, creationDate); addPropertyDateTime(result, typeId, filter, PropertyIds.LAST_MODIFICATION_DATE, lastModified); objectInfo.setCreationDate(creationDate); objectInfo.setLastModificationDate(lastModified); addPropertyString( result, typeId, filter, PropertyIds.CHANGE_TOKEN, Long.toString(record.getVersion())); addPropertyId( result, typeId, filter, PropertyIds.BASE_TYPE_ID, BaseTypeId.CMIS_FOLDER.value()); addPropertyId(result, typeId, filter, PropertyIds.OBJECT_TYPE_ID, typeId); // The principal path is always used for now String path = record.get(Schemas.PRINCIPAL_PATH); if ("collection_default".equals(typeId)) { addPropertyString(result, typeId, filter, PropertyIds.PATH, "/"); } else { addPropertyString(result, typeId, filter, PropertyIds.PATH, path); } if (record.getParentId() != null) { addPropertyString(result, typeId, filter, PropertyIds.PARENT_ID, record.getParentId()); } else if (path != null) { // The principal path is used here, also. addPropertyString( result, typeId, filter, PropertyIds.PARENT_ID, path.split("/")[path.split("/").length - 2]); } addPropertiesForMetadatas(record, orgfilter, typeId, result); addPropertyIdList(result, typeId, filter, PropertyIds.ALLOWED_CHILD_OBJECT_TYPE_IDS, null); return result; } catch (CmisBaseException cbe) { throw cbe; } catch (Exception e) { throw new CmisExceptions_Runtime(e.getMessage(), e); } }