if (objectData.getProperties() == null) { throw new IllegalArgumentException("Properties must be set!"); if (objectData.getId() == null) { throw new IllegalArgumentException("Object ID must be set!"); if (objectData.getProperties().getProperties() != null && objectData.getProperties().getProperties().containsKey(PropertyIds.SECONDARY_OBJECT_TYPE_IDS)) { @SuppressWarnings("unchecked") List<String> stids = (List<String>) objectData.getProperties().getProperties() .get(PropertyIds.SECONDARY_OBJECT_TYPE_IDS).getValues(); if (isNotEmpty(stids)) { this.properties = of.convertProperties(objectType, secondaryTypes, objectData.getProperties()); extensions.put(ExtensionLevel.PROPERTIES, objectData.getProperties().getExtensions()); if (objectData.getAllowableActions() != null) { allowableActions = objectData.getAllowableActions(); extensions.put(ExtensionLevel.ALLOWABLE_ACTIONS, objectData.getAllowableActions().getExtensions()); } else { allowableActions = null; if (objectData.getRenditions() != null && !objectData.getRenditions().isEmpty()) { renditions = new ArrayList<Rendition>(objectData.getRenditions().size()); for (RenditionData rd : objectData.getRenditions()) { renditions.add(of.convertRendition(getId(), rd)); if (objectData.getAcl() != null) { acl = objectData.getAcl();
private String getTestId(BaseTypeId baseTypeId) { LOG.debug("getTestDocId()"); ObjectInFolderList result = navSvc.getChildren(repositoryId, rootFolderId, "*", null, false, IncludeRelationships.NONE, null, true, MAX_ITEMS, SKIP_COUNT, null); List<ObjectInFolderData> children = result.getObjects(); LOG.debug(" found " + children.size() + " folders in getChildren()"); for (ObjectInFolderData child : children) { if (baseTypeId.equals(child.getObject().getBaseTypeId())) { return child.getObject().getId(); } } return null; }
Acl acl = null; if (objectData.getChangeEventInfo() != null) { changeType = objectData.getChangeEventInfo().getChangeType(); changeTime = objectData.getChangeEventInfo().getChangeTime(); if ((objectData.getProperties() != null) && (objectData.getProperties().getPropertyList() != null)) { properties = new HashMap<String, List<?>>(objectData.getProperties().getPropertyList().size()); for (PropertyData<?> property : objectData.getProperties().getPropertyList()) { properties.put(property.getId(), property.getValues()); if ((objectData.getPolicyIds() != null) && (objectData.getPolicyIds().getPolicyIds() != null)) { policyIds = objectData.getPolicyIds().getPolicyIds(); if (objectData.getAcl() != null) { acl = objectData.getAcl();
if (objectData.getProperties() != null) { List<PropertyData<?>> queryProperties = of.convertQueryProperties(objectData.getProperties()); if (objectData.getAllowableActions() != null) { this.allowableActions = objectData.getAllowableActions(); if (objectData.getRelationships() != null) { relationships = new ArrayList<Relationship>(); for (ObjectData rod : objectData.getRelationships()) { CmisObject relationship = of.convertObject(rod, session.getDefaultContext()); if (relationship instanceof Relationship) { if (objectData.getRenditions() != null) { this.renditions = new ArrayList<Rendition>(); for (RenditionData rd : objectData.getRenditions()) { this.renditions.add(of.convertRendition(null, rd));
/** * Returns the properties of the object. */ public Properties getProperties() { return (object == null ? null : object.getProperties()); }
if (startFolderData.getBaseTypeId() != BaseTypeId.CMIS_FOLDER) { throw new IllegalArgumentException("Start folder is not a folder!"); if (startFolderData.getProperties() == null || startFolderData.getProperties().getProperties() == null || startFolderData.getProperties().getProperties().get(PropertyIds.PATH) == null) { throw new IllegalArgumentException("Start folder has no path property?!"); Object startPath = startFolderData.getProperties().getProperties().get(PropertyIds.PATH) .getFirstValue(); if (!(startPath instanceof String)) { if (!repositoryInfo.getRootFolderId().equals(startFolderData.getId())) { nextPath.append(startPath); lastFolderId = startFolderId; nextPath.toString(), "cmis:objectId,cmis:baseTypeId,cmis:name", false, IncludeRelationships.NONE, "cmis:none", false, false, null); if (folderData.getBaseTypeId() != BaseTypeId.CMIS_FOLDER) { throw new CmisConstraintException("Cannot create a folder '" + segements[i] + "' because there is already an object with this name, which is not a folder!"); lastFolderId = new ObjectIdImpl(folderData.getId()); } catch (CmisObjectNotFoundException onfe) { if (lastFolderId == null) {
if (object.getProperties() == null || object.getProperties().getProperties() == null) { throw new CmisRuntimeException("No properties!"); repositoryInfo = getRepositoryInfo(repositoryId, null); } catch (CmisRuntimeException e) { LOG.error("getRepositoryInfo returned an error while compiling object info for object {}.", object.getId(), e); throw e; info.setId(object.getId()); info.setName(getStringProperty(object, PropertyIds.NAME)); info.setCreatedBy(getStringProperty(object, PropertyIds.CREATED_BY)); info.setLastModificationDate(getDateTimeProperty(object, PropertyIds.LAST_MODIFICATION_DATE)); info.setTypeId(getIdProperty(object, PropertyIds.OBJECT_TYPE_ID)); info.setBaseType(object.getBaseTypeId()); info.setIsCurrentVersion(object.getBaseTypeId() == BaseTypeId.CMIS_DOCUMENT); info.setWorkingCopyId(null); info.setWorkingCopyOriginalId(null); List<ObjectData> versions = getAllVersions(repositoryId, object.getId(), info.getVersionSeriesId(), null, Boolean.FALSE, null); if (isNotEmpty(versions)) { info.setWorkingCopyOriginalId(versions.get(0).getId()); if (object.getBaseTypeId() == BaseTypeId.CMIS_RELATIONSHIP) { info.setHasParent(false); } else if (object.getBaseTypeId() == BaseTypeId.CMIS_FOLDER) {
/** * Writes a delete object. */ public void writeDeletedObject(ObjectData object, CmisVersion cmisVersion) throws XMLStreamException { if (object == null) { return; } long now = System.currentTimeMillis(); writeAuthor(DEFAULT_AUTHOR); writeId(generateAtomId(object.getId())); writePublished(now); writeTitle(object.getId()); writeUpdated(now); XMLConverter.writeObject(getWriter(), cmisVersion, false, XMLConstants.TAG_OBJECT, XMLConstants.NAMESPACE_RESTATOM, object); }
ChangeType changeType = od.getChangeEventInfo().getChangeType(); Object objectId = od.getProperties().getProperties().get("cmis:objectId").getValues().get(0);
@Override public Void execute(CmisService cmisService) { // get original document ObjectData originalDoc = cmisService.getObject(testContext.getRepositoryId(), objectData.getId(), null, true, IncludeRelationships.NONE, null, false, true, null); Map<String, PropertyData<?>> properties = originalDoc.getProperties().getProperties(); PropertyData<Boolean> isVersionSeriesCheckedOutProp = (PropertyData<Boolean>)properties.get(PropertyIds.IS_VERSION_SERIES_CHECKED_OUT); assertNotNull(isVersionSeriesCheckedOutProp); Boolean isVersionSeriesCheckedOut = isVersionSeriesCheckedOutProp.getFirstValue(); assertNotNull(isVersionSeriesCheckedOut); assertEquals(Boolean.FALSE, isVersionSeriesCheckedOut); return null; } });
"cmis:none", Boolean.FALSE, Boolean.FALSE, null); if (obj != null && obj.getProperties() != null && obj.getProperties().getProperties() != null && obj.getProperties().getProperties().get(PropertyIds.NAME) != null) { PropertyData<?> nameProp = obj.getProperties().getProperties().get(PropertyIds.NAME); if (nameProp.getFirstValue() instanceof String) { name = (String) nameProp.getFirstValue(); if (object.getAcl() != null) { originalAces = new AccessControlListImpl(object.getAcl().getAces()); originalAces.setExact(object.isExactAcl());
for (int i = 0; i < children.size(); i++) { ObjectData child = children.get(i).getObject(); docId = (String) child.getProperties().getProperties().get(PropertyIds.OBJECT_ID).getFirstValue(); if (child.getBaseTypeId().equals(BaseTypeId.CMIS_DOCUMENT)) { if (numDocsFound == index) { return docId;
@Override public Void execute(CmisService cmisService) { try { // check allowable actions ObjectData originalDoc = cmisService.getObject(testContext.getRepositoryId(), objectData.getId(), null, true, IncludeRelationships.NONE, null, false, true, null); AllowableActions allowableActions = originalDoc.getAllowableActions(); assertNotNull(allowableActions); assertFalse(allowableActions.getAllowableActions().contains(Action.CAN_DELETE_OBJECT)); // try to cancel the checkout cmisService.deleteObjectOrCancelCheckOut(testContext.getRepositoryId(), objectData.getId(), Boolean.TRUE, null); fail(); } catch(CmisConstraintException e) { // expected } return null; } });
if (object.getAcl() != null) { originalAces = new AccessControlListImpl(object.getAcl().getAces()); originalAces.setExact(object.isExactAcl());
@Override public List<RenditionData> getRenditions(String repositoryId, String objectId, String renditionFilter, BigInteger maxItems, BigInteger skipCount, ExtensionsData extension) { ObjectData object = getObjectInternal(repositoryId, IdentifierType.ID, objectId, ReturnVersion.THIS, PropertyIds.OBJECT_ID, Boolean.FALSE, IncludeRelationships.NONE, renditionFilter, Boolean.FALSE, Boolean.FALSE, extension); List<RenditionData> result = object.getRenditions(); if (result == null) { result = Collections.emptyList(); } return result; }
public CmisObject convertObject(ObjectData objectData, OperationContext context) { if (objectData == null) { throw new IllegalArgumentException("Object data is null!"); } ObjectType type = getTypeFromObjectData(objectData); /* determine type */ switch (objectData.getBaseTypeId()) { case CMIS_DOCUMENT: return new AlfrescoDocumentImpl((SessionImpl) this.session, type, objectData, context); case CMIS_FOLDER: return new AlfrescoFolderImpl((SessionImpl) this.session, type, objectData, context); case CMIS_POLICY: return new PolicyImpl((SessionImpl) this.session, type, objectData, context); case CMIS_RELATIONSHIP: return new RelationshipImpl((SessionImpl) this.session, type, objectData, context); default: throw new CmisRuntimeException("unsupported type: " + objectData.getBaseTypeId()); } } }
/** * Returns the ACL of the object. */ public Acl getAcl() { return (object == null ? null : object.getAcl()); }
/** * {@inheritDoc} * * <p> * <b>Implementation Hints:</b> * <ul> * <li>Bindings: AtomPub, Web Services, Browser, Local</li> * <li>Implementation is optional. Convenience implementation is present.</li> * </ul> */ @Override public AllowableActions getAllowableActions(String repositoryId, String objectId, ExtensionsData extension) { return getObject(repositoryId, objectId, "cmis:objectId", true, IncludeRelationships.NONE, "cmis:none", false, false, extension).getAllowableActions(); }
/** * Returns the policy id list of the object. */ public List<String> getPolicyIds() { if ((object == null) || (object.getPolicyIds() == null)) { return null; } return object.getPolicyIds().getPolicyIds(); }
addResult(assertNull(doc1.getChangeEventInfo(), null, f));