You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chemistry.apache.org by fm...@apache.org on 2010/03/01 10:06:07 UTC
svn commit: r917425 [3/3] - in
/incubator/chemistry/trunk/opencmis/opencmis-client:
opencmis-client-api/src/main/java/org/apache/opencmis/client/api/
opencmis-client-api/src/main/java/org/apache/opencmis/client/api/objecttype/
opencmis-client-api/src/m...
Added: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/objecttype/AbstractObjectType.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/objecttype/AbstractObjectType.java?rev=917425&view=auto
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/objecttype/AbstractObjectType.java (added)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/objecttype/AbstractObjectType.java Mon Mar 1 09:06:06 2010
@@ -0,0 +1,263 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.opencmis.client.runtime.objecttype;
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.opencmis.client.api.Session;
+import org.apache.opencmis.client.api.objecttype.ObjectType;
+import org.apache.opencmis.client.api.util.Container;
+import org.apache.opencmis.client.api.util.PagingList;
+import org.apache.opencmis.commons.api.PropertyDefinition;
+import org.apache.opencmis.commons.api.TypeDefinition;
+import org.apache.opencmis.commons.enums.BaseObjectTypeIds;
+
+/**
+ * Base class for object types.
+ */
+public abstract class AbstractObjectType implements ObjectType {
+
+ private Session session;
+ private TypeDefinition typeDefinition;
+ private ObjectType baseType;
+ private ObjectType parentType;
+
+ /**
+ * Initializes the object.
+ */
+ protected void initialize(Session session, TypeDefinition typeDefintion) {
+ this.session = session;
+ this.typeDefinition = typeDefintion;
+ }
+
+ /**
+ * Returns the session object.
+ */
+ protected Session getSession() {
+ return this.session;
+ }
+
+ /**
+ * Returns the type definition.
+ */
+ protected TypeDefinition getTypeDefinition() {
+ return this.typeDefinition;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.opencmis.client.api.objecttype.ObjectType#getBaseType()
+ */
+ public ObjectType getBaseType() {
+ if (this.baseType != null) {
+ return this.baseType;
+ }
+
+ if (getBaseTypeId() == null) {
+ return null;
+ }
+
+ this.baseType = getSession().getTypeDefinition(getBaseTypeId().value());
+
+ return this.baseType;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.opencmis.client.api.objecttype.ObjectType#getBaseTypeId()
+ */
+ public BaseObjectTypeIds getBaseTypeId() {
+ return getTypeDefinition().getBaseId();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.opencmis.client.api.objecttype.ObjectType#getDescription()
+ */
+ public String getDescription() {
+ return getTypeDefinition().getDescription();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.opencmis.client.api.objecttype.ObjectType#getDisplayName()
+ */
+ public String getDisplayName() {
+ return getTypeDefinition().getDisplayName();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.opencmis.client.api.objecttype.ObjectType#getId()
+ */
+ public String getId() {
+ return getTypeDefinition().getId();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.opencmis.client.api.objecttype.ObjectType#getLocalName()
+ */
+ public String getLocalName() {
+ return getTypeDefinition().getLocalName();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.opencmis.client.api.objecttype.ObjectType#getLocalNamespace()
+ */
+ public String getLocalNamespace() {
+ return getTypeDefinition().getLocalNamespace();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.opencmis.client.api.objecttype.ObjectType#getParent()
+ */
+ public ObjectType getParent() {
+ if (this.parentType != null) {
+ return this.parentType;
+ }
+
+ if (getTypeDefinition().getParentId() == null) {
+ return null;
+ }
+
+ this.parentType = getSession().getTypeDefinition(getTypeDefinition().getParentId());
+
+ return this.parentType;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.opencmis.client.api.objecttype.ObjectType#getPropertyDefintions()
+ */
+ public Map<String, PropertyDefinition<?>> getPropertyDefintions() {
+ return typeDefinition.getPropertyDefinitions();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.opencmis.client.api.objecttype.ObjectType#getQueryName()
+ */
+ public String getQueryName() {
+ return getTypeDefinition().getQueryName();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.opencmis.client.api.objecttype.ObjectType#isBase()
+ */
+ public boolean isBase() {
+ return (getTypeDefinition().getParentId() == null);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.opencmis.client.api.objecttype.ObjectType#isControllableAcl()
+ */
+ public Boolean isControllableAcl() {
+ return getTypeDefinition().isControllableAcl();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.opencmis.client.api.objecttype.ObjectType#isControllablePolicy()
+ */
+ public Boolean isControllablePolicy() {
+ return getTypeDefinition().isControllablePolicy();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.opencmis.client.api.objecttype.ObjectType#isCreatable()
+ */
+ public Boolean isCreatable() {
+ return getTypeDefinition().isCreatable();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.opencmis.client.api.objecttype.ObjectType#isFileable()
+ */
+ public Boolean isFileable() {
+ return getTypeDefinition().isFileable();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.opencmis.client.api.objecttype.ObjectType#isFulltextIndexed()
+ */
+ public Boolean isFulltextIndexed() {
+ return getTypeDefinition().isFulltextIndexed();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.opencmis.client.api.objecttype.ObjectType#isIncludedInSupertypeQuery()
+ */
+ public Boolean isIncludedInSupertypeQuery() {
+ return getTypeDefinition().isIncludedInSupertypeQuery();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.opencmis.client.api.objecttype.ObjectType#isQueryable()
+ */
+ public Boolean isQueryable() {
+ return getTypeDefinition().isQueryable();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.opencmis.client.api.objecttype.ObjectType#getChildren(int)
+ */
+ public PagingList<ObjectType> getChildren(int itemsPerPage) {
+ return getSession().getTypeChildren(this, true, itemsPerPage);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.opencmis.client.api.objecttype.ObjectType#getDescendants(int)
+ */
+ public List<Container<ObjectType>> getDescendants(int depth) {
+ return getSession().getTypeDescendants(this, depth, true);
+ }
+}
Propchange: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/objecttype/AbstractObjectType.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/objecttype/DocumentTypeImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/objecttype/DocumentTypeImpl.java?rev=917425&view=auto
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/objecttype/DocumentTypeImpl.java (added)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/objecttype/DocumentTypeImpl.java Mon Mar 1 09:06:06 2010
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.opencmis.client.runtime.objecttype;
+
+import org.apache.opencmis.client.api.Session;
+import org.apache.opencmis.client.api.objecttype.DocumentType;
+import org.apache.opencmis.commons.api.DocumentTypeDefinition;
+import org.apache.opencmis.commons.api.TypeDefinition;
+import org.apache.opencmis.commons.enums.ContentStreamAllowed;
+
+/**
+ * Document type.
+ */
+public class DocumentTypeImpl extends AbstractObjectType implements DocumentType {
+
+ /**
+ * Constructor.
+ */
+ public DocumentTypeImpl(Session session, TypeDefinition typeDefinition) {
+ initialize(session, typeDefinition);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.opencmis.client.api.objecttype.DocumentType#getContentStreamAllowed()
+ */
+ public ContentStreamAllowed getContentStreamAllowed() {
+ return ((DocumentTypeDefinition) getTypeDefinition()).getContentStreamAllowed();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.opencmis.client.api.objecttype.DocumentType#isVersionable()
+ */
+ public Boolean isVersionable() {
+ return ((DocumentTypeDefinition) getTypeDefinition()).isVersionable();
+ }
+}
Propchange: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/objecttype/DocumentTypeImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/objecttype/FolderTypeImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/objecttype/FolderTypeImpl.java?rev=917425&view=auto
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/objecttype/FolderTypeImpl.java (added)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/objecttype/FolderTypeImpl.java Mon Mar 1 09:06:06 2010
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.opencmis.client.runtime.objecttype;
+
+import org.apache.opencmis.client.api.Session;
+import org.apache.opencmis.client.api.objecttype.FolderType;
+import org.apache.opencmis.commons.api.TypeDefinition;
+
+/**
+ * Folder type.
+ */
+public class FolderTypeImpl extends AbstractObjectType implements FolderType {
+
+ /**
+ * Constructor.
+ */
+ public FolderTypeImpl(Session session, TypeDefinition typeDefinition) {
+ initialize(session, typeDefinition);
+ }
+}
Propchange: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/objecttype/FolderTypeImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/objecttype/PolicyTypeImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/objecttype/PolicyTypeImpl.java?rev=917425&view=auto
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/objecttype/PolicyTypeImpl.java (added)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/objecttype/PolicyTypeImpl.java Mon Mar 1 09:06:06 2010
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.opencmis.client.runtime.objecttype;
+
+import org.apache.opencmis.client.api.Session;
+import org.apache.opencmis.client.api.objecttype.PolicyType;
+import org.apache.opencmis.commons.api.TypeDefinition;
+
+/**
+ * Policy type.
+ */
+public class PolicyTypeImpl extends AbstractObjectType implements PolicyType {
+
+ /**
+ * Constructor.
+ */
+ public PolicyTypeImpl(Session session, TypeDefinition typeDefinition) {
+ initialize(session, typeDefinition);
+ }
+}
Propchange: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/objecttype/PolicyTypeImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/objecttype/RelationshipTypeImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/objecttype/RelationshipTypeImpl.java?rev=917425&view=auto
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/objecttype/RelationshipTypeImpl.java (added)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/objecttype/RelationshipTypeImpl.java Mon Mar 1 09:06:06 2010
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.opencmis.client.runtime.objecttype;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.opencmis.client.api.Session;
+import org.apache.opencmis.client.api.objecttype.ObjectType;
+import org.apache.opencmis.client.api.objecttype.RelationshipType;
+import org.apache.opencmis.commons.api.RelationshipTypeDefinition;
+import org.apache.opencmis.commons.api.TypeDefinition;
+
+/**
+ * Relationship type.
+ */
+public class RelationshipTypeImpl extends AbstractObjectType implements RelationshipType {
+
+ private List<ObjectType> allowedSourceTypes;
+ private List<ObjectType> allowedTargetTypes;
+
+ /**
+ * Constructor.
+ */
+ public RelationshipTypeImpl(Session session, TypeDefinition typeDefinition) {
+ initialize(session, typeDefinition);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.opencmis.client.api.objecttype.RelationshipType#getAllowedSourceTypes()
+ */
+ public List<ObjectType> getAllowedSourceTypes() {
+ if (allowedSourceTypes == null) {
+ List<ObjectType> types = new ArrayList<ObjectType>();
+
+ List<String> ids = ((RelationshipTypeDefinition) getTypeDefinition()).getAllowedSourceTypes();
+ if (ids != null) {
+ for (String id : ids) {
+ types.add(getSession().getTypeDefinition(id));
+ }
+ }
+
+ allowedSourceTypes = types;
+ }
+
+ return allowedSourceTypes;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.opencmis.client.api.objecttype.RelationshipType#getAllowedTargetTypes()
+ */
+ public List<ObjectType> getAllowedTargetTypes() {
+ if (allowedTargetTypes == null) {
+ List<ObjectType> types = new ArrayList<ObjectType>();
+
+ List<String> ids = ((RelationshipTypeDefinition) getTypeDefinition()).getAllowedTargetTypes();
+ if (ids != null) {
+ for (String id : ids) {
+ types.add(getSession().getTypeDefinition(id));
+ }
+ }
+
+ allowedTargetTypes = types;
+ }
+
+ return allowedTargetTypes;
+ }
+
+}
Propchange: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/objecttype/RelationshipTypeImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/repository/PersistentObjectFactoryImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/repository/PersistentObjectFactoryImpl.java?rev=917425&r1=917424&r2=917425&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/repository/PersistentObjectFactoryImpl.java (original)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/repository/PersistentObjectFactoryImpl.java Mon Mar 1 09:06:06 2010
@@ -20,10 +20,11 @@
import java.io.InputStream;
import java.util.List;
+import java.util.Map;
import org.apache.opencmis.client.api.Ace;
import org.apache.opencmis.client.api.Acl;
-import org.apache.opencmis.client.api.AclPermission;
+import org.apache.opencmis.client.api.AllowableActions;
import org.apache.opencmis.client.api.ContentStream;
import org.apache.opencmis.client.api.Document;
import org.apache.opencmis.client.api.Folder;
@@ -31,76 +32,78 @@
import org.apache.opencmis.client.api.Property;
import org.apache.opencmis.client.api.Relationship;
import org.apache.opencmis.client.api.repository.ObjectFactory;
+import org.apache.opencmis.client.runtime.AceImpl;
+import org.apache.opencmis.client.runtime.AclImpl;
+import org.apache.opencmis.client.runtime.AllowableActionsImpl;
import org.apache.opencmis.client.runtime.PersistentFolderImpl;
import org.apache.opencmis.client.runtime.PersistentSessionImpl;
import org.apache.opencmis.commons.enums.VersioningState;
import org.apache.opencmis.commons.exceptions.CmisRuntimeException;
-import org.apache.opencmis.commons.impl.dataobjects.ObjectDataImpl;
public class PersistentObjectFactoryImpl implements ObjectFactory {
- private PersistentSessionImpl session = null;
-
- protected PersistentObjectFactoryImpl(PersistentSessionImpl session) {
- this.session = session;
- }
-
- public static ObjectFactory newInstance(PersistentSessionImpl session) {
- ObjectFactory f = new PersistentObjectFactoryImpl(session);
- return f;
- }
-
- public Ace createAce(String principal, List<AclPermission> permissions) {
- throw new CmisRuntimeException("not implemented");
- }
-
- public Acl createAcl(List<Ace> aces) {
- throw new CmisRuntimeException("not implemented");
- }
-
- public ContentStream createContentStream(int length, String mimetype,
- String filename, InputStream stream) {
- throw new CmisRuntimeException("not implemented");
- }
-
- public Document createDocument(Folder parentfolder, String name) {
- throw new CmisRuntimeException("not implemented");
- }
-
- public Document createDocument(List<Property<?>> properties,
- Folder parentfolder, ContentStream contentstream,
- VersioningState versioningState, List<Policy> policies,
- List<Ace> addACEs, List<Ace> removeACEs) {
- throw new CmisRuntimeException("not implemented");
- }
-
- public Document createDocumentFromSource(Document source,
- List<Property<?>> properties, Folder parentfolder,
- VersioningState versioningState, List<Policy> policies,
- List<Ace> addACEs, List<Ace> removeACEs) {
- throw new CmisRuntimeException("not implemented");
- }
-
- public Folder createFolder(Folder parent, List<Property<?>> properties,
- List<Policy> policies, List<Ace> addACEs, List<Ace> removeACEs) {
-
- PersistentFolderImpl f = new PersistentFolderImpl(this.session);
-
- /* create folder in backend */
- f.create(parent, properties, policies, addACEs, removeACEs);
-
- return f;
- }
-
- public Policy createPolicy(List<Property<?>> properties,
- Folder parentfolder, List<Policy> policies, List<Ace> addACEs,
- List<Ace> removeACEs) {
- throw new CmisRuntimeException("not implemented");
- }
-
- public Relationship createRelationship(List<Property<?>> properties,
- List<Policy> policies, List<Ace> addACEs, List<Ace> removeACEs) {
- throw new CmisRuntimeException("not implemented");
- }
+ private PersistentSessionImpl session = null;
+ protected PersistentObjectFactoryImpl(PersistentSessionImpl session) {
+ this.session = session;
+ }
+
+ public static ObjectFactory newInstance(PersistentSessionImpl session) {
+ ObjectFactory f = new PersistentObjectFactoryImpl(session);
+ return f;
+ }
+
+ public AllowableActions createAllowableAction(Map<String, Boolean> actions) {
+ return new AllowableActionsImpl(actions);
+ }
+
+ public Ace createAce(String principalId, List<String> permissions, boolean isDirect) {
+ return new AceImpl(principalId, permissions, isDirect);
+ }
+
+ public Acl createAcl(List<Ace> aces, Boolean isExact) {
+ return new AclImpl(aces, isExact);
+ }
+
+ public ContentStream createContentStream(int length, String mimetype, String filename,
+ InputStream stream) {
+ throw new CmisRuntimeException("not implemented");
+ }
+
+ public Document createDocument(Folder parentfolder, String name) {
+ throw new CmisRuntimeException("not implemented");
+ }
+
+ public Document createDocument(List<Property<?>> properties, Folder parentfolder,
+ ContentStream contentstream, VersioningState versioningState, List<Policy> policies,
+ List<Ace> addACEs, List<Ace> removeACEs) {
+ throw new CmisRuntimeException("not implemented");
+ }
+
+ public Document createDocumentFromSource(Document source, List<Property<?>> properties,
+ Folder parentfolder, VersioningState versioningState, List<Policy> policies,
+ List<Ace> addACEs, List<Ace> removeACEs) {
+ throw new CmisRuntimeException("not implemented");
+ }
+
+ public Folder createFolder(Folder parent, List<Property<?>> properties, List<Policy> policies,
+ List<Ace> addACEs, List<Ace> removeACEs) {
+
+ PersistentFolderImpl f = new PersistentFolderImpl(this.session);
+
+ /* create folder in backend */
+ f.create(parent, properties, policies, addACEs, removeACEs);
+
+ return f;
+ }
+
+ public Policy createPolicy(List<Property<?>> properties, Folder parentfolder,
+ List<Policy> policies, List<Ace> addACEs, List<Ace> removeACEs) {
+ throw new CmisRuntimeException("not implemented");
+ }
+
+ public Relationship createRelationship(List<Property<?>> properties, List<Policy> policies,
+ List<Ace> addACEs, List<Ace> removeACEs) {
+ throw new CmisRuntimeException("not implemented");
+ }
}
Added: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/repository/PersistentPropertyFactoryImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/repository/PersistentPropertyFactoryImpl.java?rev=917425&view=auto
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/repository/PersistentPropertyFactoryImpl.java (added)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/repository/PersistentPropertyFactoryImpl.java Mon Mar 1 09:06:06 2010
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.opencmis.client.runtime.repository;
+
+import java.util.List;
+
+import org.apache.opencmis.client.api.Property;
+import org.apache.opencmis.client.api.repository.PropertyFactory;
+import org.apache.opencmis.client.runtime.PersistentPropertyImpl;
+import org.apache.opencmis.client.runtime.PersistentSessionImpl;
+import org.apache.opencmis.commons.api.PropertyDefinition;
+
+public class PersistentPropertyFactoryImpl implements PropertyFactory {
+
+ private PersistentSessionImpl session = null;
+
+ protected PersistentPropertyFactoryImpl(PersistentSessionImpl session) {
+ this.session = session;
+ }
+
+ public static PersistentPropertyFactoryImpl newInstance(PersistentSessionImpl session) {
+ return new PersistentPropertyFactoryImpl(session);
+ }
+
+ public <T> Property<T> createProperty(PropertyDefinition<T> type, T value) {
+ Property<T> p = new PersistentPropertyImpl<T>(type, value);
+ return p;
+ }
+
+ public <T> Property<T> createPropertyMultivalue(PropertyDefinition<T> type, List<T> values) {
+ Property<T> p = new PersistentPropertyImpl<T>(type, values);
+ return p;
+ }
+}
Propchange: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/repository/PersistentPropertyFactoryImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/test/java/org/apache/opencmis/client/runtime/AbstractSessionTest.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/test/java/org/apache/opencmis/client/runtime/AbstractSessionTest.java?rev=917425&r1=917424&r2=917425&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/test/java/org/apache/opencmis/client/runtime/AbstractSessionTest.java (original)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/test/java/org/apache/opencmis/client/runtime/AbstractSessionTest.java Mon Mar 1 09:06:06 2010
@@ -20,10 +20,10 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.junit.After;
-import org.junit.Before;
import org.apache.opencmis.client.api.Session;
import org.apache.opencmis.client.api.SessionFactory;
+import org.junit.After;
+import org.junit.Before;
/**
* Create a OpenCMIS test session based on fixture parameter.
Modified: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/test/java/org/apache/opencmis/client/runtime/ReadOnlyNavigationTest.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/test/java/org/apache/opencmis/client/runtime/ReadOnlyNavigationTest.java?rev=917425&r1=917424&r2=917425&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/test/java/org/apache/opencmis/client/runtime/ReadOnlyNavigationTest.java (original)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/test/java/org/apache/opencmis/client/runtime/ReadOnlyNavigationTest.java Mon Mar 1 09:06:06 2010
@@ -19,15 +19,18 @@
package org.apache.opencmis.client.runtime;
import java.util.List;
-import java.util.TreeMap;
import junit.framework.Assert;
import org.apache.opencmis.client.api.CmisObject;
+import org.apache.opencmis.client.api.FileableCmisObject;
import org.apache.opencmis.client.api.Folder;
+import org.apache.opencmis.client.api.util.Container;
import org.apache.opencmis.client.api.util.PagingList;
import org.junit.Test;
+import sun.reflect.generics.tree.Tree;
+
public class ReadOnlyNavigationTest extends AbstractSessionTest {
@Test
@@ -40,7 +43,7 @@
Assert.assertNotNull(pl);
Assert.assertFalse(pl.isEmpty());
- for(List<CmisObject> cl : pl) {
+ for (List<CmisObject> cl : pl) {
for (CmisObject o : cl) {
Assert.assertNotNull(o);
}
@@ -53,12 +56,13 @@
Folder folder = (Folder) this.session.getObjectByPath(path);
Assert.assertNotNull("folder not found: " + path, folder);
- TreeMap<String, CmisObject> tree = folder.getDescendants(-1);
- Assert.assertNotNull(tree);
- Assert.assertFalse(tree.isEmpty());
+ List<Container<FileableCmisObject>> desc = folder.getDescendants(-1);
+ Assert.assertNotNull(desc);
+ Assert.assertFalse(desc.isEmpty());
- for (CmisObject o : tree.values()) {
+ for (Container<FileableCmisObject> o : desc) {
Assert.assertNotNull(o);
+ Assert.assertNotNull(o.getItem());
}
}
@@ -68,12 +72,13 @@
Folder folder = (Folder) this.session.getObjectByPath(path);
Assert.assertNotNull("folder not found: " + path, folder);
- TreeMap<String, CmisObject> tree = folder.getFolderTree(-1);
+ List<Container<FileableCmisObject>> tree = folder.getFolderTree(-1);
Assert.assertNotNull(tree);
Assert.assertFalse(tree.isEmpty());
- for (CmisObject o : tree.values()) {
+ for (Container<FileableCmisObject> o : tree) {
Assert.assertNotNull(o);
+ Assert.assertNotNull(o.getItem());
}
}
Modified: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/test/java/org/apache/opencmis/client/runtime/ReadOnlyObjectTest.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/test/java/org/apache/opencmis/client/runtime/ReadOnlyObjectTest.java?rev=917425&r1=917424&r2=917425&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/test/java/org/apache/opencmis/client/runtime/ReadOnlyObjectTest.java (original)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/test/java/org/apache/opencmis/client/runtime/ReadOnlyObjectTest.java Mon Mar 1 09:06:06 2010
@@ -116,7 +116,7 @@
Document document = (Document) this.session.getObjectByPath(path);
Assert.assertNotNull("document not found: " + path, document);
- List<Property<?>> l = document.getProperties(Fixture.PROPERTY_FILTER);
+ List<Property<?>> l = document.getProperties();
Assert.assertNotNull(l);
Assert.assertEquals(false, l.isEmpty());
Iterator<Property<?>> i = l.iterator();
Modified: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/test/java/org/apache/opencmis/client/runtime/ReadOnlyTypeTest.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/test/java/org/apache/opencmis/client/runtime/ReadOnlyTypeTest.java?rev=917425&r1=917424&r2=917425&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/test/java/org/apache/opencmis/client/runtime/ReadOnlyTypeTest.java (original)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/test/java/org/apache/opencmis/client/runtime/ReadOnlyTypeTest.java Mon Mar 1 09:06:06 2010
@@ -27,6 +27,7 @@
import org.apache.opencmis.client.api.objecttype.ObjectType;
import org.apache.opencmis.client.api.objecttype.PolicyType;
import org.apache.opencmis.client.api.objecttype.RelationshipType;
+import org.apache.opencmis.client.api.util.Container;
import org.apache.opencmis.client.api.util.PagingList;
import org.junit.Test;
@@ -103,16 +104,18 @@
public void readTypeDescandantsDocument() {
ObjectType otd = this.session.getTypeDefinition(ObjectType.DOCUMENT_BASETYPE_ID);
Assert.assertNotNull(otd);
- PagingList<ObjectType> children = this.session.getTypeDescendants(otd, 1, true, -1);
- Assert.assertNotNull(children);
+ List<Container<ObjectType>> desc = this.session.getTypeDescendants(otd, 1, true);
+ Assert.assertNotNull(desc);
+ Assert.assertFalse(desc.isEmpty());
}
@Test
public void readTypeDescandantsFolder() {
ObjectType otd = this.session.getTypeDefinition(ObjectType.FOLDER_BASETYPE_ID);
Assert.assertNotNull(otd);
- PagingList<ObjectType> children = this.session.getTypeDescendants(otd, 1, true, -1);
- Assert.assertNotNull(children);
+ List<Container<ObjectType>> desc = this.session.getTypeDescendants(otd, 1, true);
+ Assert.assertNotNull(desc);
+ Assert.assertFalse(desc.isEmpty());
}
}
Modified: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/test/java/org/apache/opencmis/client/runtime/mock/MockSessionFactory.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/test/java/org/apache/opencmis/client/runtime/mock/MockSessionFactory.java?rev=917425&r1=917424&r2=917425&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/test/java/org/apache/opencmis/client/runtime/mock/MockSessionFactory.java (original)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/test/java/org/apache/opencmis/client/runtime/mock/MockSessionFactory.java Mon Mar 1 09:06:06 2010
@@ -26,6 +26,7 @@
import java.net.URI;
import java.util.ArrayList;
import java.util.Calendar;
+import java.util.Collections;
import java.util.Enumeration;
import java.util.GregorianCalendar;
import java.util.Hashtable;
@@ -33,13 +34,13 @@
import java.util.List;
import java.util.Locale;
import java.util.Map;
-import java.util.TreeMap;
import java.util.UUID;
import org.apache.opencmis.client.api.ChangeEvent;
import org.apache.opencmis.client.api.CmisObject;
import org.apache.opencmis.client.api.ContentStream;
import org.apache.opencmis.client.api.Document;
+import org.apache.opencmis.client.api.FileableCmisObject;
import org.apache.opencmis.client.api.Folder;
import org.apache.opencmis.client.api.Property;
import org.apache.opencmis.client.api.Session;
@@ -53,6 +54,7 @@
import org.apache.opencmis.client.api.repository.ObjectFactory;
import org.apache.opencmis.client.api.repository.RepositoryCapabilities;
import org.apache.opencmis.client.api.repository.RepositoryInfo;
+import org.apache.opencmis.client.api.util.Container;
import org.apache.opencmis.client.api.util.PagingList;
import org.apache.opencmis.client.runtime.Fixture;
import org.apache.opencmis.commons.PropertyIds;
@@ -157,6 +159,7 @@
List<ObjectType> dtl = new ArrayList<ObjectType>();
dtl.add(this.idTypeIndex.get(Fixture.DOCUMENT_TYPE_ID));
PagingList<ObjectType> plot = this.createMockPaging(dtl);
+ Container<ObjectType> ctdoc = this.createMockContainer(this.idTypeIndex.get(Fixture.DOCUMENT_TYPE_ID), null);
expect(
session
.getTypeChildren(this.idTypeIndex
@@ -164,21 +167,22 @@
true, -1)).andReturn(plot).anyTimes();
expect(
session.getTypeDescendants(this.idTypeIndex
- .get(BaseObjectTypeIds.CMIS_DOCUMENT.value()), 1, true,
- -1)).andReturn(plot).anyTimes();
+ .get(BaseObjectTypeIds.CMIS_DOCUMENT.value()), 1, true))
+ .andReturn(Collections.singletonList(ctdoc)).anyTimes();
/* folder child/descendants types */
List<ObjectType> ftl = new ArrayList<ObjectType>();
ftl.add(this.idTypeIndex.get(Fixture.FOLDER_TYPE_ID));
PagingList<ObjectType> plfot = this.createMockPaging(ftl);
+ Container<ObjectType> ctfolder = this.createMockContainer(this.idTypeIndex.get(Fixture.FOLDER_TYPE_ID), null);
expect(
session.getTypeChildren(this.idTypeIndex
.get(BaseObjectTypeIds.CMIS_FOLDER.value()), true, -1))
.andReturn(plfot).anyTimes();
expect(
session.getTypeDescendants(this.idTypeIndex
- .get(BaseObjectTypeIds.CMIS_FOLDER.value()), 1, true,
- -1)).andReturn(plfot).anyTimes();
+ .get(BaseObjectTypeIds.CMIS_FOLDER.value()), 1, true))
+ .andReturn(Collections.singletonList(ctfolder)).anyTimes();
/* change support */
List<ChangeEvent> cel = this.createMockChangeEvents();
@@ -270,15 +274,16 @@
PagingList<CmisObject> pl = this.createMockPaging(children);
expect(f.getChildren(null, -1)).andReturn(pl).anyTimes();
- TreeMap<String, CmisObject> tree = new TreeMap<String, CmisObject>();
+ List<Container<FileableCmisObject>> ct = new ArrayList<Container<FileableCmisObject>>();
Folder f1 = this.createMockTestFolder(f, "/" + Fixture.FOLDER1_NAME,
Fixture.FOLDER1_NAME);
Folder f2 = this.createMockTestFolder(f, "/" + Fixture.FOLDER2_NAME,
Fixture.FOLDER2_NAME);
- tree.put(f1.getId(), f1);
- tree.put(f2.getId(), f2);
- expect(f.getDescendants(-1)).andReturn(tree).anyTimes();
- expect(f.getFolderTree(-1)).andReturn(tree).anyTimes();
+ ct.add(this.createMockContainer((FileableCmisObject) f1, null));
+ ct.add(this.createMockContainer((FileableCmisObject) f2, null));
+
+ expect(f.getDescendants(-1)).andReturn(ct).anyTimes();
+ expect(f.getFolderTree(-1)).andReturn(ct).anyTimes();
this.createMockProperties(f);
replay(f);
@@ -321,8 +326,8 @@
a.add(this.createMockUriProperty(UUID.randomUUID().toString()));
expect(o.getProperties()).andReturn(a).anyTimes();
- expect(o.getProperties(Fixture.PROPERTY_FILTER)).andReturn(a)
- .anyTimes();
+ //expect(o.getProperties(Fixture.PROPERTY_FILTER)).andReturn(a)
+ // .anyTimes();
/* single property */
Property<Object> p1 = (Property<Object>) createMockStringProperty(CmisProperties.OBJECT_ID
@@ -543,9 +548,9 @@
PagingList<CmisObject> pl = this.createMockPaging(children);
expect(f.getChildren(null, -1)).andReturn(pl).anyTimes();
- TreeMap<String, CmisObject> tree = new TreeMap<String, CmisObject>();
- expect(f.getDescendants(-1)).andReturn(tree).anyTimes();
- expect(f.getFolderTree(-1)).andReturn(tree).anyTimes();
+ List<Container<FileableCmisObject>> ctlist = new ArrayList<Container<FileableCmisObject>>();
+ expect(f.getDescendants(-1)).andReturn(ctlist).anyTimes();
+ expect(f.getFolderTree(-1)).andReturn(ctlist).anyTimes();
this.createMockProperties(f);
replay(f);
@@ -571,6 +576,18 @@
return pl;
}
+ @SuppressWarnings("unchecked")
+ private <T> Container<T> createMockContainer(T item, List<T> children) {
+ Container<T> c = createNiceMock(Container.class);
+
+ expect(c.getItem()).andReturn(item).anyTimes();
+ expect(c.getChildren()).andReturn(children).anyTimes();
+
+ replay(c);
+
+ return c;
+ }
+
private void createMockGlobalTypes() {
FolderType bft = createNiceMock(FolderType.class);
expect(bft.getId()).andReturn(ObjectType.FOLDER_BASETYPE_ID).anyTimes();