Revision: 37
Author:
mark....@alfresco.com
Date: Mon Feb 10 15:50:08 2014 UTC
Log: Adding a minimal implementation of cmis:item so getAllTypes does
not throw exceptions.
http://code.google.com/a/apache-extras.org/p/alfresco-opencmis-extension/source/detail?r=37
Added:
/trunk/src/main/java/org/alfresco/cmis/client/impl/AlfrescoItemImpl.java
/trunk/src/main/java/org/alfresco/cmis/client/impl/AlfrescoItemTypeImpl.java
/trunk/src/main/java/org/alfresco/cmis/client/type/AlfrescoItemType.java
Modified:
/trunk/pom.xml
/trunk/src/main/java/org/alfresco/cmis/client/impl/AlfrescoObjectFactoryImpl.java
=======================================
--- /dev/null
+++
/trunk/src/main/java/org/alfresco/cmis/client/impl/AlfrescoItemImpl.java
Mon Feb 10 15:50:08 2014 UTC
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2014-2014 Alfresco Software Limited.
+ *
+ * Licensed 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.alfresco.cmis.client.impl;
+
+import org.apache.chemistry.opencmis.client.api.ObjectType;
+import org.apache.chemistry.opencmis.client.api.OperationContext;
+import org.apache.chemistry.opencmis.client.runtime.ItemImpl;
+import org.apache.chemistry.opencmis.client.runtime.SessionImpl;
+import org.apache.chemistry.opencmis.commons.data.ObjectData;
+
+public class AlfrescoItemImpl extends ItemImpl
+{
+ /**
+ *
+ */
+ private static final long serialVersionUID = -564801526480912392L;
+
+ public AlfrescoItemImpl(SessionImpl session, ObjectType objectType,
+ ObjectData objectData, OperationContext context)
+ {
+ super(session, objectType, objectData, context);
+ }
+}
=======================================
--- /dev/null
+++
/trunk/src/main/java/org/alfresco/cmis/client/impl/AlfrescoItemTypeImpl.java
Mon Feb 10 15:50:08 2014 UTC
@@ -0,0 +1,5 @@
+package org.alfresco.cmis.client.impl;
+
+public class AlfrescoItemTypeImpl {
+
+}
=======================================
--- /dev/null
+++
/trunk/src/main/java/org/alfresco/cmis/client/type/AlfrescoItemType.java
Mon Feb 10 15:50:08 2014 UTC
@@ -0,0 +1,27 @@
+package org.alfresco.cmis.client.type;
+
+import java.util.List;
+
+import org.alfresco.cmis.client.impl.AlfrescoUtils;
+import org.apache.chemistry.opencmis.client.api.Session;
+import
org.apache.chemistry.opencmis.client.runtime.objecttype.ItemTypeImpl;
+import
org.apache.chemistry.opencmis.commons.definitions.ItemTypeDefinition;
+
+public class AlfrescoItemType extends ItemTypeImpl implements AlfrescoType
+{
+ /**
+ *
+ */
+ private static final long serialVersionUID = 8384158771339321883L;
+
+ public AlfrescoItemType(Session session, ItemTypeDefinition
typeDefinition) {
+ super(session, typeDefinition);
+ }
+
+ public List<String> getMandatoryAspects() {
+ return AlfrescoUtils.getMandatoryAspects(this);
+ }
+
+
+
+}
=======================================
--- /trunk/pom.xml Tue Sep 3 09:35:49 2013 UTC
+++ /trunk/pom.xml Mon Feb 10 15:50:08 2014 UTC
@@ -20,7 +20,7 @@
<groupId>org.alfresco.cmis.client</groupId>
<artifactId>alfresco-opencmis-extension</artifactId>
<name>Alfresco OpenCMIS Extension</name>
- <version>0.7</version>
+ <version>0.8</version>
<packaging>jar</packaging>
<organization>
=======================================
---
/trunk/src/main/java/org/alfresco/cmis/client/impl/AlfrescoObjectFactoryImpl.java
Mon Jun 10 10:33:56 2013 UTC
+++
/trunk/src/main/java/org/alfresco/cmis/client/impl/AlfrescoObjectFactoryImpl.java
Mon Feb 10 15:50:08 2014 UTC
@@ -29,6 +29,7 @@
import org.alfresco.cmis.client.type.AlfrescoDocumentType;
import org.alfresco.cmis.client.type.AlfrescoFolderType;
+import org.alfresco.cmis.client.type.AlfrescoItemType;
import org.alfresco.cmis.client.type.AlfrescoPolicyType;
import org.alfresco.cmis.client.type.AlfrescoRelationshipType;
import org.alfresco.cmis.client.type.AlfrescoSecondaryType;
@@ -38,6 +39,7 @@
import org.apache.chemistry.opencmis.client.api.Property;
import org.apache.chemistry.opencmis.client.api.SecondaryType;
import org.apache.chemistry.opencmis.client.api.Session;
+import org.apache.chemistry.opencmis.client.runtime.ItemImpl;
import org.apache.chemistry.opencmis.client.runtime.PolicyImpl;
import org.apache.chemistry.opencmis.client.runtime.RelationshipImpl;
import org.apache.chemistry.opencmis.client.runtime.SessionImpl;
@@ -48,6 +50,7 @@
import org.apache.chemistry.opencmis.commons.data.Properties;
import
org.apache.chemistry.opencmis.commons.definitions.DocumentTypeDefinition;
import
org.apache.chemistry.opencmis.commons.definitions.FolderTypeDefinition;
+import
org.apache.chemistry.opencmis.commons.definitions.ItemTypeDefinition;
import
org.apache.chemistry.opencmis.commons.definitions.PolicyTypeDefinition;
import
org.apache.chemistry.opencmis.commons.definitions.PropertyDefinition;
import
org.apache.chemistry.opencmis.commons.definitions.RelationshipTypeDefinition;
@@ -85,6 +88,8 @@
ret = new AlfrescoPolicyType(this.session, (PolicyTypeDefinition)
typeDefinition);
} else if (typeDefinition instanceof SecondaryTypeDefinition) {
ret = new AlfrescoSecondaryType(this.session,
(SecondaryTypeDefinition) typeDefinition);
+ } else if (typeDefinition instanceof ItemTypeDefinition) {
+ ret = new AlfrescoItemType(this.session, (ItemTypeDefinition)
typeDefinition);
} else {
throw new CmisRuntimeException("Unknown base type!");
}
@@ -350,6 +355,9 @@
return new PolicyImpl((SessionImpl) this.session, type,
objectData, context);
case CMIS_RELATIONSHIP:
return new RelationshipImpl((SessionImpl) this.session, type,
objectData, context);
+ case CMIS_ITEM:
+ return new ItemImpl((SessionImpl) this.session, type,
objectData, context);
+
default:
throw new CmisRuntimeException("unsupported type: " +
objectData.getBaseTypeId());
}