chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dcaru...@apache.org
Subject svn commit: r936938 [13/29] - in /incubator/chemistry/opencmis/trunk/chemistry-opencmis-server: chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/ chemistry-opencmis-server-bindings/src/main/java/org/apache/chem...
Date Thu, 22 Apr 2010 16:28:00 GMT
Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/clientprovider/VersioningServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/clientprovider/VersioningServiceImpl.java?rev=936938&r1=936937&r2=936938&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/clientprovider/VersioningServiceImpl.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/clientprovider/VersioningServiceImpl.java Thu Apr 22 16:27:57 2010
@@ -32,58 +32,58 @@ import org.apache.chemistry.opencmis.inm
 
 public class VersioningServiceImpl extends AbstractService implements VersioningService {
 
-	private InMemoryVersioningServiceImpl fVersioningSvc;
+    private InMemoryVersioningServiceImpl fVersioningSvc;
 
-	public VersioningServiceImpl(InMemoryVersioningServiceImpl verSvc) {
-		fVersioningSvc = verSvc;
-	}
+    public VersioningServiceImpl(InMemoryVersioningServiceImpl verSvc) {
+        fVersioningSvc = verSvc;
+    }
 
-	public void cancelCheckOut(String repositoryId, String objectId, ExtensionsData extension) {
+    public void cancelCheckOut(String repositoryId, String objectId, ExtensionsData extension) {
 
-		fVersioningSvc.cancelCheckOut(fDummyCallContext, repositoryId, objectId, extension);
-	}
+        fVersioningSvc.cancelCheckOut(fDummyCallContext, repositoryId, objectId, extension);
+    }
 
-	public void checkIn(String repositoryId, Holder<String> objectId, Boolean major, Properties properties,
-			ContentStream contentStream, String checkinComment, List<String> policies, Acl addAces, Acl removeAces,
-			ExtensionsData extension) {
+    public void checkIn(String repositoryId, Holder<String> objectId, Boolean major, Properties properties,
+            ContentStream contentStream, String checkinComment, List<String> policies, Acl addAces, Acl removeAces,
+            ExtensionsData extension) {
 
-		fVersioningSvc.checkIn(fDummyCallContext, repositoryId, objectId, major, properties, contentStream,
-				checkinComment, policies, addAces, removeAces, extension, null);
-	}
+        fVersioningSvc.checkIn(fDummyCallContext, repositoryId, objectId, major, properties, contentStream,
+                checkinComment, policies, addAces, removeAces, extension, null);
+    }
 
-	public void checkOut(String repositoryId, Holder<String> objectId, ExtensionsData extension,
-			Holder<Boolean> contentCopied) {
+    public void checkOut(String repositoryId, Holder<String> objectId, ExtensionsData extension,
+            Holder<Boolean> contentCopied) {
 
-		fVersioningSvc.checkOut(fDummyCallContext, repositoryId, objectId, extension, contentCopied, null);
-	}
+        fVersioningSvc.checkOut(fDummyCallContext, repositoryId, objectId, extension, contentCopied, null);
+    }
 
-	public List<ObjectData> getAllVersions(String repositoryId, String objectId, String versionSeriesId, String filter,
-			Boolean includeAllowableActions, ExtensionsData extension) {
+    public List<ObjectData> getAllVersions(String repositoryId, String objectId, String versionSeriesId, String filter,
+            Boolean includeAllowableActions, ExtensionsData extension) {
 
-		return getAllVersions(repositoryId, versionSeriesId, filter, includeAllowableActions, extension);
-	}
+        return getAllVersions(repositoryId, versionSeriesId, filter, includeAllowableActions, extension);
+    }
 
-	public List<ObjectData> getAllVersions(String repositoryId, String versionSeriesId, String filter,
-			Boolean includeAllowableActions, ExtensionsData extension) {
+    public List<ObjectData> getAllVersions(String repositoryId, String versionSeriesId, String filter,
+            Boolean includeAllowableActions, ExtensionsData extension) {
 
-		return fVersioningSvc.getAllVersions(fDummyCallContext, repositoryId, versionSeriesId, filter,
-				includeAllowableActions, extension, null);
-	}
+        return fVersioningSvc.getAllVersions(fDummyCallContext, repositoryId, versionSeriesId, filter,
+                includeAllowableActions, extension, null);
+    }
 
-	public ObjectData getObjectOfLatestVersion(String repositoryId, String objectId, String versionSeriesId,
-			Boolean major, String filter, Boolean includeAllowableActions, IncludeRelationships includeRelationships,
-			String renditionFilter, Boolean includePolicyIds, Boolean includeAcl, ExtensionsData extension) {
+    public ObjectData getObjectOfLatestVersion(String repositoryId, String objectId, String versionSeriesId,
+            Boolean major, String filter, Boolean includeAllowableActions, IncludeRelationships includeRelationships,
+            String renditionFilter, Boolean includePolicyIds, Boolean includeAcl, ExtensionsData extension) {
 
-		return fVersioningSvc.getObjectOfLatestVersion(fDummyCallContext, repositoryId, versionSeriesId, major, filter,
-				includeAllowableActions, includeRelationships, renditionFilter, includePolicyIds, includeAcl,
-				extension, null);
-	}
+        return fVersioningSvc.getObjectOfLatestVersion(fDummyCallContext, repositoryId, versionSeriesId, major, filter,
+                includeAllowableActions, includeRelationships, renditionFilter, includePolicyIds, includeAcl,
+                extension, null);
+    }
 
-	public Properties getPropertiesOfLatestVersion(String repositoryId, String objectId, String versionSeriesId,
-			Boolean major, String filter, ExtensionsData extension) {
+    public Properties getPropertiesOfLatestVersion(String repositoryId, String objectId, String versionSeriesId,
+            Boolean major, String filter, ExtensionsData extension) {
 
-		return fVersioningSvc.getPropertiesOfLatestVersion(fDummyCallContext, repositoryId, versionSeriesId, major,
-				filter, extension);
-	}
+        return fVersioningSvc.getPropertiesOfLatestVersion(fDummyCallContext, repositoryId, versionSeriesId, major,
+                filter, extension);
+    }
 
 }

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/AbstractServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/AbstractServiceImpl.java?rev=936938&r1=936937&r2=936938&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/AbstractServiceImpl.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/AbstractServiceImpl.java Thu Apr 22 16:27:57 2010
@@ -38,134 +38,134 @@ import org.apache.chemistry.opencmis.inm
  */
 public class AbstractServiceImpl {
 
-	protected StoreManager fStoreManager;
+    protected StoreManager fStoreManager;
 
-	protected AbstractServiceImpl(StoreManager storeManager) {
-		fStoreManager = storeManager;
-	}
-
-	/**
-	 * check if repository is known and that object exists. To avoid later calls
-	 * to again retrieve the object from the id return the retrieved object for
-	 * later use.
-	 * 
-	 * @param repositoryId
-	 *            repository id
-	 * @param objectId
-	 *            object id
-	 * @return object for objectId
-	 */
-	protected StoredObject checkStandardParameters(String repositoryId, String objectId) {
-
-		ObjectStore objStore = fStoreManager.getObjectStore(repositoryId);
-
-		if (objStore == null)
-			throw new CmisObjectNotFoundException("Unknown repository id: " + repositoryId);
-
-		StoredObject so = objStore.getObjectById(objectId);
-
-		if (so == null)
-			throw new CmisObjectNotFoundException("Unknown object id: " + objectId);
-
-		return so;
-	}
-
-	protected StoredObject checkExistingObjectId(ObjectStore objStore, String objectId) {
-
-		StoredObject so = objStore.getObjectById(objectId);
-
-		if (so == null)
-			throw new CmisObjectNotFoundException("Unknown object id: " + objectId);
-
-		return so;
-	}
-
-	protected void checkRepositoryId(String repositoryId) {
-		ObjectStore objStore = fStoreManager.getObjectStore(repositoryId);
-
-		if (objStore == null)
-			throw new CmisObjectNotFoundException("Unknown repository id: " + repositoryId);
-	}
-
-	protected TypeDefinition getTypeDefinition(String repositoryId, Properties properties) {
-		String typeId = (String) properties.getProperties().get(PropertyIds.OBJECT_TYPE_ID).getFirstValue();
-		TypeDefinitionContainer typeDefC = fStoreManager.getTypeById(repositoryId, typeId);
-		if (typeDefC == null)
-			throw new RuntimeException("Cannot create object, a type with id " + typeId + " is unknown");
-
-		return typeDefC.getTypeDefinition();
-	}
-
-	protected TypeDefinition getTypeDefinition(String repositoryId, StoredObject obj) {
-
-		TypeDefinitionContainer typeDefC = fStoreManager.getTypeById(repositoryId, obj.getTypeId());
-		return typeDefC.getTypeDefinition();
-	}
-
-	/**
-	 * We allow checkin, cancel, checkout operations on a single version as well
-	 * as on a version series This method returns the versioned document
-	 * (version series) in each case
-	 * 
-	 * @param value
-	 *            version or version series id of a document
-	 * @return version series id
-	 */
-	protected VersionedDocument getVersionedDocumentOfObjectId(StoredObject so) {
-
-		VersionedDocument verDoc;
-		if (so instanceof DocumentVersion) {
-			// get document the version is contained in to c
-			verDoc = ((DocumentVersion) so).getParentDocument();
-		} else {
-			verDoc = (VersionedDocument) so;
-		}
-
-		return verDoc;
-	}
-
-	protected VersionedDocument testIsNotCheckedOutBySomeoneElse(StoredObject so, String user) {
-		checkIsVersionableObject(so);
-		VersionedDocument verDoc = getVersionedDocumentOfObjectId(so);
-		if (verDoc.isCheckedOut())
-			testCheckedOutByCurrentUser(user, verDoc);
-
-		return verDoc;
-	}
-
-	protected VersionedDocument testHasProperCheckedOutStatus(StoredObject so, String user) {
-
-		checkIsVersionableObject(so);
-		VersionedDocument verDoc = getVersionedDocumentOfObjectId(so);
-
-		checkHasUser(user);
-
-		testIsCheckedOut(verDoc);
-		testCheckedOutByCurrentUser(user, verDoc);
-
-		return verDoc;
-	}
-
-	protected void checkIsVersionableObject(StoredObject so) {
-		if (!(so instanceof VersionedDocument || so instanceof DocumentVersion))
-			throw new RuntimeException(
-					"Object is of a versionable type but not instance of VersionedDocument or DocumentVersion.");
-	}
-
-	protected void checkHasUser(String user) {
-		if (null == user || user.length() == 0)
-			throw new CmisUpdateConflictException("Object can't be checked-in, no user is given.");
-	}
-
-	protected void testCheckedOutByCurrentUser(String user, VersionedDocument verDoc) {
-		if (!user.equals(verDoc.getCheckedOutBy()))
-			throw new CmisUpdateConflictException("Object can't be checked-in, user " + verDoc.getCheckedOutBy()
-					+ " has checked out the document.");
-	}
-
-	protected void testIsCheckedOut(VersionedDocument verDoc) {
-		if (!verDoc.isCheckedOut())
-			throw new CmisUpdateConflictException("Canot check-in: Document " + verDoc.getId() + " is not checked out.");
-	}
+    protected AbstractServiceImpl(StoreManager storeManager) {
+        fStoreManager = storeManager;
+    }
+
+    /**
+     * check if repository is known and that object exists. To avoid later calls
+     * to again retrieve the object from the id return the retrieved object for
+     * later use.
+     * 
+     * @param repositoryId
+     *            repository id
+     * @param objectId
+     *            object id
+     * @return object for objectId
+     */
+    protected StoredObject checkStandardParameters(String repositoryId, String objectId) {
+
+        ObjectStore objStore = fStoreManager.getObjectStore(repositoryId);
+
+        if (objStore == null)
+            throw new CmisObjectNotFoundException("Unknown repository id: " + repositoryId);
+
+        StoredObject so = objStore.getObjectById(objectId);
+
+        if (so == null)
+            throw new CmisObjectNotFoundException("Unknown object id: " + objectId);
+
+        return so;
+    }
+
+    protected StoredObject checkExistingObjectId(ObjectStore objStore, String objectId) {
+
+        StoredObject so = objStore.getObjectById(objectId);
+
+        if (so == null)
+            throw new CmisObjectNotFoundException("Unknown object id: " + objectId);
+
+        return so;
+    }
+
+    protected void checkRepositoryId(String repositoryId) {
+        ObjectStore objStore = fStoreManager.getObjectStore(repositoryId);
+
+        if (objStore == null)
+            throw new CmisObjectNotFoundException("Unknown repository id: " + repositoryId);
+    }
+
+    protected TypeDefinition getTypeDefinition(String repositoryId, Properties properties) {
+        String typeId = (String) properties.getProperties().get(PropertyIds.OBJECT_TYPE_ID).getFirstValue();
+        TypeDefinitionContainer typeDefC = fStoreManager.getTypeById(repositoryId, typeId);
+        if (typeDefC == null)
+            throw new RuntimeException("Cannot create object, a type with id " + typeId + " is unknown");
+
+        return typeDefC.getTypeDefinition();
+    }
+
+    protected TypeDefinition getTypeDefinition(String repositoryId, StoredObject obj) {
+
+        TypeDefinitionContainer typeDefC = fStoreManager.getTypeById(repositoryId, obj.getTypeId());
+        return typeDefC.getTypeDefinition();
+    }
+
+    /**
+     * We allow checkin, cancel, checkout operations on a single version as well
+     * as on a version series This method returns the versioned document
+     * (version series) in each case
+     * 
+     * @param value
+     *            version or version series id of a document
+     * @return version series id
+     */
+    protected VersionedDocument getVersionedDocumentOfObjectId(StoredObject so) {
+
+        VersionedDocument verDoc;
+        if (so instanceof DocumentVersion) {
+            // get document the version is contained in to c
+            verDoc = ((DocumentVersion) so).getParentDocument();
+        } else {
+            verDoc = (VersionedDocument) so;
+        }
+
+        return verDoc;
+    }
+
+    protected VersionedDocument testIsNotCheckedOutBySomeoneElse(StoredObject so, String user) {
+        checkIsVersionableObject(so);
+        VersionedDocument verDoc = getVersionedDocumentOfObjectId(so);
+        if (verDoc.isCheckedOut())
+            testCheckedOutByCurrentUser(user, verDoc);
+
+        return verDoc;
+    }
+
+    protected VersionedDocument testHasProperCheckedOutStatus(StoredObject so, String user) {
+
+        checkIsVersionableObject(so);
+        VersionedDocument verDoc = getVersionedDocumentOfObjectId(so);
+
+        checkHasUser(user);
+
+        testIsCheckedOut(verDoc);
+        testCheckedOutByCurrentUser(user, verDoc);
+
+        return verDoc;
+    }
+
+    protected void checkIsVersionableObject(StoredObject so) {
+        if (!(so instanceof VersionedDocument || so instanceof DocumentVersion))
+            throw new RuntimeException(
+                    "Object is of a versionable type but not instance of VersionedDocument or DocumentVersion.");
+    }
+
+    protected void checkHasUser(String user) {
+        if (null == user || user.length() == 0)
+            throw new CmisUpdateConflictException("Object can't be checked-in, no user is given.");
+    }
+
+    protected void testCheckedOutByCurrentUser(String user, VersionedDocument verDoc) {
+        if (!user.equals(verDoc.getCheckedOutBy()))
+            throw new CmisUpdateConflictException("Object can't be checked-in, user " + verDoc.getCheckedOutBy()
+                    + " has checked out the document.");
+    }
+
+    protected void testIsCheckedOut(VersionedDocument verDoc) {
+        if (!verDoc.isCheckedOut())
+            throw new CmisUpdateConflictException("Canot check-in: Document " + verDoc.getId() + " is not checked out.");
+    }
 
 }

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/AtomLinkInfoProvider.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/AtomLinkInfoProvider.java?rev=936938&r1=936937&r2=936938&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/AtomLinkInfoProvider.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/AtomLinkInfoProvider.java Thu Apr 22 16:27:57 2010
@@ -47,267 +47,267 @@ import org.apache.chemistry.opencmis.ser
  */
 public class AtomLinkInfoProvider {
 
-	private StoreManager fStoreManager;
+    private StoreManager fStoreManager;
 
-	public AtomLinkInfoProvider(StoreManager storeManager) {
-		fStoreManager = storeManager;
-	}
-
-	/**
-	 * FillObjectInfoHolder object with required information needed for Atom
-	 * binding for a single object
-	 * 
-	 * @param repositoryId
-	 *            id of repository
-	 * @param objectId
-	 *            object to retrieve information for
-	 * @param objectInfos
-	 *            Holder to fill with information
-	 */
-	public void fillInformationForAtomLinks(String repositoryId, StoredObject so, ObjectInfoHolder objectInfos) {
-		if (null == objectInfos || null == so)
-			return;
-		TypeDefinition typeDef = fStoreManager.getTypeById(repositoryId, so.getTypeId()).getTypeDefinition();
-
-		ObjectInfoImpl objInfo = new ObjectInfoImpl();
-		// Fill all setters:
-		objInfo.setId(so.getId());
-		objInfo.setName(so.getName());
-		objInfo.setCreatedBy(so.getCreatedBy()); // !
-		objInfo.setCreationDate(so.getCreatedAt()); // !
-		objInfo.setLastModificationDate(so.getModifiedAt());
-		objInfo.setTypeId(so.getTypeId());
-		objInfo.setBaseType(typeDef.getBaseTypeId());
-
-		// versioning information:
-		if (so instanceof DocumentVersion) {
-			DocumentVersion ver = (DocumentVersion) so;
-			DocumentVersion pwc = ver.getParentDocument().getPwc();
-			objInfo.setIsCurrentVersion(ver == ver.getParentDocument().getLatestVersion(false));
-			objInfo.setVersionSeriesId(ver.getParentDocument().getId());
-			objInfo.setWorkingCopyId(pwc == null ? null : pwc.getId());
-			objInfo.setWorkingCopyOriginalId(pwc == ver ? ver.getParentDocument().getLatestVersion(false).getId()
-					: null);
-		} else if (so instanceof VersionedDocument) {
-			VersionedDocument doc = (VersionedDocument) so;
-			DocumentVersion pwc = doc.getPwc();
-			objInfo.setIsCurrentVersion(false);
-			objInfo.setVersionSeriesId(doc.getId());
-			objInfo.setWorkingCopyId(pwc == null ? null : pwc.getId());
-			objInfo.setWorkingCopyOriginalId(null);
-		} else { // unversioned document
-			objInfo.setIsCurrentVersion(true);
-			objInfo.setVersionSeriesId(null);
-			objInfo.setWorkingCopyId(null);
-			objInfo.setWorkingCopyOriginalId(null);
-		}
-
-		if (so instanceof Content) {
-			Content cont = ((Content) so);
-			objInfo.setHasContent(cont.getContent(0, -1) != null);
-			objInfo.setContentType(cont.getContent(0, -1) != null ? cont.getContent(0, -1).getMimeType() : null);
-			objInfo.setFileName(cont.getContent(0, -1) != null ? cont.getContent(0, -1).getFileName() : null);
-		} else {
-			objInfo.setHasContent(false);
-			objInfo.setContentType(null);
-			objInfo.setFileName(null);
-		}
-
-		// Filing
-		if (so instanceof Filing) {
-			Filing sop = ((Filing) so);
-			objInfo.setHasParent(!sop.getParents().isEmpty());
-		} else {
-			objInfo.setHasParent(false);
-		}
-
-		// Renditions, currently not supported by in-memory provider
-		objInfo.setRenditionInfos(null);
-
-		// Relationships, currently not supported by in-memory provider
-		objInfo.setSupportsRelationships(false);
-		objInfo.setRelationshipSourceIds(null);
-		objInfo.setRelationshipTargetIds(null);
-
-		// Policies, currently not supported by in-memory provider
-		objInfo.setSupportsPolicies(false);
-
-		// ACLs, currently not supported by in-memory provider
-		objInfo.setHasAcl(false);
-
-		objInfo.setSupportsDescendants(true);
-		objInfo.setSupportsFolderTree(true);
-
-		objectInfos.addObjectInfo(objInfo);
-	}
-
-	/**
-	 * FillObjectInfoHolder object with required information needed for Atom
-	 * binding for a single object
-	 * 
-	 * @param repositoryId
-	 *            id of repository
-	 * @param objectId
-	 *            object to retrieve information for
-	 * @param objectInfos
-	 *            Holder to fill with information
-	 */
-	public void fillInformationForAtomLinks(String repositoryId, String objectId, ObjectInfoHolder objectInfos) {
-		if (null == objectInfos || null == objectId)
-			return;
-
-		ObjectStore objectStore = fStoreManager.getObjectStore(repositoryId);
-		StoredObject so = objectStore.getObjectById(objectId);
-		fillInformationForAtomLinks(repositoryId, so, objectInfos);
-	}
-
-	/**
-	 * FillObjectInfoHolder object with required information needed for Atom
-	 * binding after a getChildren() call in navigation service
-	 * 
-	 * @param repositoryId
-	 *            id of repository
-	 * @param objectId
-	 *            object to retrieve information for
-	 * @param objectInfos
-	 *            Holder to fill with information
-	 * @param objList
-	 *            result of getChildren call
-	 */
-	public void fillInformationForAtomLinks(String repositoryId, String objectId, ObjectInfoHolder objectInfos,
-			ObjectInFolderList objList) {
-
-		if (null == objectInfos || null == objList || null == objectId)
-			return;
-
-		// Fill object information for requested object
-		fillInformationForAtomLinks(repositoryId, objectId, objectInfos);
-
-		// Fill object information for all children in result list
-		for (ObjectInFolderData object : objList.getObjects()) {
-			fillInformationForAtomLinks(repositoryId, object.getObject().getId(), objectInfos);
-		}
-	}
-
-	/**
-	 * FillObjectInfoHolder object with required information needed for Atom
-	 * binding for an object list
-	 * 
-	 * @param repositoryId
-	 *            id of repository
-	 * @param objectId
-	 *            object to retrieve information for
-	 * @param objectInfos
-	 *            Holder to fill with information
-	 * @param objList
-	 *            result of getChildren call
-	 */
-	public void fillInformationForAtomLinks(String repositoryId, String objectId, ObjectInfoHolder objectInfos,
-			ObjectList objList) {
-
-		if (null != objectId) {
-			// Fill object information for requested object
-			fillInformationForAtomLinks(repositoryId, objectId, objectInfos);
-		}
-
-		if (null != objList && null != objList.getObjects()) {
-			// Fill object information for all children in result list
-			List<ObjectData> listObjects = objList.getObjects();
-			if (null != listObjects)
-				for (ObjectData object : listObjects) {
-					fillInformationForAtomLinks(repositoryId, object.getId(), objectInfos);
-				}
-		}
-
-	}
-
-	/**
-	 * FillObjectInfoHolder object with required information needed for Atom
-	 * binding for an ObjectInFolderContainer
-	 * 
-	 * @param repositoryId
-	 *            id of repository
-	 * @param objectId
-	 *            object to retrieve information for
-	 * @param objectInfos
-	 *            Holder to fill with information
-	 * @param objList
-	 *            result of getChildren call
-	 */
-	private void fillInformationForAtomLinks(String repositoryId, ObjectInfoHolder objectInfos,
-			ObjectInFolderContainer oifc) {
-
-		if (null == objectInfos || null == oifc)
-			return;
-
-		// Fill object information for all elements in result list
-		fillInformationForAtomLinks(repositoryId, objectInfos, oifc.getObject());
-
-		if (null != oifc.getChildren())
-			for (ObjectInFolderContainer object : oifc.getChildren()) {
-				// call recursively
-				fillInformationForAtomLinks(repositoryId, objectInfos, object);
-			}
-	}
-
-	/**
-	 * FillObjectInfoHolder object with required information needed for Atom
-	 * binding for a list with ObjectInFolderContainers
-	 * 
-	 * @param repositoryId
-	 *            id of repository
-	 * @param objectId
-	 *            object to retrieve information for
-	 * @param objectInfos
-	 *            Holder to fill with information
-	 * @param oifcList
-	 *            result of getDescendants call
-	 */
-	public void fillInformationForAtomLinks(String repositoryId, String objectId, ObjectInfoHolder objectInfos,
-			List<ObjectInFolderContainer> oifcList) {
-
-		if (null == objectInfos || null == oifcList || null == objectId)
-			return;
-
-		// Fill object information for requested object
-		fillInformationForAtomLinks(repositoryId, objectId, objectInfos);
-
-		for (ObjectInFolderContainer object : oifcList) {
-			fillInformationForAtomLinks(repositoryId, objectInfos, object);
-		}
-	}
-
-	private void fillInformationForAtomLinks(String repositoryId, ObjectInfoHolder objectInfos,
-			ObjectInFolderData object) {
-
-		fillInformationForAtomLinks(repositoryId, object.getObject().getId(), objectInfos);
-	}
-
-	/**
-	 * FillObjectInfoHolder object with required information needed for Atom
-	 * binding for a list with ObjectParentData objects
-	 * 
-	 * @param repositoryId
-	 *            id of repository
-	 * @param objectId
-	 *            object to retrieve information for
-	 * @param objectInfos
-	 *            Holder to fill with information
-	 * @param objParents
-	 *            result of getObjectParents call
-	 */
-	public void fillInformationForAtomLinksGetParents(String repositoryId, String objectId,
-			ObjectInfoHolder objectInfos, List<ObjectParentData> objParents) {
-
-		if (null == objectInfos || null == objParents || null == objectId)
-			return;
-
-		// Fill object information for requested object
-		fillInformationForAtomLinks(repositoryId, objectId, objectInfos);
-
-		for (ObjectParentData object : objParents) {
-			fillInformationForAtomLinks(repositoryId, object.getObject().getId(), objectInfos);
-		}
-	}
+    public AtomLinkInfoProvider(StoreManager storeManager) {
+        fStoreManager = storeManager;
+    }
+
+    /**
+     * FillObjectInfoHolder object with required information needed for Atom
+     * binding for a single object
+     * 
+     * @param repositoryId
+     *            id of repository
+     * @param objectId
+     *            object to retrieve information for
+     * @param objectInfos
+     *            Holder to fill with information
+     */
+    public void fillInformationForAtomLinks(String repositoryId, StoredObject so, ObjectInfoHolder objectInfos) {
+        if (null == objectInfos || null == so)
+            return;
+        TypeDefinition typeDef = fStoreManager.getTypeById(repositoryId, so.getTypeId()).getTypeDefinition();
+
+        ObjectInfoImpl objInfo = new ObjectInfoImpl();
+        // Fill all setters:
+        objInfo.setId(so.getId());
+        objInfo.setName(so.getName());
+        objInfo.setCreatedBy(so.getCreatedBy()); // !
+        objInfo.setCreationDate(so.getCreatedAt()); // !
+        objInfo.setLastModificationDate(so.getModifiedAt());
+        objInfo.setTypeId(so.getTypeId());
+        objInfo.setBaseType(typeDef.getBaseTypeId());
+
+        // versioning information:
+        if (so instanceof DocumentVersion) {
+            DocumentVersion ver = (DocumentVersion) so;
+            DocumentVersion pwc = ver.getParentDocument().getPwc();
+            objInfo.setIsCurrentVersion(ver == ver.getParentDocument().getLatestVersion(false));
+            objInfo.setVersionSeriesId(ver.getParentDocument().getId());
+            objInfo.setWorkingCopyId(pwc == null ? null : pwc.getId());
+            objInfo.setWorkingCopyOriginalId(pwc == ver ? ver.getParentDocument().getLatestVersion(false).getId()
+                    : null);
+        } else if (so instanceof VersionedDocument) {
+            VersionedDocument doc = (VersionedDocument) so;
+            DocumentVersion pwc = doc.getPwc();
+            objInfo.setIsCurrentVersion(false);
+            objInfo.setVersionSeriesId(doc.getId());
+            objInfo.setWorkingCopyId(pwc == null ? null : pwc.getId());
+            objInfo.setWorkingCopyOriginalId(null);
+        } else { // unversioned document
+            objInfo.setIsCurrentVersion(true);
+            objInfo.setVersionSeriesId(null);
+            objInfo.setWorkingCopyId(null);
+            objInfo.setWorkingCopyOriginalId(null);
+        }
+
+        if (so instanceof Content) {
+            Content cont = ((Content) so);
+            objInfo.setHasContent(cont.getContent(0, -1) != null);
+            objInfo.setContentType(cont.getContent(0, -1) != null ? cont.getContent(0, -1).getMimeType() : null);
+            objInfo.setFileName(cont.getContent(0, -1) != null ? cont.getContent(0, -1).getFileName() : null);
+        } else {
+            objInfo.setHasContent(false);
+            objInfo.setContentType(null);
+            objInfo.setFileName(null);
+        }
+
+        // Filing
+        if (so instanceof Filing) {
+            Filing sop = ((Filing) so);
+            objInfo.setHasParent(!sop.getParents().isEmpty());
+        } else {
+            objInfo.setHasParent(false);
+        }
+
+        // Renditions, currently not supported by in-memory provider
+        objInfo.setRenditionInfos(null);
+
+        // Relationships, currently not supported by in-memory provider
+        objInfo.setSupportsRelationships(false);
+        objInfo.setRelationshipSourceIds(null);
+        objInfo.setRelationshipTargetIds(null);
+
+        // Policies, currently not supported by in-memory provider
+        objInfo.setSupportsPolicies(false);
+
+        // ACLs, currently not supported by in-memory provider
+        objInfo.setHasAcl(false);
+
+        objInfo.setSupportsDescendants(true);
+        objInfo.setSupportsFolderTree(true);
+
+        objectInfos.addObjectInfo(objInfo);
+    }
+
+    /**
+     * FillObjectInfoHolder object with required information needed for Atom
+     * binding for a single object
+     * 
+     * @param repositoryId
+     *            id of repository
+     * @param objectId
+     *            object to retrieve information for
+     * @param objectInfos
+     *            Holder to fill with information
+     */
+    public void fillInformationForAtomLinks(String repositoryId, String objectId, ObjectInfoHolder objectInfos) {
+        if (null == objectInfos || null == objectId)
+            return;
+
+        ObjectStore objectStore = fStoreManager.getObjectStore(repositoryId);
+        StoredObject so = objectStore.getObjectById(objectId);
+        fillInformationForAtomLinks(repositoryId, so, objectInfos);
+    }
+
+    /**
+     * FillObjectInfoHolder object with required information needed for Atom
+     * binding after a getChildren() call in navigation service
+     * 
+     * @param repositoryId
+     *            id of repository
+     * @param objectId
+     *            object to retrieve information for
+     * @param objectInfos
+     *            Holder to fill with information
+     * @param objList
+     *            result of getChildren call
+     */
+    public void fillInformationForAtomLinks(String repositoryId, String objectId, ObjectInfoHolder objectInfos,
+            ObjectInFolderList objList) {
+
+        if (null == objectInfos || null == objList || null == objectId)
+            return;
+
+        // Fill object information for requested object
+        fillInformationForAtomLinks(repositoryId, objectId, objectInfos);
+
+        // Fill object information for all children in result list
+        for (ObjectInFolderData object : objList.getObjects()) {
+            fillInformationForAtomLinks(repositoryId, object.getObject().getId(), objectInfos);
+        }
+    }
+
+    /**
+     * FillObjectInfoHolder object with required information needed for Atom
+     * binding for an object list
+     * 
+     * @param repositoryId
+     *            id of repository
+     * @param objectId
+     *            object to retrieve information for
+     * @param objectInfos
+     *            Holder to fill with information
+     * @param objList
+     *            result of getChildren call
+     */
+    public void fillInformationForAtomLinks(String repositoryId, String objectId, ObjectInfoHolder objectInfos,
+            ObjectList objList) {
+
+        if (null != objectId) {
+            // Fill object information for requested object
+            fillInformationForAtomLinks(repositoryId, objectId, objectInfos);
+        }
+
+        if (null != objList && null != objList.getObjects()) {
+            // Fill object information for all children in result list
+            List<ObjectData> listObjects = objList.getObjects();
+            if (null != listObjects)
+                for (ObjectData object : listObjects) {
+                    fillInformationForAtomLinks(repositoryId, object.getId(), objectInfos);
+                }
+        }
+
+    }
+
+    /**
+     * FillObjectInfoHolder object with required information needed for Atom
+     * binding for an ObjectInFolderContainer
+     * 
+     * @param repositoryId
+     *            id of repository
+     * @param objectId
+     *            object to retrieve information for
+     * @param objectInfos
+     *            Holder to fill with information
+     * @param objList
+     *            result of getChildren call
+     */
+    private void fillInformationForAtomLinks(String repositoryId, ObjectInfoHolder objectInfos,
+            ObjectInFolderContainer oifc) {
+
+        if (null == objectInfos || null == oifc)
+            return;
+
+        // Fill object information for all elements in result list
+        fillInformationForAtomLinks(repositoryId, objectInfos, oifc.getObject());
+
+        if (null != oifc.getChildren())
+            for (ObjectInFolderContainer object : oifc.getChildren()) {
+                // call recursively
+                fillInformationForAtomLinks(repositoryId, objectInfos, object);
+            }
+    }
+
+    /**
+     * FillObjectInfoHolder object with required information needed for Atom
+     * binding for a list with ObjectInFolderContainers
+     * 
+     * @param repositoryId
+     *            id of repository
+     * @param objectId
+     *            object to retrieve information for
+     * @param objectInfos
+     *            Holder to fill with information
+     * @param oifcList
+     *            result of getDescendants call
+     */
+    public void fillInformationForAtomLinks(String repositoryId, String objectId, ObjectInfoHolder objectInfos,
+            List<ObjectInFolderContainer> oifcList) {
+
+        if (null == objectInfos || null == oifcList || null == objectId)
+            return;
+
+        // Fill object information for requested object
+        fillInformationForAtomLinks(repositoryId, objectId, objectInfos);
+
+        for (ObjectInFolderContainer object : oifcList) {
+            fillInformationForAtomLinks(repositoryId, objectInfos, object);
+        }
+    }
+
+    private void fillInformationForAtomLinks(String repositoryId, ObjectInfoHolder objectInfos,
+            ObjectInFolderData object) {
+
+        fillInformationForAtomLinks(repositoryId, object.getObject().getId(), objectInfos);
+    }
+
+    /**
+     * FillObjectInfoHolder object with required information needed for Atom
+     * binding for a list with ObjectParentData objects
+     * 
+     * @param repositoryId
+     *            id of repository
+     * @param objectId
+     *            object to retrieve information for
+     * @param objectInfos
+     *            Holder to fill with information
+     * @param objParents
+     *            result of getObjectParents call
+     */
+    public void fillInformationForAtomLinksGetParents(String repositoryId, String objectId,
+            ObjectInfoHolder objectInfos, List<ObjectParentData> objParents) {
+
+        if (null == objectInfos || null == objParents || null == objectId)
+            return;
+
+        // Fill object information for requested object
+        fillInformationForAtomLinks(repositoryId, objectId, objectInfos);
+
+        for (ObjectParentData object : objParents) {
+            fillInformationForAtomLinks(repositoryId, object.getObject().getId(), objectInfos);
+        }
+    }
 
 }

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryAbstractServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryAbstractServiceImpl.java?rev=936938&r1=936937&r2=936938&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryAbstractServiceImpl.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryAbstractServiceImpl.java Thu Apr 22 16:27:57 2010
@@ -38,134 +38,134 @@ import org.apache.chemistry.opencmis.inm
  */
 public class InMemoryAbstractServiceImpl {
 
-	protected StoreManager fStoreManager;
+    protected StoreManager fStoreManager;
 
-	protected InMemoryAbstractServiceImpl(StoreManager storeManager) {
-		fStoreManager = storeManager;
-	}
-
-	/**
-	 * check if repository is known and that object exists. To avoid later calls
-	 * to again retrieve the object from the id return the retrieved object for
-	 * later use.
-	 * 
-	 * @param repositoryId
-	 *            repository id
-	 * @param objectId
-	 *            object id
-	 * @return object for objectId
-	 */
-	protected StoredObject checkStandardParameters(String repositoryId, String objectId) {
-
-		ObjectStore objStore = fStoreManager.getObjectStore(repositoryId);
-
-		if (objStore == null)
-			throw new CmisObjectNotFoundException("Unknown repository id: " + repositoryId);
-
-		StoredObject so = objStore.getObjectById(objectId);
-
-		if (so == null)
-			throw new CmisObjectNotFoundException("Unknown object id: " + objectId);
-
-		return so;
-	}
-
-	protected StoredObject checkExistingObjectId(ObjectStore objStore, String objectId) {
-
-		StoredObject so = objStore.getObjectById(objectId);
-
-		if (so == null)
-			throw new CmisObjectNotFoundException("Unknown object id: " + objectId);
-
-		return so;
-	}
-
-	protected void checkRepositoryId(String repositoryId) {
-		ObjectStore objStore = fStoreManager.getObjectStore(repositoryId);
-
-		if (objStore == null)
-			throw new CmisObjectNotFoundException("Unknown repository id: " + repositoryId);
-	}
-
-	protected TypeDefinition getTypeDefinition(String repositoryId, Properties properties) {
-		String typeId = (String) properties.getProperties().get(PropertyIds.OBJECT_TYPE_ID).getFirstValue();
-		TypeDefinitionContainer typeDefC = fStoreManager.getTypeById(repositoryId, typeId);
-		if (typeDefC == null)
-			throw new RuntimeException("Cannot create object, a type with id " + typeId + " is unknown");
-
-		return typeDefC.getTypeDefinition();
-	}
-
-	protected TypeDefinition getTypeDefinition(String repositoryId, StoredObject obj) {
-
-		TypeDefinitionContainer typeDefC = fStoreManager.getTypeById(repositoryId, obj.getTypeId());
-		return typeDefC.getTypeDefinition();
-	}
-
-	/**
-	 * We allow checkin, cancel, checkout operations on a single version as well
-	 * as on a version series This method returns the versioned document
-	 * (version series) in each case
-	 * 
-	 * @param value
-	 *            version or version series id of a document
-	 * @return version series id
-	 */
-	protected VersionedDocument getVersionedDocumentOfObjectId(StoredObject so) {
-
-		VersionedDocument verDoc;
-		if (so instanceof DocumentVersion) {
-			// get document the version is contained in to c
-			verDoc = ((DocumentVersion) so).getParentDocument();
-		} else {
-			verDoc = (VersionedDocument) so;
-		}
-
-		return verDoc;
-	}
-
-	protected VersionedDocument testIsNotCheckedOutBySomeoneElse(StoredObject so, String user) {
-		checkIsVersionableObject(so);
-		VersionedDocument verDoc = getVersionedDocumentOfObjectId(so);
-		if (verDoc.isCheckedOut())
-			testCheckedOutByCurrentUser(user, verDoc);
-
-		return verDoc;
-	}
-
-	protected VersionedDocument testHasProperCheckedOutStatus(StoredObject so, String user) {
-
-		checkIsVersionableObject(so);
-		VersionedDocument verDoc = getVersionedDocumentOfObjectId(so);
-
-		checkHasUser(user);
-
-		testIsCheckedOut(verDoc);
-		testCheckedOutByCurrentUser(user, verDoc);
-
-		return verDoc;
-	}
-
-	protected void checkIsVersionableObject(StoredObject so) {
-		if (!(so instanceof VersionedDocument || so instanceof DocumentVersion))
-			throw new RuntimeException(
-					"Object is of a versionable type but not instance of VersionedDocument or DocumentVersion.");
-	}
-
-	protected void checkHasUser(String user) {
-		if (null == user || user.length() == 0)
-			throw new CmisUpdateConflictException("Object can't be checked-in, no user is given.");
-	}
-
-	protected void testCheckedOutByCurrentUser(String user, VersionedDocument verDoc) {
-		if (!user.equals(verDoc.getCheckedOutBy()))
-			throw new CmisUpdateConflictException("Object can't be checked-in, user " + verDoc.getCheckedOutBy()
-					+ " has checked out the document.");
-	}
-
-	protected void testIsCheckedOut(VersionedDocument verDoc) {
-		if (!verDoc.isCheckedOut())
-			throw new CmisUpdateConflictException("Canot check-in: Document " + verDoc.getId() + " is not checked out.");
-	}
+    protected InMemoryAbstractServiceImpl(StoreManager storeManager) {
+        fStoreManager = storeManager;
+    }
+
+    /**
+     * check if repository is known and that object exists. To avoid later calls
+     * to again retrieve the object from the id return the retrieved object for
+     * later use.
+     * 
+     * @param repositoryId
+     *            repository id
+     * @param objectId
+     *            object id
+     * @return object for objectId
+     */
+    protected StoredObject checkStandardParameters(String repositoryId, String objectId) {
+
+        ObjectStore objStore = fStoreManager.getObjectStore(repositoryId);
+
+        if (objStore == null)
+            throw new CmisObjectNotFoundException("Unknown repository id: " + repositoryId);
+
+        StoredObject so = objStore.getObjectById(objectId);
+
+        if (so == null)
+            throw new CmisObjectNotFoundException("Unknown object id: " + objectId);
+
+        return so;
+    }
+
+    protected StoredObject checkExistingObjectId(ObjectStore objStore, String objectId) {
+
+        StoredObject so = objStore.getObjectById(objectId);
+
+        if (so == null)
+            throw new CmisObjectNotFoundException("Unknown object id: " + objectId);
+
+        return so;
+    }
+
+    protected void checkRepositoryId(String repositoryId) {
+        ObjectStore objStore = fStoreManager.getObjectStore(repositoryId);
+
+        if (objStore == null)
+            throw new CmisObjectNotFoundException("Unknown repository id: " + repositoryId);
+    }
+
+    protected TypeDefinition getTypeDefinition(String repositoryId, Properties properties) {
+        String typeId = (String) properties.getProperties().get(PropertyIds.OBJECT_TYPE_ID).getFirstValue();
+        TypeDefinitionContainer typeDefC = fStoreManager.getTypeById(repositoryId, typeId);
+        if (typeDefC == null)
+            throw new RuntimeException("Cannot create object, a type with id " + typeId + " is unknown");
+
+        return typeDefC.getTypeDefinition();
+    }
+
+    protected TypeDefinition getTypeDefinition(String repositoryId, StoredObject obj) {
+
+        TypeDefinitionContainer typeDefC = fStoreManager.getTypeById(repositoryId, obj.getTypeId());
+        return typeDefC.getTypeDefinition();
+    }
+
+    /**
+     * We allow checkin, cancel, checkout operations on a single version as well
+     * as on a version series This method returns the versioned document
+     * (version series) in each case
+     * 
+     * @param value
+     *            version or version series id of a document
+     * @return version series id
+     */
+    protected VersionedDocument getVersionedDocumentOfObjectId(StoredObject so) {
+
+        VersionedDocument verDoc;
+        if (so instanceof DocumentVersion) {
+            // get document the version is contained in to c
+            verDoc = ((DocumentVersion) so).getParentDocument();
+        } else {
+            verDoc = (VersionedDocument) so;
+        }
+
+        return verDoc;
+    }
+
+    protected VersionedDocument testIsNotCheckedOutBySomeoneElse(StoredObject so, String user) {
+        checkIsVersionableObject(so);
+        VersionedDocument verDoc = getVersionedDocumentOfObjectId(so);
+        if (verDoc.isCheckedOut())
+            testCheckedOutByCurrentUser(user, verDoc);
+
+        return verDoc;
+    }
+
+    protected VersionedDocument testHasProperCheckedOutStatus(StoredObject so, String user) {
+
+        checkIsVersionableObject(so);
+        VersionedDocument verDoc = getVersionedDocumentOfObjectId(so);
+
+        checkHasUser(user);
+
+        testIsCheckedOut(verDoc);
+        testCheckedOutByCurrentUser(user, verDoc);
+
+        return verDoc;
+    }
+
+    protected void checkIsVersionableObject(StoredObject so) {
+        if (!(so instanceof VersionedDocument || so instanceof DocumentVersion))
+            throw new RuntimeException(
+                    "Object is of a versionable type but not instance of VersionedDocument or DocumentVersion.");
+    }
+
+    protected void checkHasUser(String user) {
+        if (null == user || user.length() == 0)
+            throw new CmisUpdateConflictException("Object can't be checked-in, no user is given.");
+    }
+
+    protected void testCheckedOutByCurrentUser(String user, VersionedDocument verDoc) {
+        if (!user.equals(verDoc.getCheckedOutBy()))
+            throw new CmisUpdateConflictException("Object can't be checked-in, user " + verDoc.getCheckedOutBy()
+                    + " has checked out the document.");
+    }
+
+    protected void testIsCheckedOut(VersionedDocument verDoc) {
+        if (!verDoc.isCheckedOut())
+            throw new CmisUpdateConflictException("Canot check-in: Document " + verDoc.getId() + " is not checked out.");
+    }
 
 }

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryDiscoveryServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryDiscoveryServiceImpl.java?rev=936938&r1=936937&r2=936938&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryDiscoveryServiceImpl.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryDiscoveryServiceImpl.java Thu Apr 22 16:27:57 2010
@@ -42,85 +42,84 @@ import org.apache.chemistry.opencmis.ser
 
 public class InMemoryDiscoveryServiceImpl implements CmisDiscoveryService {
 
-	private StoreManager fStoreManager;
-	AtomLinkInfoProvider fAtomLinkProvider;
-	InMemoryNavigationServiceImpl fNavigationService; // real implementation of
-														// the service
-	InMemoryRepositoryServiceImpl fRepositoryService;
-
-	public InMemoryDiscoveryServiceImpl(StoreManager storeManager, InMemoryRepositoryServiceImpl repSvc,
-			InMemoryNavigationServiceImpl navSvc) {
-		fStoreManager = storeManager;
-		fAtomLinkProvider = new AtomLinkInfoProvider(fStoreManager);
-		fNavigationService = navSvc;
-		fRepositoryService = repSvc;
-	}
-
-	public ObjectList getContentChanges(CallContext context, String repositoryId, Holder<String> changeLogToken,
-			Boolean includeProperties, String filter, Boolean includePolicyIds, Boolean includeAcl,
-			BigInteger maxItems, ExtensionsData extension, ObjectInfoHolder objectInfos) {
-		// dummy implementation using hard coded values
-
-			RepositoryInfo rep = fRepositoryService.getRepositoryInfo(context, repositoryId, null);
-			String rootFolderId = rep.getRootFolderId();
-
-			ObjectListImpl objList = new ObjectListImpl();
-			List<ObjectInFolderContainer> tempRes = fNavigationService.getDescendants(context, repositoryId,
-					rootFolderId, BigInteger.valueOf(3), filter, false, IncludeRelationships.NONE, null, false,
-					extension, null);
-
-			// convert ObjectInFolderContainerList to objectList
-			List<ObjectData> lod = new ArrayList<ObjectData>();
-			for (ObjectInFolderContainer obj : tempRes) {
-				convertList(lod, obj);
-			}
-			objList.setObjects(lod);
-			objList.setNumItems(BigInteger.valueOf(lod.size()));
-
-			// To be able to provide all Atom links in the response we need
-			// additional information:
-			fAtomLinkProvider.fillInformationForAtomLinks(repositoryId, null, objectInfos, objList);
-			return objList;
-	}
-
-	private void convertList(List<ObjectData> lod, ObjectInFolderContainer obj) {
-		lod.add(obj.getObject().getObject());
-		// add dummy event info
-		ObjectData oif = obj.getObject().getObject();
-		ObjectDataImpl oifImpl = (ObjectDataImpl) oif;
-		ChangeEventInfoDataImpl changeEventInfo = new ChangeEventInfoDataImpl();
-		changeEventInfo.setChangeType(ChangeType.UPDATED);
-		changeEventInfo.setChangeTime(new GregorianCalendar());
-		oifImpl.setChangeEventInfo(changeEventInfo);
-		if (null != obj.getChildren()) {
-			for (ObjectInFolderContainer oifc : obj.getChildren()) {
-				convertList(lod, oifc);
-			}
-		}
-	}
-
-	public ObjectList query(CallContext context, String repositoryId, String statement, Boolean searchAllVersions,
-			Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter,
-			BigInteger maxItems, BigInteger skipCount, ExtensionsData extension) {
-		// dummy implementation using hard coded values
-
-			// use descendants of root folder as result
-			RepositoryInfo rep = fRepositoryService.getRepositoryInfo(context, repositoryId, null);
-			String rootFolderId = rep.getRootFolderId();
-			ObjectListImpl objList = new ObjectListImpl();
-			List<ObjectInFolderContainer> tempRes = fNavigationService.getDescendants(context, repositoryId,
-					rootFolderId, BigInteger.valueOf(3), "*", includeAllowableActions, includeRelationships,
-					renditionFilter, false, extension, null);
-
-			// convert ObjectInFolderContainerList to objectList
-			List<ObjectData> lod = new ArrayList<ObjectData>();
-			for (ObjectInFolderContainer obj : tempRes) {
-				convertList(lod, obj);
-			}
-			objList.setObjects(lod);
-			objList.setNumItems(BigInteger.valueOf(lod.size()));
+    private StoreManager fStoreManager;
+    AtomLinkInfoProvider fAtomLinkProvider;
+    InMemoryNavigationServiceImpl fNavigationService; // real implementation of
+    // the service
+    InMemoryRepositoryServiceImpl fRepositoryService;
+
+    public InMemoryDiscoveryServiceImpl(StoreManager storeManager, InMemoryRepositoryServiceImpl repSvc,
+            InMemoryNavigationServiceImpl navSvc) {
+        fStoreManager = storeManager;
+        fAtomLinkProvider = new AtomLinkInfoProvider(fStoreManager);
+        fNavigationService = navSvc;
+        fRepositoryService = repSvc;
+    }
+
+    public ObjectList getContentChanges(CallContext context, String repositoryId, Holder<String> changeLogToken,
+            Boolean includeProperties, String filter, Boolean includePolicyIds, Boolean includeAcl,
+            BigInteger maxItems, ExtensionsData extension, ObjectInfoHolder objectInfos) {
+        // dummy implementation using hard coded values
+
+        RepositoryInfo rep = fRepositoryService.getRepositoryInfo(context, repositoryId, null);
+        String rootFolderId = rep.getRootFolderId();
+
+        ObjectListImpl objList = new ObjectListImpl();
+        List<ObjectInFolderContainer> tempRes = fNavigationService.getDescendants(context, repositoryId, rootFolderId,
+                BigInteger.valueOf(3), filter, false, IncludeRelationships.NONE, null, false, extension, null);
+
+        // convert ObjectInFolderContainerList to objectList
+        List<ObjectData> lod = new ArrayList<ObjectData>();
+        for (ObjectInFolderContainer obj : tempRes) {
+            convertList(lod, obj);
+        }
+        objList.setObjects(lod);
+        objList.setNumItems(BigInteger.valueOf(lod.size()));
+
+        // To be able to provide all Atom links in the response we need
+        // additional information:
+        fAtomLinkProvider.fillInformationForAtomLinks(repositoryId, null, objectInfos, objList);
+        return objList;
+    }
+
+    private void convertList(List<ObjectData> lod, ObjectInFolderContainer obj) {
+        lod.add(obj.getObject().getObject());
+        // add dummy event info
+        ObjectData oif = obj.getObject().getObject();
+        ObjectDataImpl oifImpl = (ObjectDataImpl) oif;
+        ChangeEventInfoDataImpl changeEventInfo = new ChangeEventInfoDataImpl();
+        changeEventInfo.setChangeType(ChangeType.UPDATED);
+        changeEventInfo.setChangeTime(new GregorianCalendar());
+        oifImpl.setChangeEventInfo(changeEventInfo);
+        if (null != obj.getChildren()) {
+            for (ObjectInFolderContainer oifc : obj.getChildren()) {
+                convertList(lod, oifc);
+            }
+        }
+    }
+
+    public ObjectList query(CallContext context, String repositoryId, String statement, Boolean searchAllVersions,
+            Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter,
+            BigInteger maxItems, BigInteger skipCount, ExtensionsData extension) {
+        // dummy implementation using hard coded values
+
+        // use descendants of root folder as result
+        RepositoryInfo rep = fRepositoryService.getRepositoryInfo(context, repositoryId, null);
+        String rootFolderId = rep.getRootFolderId();
+        ObjectListImpl objList = new ObjectListImpl();
+        List<ObjectInFolderContainer> tempRes = fNavigationService.getDescendants(context, repositoryId, rootFolderId,
+                BigInteger.valueOf(3), "*", includeAllowableActions, includeRelationships, renditionFilter, false,
+                extension, null);
+
+        // convert ObjectInFolderContainerList to objectList
+        List<ObjectData> lod = new ArrayList<ObjectData>();
+        for (ObjectInFolderContainer obj : tempRes) {
+            convertList(lod, obj);
+        }
+        objList.setObjects(lod);
+        objList.setNumItems(BigInteger.valueOf(lod.size()));
 
-			return objList;
-	}
+        return objList;
+    }
 
 }

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryMultiFilingServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryMultiFilingServiceImpl.java?rev=936938&r1=936937&r2=936938&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryMultiFilingServiceImpl.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryMultiFilingServiceImpl.java Thu Apr 22 16:27:57 2010
@@ -35,93 +35,93 @@ import org.apache.chemistry.opencmis.ser
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
-public class InMemoryMultiFilingServiceImpl extends InMemoryAbstractServiceImpl implements CmisMultiFilingService{
+public class InMemoryMultiFilingServiceImpl extends InMemoryAbstractServiceImpl implements CmisMultiFilingService {
 
-	private static final Log LOG = LogFactory.getLog(InMemoryMultiFilingServiceImpl.class.getName());
+    private static final Log LOG = LogFactory.getLog(InMemoryMultiFilingServiceImpl.class.getName());
 
-	AtomLinkInfoProvider fAtomLinkProvider;
+    AtomLinkInfoProvider fAtomLinkProvider;
 
-	public InMemoryMultiFilingServiceImpl(StoreManager storeMgr) {
-		super(storeMgr);
-		fAtomLinkProvider = new AtomLinkInfoProvider(storeMgr);
-	}
-
-	public ObjectData addObjectToFolder(CallContext context, String repositoryId, String objectId, String folderId,
-			Boolean allVersions, ExtensionsData extension, ObjectInfoHolder objectInfos) {
-
-		LOG.debug("Begin addObjectToFolder()");
-
-		StoredObject[] so2 = checkParams(repositoryId, objectId, folderId);
-		if (allVersions != null && allVersions.booleanValue() == false)
-			throw new CmisNotSupportedException(
-					"Cannot add object to folder, version specific filing is not supported.");
-		StoredObject so = so2[0];
-		StoredObject folder = so2[1];
-		checkObjects(so, folder);
-
-		Folder newParent = (Folder) folder;
-		MultiFiling obj = (MultiFiling) so;
-		obj.addParent(newParent);
-
-		fAtomLinkProvider.fillInformationForAtomLinks(repositoryId, so, objectInfos);
-		fAtomLinkProvider.fillInformationForAtomLinks(repositoryId, folder, objectInfos);
-
-		String user = context.getUsername();
-		ObjectData od = PropertyCreationHelper.getObjectData(fStoreManager, so, null, user, false,
-				IncludeRelationships.NONE, null, false, false, extension);
-
-		LOG.debug("End addObjectToFolder()");
-		return od;
-	}
-
-	public ObjectData removeObjectFromFolder(CallContext context, String repositoryId, String objectId,
-			String folderId, ExtensionsData extension, ObjectInfoHolder objectInfos) {
-
-		LOG.debug("Begin removeObjectFromFolder()");
-
-		StoredObject so = checkStandardParameters(repositoryId, objectId);
-		ObjectStore objectStore = fStoreManager.getObjectStore(repositoryId);
-		StoredObject folder = checkExistingObjectId(objectStore, folderId);
-
-		checkObjects(so, folder);
-		Folder parent = (Folder) folder;
-		MultiFiling obj = (MultiFiling) so;
-		obj.removeParent(parent);
-
-		// To be able to provide all Atom links in the response we need
-		// additional information:
-		fAtomLinkProvider.fillInformationForAtomLinks(repositoryId, so, objectInfos);
-		fAtomLinkProvider.fillInformationForAtomLinks(repositoryId, folder, objectInfos);
-
-		String user = context.getUsername();
-		ObjectData od = PropertyCreationHelper.getObjectData(fStoreManager, so, null, user, false,
-				IncludeRelationships.NONE, null, false, false, extension);
-
-		LOG.debug("End removeObjectFromFolder()");
-
-		return od;
-	}
-
-	private StoredObject[] checkParams(String repositoryId, String objectId, String folderId) {
-		StoredObject[] so = new StoredObject[2];
-		so[0] = checkStandardParameters(repositoryId, objectId);
-		ObjectStore objectStore = fStoreManager.getObjectStore(repositoryId);
-		so[1] = checkExistingObjectId(objectStore, folderId);
-		return so;
-	}
-
-	private void checkObjects(StoredObject so, StoredObject folder) {
-		if (!(so instanceof MultiFiling))
-			throw new CmisConstraintException("Cannot add object to folder, object id " + so.getId()
-					+ " is not a multi-filed object.");
-
-		if ((so instanceof Folder))
-			throw new CmisConstraintException("Cannot add object to folder, object id " + folder.getId()
-					+ " is a folder and folders are not multi-filed.");
-
-		if (!(folder instanceof Folder))
-			throw new CmisConstraintException("Cannot add object to folder, folder id " + folder.getId()
-					+ " does not refer to a folder.");
-	}
+    public InMemoryMultiFilingServiceImpl(StoreManager storeMgr) {
+        super(storeMgr);
+        fAtomLinkProvider = new AtomLinkInfoProvider(storeMgr);
+    }
+
+    public ObjectData addObjectToFolder(CallContext context, String repositoryId, String objectId, String folderId,
+            Boolean allVersions, ExtensionsData extension, ObjectInfoHolder objectInfos) {
+
+        LOG.debug("Begin addObjectToFolder()");
+
+        StoredObject[] so2 = checkParams(repositoryId, objectId, folderId);
+        if (allVersions != null && allVersions.booleanValue() == false)
+            throw new CmisNotSupportedException(
+                    "Cannot add object to folder, version specific filing is not supported.");
+        StoredObject so = so2[0];
+        StoredObject folder = so2[1];
+        checkObjects(so, folder);
+
+        Folder newParent = (Folder) folder;
+        MultiFiling obj = (MultiFiling) so;
+        obj.addParent(newParent);
+
+        fAtomLinkProvider.fillInformationForAtomLinks(repositoryId, so, objectInfos);
+        fAtomLinkProvider.fillInformationForAtomLinks(repositoryId, folder, objectInfos);
+
+        String user = context.getUsername();
+        ObjectData od = PropertyCreationHelper.getObjectData(fStoreManager, so, null, user, false,
+                IncludeRelationships.NONE, null, false, false, extension);
+
+        LOG.debug("End addObjectToFolder()");
+        return od;
+    }
+
+    public ObjectData removeObjectFromFolder(CallContext context, String repositoryId, String objectId,
+            String folderId, ExtensionsData extension, ObjectInfoHolder objectInfos) {
+
+        LOG.debug("Begin removeObjectFromFolder()");
+
+        StoredObject so = checkStandardParameters(repositoryId, objectId);
+        ObjectStore objectStore = fStoreManager.getObjectStore(repositoryId);
+        StoredObject folder = checkExistingObjectId(objectStore, folderId);
+
+        checkObjects(so, folder);
+        Folder parent = (Folder) folder;
+        MultiFiling obj = (MultiFiling) so;
+        obj.removeParent(parent);
+
+        // To be able to provide all Atom links in the response we need
+        // additional information:
+        fAtomLinkProvider.fillInformationForAtomLinks(repositoryId, so, objectInfos);
+        fAtomLinkProvider.fillInformationForAtomLinks(repositoryId, folder, objectInfos);
+
+        String user = context.getUsername();
+        ObjectData od = PropertyCreationHelper.getObjectData(fStoreManager, so, null, user, false,
+                IncludeRelationships.NONE, null, false, false, extension);
+
+        LOG.debug("End removeObjectFromFolder()");
+
+        return od;
+    }
+
+    private StoredObject[] checkParams(String repositoryId, String objectId, String folderId) {
+        StoredObject[] so = new StoredObject[2];
+        so[0] = checkStandardParameters(repositoryId, objectId);
+        ObjectStore objectStore = fStoreManager.getObjectStore(repositoryId);
+        so[1] = checkExistingObjectId(objectStore, folderId);
+        return so;
+    }
+
+    private void checkObjects(StoredObject so, StoredObject folder) {
+        if (!(so instanceof MultiFiling))
+            throw new CmisConstraintException("Cannot add object to folder, object id " + so.getId()
+                    + " is not a multi-filed object.");
+
+        if ((so instanceof Folder))
+            throw new CmisConstraintException("Cannot add object to folder, object id " + folder.getId()
+                    + " is a folder and folders are not multi-filed.");
+
+        if (!(folder instanceof Folder))
+            throw new CmisConstraintException("Cannot add object to folder, folder id " + folder.getId()
+                    + " does not refer to a folder.");
+    }
 
 }



Mime
View raw message