diff --git a/config/alfresco/core-services-context.xml b/config/alfresco/core-services-context.xml
index 3a847ae50e..ff489c1561 100644
--- a/config/alfresco/core-services-context.xml
+++ b/config/alfresco/core-services-context.xml
@@ -614,6 +614,22 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/config/alfresco/model/cmisModel.xml b/config/alfresco/model/cmisModel.xml
deleted file mode 100644
index cdbf4b3452..0000000000
--- a/config/alfresco/model/cmisModel.xml
+++ /dev/null
@@ -1,390 +0,0 @@
-
-
- CMIS Model Definitions
- 1.0
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- org.alfresco.repo.search.impl.lucene.analysis.AlfrescoStandardAnalyser
- java.lang.String
-
-
-
- org.alfresco.repo.search.impl.lucene.analysis.AlfrescoStandardAnalyser
- java.lang.String
-
-
-
- org.alfresco.repo.search.impl.lucene.analysis.AlfrescoStandardAnalyser
- java.lang.String
-
-
-
-
-
-
-
-
-
- notallowed
- allowed
- required
-
-
-
-
-
-
-
-
-
-
-
- Object Id
- The unique object id (a node ref)
- cmis:id
- true
- false
- false
-
- false
-
-
-
- Object Type Id
- Id of the object’s type
- cmis:id
- true
- false
- false
-
- false
-
-
-
- Base Type Id
- Id of the base object type for the object
- cmis:id
- true
- false
- false
-
- true
-
-
-
- Name
- Name
- d:text
- false
- false
- false
-
- both
-
-
-
- Created by
- The authority who created this object
- d:text
- true
- false
- false
-
- false
-
-
-
- Creation Date
- The object creation date
- d:datetime
- true
- false
- false
-
- false
-
-
-
- Last Modified By
- The authority who last modified this object
- d:text
- true
- false
- false
-
- false
-
-
-
- Last Modified Date
- The date this object was last modified
- d:datetime
- true
- false
- false
-
- false
-
-
-
- Change token
- Change Token
- d:text
- true
- false
- false
-
-
-
- Alfresco Node Ref
- Alfresco Node Ref
- cmis:id
- true
- false
- false
-
-
-
-
-
-
- Document
- Document Type
- cmisext:object
-
-
- Is Immutable
- Is the document immutable?
- d:boolean
- true
- false
- false
-
-
-
- Is Latest Version
- Is this the latest version of the document?
- d:boolean
- true
- false
- false
-
-
-
- Is Major Version
- Is this a major version of the document?
- d:boolean
- true
- false
- false
-
-
-
- Is Latest Major Version
- Is this the latest major version of the document?
- d:boolean
- true
- false
- false
-
-
-
- Version Label
- The version label
- d:text
- true
- false
- false
-
-
-
- Version series id
- The version series id
- cmis:id
- true
- false
- false
-
-
-
- Is Version Series Checked Out
- Is the version series checked out?
- d:boolean
- true
- false
- false
-
-
-
- Version Series Checked Out By
- The authority who checked out this document version series
- d:text
- true
- false
- false
-
-
-
- Version Series Checked Out Id
- The checked out version series id
- cmis:id
- true
- false
- false
-
-
-
- Checkin Comment
- The checkin comment
- d:text
- true
- false
- false
-
-
-
- Content Stream Length
- The length of the content stream
- d:long
- true
- false
- false
-
- false
-
-
-
- Content Stream MIME Type
- The content stream MIME type
- d:text
- true
- false
- false
-
- false
-
-
-
- Content Stream Filename
- The content stream filename
- d:text
- true
- false
- false
-
- true
-
-
-
- Content Stream Id
- Id of the stream
- cmis:id
- true
- false
- false
-
-
-
-
-
-
- Folder
- Folder Type
- cmisext:object
-
-
- Parent Id
- The parent id of the folder
- cmis:id
- true
- false
- false
-
- false
-
-
-
- Path
- The fully qualified path to this folder/description
- d:text
- true
- false
- false
-
-
-
- Allowed Child Object Types Ids
- The allowed child object type ids
- cmis:id
- true
- false
- true
-
-
-
-
-
-
- Relationship
- Relationship Type
- cmisext:object
-
-
- Source Id
- The source id for the relationship
- cmis:id
- true
- true
- false
-
-
-
- Target Id
- The target id for the relationship
- cmis:id
- true
- true
- false
-
-
-
-
-
-
- Policy
- Policy Type
- cmisext:object
-
-
- Policy Text
- The policy text
- d:text
- true
- true
- false
-
-
-
-
-
-
- Aspects
- Aspects Type
- cmis:policy
-
-
-
-
\ No newline at end of file
diff --git a/config/alfresco/opencmis-context.xml b/config/alfresco/opencmis-context.xml
index b5b0f56ea3..82c22fa697 100644
--- a/config/alfresco/opencmis-context.xml
+++ b/config/alfresco/opencmis-context.xml
@@ -3,6 +3,32 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -55,20 +81,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/source/java/org/alfresco/cmis/CMISAccessControlFormatEnum.java b/source/java/org/alfresco/cmis/CMISAccessControlFormatEnum.java
deleted file mode 100644
index 4e04cc7ad4..0000000000
--- a/source/java/org/alfresco/cmis/CMISAccessControlFormatEnum.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (C) 2005-2010 Alfresco Software Limited.
- *
- * This file is part of Alfresco
- *
- * Alfresco is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Alfresco is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Alfresco. If not, see .
- */
-package org.alfresco.cmis;
-
-/**
- * @author andyh
- *
- */
-public enum CMISAccessControlFormatEnum implements EnumLabel
-{
- /**
- * Report only CMIS basic permissions
- */
- CMIS_BASIC_PERMISSIONS("onlyBasicPermissions"),
-
- /**
- * May report CMIS basic permission, repository specific permissions or a mixture of both.
- */
- REPOSITORY_SPECIFIC_PERMISSIONS("repositorySpecificPermissions");
-
- private String label;
-
- /**
- * Construct
- *
- * @param label
- */
- CMISAccessControlFormatEnum(String label)
- {
- this.label = label;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.alfresco.cmis.EnumLabel#label()
- */
- public String getLabel()
- {
- return label;
- }
-
- /**
- * Factory for CMISAclPropagationEnum
- */
- public static EnumFactory FACTORY = new EnumFactory(CMISAccessControlFormatEnum.class, CMIS_BASIC_PERMISSIONS, true);
-
-}
diff --git a/source/java/org/alfresco/cmis/CMISAccessControlService.java b/source/java/org/alfresco/cmis/CMISAccessControlService.java
index 0e20cf8ad6..0a7edf48a6 100644
--- a/source/java/org/alfresco/cmis/CMISAccessControlService.java
+++ b/source/java/org/alfresco/cmis/CMISAccessControlService.java
@@ -20,6 +20,7 @@ package org.alfresco.cmis;
import java.util.List;
+import org.alfresco.opencmis.CMISAccessControlFormatEnum;
import org.alfresco.service.cmr.repository.NodeRef;
/**
diff --git a/source/java/org/alfresco/cmis/CMISAclCapabilityEnum.java b/source/java/org/alfresco/cmis/CMISAclCapabilityEnum.java
index d1cf6075e4..ca3ef62dcb 100644
--- a/source/java/org/alfresco/cmis/CMISAclCapabilityEnum.java
+++ b/source/java/org/alfresco/cmis/CMISAclCapabilityEnum.java
@@ -18,6 +18,9 @@
*/
package org.alfresco.cmis;
+import org.alfresco.opencmis.EnumFactory;
+import org.alfresco.opencmis.EnumLabel;
+
/**
* CMIS ACL capability
*
diff --git a/source/java/org/alfresco/cmis/CMISAclPropagationEnum.java b/source/java/org/alfresco/cmis/CMISAclPropagationEnum.java
index 8f165e57e3..00cfa75d40 100644
--- a/source/java/org/alfresco/cmis/CMISAclPropagationEnum.java
+++ b/source/java/org/alfresco/cmis/CMISAclPropagationEnum.java
@@ -18,6 +18,9 @@
*/
package org.alfresco.cmis;
+import org.alfresco.opencmis.EnumFactory;
+import org.alfresco.opencmis.EnumLabel;
+
/**
* CMIS ACL propagation
*
diff --git a/source/java/org/alfresco/cmis/CMISAclSupportedPermissionEnum.java b/source/java/org/alfresco/cmis/CMISAclSupportedPermissionEnum.java
index ced83d7253..d2869b4c01 100644
--- a/source/java/org/alfresco/cmis/CMISAclSupportedPermissionEnum.java
+++ b/source/java/org/alfresco/cmis/CMISAclSupportedPermissionEnum.java
@@ -18,6 +18,8 @@
*/
package org.alfresco.cmis;
+import org.alfresco.opencmis.EnumFactory;
+
/**
* Specifies which types of permissions are supported..
*
diff --git a/source/java/org/alfresco/cmis/CMISAllowedActionEnum.java b/source/java/org/alfresco/cmis/CMISAllowedActionEnum.java
index 80cab202fd..19a86d7a63 100644
--- a/source/java/org/alfresco/cmis/CMISAllowedActionEnum.java
+++ b/source/java/org/alfresco/cmis/CMISAllowedActionEnum.java
@@ -23,6 +23,9 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import org.alfresco.opencmis.EnumFactory;
+import org.alfresco.opencmis.EnumLabel;
+
/**
* CMIS Allowed Action Enum
*
diff --git a/source/java/org/alfresco/cmis/CMISBaseObjectTypeIds.java b/source/java/org/alfresco/cmis/CMISBaseObjectTypeIds.java
index 5bbc44a239..3ac8cf3c04 100644
--- a/source/java/org/alfresco/cmis/CMISBaseObjectTypeIds.java
+++ b/source/java/org/alfresco/cmis/CMISBaseObjectTypeIds.java
@@ -18,6 +18,9 @@
*/
package org.alfresco.cmis;
+import org.alfresco.opencmis.EnumFactory;
+import org.alfresco.opencmis.EnumLabel;
+
/**
* Enumeration of base Alfresco Object type Ids. Possible values:
* DOCUMENT,
diff --git a/source/java/org/alfresco/cmis/CMISCapabilityChanges.java b/source/java/org/alfresco/cmis/CMISCapabilityChanges.java
index 8f8e0ceef2..5ac4253cc4 100644
--- a/source/java/org/alfresco/cmis/CMISCapabilityChanges.java
+++ b/source/java/org/alfresco/cmis/CMISCapabilityChanges.java
@@ -18,6 +18,9 @@
*/
package org.alfresco.cmis;
+import org.alfresco.opencmis.EnumFactory;
+import org.alfresco.opencmis.EnumLabel;
+
/**
* Enumeration of the CMIS Changes Capability
*
diff --git a/source/java/org/alfresco/cmis/CMISCardinalityEnum.java b/source/java/org/alfresco/cmis/CMISCardinalityEnum.java
index fcc0a2648f..a461abd0fb 100644
--- a/source/java/org/alfresco/cmis/CMISCardinalityEnum.java
+++ b/source/java/org/alfresco/cmis/CMISCardinalityEnum.java
@@ -18,6 +18,9 @@
*/
package org.alfresco.cmis;
+import org.alfresco.opencmis.EnumFactory;
+import org.alfresco.opencmis.EnumLabel;
+
/**
* CMIS Property Cardinality Enum
*
diff --git a/source/java/org/alfresco/cmis/CMISChangeType.java b/source/java/org/alfresco/cmis/CMISChangeType.java
index e7a35452bf..928a4c1bd7 100644
--- a/source/java/org/alfresco/cmis/CMISChangeType.java
+++ b/source/java/org/alfresco/cmis/CMISChangeType.java
@@ -18,6 +18,9 @@
*/
package org.alfresco.cmis;
+import org.alfresco.opencmis.EnumFactory;
+import org.alfresco.opencmis.EnumLabel;
+
/**
* Enumeration of the CMIS Change Type. Possible values:
* CREATED
diff --git a/source/java/org/alfresco/cmis/CMISContentStreamAllowedEnum.java b/source/java/org/alfresco/cmis/CMISContentStreamAllowedEnum.java
index 70973e8404..538a300b92 100644
--- a/source/java/org/alfresco/cmis/CMISContentStreamAllowedEnum.java
+++ b/source/java/org/alfresco/cmis/CMISContentStreamAllowedEnum.java
@@ -18,6 +18,9 @@
*/
package org.alfresco.cmis;
+import org.alfresco.opencmis.EnumFactory;
+import org.alfresco.opencmis.EnumLabel;
+
/**
* CMIS Content Stream Allowed Enum
*
diff --git a/source/java/org/alfresco/cmis/CMISDataTypeEnum.java b/source/java/org/alfresco/cmis/CMISDataTypeEnum.java
index be3384f147..765e70a385 100644
--- a/source/java/org/alfresco/cmis/CMISDataTypeEnum.java
+++ b/source/java/org/alfresco/cmis/CMISDataTypeEnum.java
@@ -18,6 +18,8 @@
*/
package org.alfresco.cmis;
+import org.alfresco.opencmis.EnumFactory;
+import org.alfresco.opencmis.EnumLabel;
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
import org.alfresco.service.namespace.QName;
diff --git a/source/java/org/alfresco/cmis/CMISJoinEnum.java b/source/java/org/alfresco/cmis/CMISJoinEnum.java
index b9115fd124..dff61415fe 100644
--- a/source/java/org/alfresco/cmis/CMISJoinEnum.java
+++ b/source/java/org/alfresco/cmis/CMISJoinEnum.java
@@ -18,6 +18,9 @@
*/
package org.alfresco.cmis;
+import org.alfresco.opencmis.EnumFactory;
+import org.alfresco.opencmis.EnumLabel;
+
/**
* CMIS Join Enum
*
diff --git a/source/java/org/alfresco/cmis/CMISPropertyAccessor.java b/source/java/org/alfresco/cmis/CMISPropertyAccessor.java
deleted file mode 100644
index e367bae7f0..0000000000
--- a/source/java/org/alfresco/cmis/CMISPropertyAccessor.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright (C) 2005-2010 Alfresco Software Limited.
- *
- * This file is part of Alfresco
- *
- * Alfresco is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Alfresco is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Alfresco. If not, see .
- */
-package org.alfresco.cmis;
-
-import java.io.Serializable;
-
-import org.alfresco.service.cmr.repository.AssociationRef;
-import org.alfresco.service.cmr.repository.NodeRef;
-import org.alfresco.service.namespace.QName;
-
-/**
- * CMIS Property Accessor (get and set property values)
- *
- * @author davidc
- */
-public interface CMISPropertyAccessor
-{
- /**
- * Get the CMIS Property Name
- *
- * @return
- */
- public String getName();
-
- /**
- * Get the (directly) mapped Alfresco property (if a direct mapping exists)
- *
- * @return
- */
- public QName getMappedProperty();
-
- /**
- * Get the property value for a node
- *
- * @param nodeRef
- * @return
- */
- public Serializable getValue(NodeRef nodeRef);
-
- /**
- * Set the property value for a node
- *
- * @param nodeRef
- * @Param value
- */
- public void setValue(NodeRef nodeRef, Serializable value);
-
- /**
- * Get the property value for an association
- *
- * @param nodeRef
- * @return
- */
- public Serializable getValue(AssociationRef assocRef);
-}
diff --git a/source/java/org/alfresco/cmis/CMISPropertyDefinition.java b/source/java/org/alfresco/cmis/CMISPropertyDefinition.java
index 12cf358702..cbcc324dcc 100644
--- a/source/java/org/alfresco/cmis/CMISPropertyDefinition.java
+++ b/source/java/org/alfresco/cmis/CMISPropertyDefinition.java
@@ -20,6 +20,9 @@ package org.alfresco.cmis;
import java.util.Collection;
+import org.alfresco.opencmis.dictionary.CMISPropertyAccessor;
+import org.alfresco.opencmis.dictionary.CMISPropertyLuceneBuilder;
+
/**
* CMIS Property Definition
@@ -159,5 +162,4 @@ public interface CMISPropertyDefinition
* @return
*/
public CMISPropertyLuceneBuilder getPropertyLuceneBuilder();
-
}
diff --git a/source/java/org/alfresco/cmis/CMISPropertyLuceneBuilder.java b/source/java/org/alfresco/cmis/CMISPropertyLuceneBuilder.java
deleted file mode 100644
index 0ec78921c1..0000000000
--- a/source/java/org/alfresco/cmis/CMISPropertyLuceneBuilder.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * Copyright (C) 2005-2010 Alfresco Software Limited.
- *
- * This file is part of Alfresco
- *
- * Alfresco is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Alfresco is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Alfresco. If not, see .
- */
-package org.alfresco.cmis;
-
-import java.io.Serializable;
-import java.util.Collection;
-
-import org.alfresco.repo.search.impl.lucene.LuceneFunction;
-import org.alfresco.repo.search.impl.lucene.LuceneQueryParser;
-import org.alfresco.repo.search.impl.querymodel.PredicateMode;
-import org.apache.lucene.queryParser.ParseException;
-import org.apache.lucene.search.Query;
-
-/**
- * CMIS Property Lucene Builder
- *
- * @author andyh
- */
-public interface CMISPropertyLuceneBuilder
-{
- /**
- * @param lqp
- * @param value
- * @param mode
- * @param luceneFunction
- * @return the query
- * @throws ParseException
- */
- public Query buildLuceneEquality(LuceneQueryParser lqp, Serializable value, PredicateMode mode, LuceneFunction luceneFunction) throws ParseException;
-
- /**
- * @param lqp
- * @param not
- * @return the query
- * @throws ParseException
- */
- public Query buildLuceneExists(LuceneQueryParser lqp, Boolean not) throws ParseException;
-
- /**
- * @param lqp
- * @param value
- * @param mode
- * @param luceneFunction
- * @return the query
- * @throws ParseException
- */
- public Query buildLuceneGreaterThan(LuceneQueryParser lqp, Serializable value, PredicateMode mode, LuceneFunction luceneFunction) throws ParseException;
-
- /**
- * @param lqp
- * @param value
- * @param mode
- * @param luceneFunction
- * @return the query
- * @throws ParseException
- */
- public Query buildLuceneGreaterThanOrEquals(LuceneQueryParser lqp, Serializable value, PredicateMode mode, LuceneFunction luceneFunction) throws ParseException;
-
- /**
- * @param lqp
- * @param values
- * @param not
- * @param mode
- * @return the query
- * @throws ParseException
- */
- public Query buildLuceneIn(LuceneQueryParser lqp, Collection values, Boolean not, PredicateMode mode) throws ParseException;
-
- /**
- * @param lqp
- * @param value
- * @param mode
- * @param luceneFunction
- * @return the query
- * @throws ParseException
- */
- public Query buildLuceneInequality(LuceneQueryParser lqp, Serializable value, PredicateMode mode, LuceneFunction luceneFunction) throws ParseException;
-
- /**
- * @param lqp
- * @param value
- * @param mode
- * @param luceneFunction
- * @return the query
- * @throws ParseException
- */
- public Query buildLuceneLessThan(LuceneQueryParser lqp, Serializable value, PredicateMode mode, LuceneFunction luceneFunction) throws ParseException;
-
- /**
- * @param lqp
- * @param value
- * @param mode
- * @param luceneFunction
- * @return the query
- * @throws ParseException
- */
- public Query buildLuceneLessThanOrEquals(LuceneQueryParser lqp, Serializable value, PredicateMode mode, LuceneFunction luceneFunction) throws ParseException;
-
- /**
- * @param lqp
- * @param value
- * @param not
- * @return the query
- * @throws ParseException
- */
- public Query buildLuceneLike(LuceneQueryParser lqp, Serializable value, Boolean not) throws ParseException;
-
- /**
- * @param lqp TODO
- * @return the sort field
- */
- public String getLuceneSortField(LuceneQueryParser lqp);
-
- /**
- * @return the field name
- *
- */
- public String getLuceneFieldName();
-}
diff --git a/source/java/org/alfresco/cmis/CMISQueryEnum.java b/source/java/org/alfresco/cmis/CMISQueryEnum.java
index 13206f2c99..4b5f423b26 100644
--- a/source/java/org/alfresco/cmis/CMISQueryEnum.java
+++ b/source/java/org/alfresco/cmis/CMISQueryEnum.java
@@ -18,6 +18,9 @@
*/
package org.alfresco.cmis;
+import org.alfresco.opencmis.EnumFactory;
+import org.alfresco.opencmis.EnumLabel;
+
/**
* CMIS Join Enum
*
diff --git a/source/java/org/alfresco/cmis/CMISRelationshipDirectionEnum.java b/source/java/org/alfresco/cmis/CMISRelationshipDirectionEnum.java
index 39b8f432a3..a6d09d331e 100644
--- a/source/java/org/alfresco/cmis/CMISRelationshipDirectionEnum.java
+++ b/source/java/org/alfresco/cmis/CMISRelationshipDirectionEnum.java
@@ -18,6 +18,9 @@
*/
package org.alfresco.cmis;
+import org.alfresco.opencmis.EnumFactory;
+import org.alfresco.opencmis.EnumLabel;
+
/**
* CMIS Types Filter Enum
*
diff --git a/source/java/org/alfresco/cmis/CMISScope.java b/source/java/org/alfresco/cmis/CMISScope.java
index c996b9aa7d..c743f6870d 100644
--- a/source/java/org/alfresco/cmis/CMISScope.java
+++ b/source/java/org/alfresco/cmis/CMISScope.java
@@ -18,6 +18,9 @@
*/
package org.alfresco.cmis;
+import org.alfresco.opencmis.EnumFactory;
+import org.alfresco.opencmis.EnumLabel;
+
/**
* The scope for a CMIS name
diff --git a/source/java/org/alfresco/cmis/CMISTypesFilterEnum.java b/source/java/org/alfresco/cmis/CMISTypesFilterEnum.java
index 79a4d6d4d4..4305022105 100644
--- a/source/java/org/alfresco/cmis/CMISTypesFilterEnum.java
+++ b/source/java/org/alfresco/cmis/CMISTypesFilterEnum.java
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2005-2010 Alfresco Software Limited.
*
* This file is part of Alfresco
@@ -14,42 +14,45 @@
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
- * along with Alfresco. If not, see .
- */
-package org.alfresco.cmis;
-
-/**
- * CMIS Types Filter Enum
- *
- * @author davidc
- */
-public enum CMISTypesFilterEnum implements EnumLabel
-{
- DOCUMENTS("documents"),
- FOLDERS("folders"),
- POLICIES("policies"),
- ANY("any");
-
-
- private String label;
-
- /**
- * Construct
- *
- * @param label
- */
- CMISTypesFilterEnum(String label)
- {
- this.label = label;
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.cmis.EnumLabel#label()
- */
- public String getLabel()
- {
- return label;
- }
-
- public static EnumFactory FACTORY = new EnumFactory(CMISTypesFilterEnum.class, ANY);
+ * along with Alfresco. If not, see .
+ */
+package org.alfresco.cmis;
+
+import org.alfresco.opencmis.EnumFactory;
+import org.alfresco.opencmis.EnumLabel;
+
+/**
+ * CMIS Types Filter Enum
+ *
+ * @author davidc
+ */
+public enum CMISTypesFilterEnum implements EnumLabel
+{
+ DOCUMENTS("documents"),
+ FOLDERS("folders"),
+ POLICIES("policies"),
+ ANY("any");
+
+
+ private String label;
+
+ /**
+ * Construct
+ *
+ * @param label
+ */
+ CMISTypesFilterEnum(String label)
+ {
+ this.label = label;
+ }
+
+ /* (non-Javadoc)
+ * @see org.alfresco.cmis.EnumLabel#label()
+ */
+ public String getLabel()
+ {
+ return label;
+ }
+
+ public static EnumFactory FACTORY = new EnumFactory(CMISTypesFilterEnum.class, ANY);
}
\ No newline at end of file
diff --git a/source/java/org/alfresco/cmis/CMISUpdatabilityEnum.java b/source/java/org/alfresco/cmis/CMISUpdatabilityEnum.java
index e639c85dd1..eab05808b7 100644
--- a/source/java/org/alfresco/cmis/CMISUpdatabilityEnum.java
+++ b/source/java/org/alfresco/cmis/CMISUpdatabilityEnum.java
@@ -18,6 +18,9 @@
*/
package org.alfresco.cmis;
+import org.alfresco.opencmis.EnumFactory;
+import org.alfresco.opencmis.EnumLabel;
+
/**
* CMIS Updatability Enum
*
diff --git a/source/java/org/alfresco/cmis/CMISVersioningStateEnum.java b/source/java/org/alfresco/cmis/CMISVersioningStateEnum.java
index 5943a6c227..fc9bea5bbc 100644
--- a/source/java/org/alfresco/cmis/CMISVersioningStateEnum.java
+++ b/source/java/org/alfresco/cmis/CMISVersioningStateEnum.java
@@ -18,6 +18,9 @@
*/
package org.alfresco.cmis;
+import org.alfresco.opencmis.EnumFactory;
+import org.alfresco.opencmis.EnumLabel;
+
/**
* CMIS Versioning State Enumeration.
*
diff --git a/source/java/org/alfresco/cmis/EnumFactory.java b/source/java/org/alfresco/cmis/EnumFactory.java
deleted file mode 100644
index f19ef5c015..0000000000
--- a/source/java/org/alfresco/cmis/EnumFactory.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Copyright (C) 2005-2010 Alfresco Software Limited.
- *
- * This file is part of Alfresco
- *
- * Alfresco is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Alfresco is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Alfresco. If not, see .
- */
-package org.alfresco.cmis;
-
-import java.util.EnumSet;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.TreeMap;
-
-
-/**
- * Enum Factory for managing mapping between Enum name and Enum label
- *
- * @author dcaruana
- *
- * @param
- */
-public class EnumFactory>
-{
- private E defaultEnum;
- private Map labelMap = new HashMap(10);
-
- /**
- * @param enumClass
- */
- public EnumFactory(Class enumClass)
- {
- this(enumClass, null, false);
- }
-
- /**
- * @param enumClass
- * @param defaultEnum
- */
- public EnumFactory(Class enumClass, E defaultEnum)
- {
- this(enumClass, defaultEnum, false);
- }
-
- /**
- * @param enumClass
- * @param defaultEnum
- * @param caseSensitive case-sensitive lookup for Enum label
- */
- public EnumFactory(Class enumClass, E defaultEnum, boolean caseSensitive)
- {
- this.defaultEnum = defaultEnum;
-
- // setup label map
- labelMap = caseSensitive ? new HashMap(10) : new TreeMap(String.CASE_INSENSITIVE_ORDER);
- EnumSet enumSet = EnumSet.allOf(enumClass);
- Iterator iter = enumSet.iterator();
- while(iter.hasNext())
- {
- E e = iter.next();
- if (e instanceof EnumLabel)
- {
- labelMap.put(((EnumLabel)e).getLabel(), e);
- }
- }
- }
-
- /**
- * Gets the default enum
- *
- * @return default enum (or null, if no default specified)
- */
- public Enum getDefaultEnum()
- {
- return defaultEnum;
- }
-
- /**
- * Gets the default label
- *
- * @return label of default enum (or null, if no default specified)
- */
- public String getDefaultLabel()
- {
- return label(defaultEnum);
- }
-
- /**
- * Gets the label for the specified enum
- *
- * @param e enum
- * @return label (or null, if no label specified)
- */
- public String label(E e)
- {
- if (e instanceof EnumLabel)
- {
- return ((EnumLabel)e).getLabel();
- }
- return null;
- }
-
- /**
- * Is valid label?
- *
- * @param label
- * @return true => valid, false => does not exist for this enum
- */
- public boolean validLabel(String label)
- {
- return fromLabel(label) == null ? false : true;
- }
-
- /**
- * Gets enum from label
- *
- * @param label
- * @return enum (or null, if no enum has specified label)
- */
- public E fromLabel(String label)
- {
- return labelMap.get(label);
- }
-
- /**
- * Gets enum from label
- *
- * NOTE: If specified label is invalid, the default enum is returned
- *
- * @param label
- * @return enum (or default enum, if label is invalid)
- */
- public E toEnum(String label)
- {
- E e = (label == null) ? null : fromLabel(label);
- if (e == null)
- {
- e = defaultEnum;
- }
- return e;
- }
-}
diff --git a/source/java/org/alfresco/cmis/acl/CMISAccessControlServiceImpl.java b/source/java/org/alfresco/cmis/acl/CMISAccessControlServiceImpl.java
index 946d59cfbf..fff11a36e6 100644
--- a/source/java/org/alfresco/cmis/acl/CMISAccessControlServiceImpl.java
+++ b/source/java/org/alfresco/cmis/acl/CMISAccessControlServiceImpl.java
@@ -29,7 +29,6 @@ import java.util.Map;
import java.util.Set;
import org.alfresco.cmis.CMISAccessControlEntry;
-import org.alfresco.cmis.CMISAccessControlFormatEnum;
import org.alfresco.cmis.CMISAccessControlReport;
import org.alfresco.cmis.CMISAccessControlService;
import org.alfresco.cmis.CMISAclCapabilityEnum;
@@ -42,6 +41,7 @@ import org.alfresco.cmis.CMISPermissionDefinition;
import org.alfresco.cmis.CMISPermissionMapping;
import org.alfresco.cmis.CMISTypeDefinition;
import org.alfresco.cmis.mapping.CMISMapping;
+import org.alfresco.opencmis.CMISAccessControlFormatEnum;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.security.permissions.PermissionReference;
import org.alfresco.repo.security.permissions.impl.AccessPermissionImpl;
diff --git a/source/java/org/alfresco/cmis/acl/CMISAccessControlServiceTest.java b/source/java/org/alfresco/cmis/acl/CMISAccessControlServiceTest.java
index e241b9ae4a..4149971c53 100644
--- a/source/java/org/alfresco/cmis/acl/CMISAccessControlServiceTest.java
+++ b/source/java/org/alfresco/cmis/acl/CMISAccessControlServiceTest.java
@@ -26,7 +26,6 @@ import java.util.Set;
import org.alfresco.cmis.CMISAccessControlEntriesGroupedByPrincipalId;
import org.alfresco.cmis.CMISAccessControlEntry;
-import org.alfresco.cmis.CMISAccessControlFormatEnum;
import org.alfresco.cmis.CMISAccessControlReport;
import org.alfresco.cmis.CMISAccessControlService;
import org.alfresco.cmis.CMISAclCapabilityEnum;
@@ -37,6 +36,7 @@ import org.alfresco.cmis.CMISPermissionMapping;
import org.alfresco.cmis.acl.CMISAccessControlServiceImpl.AccessPermissionComparator;
import org.alfresco.cmis.mapping.BaseCMISTest;
import org.alfresco.model.ContentModel;
+import org.alfresco.opencmis.CMISAccessControlFormatEnum;
import org.alfresco.repo.security.permissions.PermissionReference;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.security.AccessPermission;
diff --git a/source/java/org/alfresco/cmis/acl/CMISAllowedActionKeyTypeEnum.java b/source/java/org/alfresco/cmis/acl/CMISAllowedActionKeyTypeEnum.java
index 03ffa52ed6..9610ffed7b 100644
--- a/source/java/org/alfresco/cmis/acl/CMISAllowedActionKeyTypeEnum.java
+++ b/source/java/org/alfresco/cmis/acl/CMISAllowedActionKeyTypeEnum.java
@@ -18,8 +18,8 @@
*/
package org.alfresco.cmis.acl;
-import org.alfresco.cmis.EnumFactory;
-import org.alfresco.cmis.EnumLabel;
+import org.alfresco.opencmis.EnumFactory;
+import org.alfresco.opencmis.EnumLabel;
/**
* Part two of the allowable action key for the permission mappings
diff --git a/source/java/org/alfresco/cmis/dictionary/CMISAbstractDictionaryService.java b/source/java/org/alfresco/cmis/dictionary/CMISAbstractDictionaryService.java
index 56f4d3fafc..ffa76add95 100644
--- a/source/java/org/alfresco/cmis/dictionary/CMISAbstractDictionaryService.java
+++ b/source/java/org/alfresco/cmis/dictionary/CMISAbstractDictionaryService.java
@@ -195,7 +195,6 @@ public abstract class CMISAbstractDictionaryService extends AbstractLifecycleBea
logger.debug(" Id: " + propDef.getPropertyId().getId());
logger.debug(" Owning Type: " + propDef.getOwningType().getTypeId());
logger.debug(" Property Accessor: " + propDef.getPropertyAccessor() + " , mappedProperty=" + propDef.getPropertyAccessor().getMappedProperty());
- logger.debug(" Property Lucene Builder: " + propDef.getPropertyLuceneBuilder());
}
}
diff --git a/source/java/org/alfresco/cmis/dictionary/CMISBasePropertyDefinition.java b/source/java/org/alfresco/cmis/dictionary/CMISBasePropertyDefinition.java
index 60163cb066..9fd8ba2ae5 100644
--- a/source/java/org/alfresco/cmis/dictionary/CMISBasePropertyDefinition.java
+++ b/source/java/org/alfresco/cmis/dictionary/CMISBasePropertyDefinition.java
@@ -30,10 +30,10 @@ import org.alfresco.cmis.CMISPropertyDefinition;
import org.alfresco.cmis.CMISPropertyId;
import org.alfresco.cmis.CMISTypeDefinition;
import org.alfresco.cmis.CMISUpdatabilityEnum;
-import org.alfresco.cmis.CMISPropertyAccessor;
-import org.alfresco.cmis.CMISPropertyLuceneBuilder;
import org.alfresco.cmis.mapping.AbstractProperty;
import org.alfresco.cmis.mapping.CMISMapping;
+import org.alfresco.opencmis.dictionary.CMISPropertyAccessor;
+import org.alfresco.opencmis.dictionary.CMISPropertyLuceneBuilder;
import org.alfresco.repo.dictionary.IndexTokenisationMode;
import org.alfresco.repo.dictionary.constraint.ListOfValuesConstraint;
import org.alfresco.repo.dictionary.constraint.NumericRangeConstraint;
diff --git a/source/java/org/alfresco/cmis/mapping/AbstractProperty.java b/source/java/org/alfresco/cmis/mapping/AbstractProperty.java
index bb171537f8..b3e963576c 100644
--- a/source/java/org/alfresco/cmis/mapping/AbstractProperty.java
+++ b/source/java/org/alfresco/cmis/mapping/AbstractProperty.java
@@ -21,8 +21,8 @@ package org.alfresco.cmis.mapping;
import java.io.Serializable;
import java.util.Collection;
-import org.alfresco.cmis.CMISPropertyAccessor;
-import org.alfresco.cmis.CMISPropertyLuceneBuilder;
+import org.alfresco.opencmis.dictionary.CMISPropertyAccessor;
+import org.alfresco.opencmis.dictionary.CMISPropertyLuceneBuilder;
import org.alfresco.repo.search.impl.lucene.LuceneFunction;
import org.alfresco.repo.search.impl.lucene.LuceneQueryParser;
import org.alfresco.repo.search.impl.querymodel.PredicateMode;
diff --git a/source/java/org/alfresco/cmis/mapping/CMISMapping.java b/source/java/org/alfresco/cmis/mapping/CMISMapping.java
index 018cbde47f..9f7c76d779 100644
--- a/source/java/org/alfresco/cmis/mapping/CMISMapping.java
+++ b/source/java/org/alfresco/cmis/mapping/CMISMapping.java
@@ -27,7 +27,6 @@ import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;
-import org.alfresco.cmis.CMISAccessControlFormatEnum;
import org.alfresco.cmis.CMISAccessControlService;
import org.alfresco.cmis.CMISActionEvaluator;
import org.alfresco.cmis.CMISAllowedActionEnum;
@@ -39,6 +38,7 @@ import org.alfresco.cmis.CMISServices;
import org.alfresco.cmis.CMISTypeId;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.model.ContentModel;
+import org.alfresco.opencmis.CMISAccessControlFormatEnum;
import org.alfresco.service.ServiceRegistry;
import org.alfresco.service.cmr.dictionary.AspectDefinition;
import org.alfresco.service.cmr.dictionary.AssociationDefinition;
diff --git a/source/java/org/alfresco/cmis/search/CmisFunctionEvaluationContext.java b/source/java/org/alfresco/cmis/search/CmisFunctionEvaluationContext.java
index 57c5faecec..e48bbb4399 100644
--- a/source/java/org/alfresco/cmis/search/CmisFunctionEvaluationContext.java
+++ b/source/java/org/alfresco/cmis/search/CmisFunctionEvaluationContext.java
@@ -453,5 +453,4 @@ public class CmisFunctionEvaluationContext implements FunctionEvaluationContext
return propDef.getCardinality() == CMISCardinalityEnum.MULTI_VALUED;
}
-
}
diff --git a/source/java/org/alfresco/opencmis/CMISActionEvaluator.java b/source/java/org/alfresco/opencmis/CMISActionEvaluator.java
deleted file mode 100644
index 08bc454c5c..0000000000
--- a/source/java/org/alfresco/opencmis/CMISActionEvaluator.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (C) 2005-2010 Alfresco Software Limited.
- *
- * This file is part of Alfresco
- *
- * Alfresco is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Alfresco is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Alfresco. If not, see .
- */
-package org.alfresco.opencmis;
-
-import org.apache.chemistry.opencmis.commons.enums.Action;
-
-public interface CMISActionEvaluator
-{
- /**
- * Gets the CMIS Allowed Action
- *
- * @return
- */
- public Action getAction();
-
- /**
- * Determines if an action is allowed on an object
- *
- * @param object
- * @return
- */
- public boolean isAllowed(T object);
-}
diff --git a/source/java/org/alfresco/opencmis/CMISConnector.java b/source/java/org/alfresco/opencmis/CMISConnector.java
index fdc79dc31b..e0e76ced71 100644
--- a/source/java/org/alfresco/opencmis/CMISConnector.java
+++ b/source/java/org/alfresco/opencmis/CMISConnector.java
@@ -42,6 +42,7 @@ import javax.xml.datatype.DatatypeConfigurationException;
import javax.xml.datatype.DatatypeFactory;
import org.alfresco.model.ContentModel;
+import org.alfresco.opencmis.dictionary.CMISActionEvaluator;
import org.alfresco.opencmis.dictionary.CMISAllowedActionEnum;
import org.alfresco.opencmis.dictionary.CMISDictionaryService;
import org.alfresco.opencmis.dictionary.DocumentTypeDefinitionWrapper;
diff --git a/source/java/org/alfresco/opencmis/CMISUtils.java b/source/java/org/alfresco/opencmis/CMISUtils.java
deleted file mode 100644
index 5624ffb00b..0000000000
--- a/source/java/org/alfresco/opencmis/CMISUtils.java
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- * Copyright (C) 2005-2010 Alfresco Software Limited.
- *
- * This file is part of Alfresco
- *
- * Alfresco is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Alfresco is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Alfresco. If not, see .
- */
-package org.alfresco.opencmis;
-
-import java.io.InputStream;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.io.OutputStream;
-
-import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException;
-
-public class CMISUtils
-{
- @SuppressWarnings("unchecked")
- public static T copy(T source)
- {
- T target = null;
- try
- {
- CopyOutputStream cos = new CopyOutputStream();
- ObjectOutputStream out = new ObjectOutputStream(cos);
- out.writeObject(source);
- out.flush();
- out.close();
-
- ObjectInputStream in = new ObjectInputStream(cos.getInputStream());
- target = (T) in.readObject();
- } catch (Exception e)
- {
- throw new CmisRuntimeException("Object copy failed!", e);
- }
-
- return target;
- }
-
- private static class CopyOutputStream extends OutputStream
- {
- protected byte[] buf = null;
- protected int size = 0;
-
- public CopyOutputStream()
- {
- this(16 * 1024);
- }
-
- public CopyOutputStream(int initSize)
- {
- this.size = 0;
- this.buf = new byte[initSize];
- }
-
- private void verifyBufferSize(int sz)
- {
- if (sz > buf.length)
- {
- byte[] old = buf;
- buf = new byte[Math.max(sz, 2 * buf.length)];
- System.arraycopy(old, 0, buf, 0, old.length);
- old = null;
- }
- }
-
- public final void write(byte b[])
- {
- verifyBufferSize(size + b.length);
- System.arraycopy(b, 0, buf, size, b.length);
- size += b.length;
- }
-
- public final void write(byte b[], int off, int len)
- {
- verifyBufferSize(size + len);
- System.arraycopy(b, off, buf, size, len);
- size += len;
- }
-
- public final void write(int b)
- {
- verifyBufferSize(size + 1);
- buf[size++] = (byte) b;
- }
-
- public InputStream getInputStream()
- {
- return new CopyInputStream(buf, size);
- }
- }
-
- private static class CopyInputStream extends InputStream
- {
- protected byte[] buf = null;
- protected int count = 0;
- protected int pos = 0;
-
- public CopyInputStream(byte[] buf, int count)
- {
- this.buf = buf;
- this.count = count;
- }
-
- public final int available()
- {
- return count - pos;
- }
-
- public final int read()
- {
- return (pos < count) ? (buf[pos++] & 0xff) : -1;
- }
-
- public final int read(byte[] b, int off, int len)
- {
- if (pos >= count)
- {
- return -1;
- }
-
- if ((pos + len) > count)
- {
- len = (count - pos);
- }
-
- System.arraycopy(buf, pos, b, off, len);
- pos += len;
-
- return len;
- }
-
- public final long skip(long n)
- {
- if ((pos + n) > count)
- {
- n = count - pos;
- }
-
- if (n < 0)
- {
- return 0;
- }
-
- pos += n;
-
- return n;
- }
- }
-}
diff --git a/source/java/org/alfresco/opencmis/dictionary/AbstractTypeDefinitionWrapper.java b/source/java/org/alfresco/opencmis/dictionary/AbstractTypeDefinitionWrapper.java
deleted file mode 100644
index 424ba77310..0000000000
--- a/source/java/org/alfresco/opencmis/dictionary/AbstractTypeDefinitionWrapper.java
+++ /dev/null
@@ -1,658 +0,0 @@
-/*
- * Copyright (C) 2005-2010 Alfresco Software Limited.
- *
- * This file is part of Alfresco
- *
- * Alfresco is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Alfresco is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Alfresco. If not, see .
- */
-package org.alfresco.opencmis.dictionary;
-
-import java.io.Serializable;
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.GregorianCalendar;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.alfresco.error.AlfrescoRuntimeException;
-import org.alfresco.opencmis.CMISActionEvaluator;
-import org.alfresco.opencmis.dictionary.CMISAbstractDictionaryService.DictionaryRegistry;
-import org.alfresco.opencmis.mapping.AbstractProperty;
-import org.alfresco.opencmis.mapping.CMISMapping;
-import org.alfresco.opencmis.mapping.DirectProperty;
-import org.alfresco.repo.dictionary.IndexTokenisationMode;
-import org.alfresco.repo.dictionary.constraint.ListOfValuesConstraint;
-import org.alfresco.repo.dictionary.constraint.NumericRangeConstraint;
-import org.alfresco.repo.dictionary.constraint.StringLengthConstraint;
-import org.alfresco.repo.search.impl.lucene.analysis.DateAnalyser;
-import org.alfresco.repo.search.impl.lucene.analysis.DateTimeAnalyser;
-import org.alfresco.repo.search.impl.lucene.analysis.DoubleAnalyser;
-import org.alfresco.repo.search.impl.lucene.analysis.FloatAnalyser;
-import org.alfresco.repo.search.impl.lucene.analysis.IntegerAnalyser;
-import org.alfresco.repo.search.impl.lucene.analysis.LongAnalyser;
-import org.alfresco.repo.search.impl.lucene.analysis.PathAnalyser;
-import org.alfresco.repo.search.impl.lucene.analysis.VerbatimAnalyser;
-import org.alfresco.service.ServiceRegistry;
-import org.alfresco.service.cmr.dictionary.ClassDefinition;
-import org.alfresco.service.cmr.dictionary.Constraint;
-import org.alfresco.service.cmr.dictionary.ConstraintDefinition;
-import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
-import org.alfresco.service.cmr.dictionary.DictionaryService;
-import org.alfresco.service.namespace.QName;
-import org.apache.chemistry.abdera.ext.utils.ISO8601DateFormat;
-import org.apache.chemistry.opencmis.commons.PropertyIds;
-import org.apache.chemistry.opencmis.commons.definitions.Choice;
-import org.apache.chemistry.opencmis.commons.definitions.PropertyDefinition;
-import org.apache.chemistry.opencmis.commons.definitions.TypeDefinition;
-import org.apache.chemistry.opencmis.commons.enums.Action;
-import org.apache.chemistry.opencmis.commons.enums.BaseTypeId;
-import org.apache.chemistry.opencmis.commons.enums.Cardinality;
-import org.apache.chemistry.opencmis.commons.enums.PropertyType;
-import org.apache.chemistry.opencmis.commons.enums.Updatability;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.AbstractPropertyDefinition;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.AbstractTypeDefinition;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.ChoiceImpl;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyBooleanDefinitionImpl;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyDateTimeDefinitionImpl;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyDecimalDefinitionImpl;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyHtmlDefinitionImpl;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyIdDefinitionImpl;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyIntegerDefinitionImpl;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyStringDefinitionImpl;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyUriDefinitionImpl;
-
-/**
- * Base class for type definition wrappers.
- *
- * @author florian.mueller
- */
-public abstract class AbstractTypeDefinitionWrapper implements TypeDefinitionWrapper, Serializable
-{
- private static final long serialVersionUID = 1L;
-
- protected AbstractTypeDefinition typeDef;
- protected AbstractTypeDefinition typeDefInclProperties;
-
- protected TypeDefinitionWrapper parent;
- protected List children;
-
- protected QName alfrescoName = null;
- protected QName alfrescoClass = null;
- protected Map> actionEvaluators;
-
- protected Map propertiesById = new HashMap();
- protected Map propertiesByQueryName = new HashMap();
- protected Map propertiesByQName = new HashMap();
-
- // interface
-
- public TypeDefinition getTypeDefinition(boolean includePropertyDefinitions)
- {
- if (includePropertyDefinitions)
- {
- return typeDefInclProperties;
- } else
- {
- return typeDef;
- }
- }
-
- protected void setTypeDefinition(AbstractTypeDefinition typeDef, AbstractTypeDefinition typeDefInclProperties)
- {
- this.typeDef = typeDef;
- this.typeDefInclProperties = typeDefInclProperties;
- }
-
- @Override
- public String getTypeId()
- {
- return typeDef.getId();
- }
-
- @Override
- public BaseTypeId getBaseTypeId()
- {
- return typeDef.getBaseTypeId();
- }
-
- @Override
- public boolean isBaseType()
- {
- return typeDef.getId().equals(typeDef.getBaseTypeId().value());
- }
-
- @Override
- public QName getAlfrescoName()
- {
- return alfrescoName;
- }
-
- @Override
- public QName getAlfrescoClass()
- {
- return alfrescoClass;
- }
-
- @Override
- public TypeDefinitionWrapper getParent()
- {
- return parent;
- }
-
- @Override
- public List getChildren()
- {
- return children;
- }
-
- @Override
- public Map> getActionEvaluators()
- {
- return actionEvaluators;
- }
-
- @Override
- public Collection getProperties()
- {
- return propertiesById.values();
- }
-
- @Override
- public PropertyDefintionWrapper getPropertyById(String propertyId)
- {
- return propertiesById.get(propertyId);
- }
-
- @Override
- public PropertyDefintionWrapper getPropertyByQueryName(String queryName)
- {
- return propertiesByQueryName.get(queryName);
- }
-
- @Override
- public PropertyDefintionWrapper getPropertyByQName(QName name)
- {
- return propertiesByQName.get(name);
- }
-
- // create
-
- public abstract void connectParentAndSubTypes(CMISMapping cmisMapping, DictionaryRegistry registry,
- DictionaryService dictionaryService);
-
- public abstract void resolveInheritance(CMISMapping cmisMapping, ServiceRegistry serviceRegistry,
- DictionaryRegistry registry, DictionaryService dictionaryService);
-
- public void assertComplete()
- {
- if (typeDef == null)
- throw new IllegalStateException("typeDef is not set");
- if (typeDefInclProperties == null)
- throw new IllegalStateException("typeDefInclProperties is not set");
- if (alfrescoName == null)
- throw new IllegalStateException("alfrescoName is not set");
- if (alfrescoClass == null)
- throw new IllegalStateException("alfrescoClass is not set");
- if (propertiesById == null)
- throw new IllegalStateException("propertiesById is not set");
- if (propertiesByQueryName == null)
- throw new IllegalStateException("propertiesByQueryName is not set");
- if (propertiesByQName == null)
- throw new IllegalStateException("propertiesByQName is not set");
- if (propertiesById.size() == 0)
- throw new IllegalStateException("property map empty");
- if (propertiesById.size() != propertiesByQueryName.size())
- throw new IllegalStateException("property map mismatch");
- if (propertiesById.size() != propertiesByQName.size())
- throw new IllegalStateException("property map mismatch");
- }
-
- /**
- * Adds all property definitions owned by that type.
- */
- protected void createOwningPropertyDefinitions(CMISMapping cmisMapping, ServiceRegistry serviceRegistry,
- ClassDefinition cmisClassDef)
- {
- PropertyDefinition> propertyDefintion;
-
- for (org.alfresco.service.cmr.dictionary.PropertyDefinition alfrescoPropDef : cmisClassDef.getProperties()
- .values())
- {
- if (!isBaseType())
- {
- if (!alfrescoPropDef.getContainerClass().equals(cmisClassDef))
- {
- continue;
- }
- }
-
- // compile property id
- String propertyId = cmisMapping.buildPrefixEncodedString(alfrescoPropDef.getName());
-
- // create property definition
- propertyDefintion = createPropertyDefinition(cmisMapping, propertyId, alfrescoPropDef.getName(),
- alfrescoPropDef, false);
-
- // if the datatype is not supported, the property defintion will be
- // null
- if (propertyDefintion != null)
- {
- AbstractProperty propertyAccessor = cmisMapping.getPropertyAccessor(propertyId);
- if (propertyAccessor == null)
- {
- propertyAccessor = new DirectProperty(serviceRegistry, propertyId, alfrescoPropDef.getName());
- }
-
- registerProperty(new BasePropertyDefintionWrapper(propertyDefintion, alfrescoPropDef.getName(), this,
- propertyAccessor, propertyAccessor));
- }
- }
- }
-
- /**
- * Registers a property definition with this type
- */
- protected void registerProperty(PropertyDefintionWrapper propDefWrapper)
- {
- if (propDefWrapper == null)
- {
- return;
- }
-
- if (propertiesById.containsKey(propDefWrapper.getPropertyId()))
- {
- throw new AlfrescoRuntimeException("Property defintion " + propDefWrapper.getPropertyId()
- + " already exists on type " + typeDef.getId());
- }
-
- propertiesById.put(propDefWrapper.getPropertyId(), propDefWrapper);
- propertiesByQueryName.put(propDefWrapper.getPropertyDefinition().getQueryName(), propDefWrapper);
- propertiesByQName.put(propDefWrapper.getAlfrescoName(), propDefWrapper);
- typeDefInclProperties.addPropertyDefinition(propDefWrapper.getPropertyDefinition());
- }
-
- /**
- * Creates a property definition object.
- */
- protected PropertyDefinition> createPropertyDefinition(CMISMapping cmisMapping, String id,
- QName alfrescoPropName, org.alfresco.service.cmr.dictionary.PropertyDefinition propDef, boolean inherited)
- {
- PropertyType datatype = cmisMapping.getDataType(propDef.getDataType());
- if (datatype == null)
- {
- return null;
- }
-
- AbstractPropertyDefinition> result = null;
-
- switch (datatype)
- {
- case BOOLEAN:
- result = new PropertyBooleanDefinitionImpl();
- break;
- case DATETIME:
- result = new PropertyDateTimeDefinitionImpl();
- break;
- case DECIMAL:
- result = new PropertyDecimalDefinitionImpl();
- break;
- case HTML:
- result = new PropertyHtmlDefinitionImpl();
- break;
- case ID:
- result = new PropertyIdDefinitionImpl();
- break;
- case INTEGER:
- result = new PropertyIntegerDefinitionImpl();
- break;
- case STRING:
- result = new PropertyStringDefinitionImpl();
- break;
- case URI:
- result = new PropertyUriDefinitionImpl();
- break;
- default:
- throw new RuntimeException("Unknown datatype! Spec change?");
- }
-
- if (id.equals(PropertyIds.OBJECT_TYPE_ID) || id.equals(PropertyIds.SOURCE_ID)
- || id.equals(PropertyIds.TARGET_ID))
- {
- // the CMIS spec requirement
- result.setUpdatability(Updatability.ONCREATE);
- } else
- {
- result.setUpdatability(propDef.isProtected() ? Updatability.READONLY : Updatability.READWRITE);
- }
-
- result.setId(id);
- result.setLocalName(alfrescoPropName.getLocalName());
- result.setLocalNamespace(alfrescoPropName.getNamespaceURI());
- result.setDisplayName(propDef.getTitle() != null ? propDef.getTitle() : id);
- result.setDescription(propDef.getDescription() != null ? propDef.getDescription() : result.getDisplayName());
- result.setPropertyType(datatype);
- result.setCardinality(propDef.isMultiValued() ? Cardinality.MULTI : Cardinality.SINGLE);
- result.setIsInherited(inherited);
- result.setIsRequired(propDef.isMandatory());
- addDefaultValue(propDef.getDefaultValue(), result);
-
- // query and order
- result.setQueryName(cmisMapping.buildPrefixEncodedString(alfrescoPropName));
- result.setIsQueryable(propDef.isIndexed());
- result.setIsOrderable(false);
-
- if (result.isQueryable())
- {
- if (result.getCardinality() == Cardinality.SINGLE)
- {
- IndexTokenisationMode indexTokenisationMode = IndexTokenisationMode.TRUE;
- if (propDef.getIndexTokenisationMode() != null)
- {
- indexTokenisationMode = propDef.getIndexTokenisationMode();
- }
-
- switch (indexTokenisationMode)
- {
- case BOTH:
- case FALSE:
- result.setIsOrderable(true);
- break;
- case TRUE:
- default:
- String analyserClassName = propDef.getDataType().getAnalyserClassName();
- if (propDef.getDataType().getName().equals(DataTypeDefinition.BOOLEAN))
- {
- result.setIsOrderable(true);
- } else if (analyserClassName.equals(DateTimeAnalyser.class.getCanonicalName())
- || analyserClassName.equals(DateAnalyser.class.getCanonicalName())
- || analyserClassName.equals(DoubleAnalyser.class.getCanonicalName())
- || analyserClassName.equals(FloatAnalyser.class.getCanonicalName())
- || analyserClassName.equals(IntegerAnalyser.class.getCanonicalName())
- || analyserClassName.equals(LongAnalyser.class.getCanonicalName())
- || analyserClassName.equals(PathAnalyser.class.getCanonicalName())
- || analyserClassName.equals(VerbatimAnalyser.class.getCanonicalName()))
- {
- result.setIsOrderable(true);
- }
- }
- }
- }
-
- // constraints and choices
- for (ConstraintDefinition constraintDef : propDef.getConstraints())
- {
- Constraint constraint = constraintDef.getConstraint();
- if (constraint instanceof ListOfValuesConstraint)
- {
- addChoiceList((ListOfValuesConstraint) constraint, result);
- }
-
- if ((constraint instanceof StringLengthConstraint) && (result instanceof PropertyStringDefinitionImpl))
- {
- StringLengthConstraint slc = (StringLengthConstraint) constraint;
- ((PropertyStringDefinitionImpl) result).setMaxLength(BigInteger.valueOf(slc.getMaxLength()));
- }
-
- if (constraint instanceof NumericRangeConstraint)
- {
- NumericRangeConstraint nrc = (NumericRangeConstraint) constraint;
- if (result instanceof PropertyIntegerDefinitionImpl)
- {
- ((PropertyIntegerDefinitionImpl) result)
- .setMinValue(BigInteger.valueOf(((Double) nrc.getMinValue()).longValue()));
- ((PropertyIntegerDefinitionImpl) result)
- .setMaxValue(BigInteger.valueOf(((Double) nrc.getMaxValue()).longValue()));
- }
- if (result instanceof PropertyDecimalDefinitionImpl)
- {
- ((PropertyDecimalDefinitionImpl) result).setMinValue(BigDecimal.valueOf(nrc.getMinValue()));
- ((PropertyDecimalDefinitionImpl) result).setMaxValue(BigDecimal.valueOf(nrc.getMaxValue()));
- }
- }
- }
-
- return result;
- }
-
- @SuppressWarnings("unchecked")
- private T convertValueFromString(String value, PropertyType datatype)
- {
- if (value == null)
- {
- return null;
- }
-
- switch (datatype)
- {
- case BOOLEAN:
- return (T) Boolean.valueOf(value);
- case DATETIME:
- GregorianCalendar cal = new GregorianCalendar();
- cal.setTime(ISO8601DateFormat.parse(value));
- return (T) cal;
- case DECIMAL:
- return (T) new BigDecimal(value);
- case HTML:
- return (T) value;
- case ID:
- return (T) value;
- case INTEGER:
- return (T) new BigInteger(value);
- case STRING:
- return (T) value;
- case URI:
- return (T) value;
- default:
- throw new RuntimeException("Unknown datatype! Spec change?");
- }
- }
-
- /**
- * Adds the default value to a property definition.
- */
- private void addDefaultValue(String value, PropertyDefinition> propDef)
- {
- if (value == null)
- {
- return;
- }
-
- if (propDef instanceof PropertyBooleanDefinitionImpl)
- {
- PropertyBooleanDefinitionImpl propDefImpl = (PropertyBooleanDefinitionImpl) propDef;
- propDefImpl.setDefaultValue(Collections.singletonList((Boolean) convertValueFromString(value,
- PropertyType.BOOLEAN)));
- } else if (propDef instanceof PropertyDateTimeDefinitionImpl)
- {
- PropertyDateTimeDefinitionImpl propDefImpl = (PropertyDateTimeDefinitionImpl) propDef;
- propDefImpl.setDefaultValue(Collections.singletonList((GregorianCalendar) convertValueFromString(value,
- PropertyType.DATETIME)));
- } else if (propDef instanceof PropertyDecimalDefinitionImpl)
- {
- PropertyDecimalDefinitionImpl propDefImpl = (PropertyDecimalDefinitionImpl) propDef;
- propDefImpl.setDefaultValue(Collections.singletonList((BigDecimal) convertValueFromString(value,
- PropertyType.DECIMAL)));
- } else if (propDef instanceof PropertyHtmlDefinitionImpl)
- {
- PropertyHtmlDefinitionImpl propDefImpl = (PropertyHtmlDefinitionImpl) propDef;
- propDefImpl.setDefaultValue(Collections.singletonList((String) convertValueFromString(value,
- PropertyType.HTML)));
- } else if (propDef instanceof PropertyIdDefinitionImpl)
- {
- PropertyIdDefinitionImpl propDefImpl = (PropertyIdDefinitionImpl) propDef;
- propDefImpl.setDefaultValue(Collections.singletonList((String) convertValueFromString(value,
- PropertyType.ID)));
- } else if (propDef instanceof PropertyIntegerDefinitionImpl)
- {
- PropertyIntegerDefinitionImpl propDefImpl = (PropertyIntegerDefinitionImpl) propDef;
- propDefImpl.setDefaultValue(Collections.singletonList((BigInteger) convertValueFromString(value,
- PropertyType.INTEGER)));
- } else if (propDef instanceof PropertyStringDefinitionImpl)
- {
- PropertyStringDefinitionImpl propDefImpl = (PropertyStringDefinitionImpl) propDef;
- propDefImpl.setDefaultValue(Collections.singletonList((String) convertValueFromString(value,
- PropertyType.STRING)));
- } else if (propDef instanceof PropertyUriDefinitionImpl)
- {
- PropertyUriDefinitionImpl propDefImpl = (PropertyUriDefinitionImpl) propDef;
- propDefImpl.setDefaultValue(Collections.singletonList((String) convertValueFromString(value,
- PropertyType.URI)));
- }
- }
-
- /**
- * Adds choices to the property defintion.
- */
- private void addChoiceList(ListOfValuesConstraint lovc, PropertyDefinition> propDef)
- {
- if (propDef instanceof PropertyBooleanDefinitionImpl)
- {
- PropertyBooleanDefinitionImpl propDefImpl = (PropertyBooleanDefinitionImpl) propDef;
- propDefImpl.setIsOpenChoice(false);
-
- List> choiceList = new ArrayList>();
- for (String allowed : lovc.getAllowedValues())
- {
- ChoiceImpl choice = new ChoiceImpl();
- choice.setDisplayName(allowed);
- choice.setValue(Collections.singletonList((Boolean) convertValueFromString(allowed,
- PropertyType.BOOLEAN)));
-
- choiceList.add(choice);
- }
-
- propDefImpl.setChoices(choiceList);
- } else if (propDef instanceof PropertyDateTimeDefinitionImpl)
- {
- PropertyDateTimeDefinitionImpl propDefImpl = (PropertyDateTimeDefinitionImpl) propDef;
- propDefImpl.setIsOpenChoice(false);
-
- List> choiceList = new ArrayList>();
- for (String allowed : lovc.getAllowedValues())
- {
- ChoiceImpl choice = new ChoiceImpl();
- choice.setDisplayName(allowed);
- choice.setValue(Collections.singletonList((GregorianCalendar) convertValueFromString(allowed,
- PropertyType.DATETIME)));
-
- choiceList.add(choice);
- }
-
- propDefImpl.setChoices(choiceList);
- } else if (propDef instanceof PropertyDecimalDefinitionImpl)
- {
- PropertyDecimalDefinitionImpl propDefImpl = (PropertyDecimalDefinitionImpl) propDef;
- propDefImpl.setIsOpenChoice(false);
-
- List> choiceList = new ArrayList>();
- for (String allowed : lovc.getAllowedValues())
- {
- ChoiceImpl choice = new ChoiceImpl();
- choice.setDisplayName(allowed);
- choice.setValue(Collections.singletonList((BigDecimal) convertValueFromString(allowed,
- PropertyType.DECIMAL)));
-
- choiceList.add(choice);
- }
-
- propDefImpl.setChoices(choiceList);
- } else if (propDef instanceof PropertyHtmlDefinitionImpl)
- {
- PropertyHtmlDefinitionImpl propDefImpl = (PropertyHtmlDefinitionImpl) propDef;
- propDefImpl.setIsOpenChoice(false);
-
- List> choiceList = new ArrayList>();
- for (String allowed : lovc.getAllowedValues())
- {
- ChoiceImpl choice = new ChoiceImpl();
- choice.setDisplayName(allowed);
- choice.setValue(Collections.singletonList((String) convertValueFromString(allowed, PropertyType.HTML)));
-
- choiceList.add(choice);
- }
-
- propDefImpl.setChoices(choiceList);
- } else if (propDef instanceof PropertyIdDefinitionImpl)
- {
- PropertyIdDefinitionImpl propDefImpl = (PropertyIdDefinitionImpl) propDef;
- propDefImpl.setIsOpenChoice(false);
-
- List> choiceList = new ArrayList>();
- for (String allowed : lovc.getAllowedValues())
- {
- ChoiceImpl choice = new ChoiceImpl();
- choice.setDisplayName(allowed);
- choice.setValue(Collections.singletonList((String) convertValueFromString(allowed, PropertyType.ID)));
-
- choiceList.add(choice);
- }
-
- propDefImpl.setChoices(choiceList);
- } else if (propDef instanceof PropertyIntegerDefinitionImpl)
- {
- PropertyIntegerDefinitionImpl propDefImpl = (PropertyIntegerDefinitionImpl) propDef;
- propDefImpl.setIsOpenChoice(false);
-
- List> choiceList = new ArrayList>();
- for (String allowed : lovc.getAllowedValues())
- {
- ChoiceImpl choice = new ChoiceImpl();
- choice.setDisplayName(allowed);
- choice.setValue(Collections.singletonList((BigInteger) convertValueFromString(allowed,
- PropertyType.INTEGER)));
-
- choiceList.add(choice);
- }
-
- propDefImpl.setChoices(choiceList);
- } else if (propDef instanceof PropertyStringDefinitionImpl)
- {
- PropertyStringDefinitionImpl propDefImpl = (PropertyStringDefinitionImpl) propDef;
- propDefImpl.setIsOpenChoice(false);
-
- List> choiceList = new ArrayList>();
- for (String allowed : lovc.getAllowedValues())
- {
- ChoiceImpl choice = new ChoiceImpl();
- choice.setDisplayName(allowed);
- choice.setValue(Collections
- .singletonList((String) convertValueFromString(allowed, PropertyType.STRING)));
-
- choiceList.add(choice);
- }
-
- propDefImpl.setChoices(choiceList);
- } else if (propDef instanceof PropertyUriDefinitionImpl)
- {
- PropertyUriDefinitionImpl propDefImpl = (PropertyUriDefinitionImpl) propDef;
- propDefImpl.setIsOpenChoice(false);
-
- List> choiceList = new ArrayList>();
- for (String allowed : lovc.getAllowedValues())
- {
- ChoiceImpl choice = new ChoiceImpl();
- choice.setDisplayName(allowed);
- choice.setValue(Collections.singletonList((String) convertValueFromString(allowed, PropertyType.URI)));
-
- choiceList.add(choice);
- }
-
- propDefImpl.setChoices(choiceList);
- }
- }
-}
diff --git a/source/java/org/alfresco/opencmis/dictionary/BasePropertyDefintionWrapper.java b/source/java/org/alfresco/opencmis/dictionary/BasePropertyDefintionWrapper.java
deleted file mode 100644
index f47506f9ab..0000000000
--- a/source/java/org/alfresco/opencmis/dictionary/BasePropertyDefintionWrapper.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright (C) 2005-2010 Alfresco Software Limited.
- *
- * This file is part of Alfresco
- *
- * Alfresco is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Alfresco is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Alfresco. If not, see .
- */
-package org.alfresco.opencmis.dictionary;
-
-import java.io.Serializable;
-
-import org.alfresco.cmis.CMISPropertyAccessor;
-import org.alfresco.cmis.CMISPropertyLuceneBuilder;
-import org.alfresco.service.namespace.QName;
-import org.apache.chemistry.opencmis.commons.definitions.PropertyDefinition;
-
-public class BasePropertyDefintionWrapper implements PropertyDefintionWrapper, Serializable
-{
- private static final long serialVersionUID = 1L;
-
- private PropertyDefinition> propDef;
- private QName alfrescoName;
- private TypeDefinitionWrapper owningType;
- private CMISPropertyAccessor accessor;
- private CMISPropertyLuceneBuilder luceneBuilder;
-
- public BasePropertyDefintionWrapper(PropertyDefinition> propDef, QName alfrescoName,
- TypeDefinitionWrapper owningType, CMISPropertyAccessor accessor, CMISPropertyLuceneBuilder luceneBuilder)
- {
- this.propDef = propDef;
- this.alfrescoName = alfrescoName;
- this.owningType = owningType;
- this.accessor = accessor;
- this.luceneBuilder = luceneBuilder;
- }
-
- @Override
- public PropertyDefinition> getPropertyDefinition()
- {
- return propDef;
- }
-
- @Override
- public String getPropertyId()
- {
- return propDef.getId();
- }
-
- @Override
- public QName getAlfrescoName()
- {
- return alfrescoName;
- }
-
- @Override
- public TypeDefinitionWrapper getOwningType()
- {
- return owningType;
- }
-
- @Override
- public CMISPropertyAccessor getPropertyAccessor()
- {
- return accessor;
- }
-
- @Override
- public CMISPropertyLuceneBuilder getPropertyLuceneBuilder()
- {
- return luceneBuilder;
- }
-
-}
diff --git a/source/java/org/alfresco/opencmis/dictionary/CMISAbstractDictionaryService.java b/source/java/org/alfresco/opencmis/dictionary/CMISAbstractDictionaryService.java
deleted file mode 100644
index dcea262168..0000000000
--- a/source/java/org/alfresco/opencmis/dictionary/CMISAbstractDictionaryService.java
+++ /dev/null
@@ -1,428 +0,0 @@
-/*
- * Copyright (C) 2005-2010 Alfresco Software Limited.
- *
- * This file is part of Alfresco
- *
- * Alfresco is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Alfresco is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Alfresco. If not, see .
- */
-package org.alfresco.opencmis.dictionary;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-import org.alfresco.error.AlfrescoRuntimeException;
-import org.alfresco.opencmis.mapping.CMISMapping;
-import org.alfresco.repo.dictionary.DictionaryDAO;
-import org.alfresco.repo.dictionary.DictionaryListener;
-import org.alfresco.repo.tenant.TenantService;
-import org.alfresco.service.ServiceRegistry;
-import org.alfresco.service.cmr.dictionary.DictionaryService;
-import org.alfresco.service.namespace.QName;
-import org.apache.chemistry.opencmis.commons.enums.BaseTypeId;
-import org.apache.chemistry.opencmis.commons.enums.PropertyType;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.springframework.context.ApplicationEvent;
-import org.springframework.extensions.surf.util.AbstractLifecycleBean;
-
-/**
- * Common CMIS Dictionary Support including registry of Types.
- *
- * @author davidc
- * @author florian.mueller
- */
-public abstract class CMISAbstractDictionaryService extends AbstractLifecycleBean implements CMISDictionaryService,
- DictionaryListener
-{
- // Logger
- protected static final Log logger = LogFactory.getLog(CMISAbstractDictionaryService.class);
-
- // service dependencies
- private DictionaryDAO dictionaryDAO;
- protected CMISMapping cmisMapping;
- protected DictionaryService dictionaryService;
- protected TenantService tenantService;
- protected ServiceRegistry serviceRegistry;
-
- /**
- * Set the mapping service
- *
- * @param cmisMapping
- */
- public void setOpenCMISMapping(CMISMapping cmisMapping)
- {
- this.cmisMapping = cmisMapping;
- }
-
- /**
- * Set the dictionary Service
- *
- * @param dictionaryService
- */
- public void setDictionaryService(DictionaryService dictionaryService)
- {
- this.dictionaryService = dictionaryService;
- }
-
- /**
- * Set the dictionary DAO
- *
- * @param dictionaryDAO
- */
- public void setDictionaryDAO(DictionaryDAO dictionaryDAO)
- {
- this.dictionaryDAO = dictionaryDAO;
- }
-
- /**
- * Set the tenant Service
- *
- * @param tenantService
- */
- public void setTenantService(TenantService tenantService)
- {
- this.tenantService = tenantService;
- }
-
- /**
- * Set the service registry
- *
- * @param serviceRegistry
- */
- public void setServiceRegistry(ServiceRegistry serviceRegistry)
- {
- this.serviceRegistry = serviceRegistry;
- }
-
- /** CMIS Dictionary Registry (tenant-aware) */
- private Map registryMap = new ConcurrentHashMap(4);
-
- /**
- * CMIS Dictionary registry
- *
- * Index of CMIS Type Definitions
- */
- /* package */class DictionaryRegistry
- {
- // Type Definitions Index
- Map typeDefsByQName = new HashMap();
- Map assocDefsByQName = new HashMap();
-
- Map typeDefsByTypeId = new HashMap();
- Map typeDefsByQueryName = new HashMap();
- List baseTypes = new ArrayList();
-
- Map propDefbyPropId = new HashMap();
- Map propDefbyQueryName = new HashMap();
-
- /**
- * Register type definition.
- *
- * @param typeDef
- */
- public void registerTypeDefinition(AbstractTypeDefinitionWrapper typeDef)
- {
- AbstractTypeDefinitionWrapper existingTypeDef = typeDefsByTypeId.get(typeDef.getTypeId());
- if (existingTypeDef != null)
- {
- throw new AlfrescoRuntimeException("Type " + typeDef.getTypeId() + " already registered");
- }
-
- typeDefsByTypeId.put(typeDef.getTypeId(), typeDef);
- QName typeQName = typeDef.getAlfrescoName();
- if (typeQName != null)
- {
- if ((typeDef instanceof RelationshipTypeDefintionWrapper) && !typeDef.isBaseType())
- {
- assocDefsByQName.put(typeQName, typeDef);
- } else
- {
- typeDefsByQName.put(typeQName, typeDef);
- }
- }
-
- typeDefsByQueryName.put(typeDef.getTypeDefinition(false).getQueryName(), typeDef);
-
- if (logger.isDebugEnabled())
- {
- logger.debug("Registered type " + typeDef.getTypeId() + " (scope=" + typeDef.getBaseTypeId() + ")");
- logger.debug(" QName: " + typeDef.getAlfrescoName());
- logger.debug(" Table: " + typeDef.getTypeDefinition(false).getQueryName());
- logger.debug(" Action Evaluators: " + typeDef.getActionEvaluators().size());
- }
- }
-
- /**
- * Register property definitions.
- *
- * @param typeDef
- */
- public void registerPropertyDefinitions(AbstractTypeDefinitionWrapper typeDef)
- {
- for (PropertyDefintionWrapper propDef : typeDef.getProperties())
- {
- if (propDef.getPropertyDefinition().isInherited())
- {
- continue;
- }
-
- propDefbyPropId.put(propDef.getPropertyId(), propDef);
- propDefbyQueryName.put(propDef.getPropertyDefinition().getQueryName(), propDef);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString()
- {
- StringBuilder builder = new StringBuilder();
- builder.append("DictionaryRegistry[");
- builder.append("Types=").append(typeDefsByTypeId.size()).append(", ");
- builder.append("Base Types=").append(baseTypes.size()).append(", ");
- builder.append("]");
- return builder.toString();
- }
- }
-
- private DictionaryRegistry getRegistry()
- {
- String tenantDomain = tenantService.getCurrentUserDomain();
- DictionaryRegistry registry = registryMap.get(tenantDomain);
- if (registry == null)
- {
- init();
- registry = registryMap.get(tenantDomain);
- }
- return registry;
- }
-
- public TypeDefinitionWrapper findType(String typeId)
- {
- return getRegistry().typeDefsByTypeId.get(typeId);
- }
-
- public TypeDefinitionWrapper findTypeForClass(QName clazz, BaseTypeId... matchingScopes)
- {
- // searching for relationship
- boolean scopeByRelationship = false;
- for (BaseTypeId scope : matchingScopes)
- {
- if (scope == BaseTypeId.CMIS_RELATIONSHIP)
- {
- scopeByRelationship = true;
- break;
- }
- }
-
- // locate type in registry
- clazz = cmisMapping.getCmisType(clazz);
- TypeDefinitionWrapper typeDef = null;
- if (scopeByRelationship)
- {
- typeDef = getRegistry().assocDefsByQName.get(clazz);
- } else
- {
- typeDef = getRegistry().typeDefsByQName.get(clazz);
- if (typeDef == null)
- {
- typeDef = getRegistry().assocDefsByQName.get(clazz);
- }
- }
-
- // ensure matches one of provided matching scopes
- TypeDefinitionWrapper matchingTypeDef = (matchingScopes.length == 0) ? typeDef : null;
- if (typeDef != null)
- {
- for (BaseTypeId scope : matchingScopes)
- {
- if (typeDef.getBaseTypeId() == scope)
- {
- matchingTypeDef = typeDef;
- break;
- }
- }
- }
-
- return matchingTypeDef;
- }
-
- public TypeDefinitionWrapper findNodeType(QName clazz)
- {
- return getRegistry().typeDefsByQName.get(cmisMapping.getCmisType(clazz));
- }
-
- public TypeDefinitionWrapper findAssocType(QName clazz)
- {
- return getRegistry().assocDefsByQName.get(cmisMapping.getCmisType(clazz));
- }
-
- public TypeDefinitionWrapper findTypeByQueryName(String queryName)
- {
- return getRegistry().typeDefsByQueryName.get(queryName);
- }
-
- public QName getAlfrescoClass(QName name)
- {
- return cmisMapping.getAlfrescoClass(name);
- }
-
- public PropertyDefintionWrapper findProperty(String propId)
- {
- return getRegistry().propDefbyPropId.get(propId);
- }
-
- @Override
- public PropertyDefintionWrapper findPropertyByQueryName(String queryName)
- {
- return getRegistry().propDefbyQueryName.get(queryName);
- }
-
- public List getBaseTypes()
- {
- return Collections.unmodifiableList(getRegistry().baseTypes);
- }
-
- public List getAllTypes()
- {
- return Collections.unmodifiableList(new ArrayList(getRegistry().typeDefsByTypeId
- .values()));
- }
-
- public PropertyType findDataType(QName dataType)
- {
- return cmisMapping.getDataType(dataType);
- }
-
- public QName findAlfrescoDataType(PropertyType propertyType)
- {
- return cmisMapping.getAlfrescoDataType(propertyType);
- }
-
- /**
- * Factory for creating CMIS Definitions
- *
- * @param registry
- */
- abstract protected void createDefinitions(DictionaryRegistry registry);
-
- /**
- * Dictionary Initialization - creates a new registry
- */
- private void init()
- {
- DictionaryRegistry registry = new DictionaryRegistry();
-
- if (logger.isDebugEnabled())
- logger.debug("Creating type definitions...");
-
- // phase 1: construct type definitions and link them together
- createDefinitions(registry);
- for (AbstractTypeDefinitionWrapper objectTypeDef : registry.typeDefsByTypeId.values())
- {
- objectTypeDef.connectParentAndSubTypes(cmisMapping, registry, dictionaryService);
- }
-
- // phase 2: register base types and inherit property definitions
- for (AbstractTypeDefinitionWrapper typeDef : registry.typeDefsByTypeId.values())
- {
- if (typeDef.getTypeDefinition(false).getParentTypeId() == null)
- {
- registry.baseTypes.add(typeDef);
- typeDef.resolveInheritance(cmisMapping, serviceRegistry, registry, dictionaryService);
- }
- }
-
- // phase 3: register properties
- for (AbstractTypeDefinitionWrapper typeDef : registry.typeDefsByTypeId.values())
- {
- registry.registerPropertyDefinitions(typeDef);
- }
-
- // phase 4: assert valid
- for (AbstractTypeDefinitionWrapper typeDef : registry.typeDefsByTypeId.values())
- {
- typeDef.assertComplete();
- }
-
- // publish new registry
- registryMap.put(tenantService.getCurrentUserDomain(), registry);
-
- if (logger.isInfoEnabled())
- logger.info("Initialized CMIS Dictionary. Types:" + registry.typeDefsByTypeId.size() + ", Base Types:"
- + registry.baseTypes.size());
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.alfresco.repo.dictionary.DictionaryListener#onInit()
- */
- public void onDictionaryInit()
- {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.alfresco.repo.dictionary.DictionaryListener#afterInit()
- */
- public void afterDictionaryInit()
- {
- init();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.alfresco.repo.dictionary.DictionaryListener#afterDictionaryDestroy()
- */
- public void afterDictionaryDestroy()
- {
- registryMap.remove(tenantService.getCurrentUserDomain());
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.springframework.extensions.surf.util.AbstractLifecycleBean#onBootstrap
- * (org.springframework.context.ApplicationEvent)
- */
- protected void onBootstrap(ApplicationEvent event)
- {
- afterDictionaryInit();
- dictionaryDAO.register(this);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.springframework.extensions.surf.util.AbstractLifecycleBean#onShutdown
- * (org.springframework.context.ApplicationEvent)
- */
- protected void onShutdown(ApplicationEvent event)
- {
- }
-
-}
diff --git a/source/java/org/alfresco/opencmis/dictionary/CMISDictionaryService.java b/source/java/org/alfresco/opencmis/dictionary/CMISDictionaryService.java
deleted file mode 100644
index 715ad3292f..0000000000
--- a/source/java/org/alfresco/opencmis/dictionary/CMISDictionaryService.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright (C) 2005-2010 Alfresco Software Limited.
- *
- * This file is part of Alfresco
- *
- * Alfresco is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Alfresco is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General License for more details.
- *
- * You should have received a copy of the GNU Lesser General License
- * along with Alfresco. If not, see .
- */
-package org.alfresco.opencmis.dictionary;
-
-import java.util.List;
-
-import org.alfresco.service.namespace.QName;
-import org.apache.chemistry.opencmis.commons.enums.BaseTypeId;
-import org.apache.chemistry.opencmis.commons.enums.PropertyType;
-
-/**
- * Service to query the CMIS meta model
- *
- * @author davidc
- */
-public interface CMISDictionaryService
-{
- /**
- * Find type for type id
- *
- * @param typeId
- * @return
- */
- TypeDefinitionWrapper findType(String typeId);
-
- /**
- * Find type for Alfresco class name. Optionally, constrain match to one of
- * specified CMIS scopes
- *
- * @param clazz
- * @param matchingScopes
- * @return
- */
- TypeDefinitionWrapper findTypeForClass(QName clazz, BaseTypeId... matchingScopes);
-
- TypeDefinitionWrapper findNodeType(QName clazz);
-
- TypeDefinitionWrapper findAssocType(QName clazz);
-
- PropertyDefintionWrapper findProperty(String propId);
-
- PropertyDefintionWrapper findPropertyByQueryName(String queryName);
-
- /**
- * Find a type by its query name
- *
- * @param queryName
- * @return
- */
- TypeDefinitionWrapper findTypeByQueryName(String queryName);
-
- /**
- * Get Base Types
- */
- List getBaseTypes();
-
- /**
- * Get all Types
- *
- * @return
- */
- List getAllTypes();
-
- /**
- * Find data type
- *
- * @param dataType
- * @return
- */
- PropertyType findDataType(QName dataType);
-
- QName findAlfrescoDataType(PropertyType propertyType);
-}
diff --git a/source/java/org/alfresco/opencmis/dictionary/CMISStrictDictionaryService.java b/source/java/org/alfresco/opencmis/dictionary/CMISStrictDictionaryService.java
deleted file mode 100644
index c4a97b1e44..0000000000
--- a/source/java/org/alfresco/opencmis/dictionary/CMISStrictDictionaryService.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Copyright (C) 2005-2010 Alfresco Software Limited.
- *
- * This file is part of Alfresco
- *
- * Alfresco is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Alfresco is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Alfresco. If not, see .
- */
-package org.alfresco.opencmis.dictionary;
-
-import java.util.Collection;
-
-import org.alfresco.cmis.mapping.CMISMapping;
-import org.alfresco.service.cmr.dictionary.AssociationDefinition;
-import org.alfresco.service.cmr.dictionary.ClassDefinition;
-import org.alfresco.service.namespace.QName;
-import org.apache.chemistry.opencmis.commons.enums.BaseTypeId;
-
-/**
- * CMIS Dictionary which provides Types that strictly conform to the CMIS
- * specification.
- *
- * That is, only maps types to one of root Document, Folder, Relationship &
- * Policy.
- *
- * @author davidc
- */
-public class CMISStrictDictionaryService extends CMISAbstractDictionaryService
-{
-
- @Override
- protected void createDefinitions(DictionaryRegistry registry)
- {
- createTypeDefs(registry, dictionaryService.getAllTypes());
- createAssocDefs(registry, dictionaryService.getAllAssociations());
- createTypeDefs(registry, dictionaryService.getAllAspects());
- }
-
- /**
- * Create Type Definitions
- *
- * @param registry
- * @param classQNames
- */
- private void createTypeDefs(DictionaryRegistry registry, Collection classQNames)
- {
- for (QName classQName : classQNames)
- {
- // skip items that are remapped to CMIS model
- if (cmisMapping.isRemappedType(classQName))
- continue;
-
- // create appropriate kind of type definition
- ClassDefinition classDef = dictionaryService.getClass(classQName);
- String typeId = null;
- AbstractTypeDefinitionWrapper objectTypeDef = null;
- if (cmisMapping.isValidCmisDocument(classQName))
- {
- typeId = cmisMapping.getCmisTypeId(BaseTypeId.CMIS_DOCUMENT, classQName);
- objectTypeDef = new DocumentTypeDefinitionWrapper(cmisMapping, serviceRegistry, typeId, classDef);
- } else if (cmisMapping.isValidCmisFolder(classQName))
- {
- typeId = cmisMapping.getCmisTypeId(BaseTypeId.CMIS_FOLDER, classQName);
- objectTypeDef = new FolderTypeDefintionWrapper(cmisMapping, serviceRegistry, typeId, classDef);
- } else if (cmisMapping.isValidCmisPolicy(classQName))
- {
- typeId = cmisMapping.getCmisTypeId(BaseTypeId.CMIS_POLICY, classQName);
- objectTypeDef = new PolicyTypeDefintionWrapper(cmisMapping, serviceRegistry, typeId, classDef);
- }
-
- if (objectTypeDef != null)
- {
- registry.registerTypeDefinition(objectTypeDef);
- }
- }
- }
-
- /**
- * Create Relationship Definitions
- *
- * @param registry
- * @param classQNames
- */
- private void createAssocDefs(DictionaryRegistry registry, Collection classQNames)
- {
- // register base type
- String typeId = cmisMapping.getCmisTypeId(BaseTypeId.CMIS_RELATIONSHIP, CMISMapping.RELATIONSHIP_QNAME);
- RelationshipTypeDefintionWrapper objectTypeDef = new RelationshipTypeDefintionWrapper(cmisMapping,
- serviceRegistry, typeId, dictionaryService.getClass(CMISMapping.RELATIONSHIP_QNAME));
-
- registry.registerTypeDefinition(objectTypeDef);
-
- // register all other relationships
- for (QName classQName : classQNames)
- {
- if (!cmisMapping.isValidCmisRelationship(classQName))
- continue;
-
- // create appropriate kind of type definition
- AssociationDefinition assocDef = dictionaryService.getAssociation(classQName);
- typeId = cmisMapping.getCmisTypeId(BaseTypeId.CMIS_RELATIONSHIP, classQName);
- objectTypeDef = new RelationshipTypeDefintionWrapper(cmisMapping, typeId, assocDef);
-
- registry.registerTypeDefinition(objectTypeDef);
- }
- }
-}
diff --git a/source/java/org/alfresco/opencmis/dictionary/DocumentTypeDefinitionWrapper.java b/source/java/org/alfresco/opencmis/dictionary/DocumentTypeDefinitionWrapper.java
deleted file mode 100644
index 80d1b21b2e..0000000000
--- a/source/java/org/alfresco/opencmis/dictionary/DocumentTypeDefinitionWrapper.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright (C) 2005-2010 Alfresco Software Limited.
- *
- * This file is part of Alfresco
- *
- * Alfresco is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Alfresco is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Alfresco. If not, see .
- */
-package org.alfresco.opencmis.dictionary;
-
-import org.alfresco.opencmis.CMISUtils;
-import org.alfresco.opencmis.mapping.CMISMapping;
-import org.alfresco.service.ServiceRegistry;
-import org.alfresco.service.cmr.dictionary.ClassDefinition;
-import org.alfresco.service.namespace.QName;
-import org.apache.chemistry.opencmis.commons.enums.BaseTypeId;
-import org.apache.chemistry.opencmis.commons.enums.ContentStreamAllowed;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.DocumentTypeDefinitionImpl;
-
-public class DocumentTypeDefinitionWrapper extends ShadowTypeDefinitionWrapper
-{
- private static final long serialVersionUID = 1L;
-
- private DocumentTypeDefinitionImpl typeDef;
- private DocumentTypeDefinitionImpl typeDefInclProperties;
-
- public DocumentTypeDefinitionWrapper(CMISMapping cmisMapping, ServiceRegistry serviceRegistry, String typeId,
- ClassDefinition cmisClassDef)
- {
- alfrescoName = cmisClassDef.getName();
- alfrescoClass = cmisMapping.getAlfrescoClass(alfrescoName);
-
- typeDef = new DocumentTypeDefinitionImpl();
-
- typeDef.setBaseTypeId(BaseTypeId.CMIS_DOCUMENT);
- typeDef.setId(typeId);
- typeDef.setLocalName(alfrescoName.getLocalName());
- typeDef.setLocalNamespace(alfrescoName.getNamespaceURI());
-
- if (BaseTypeId.CMIS_DOCUMENT.value().equals(typeId))
- {
- typeDef.setQueryName(typeId);
- typeDef.setParentTypeId(null);
- } else
- {
- typeDef.setQueryName(cmisMapping.buildPrefixEncodedString(alfrescoName));
- QName parentQName = cmisMapping.getCmisType(cmisClassDef.getParentName());
- if (cmisMapping.isValidCmisDocument(parentQName))
- {
- typeDef.setParentTypeId(cmisMapping.getCmisTypeId(BaseTypeId.CMIS_DOCUMENT, parentQName));
- }
- }
-
- typeDef.setDisplayName((cmisClassDef.getTitle() != null) ? cmisClassDef.getTitle() : typeId);
- typeDef.setDescription(cmisClassDef.getDescription() != null ? cmisClassDef.getDescription() : typeDef
- .getDisplayName());
-
- typeDef.setIsCreatable(true);
- typeDef.setIsQueryable(true);
- typeDef.setIsFulltextIndexed(true);
- typeDef.setIsControllablePolicy(false);
- typeDef.setIsControllableAcl(true);
- typeDef.setIsIncludedInSupertypeQuery(cmisClassDef.getIncludedInSuperTypeQuery());
- typeDef.setIsFileable(true);
- typeDef.setContentStreamAllowed(ContentStreamAllowed.ALLOWED);
- typeDef.setIsVersionable(true);
-
- typeDefInclProperties = CMISUtils.copy(typeDef);
- setTypeDefinition(typeDef, typeDefInclProperties);
-
- createOwningPropertyDefinitions(cmisMapping, serviceRegistry, cmisClassDef);
-
- actionEvaluators = cmisMapping.getActionEvaluators(BaseTypeId.CMIS_DOCUMENT);
- }
-}
diff --git a/source/java/org/alfresco/opencmis/dictionary/FolderTypeDefintionWrapper.java b/source/java/org/alfresco/opencmis/dictionary/FolderTypeDefintionWrapper.java
deleted file mode 100644
index a45de14daf..0000000000
--- a/source/java/org/alfresco/opencmis/dictionary/FolderTypeDefintionWrapper.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright (C) 2005-2010 Alfresco Software Limited.
- *
- * This file is part of Alfresco
- *
- * Alfresco is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Alfresco is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Alfresco. If not, see .
- */
-package org.alfresco.opencmis.dictionary;
-
-import org.alfresco.model.ContentModel;
-import org.alfresco.opencmis.CMISUtils;
-import org.alfresco.opencmis.mapping.CMISMapping;
-import org.alfresco.service.ServiceRegistry;
-import org.alfresco.service.cmr.dictionary.ClassDefinition;
-import org.alfresco.service.namespace.QName;
-import org.apache.chemistry.opencmis.commons.enums.BaseTypeId;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.FolderTypeDefinitionImpl;
-
-public class FolderTypeDefintionWrapper extends ShadowTypeDefinitionWrapper
-{
- private static final long serialVersionUID = 1L;
-
- private FolderTypeDefinitionImpl typeDef;
- private FolderTypeDefinitionImpl typeDefInclProperties;
-
- public FolderTypeDefintionWrapper(CMISMapping cmisMapping, ServiceRegistry serviceRegistry, String typeId,
- ClassDefinition cmisClassDef)
- {
- alfrescoName = cmisClassDef.getName();
- alfrescoClass = cmisMapping.getAlfrescoClass(alfrescoName);
-
- typeDef = new FolderTypeDefinitionImpl();
-
- typeDef.setBaseTypeId(BaseTypeId.CMIS_FOLDER);
- typeDef.setId(typeId);
- typeDef.setLocalName(alfrescoName.getLocalName());
- typeDef.setLocalNamespace(alfrescoName.getNamespaceURI());
-
- boolean isSystemFolder = false;
- if (BaseTypeId.CMIS_FOLDER.value().equals(typeId))
- {
- typeDef.setQueryName(typeId);
- typeDef.setParentTypeId(null);
- } else
- {
- typeDef.setQueryName(cmisMapping.buildPrefixEncodedString(alfrescoName));
- QName parentQName = cmisMapping.getCmisType(cmisClassDef.getParentName());
- if (cmisMapping.isValidCmisFolder(parentQName))
- {
- typeDef.setParentTypeId(cmisMapping.getCmisTypeId(BaseTypeId.CMIS_FOLDER, parentQName));
- }
-
- if (alfrescoName.equals(ContentModel.TYPE_SYSTEM_FOLDER)
- || serviceRegistry.getDictionaryService().isSubClass(alfrescoName, ContentModel.TYPE_SYSTEM_FOLDER))
- {
- isSystemFolder = true;
- }
- }
-
- typeDef.setDisplayName((cmisClassDef.getTitle() != null) ? cmisClassDef.getTitle() : typeId);
- typeDef.setDescription(cmisClassDef.getDescription() != null ? cmisClassDef.getDescription() : typeDef
- .getDisplayName());
-
- typeDef.setIsCreatable(!isSystemFolder);
- typeDef.setIsQueryable(true);
- typeDef.setIsFulltextIndexed(true);
- typeDef.setIsControllablePolicy(false);
- typeDef.setIsControllableAcl(true);
- typeDef.setIsIncludedInSupertypeQuery(cmisClassDef.getIncludedInSuperTypeQuery());
- typeDef.setIsFileable(true);
-
- typeDefInclProperties = CMISUtils.copy(typeDef);
- setTypeDefinition(typeDef, typeDefInclProperties);
-
- createOwningPropertyDefinitions(cmisMapping, serviceRegistry, cmisClassDef);
-
- actionEvaluators = cmisMapping.getActionEvaluators(BaseTypeId.CMIS_FOLDER);
- }
-}
diff --git a/source/java/org/alfresco/opencmis/dictionary/PolicyTypeDefintionWrapper.java b/source/java/org/alfresco/opencmis/dictionary/PolicyTypeDefintionWrapper.java
deleted file mode 100644
index b7bf3b1c74..0000000000
--- a/source/java/org/alfresco/opencmis/dictionary/PolicyTypeDefintionWrapper.java
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
- * Copyright (C) 2005-2010 Alfresco Software Limited.
- *
- * This file is part of Alfresco
- *
- * Alfresco is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Alfresco is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Alfresco. If not, see .
- */
-package org.alfresco.opencmis.dictionary;
-
-import java.util.ArrayList;
-import java.util.Collection;
-
-import org.alfresco.error.AlfrescoRuntimeException;
-import org.alfresco.opencmis.CMISUtils;
-import org.alfresco.opencmis.dictionary.CMISAbstractDictionaryService.DictionaryRegistry;
-import org.alfresco.opencmis.mapping.CMISMapping;
-import org.alfresco.service.ServiceRegistry;
-import org.alfresco.service.cmr.dictionary.ClassDefinition;
-import org.alfresco.service.cmr.dictionary.DictionaryService;
-import org.alfresco.service.namespace.QName;
-import org.apache.chemistry.opencmis.commons.definitions.PropertyDefinition;
-import org.apache.chemistry.opencmis.commons.enums.BaseTypeId;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.PolicyTypeDefinitionImpl;
-
-public class PolicyTypeDefintionWrapper extends AbstractTypeDefinitionWrapper
-{
- private static final long serialVersionUID = 1L;
-
- private PolicyTypeDefinitionImpl typeDef;
- private PolicyTypeDefinitionImpl typeDefInclProperties;
-
- public PolicyTypeDefintionWrapper(CMISMapping cmisMapping, ServiceRegistry serviceRegistry, String typeId,
- ClassDefinition cmisClassDef)
- {
- alfrescoName = cmisClassDef.getName();
- alfrescoClass = cmisMapping.getAlfrescoClass(alfrescoName);
-
- typeDef = new PolicyTypeDefinitionImpl();
-
- typeDef.setBaseTypeId(BaseTypeId.CMIS_POLICY);
- typeDef.setId(typeId);
- typeDef.setLocalName(alfrescoName.getLocalName());
- typeDef.setLocalNamespace(alfrescoName.getNamespaceURI());
-
- if (BaseTypeId.CMIS_POLICY.value().equals(typeId))
- {
- typeDef.setQueryName(typeId);
- typeDef.setParentTypeId(null);
- } else
- {
- typeDef.setQueryName(cmisMapping.buildPrefixEncodedString(alfrescoName));
- QName parentQName = cmisMapping.getCmisType(cmisClassDef.getParentName());
- if (parentQName == null)
- {
- typeDef.setParentTypeId(cmisMapping.getCmisTypeId(CMISMapping.ASPECTS_QNAME));
- } else if (cmisMapping.isValidCmisPolicy(parentQName))
- {
- typeDef.setParentTypeId(cmisMapping.getCmisTypeId(BaseTypeId.CMIS_POLICY, parentQName));
- }
- }
-
- typeDef.setDisplayName((cmisClassDef.getTitle() != null) ? cmisClassDef.getTitle() : typeId);
- typeDef.setDescription(cmisClassDef.getDescription() != null ? cmisClassDef.getDescription() : typeDef
- .getDisplayName());
-
- typeDef.setIsCreatable(false);
- typeDef.setIsQueryable(true);
- typeDef.setIsFulltextIndexed(true);
- typeDef.setIsControllablePolicy(false);
- typeDef.setIsControllableAcl(false);
- typeDef.setIsIncludedInSupertypeQuery(cmisClassDef.getIncludedInSuperTypeQuery());
- typeDef.setIsFileable(true);
-
- typeDefInclProperties = CMISUtils.copy(typeDef);
- setTypeDefinition(typeDef, typeDefInclProperties);
-
- createOwningPropertyDefinitions(cmisMapping, serviceRegistry, cmisClassDef);
-
- actionEvaluators = cmisMapping.getActionEvaluators(BaseTypeId.CMIS_POLICY);
- }
-
- public void connectParentAndSubTypes(CMISMapping cmisMapping, DictionaryRegistry registry,
- DictionaryService dictionaryService)
- {
- // find parent
- if (typeDef.getParentTypeId() != null)
- {
- parent = registry.typeDefsByTypeId.get(typeDef.getParentTypeId());
- } else
- {
- if (!isBaseType())
- {
- throw new AlfrescoRuntimeException("Type " + typeDef.getId() + " has no parent!");
- }
-
- parent = null;
- }
-
- // find children
- children = new ArrayList();
- Collection childrenNames = null;
-
- if (isBaseType())
- {
- // add the "Aspects" type to the CMIS Policy type
- childrenNames = new ArrayList();
- childrenNames.add(CMISMapping.ASPECTS_QNAME);
- } else if (getAlfrescoName().equals(CMISMapping.ASPECTS_QNAME))
- {
- // add all root aspects to the "Aspects" type
- childrenNames = new ArrayList();
-
- String aspectsTypeId = cmisMapping.getCmisTypeId(CMISMapping.ASPECTS_QNAME);
- for (AbstractTypeDefinitionWrapper tdw : registry.typeDefsByTypeId.values())
- {
- String parentId = tdw.getTypeDefinition(false).getParentTypeId();
- if ((parentId != null) && parentId.equals(aspectsTypeId))
- {
- childrenNames.add(tdw.getAlfrescoName());
- }
- }
- } else
- {
- // add all non-root aspects to their parent
- childrenNames = dictionaryService.getSubAspects(cmisMapping.getAlfrescoClass(getAlfrescoName()), false);
- }
-
- for (QName childName : childrenNames)
- {
- if (cmisMapping.isValidCmisPolicy(childName))
- {
- TypeDefinitionWrapper child = registry.typeDefsByQName.get(childName);
-
- if (child == null)
- {
- throw new AlfrescoRuntimeException("Failed to retrieve sub type for type id " + childName
- + " for parent type " + getAlfrescoName() + "!");
- }
- children.add(child);
- } else
- {
- System.out.println("Not a policy: " + childName);
- }
- }
- }
-
- public void resolveInheritance(CMISMapping cmisMapping, ServiceRegistry serviceRegistry,
- DictionaryRegistry registry, DictionaryService dictionaryService)
- {
- PropertyDefinition> propertyDefintion;
-
- if (parent != null)
- {
- for (PropertyDefintionWrapper propDef : parent.getProperties())
- {
- if (propertiesById.containsKey(propDef.getPropertyId()))
- {
- continue;
- }
-
- org.alfresco.service.cmr.dictionary.PropertyDefinition alfrescoPropDef = dictionaryService.getProperty(
- propDef.getOwningType().getAlfrescoName(), propDef.getAlfrescoName());
-
- propertyDefintion = createPropertyDefinition(cmisMapping, propDef.getPropertyId(),
- alfrescoPropDef.getName(), alfrescoPropDef, true);
-
- if (propertyDefintion != null)
- {
- registerProperty(new BasePropertyDefintionWrapper(propertyDefintion, alfrescoPropDef.getName(),
- propDef.getOwningType(), propDef.getPropertyAccessor(), propDef.getPropertyLuceneBuilder()));
- }
- }
- }
-
- for (TypeDefinitionWrapper child : children)
- {
- if (child instanceof AbstractTypeDefinitionWrapper)
- {
- ((AbstractTypeDefinitionWrapper) child).resolveInheritance(cmisMapping, serviceRegistry, registry,
- dictionaryService);
- }
- }
- }
-}
diff --git a/source/java/org/alfresco/opencmis/dictionary/PropertyDefintionWrapper.java b/source/java/org/alfresco/opencmis/dictionary/PropertyDefintionWrapper.java
deleted file mode 100644
index e92384f991..0000000000
--- a/source/java/org/alfresco/opencmis/dictionary/PropertyDefintionWrapper.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (C) 2005-2010 Alfresco Software Limited.
- *
- * This file is part of Alfresco
- *
- * Alfresco is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Alfresco is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Alfresco. If not, see .
- */
-package org.alfresco.opencmis.dictionary;
-
-import org.alfresco.cmis.CMISPropertyAccessor;
-import org.alfresco.cmis.CMISPropertyLuceneBuilder;
-import org.alfresco.service.namespace.QName;
-import org.apache.chemistry.opencmis.commons.definitions.PropertyDefinition;
-
-public interface PropertyDefintionWrapper
-{
- PropertyDefinition> getPropertyDefinition();
-
- String getPropertyId();
-
- QName getAlfrescoName();
-
- TypeDefinitionWrapper getOwningType();
-
- CMISPropertyAccessor getPropertyAccessor();
-
- CMISPropertyLuceneBuilder getPropertyLuceneBuilder();
-}
diff --git a/source/java/org/alfresco/opencmis/dictionary/RelationshipTypeDefintionWrapper.java b/source/java/org/alfresco/opencmis/dictionary/RelationshipTypeDefintionWrapper.java
deleted file mode 100644
index 4819728df3..0000000000
--- a/source/java/org/alfresco/opencmis/dictionary/RelationshipTypeDefintionWrapper.java
+++ /dev/null
@@ -1,193 +0,0 @@
-/*
- * Copyright (C) 2005-2010 Alfresco Software Limited.
- *
- * This file is part of Alfresco
- *
- * Alfresco is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Alfresco is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Alfresco. If not, see .
- */
-package org.alfresco.opencmis.dictionary;
-
-import java.util.ArrayList;
-import java.util.Collections;
-
-import org.alfresco.error.AlfrescoRuntimeException;
-import org.alfresco.opencmis.CMISUtils;
-import org.alfresco.opencmis.dictionary.CMISAbstractDictionaryService.DictionaryRegistry;
-import org.alfresco.opencmis.mapping.CMISMapping;
-import org.alfresco.service.ServiceRegistry;
-import org.alfresco.service.cmr.dictionary.AssociationDefinition;
-import org.alfresco.service.cmr.dictionary.ClassDefinition;
-import org.alfresco.service.cmr.dictionary.DictionaryService;
-import org.apache.chemistry.opencmis.commons.definitions.PropertyDefinition;
-import org.apache.chemistry.opencmis.commons.enums.BaseTypeId;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.RelationshipTypeDefinitionImpl;
-
-public class RelationshipTypeDefintionWrapper extends AbstractTypeDefinitionWrapper
-{
- private static final long serialVersionUID = 1L;
-
- private RelationshipTypeDefinitionImpl typeDef;
- private RelationshipTypeDefinitionImpl typeDefInclProperties;
-
- public RelationshipTypeDefintionWrapper(CMISMapping cmisMapping, ServiceRegistry serviceRegistry, String typeId,
- ClassDefinition cmisClassDef)
- {
- alfrescoName = cmisClassDef.getName();
- alfrescoClass = cmisMapping.getAlfrescoClass(alfrescoName);
-
- typeDef = new RelationshipTypeDefinitionImpl();
-
- typeDef.setBaseTypeId(BaseTypeId.CMIS_RELATIONSHIP);
- typeDef.setId(typeId);
- typeDef.setLocalName(alfrescoName.getLocalName());
- typeDef.setLocalNamespace(alfrescoName.getNamespaceURI());
-
- if (BaseTypeId.CMIS_RELATIONSHIP.value().equals(typeId))
- {
- typeDef.setQueryName(typeId);
- typeDef.setParentTypeId(null);
- } else
- {
- typeDef.setQueryName(cmisMapping.buildPrefixEncodedString(alfrescoName));
- typeDef.setParentTypeId(BaseTypeId.CMIS_RELATIONSHIP.value());
- }
-
- typeDef.setDisplayName(cmisClassDef.getTitle() != null ? cmisClassDef.getTitle() : typeId);
- typeDef.setDescription(cmisClassDef.getDescription() != null ? cmisClassDef.getDescription() : typeDef
- .getDisplayName());
-
- typeDef.setIsCreatable(true);
- typeDef.setIsQueryable(false);
- typeDef.setIsFulltextIndexed(false);
- typeDef.setIsControllablePolicy(false);
- typeDef.setIsControllableAcl(false);
- typeDef.setIsIncludedInSupertypeQuery(true);
- typeDef.setIsFileable(false);
-
- typeDefInclProperties = CMISUtils.copy(typeDef);
- setTypeDefinition(typeDef, typeDefInclProperties);
-
- createOwningPropertyDefinitions(cmisMapping, serviceRegistry, cmisClassDef);
-
- actionEvaluators = cmisMapping.getActionEvaluators(BaseTypeId.CMIS_RELATIONSHIP);
- }
-
- public RelationshipTypeDefintionWrapper(CMISMapping cmisMapping, String typeId, AssociationDefinition cmisAssocDef)
- {
- alfrescoName = cmisAssocDef.getName();
- alfrescoClass = cmisMapping.getAlfrescoClass(alfrescoName);
-
- typeDef = new RelationshipTypeDefinitionImpl();
-
- typeDef.setBaseTypeId(BaseTypeId.CMIS_RELATIONSHIP);
- typeDef.setId(typeId);
- typeDef.setLocalName(alfrescoName.getLocalName());
- typeDef.setLocalNamespace(alfrescoName.getNamespaceURI());
-
- typeDef.setQueryName(cmisMapping.buildPrefixEncodedString(alfrescoName));
- typeDef.setParentTypeId(BaseTypeId.CMIS_RELATIONSHIP.value());
-
- typeDef.setDisplayName(cmisAssocDef.getTitle() != null ? cmisAssocDef.getTitle() : typeId);
- typeDef.setDescription(cmisAssocDef.getDescription() != null ? cmisAssocDef.getDescription() : typeDef
- .getDisplayName());
-
- typeDef.setIsCreatable(true);
- typeDef.setIsQueryable(false);
- typeDef.setIsFulltextIndexed(false);
- typeDef.setIsControllablePolicy(false);
- typeDef.setIsControllableAcl(false);
- typeDef.setIsIncludedInSupertypeQuery(true);
- typeDef.setIsFileable(false);
-
- String sourceTypeId = cmisMapping.getCmisTypeId(cmisMapping
- .getCmisType(cmisAssocDef.getSourceClass().getName()));
- if (sourceTypeId != null)
- {
- typeDef.setAllowedSourceTypes(Collections.singletonList(sourceTypeId));
- }
-
- String targetTypeId = cmisMapping.getCmisTypeId(cmisMapping
- .getCmisType(cmisAssocDef.getTargetClass().getName()));
- if (targetTypeId != null)
- {
- typeDef.setAllowedTargetTypes(Collections.singletonList(targetTypeId));
- }
-
- typeDefInclProperties = CMISUtils.copy(typeDef);
- setTypeDefinition(typeDef, typeDefInclProperties);
-
- actionEvaluators = cmisMapping.getActionEvaluators(BaseTypeId.CMIS_RELATIONSHIP);
- }
-
- public void connectParentAndSubTypes(CMISMapping cmisMapping, DictionaryRegistry registry,
- DictionaryService dictionaryService)
- {
- // find parent
- if (typeDef.getParentTypeId() != null)
- {
- parent = registry.typeDefsByTypeId.get(typeDef.getParentTypeId());
- } else
- {
- if (!isBaseType())
- {
- throw new AlfrescoRuntimeException("Type " + typeDef.getId() + " has no parent!");
- }
-
- parent = null;
- }
-
- // find children
- children = new ArrayList();
- if (isBaseType())
- {
- for (TypeDefinitionWrapper child : registry.assocDefsByQName.values())
- {
- children.add(child);
- }
- }
- }
-
- public void resolveInheritance(CMISMapping cmisMapping, ServiceRegistry serviceRegistry,
- DictionaryRegistry registry, DictionaryService dictionaryService)
- {
- PropertyDefinition> propertyDefintion;
-
- if (parent != null)
- {
- for (PropertyDefintionWrapper propDef : parent.getProperties())
- {
- org.alfresco.service.cmr.dictionary.PropertyDefinition alfrescoPropDef = dictionaryService.getProperty(
- propDef.getOwningType().getAlfrescoName(), propDef.getAlfrescoName());
-
- propertyDefintion = createPropertyDefinition(cmisMapping, propDef.getPropertyId(),
- alfrescoPropDef.getName(), alfrescoPropDef, true);
-
- if (propertyDefintion != null)
- {
- registerProperty(new BasePropertyDefintionWrapper(propertyDefintion, alfrescoPropDef.getName(),
- propDef.getOwningType(), propDef.getPropertyAccessor(), propDef.getPropertyLuceneBuilder()));
- }
- }
- }
-
- for (TypeDefinitionWrapper child : children)
- {
- if (child instanceof AbstractTypeDefinitionWrapper)
- {
- ((AbstractTypeDefinitionWrapper) child).resolveInheritance(cmisMapping, serviceRegistry, registry,
- dictionaryService);
- }
- }
- }
-}
diff --git a/source/java/org/alfresco/opencmis/dictionary/ShadowTypeDefinitionWrapper.java b/source/java/org/alfresco/opencmis/dictionary/ShadowTypeDefinitionWrapper.java
deleted file mode 100644
index 8b7bd70bc4..0000000000
--- a/source/java/org/alfresco/opencmis/dictionary/ShadowTypeDefinitionWrapper.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Copyright (C) 2005-2010 Alfresco Software Limited.
- *
- * This file is part of Alfresco
- *
- * Alfresco is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Alfresco is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Alfresco. If not, see .
- */
-package org.alfresco.opencmis.dictionary;
-
-import java.util.ArrayList;
-import java.util.Collection;
-
-import org.alfresco.error.AlfrescoRuntimeException;
-import org.alfresco.opencmis.dictionary.CMISAbstractDictionaryService.DictionaryRegistry;
-import org.alfresco.opencmis.mapping.CMISMapping;
-import org.alfresco.service.ServiceRegistry;
-import org.alfresco.service.cmr.dictionary.DictionaryService;
-import org.alfresco.service.namespace.QName;
-import org.apache.chemistry.opencmis.commons.definitions.PropertyDefinition;
-
-public abstract class ShadowTypeDefinitionWrapper extends AbstractTypeDefinitionWrapper
-{
-
- private static final long serialVersionUID = 1L;
-
- public void connectParentAndSubTypes(CMISMapping cmisMapping, DictionaryRegistry registry,
- DictionaryService dictionaryService)
- {
- // find parent
- if (typeDef.getParentTypeId() != null)
- {
- parent = registry.typeDefsByTypeId.get(typeDef.getParentTypeId());
- } else
- {
- if (!isBaseType())
- {
- throw new AlfrescoRuntimeException("Type " + typeDef.getId() + " has no parent!");
- }
-
- parent = null;
- }
-
- // find children
- children = new ArrayList();
- Collection childrenNames = dictionaryService.getSubTypes(cmisMapping.getAlfrescoClass(getAlfrescoName()),
- false);
- for (QName childName : childrenNames)
- {
- if (cmisMapping.isValidCmisObject(getBaseTypeId(), childName))
- {
- TypeDefinitionWrapper child = registry.typeDefsByQName.get(childName);
-
- if (child == null)
- {
- throw new AlfrescoRuntimeException("Failed to retrieve sub type for type id " + childName
- + " for parent type " + getAlfrescoName() + "!");
- }
- children.add(child);
- }
- }
- }
-
- public void resolveInheritance(CMISMapping cmisMapping, ServiceRegistry serviceRegistry,
- DictionaryRegistry registry, DictionaryService dictionaryService)
- {
- PropertyDefinition> propertyDefintion;
-
- if (parent != null)
- {
- for (PropertyDefintionWrapper propDef : parent.getProperties())
- {
- if (propertiesById.containsKey(propDef.getPropertyId()))
- {
- continue;
- }
-
- org.alfresco.service.cmr.dictionary.PropertyDefinition alfrescoPropDef = dictionaryService.getProperty(
- propDef.getOwningType().getAlfrescoName(), propDef.getAlfrescoName());
-
- propertyDefintion = createPropertyDefinition(cmisMapping, propDef.getPropertyId(),
- alfrescoPropDef.getName(), alfrescoPropDef, true);
-
- if (propertyDefintion != null)
- {
- registerProperty(new BasePropertyDefintionWrapper(propertyDefintion, alfrescoPropDef.getName(),
- propDef.getOwningType(), propDef.getPropertyAccessor(), propDef.getPropertyLuceneBuilder()));
- }
- }
- }
-
- for (TypeDefinitionWrapper child : children)
- {
- if (child instanceof AbstractTypeDefinitionWrapper)
- {
- ((AbstractTypeDefinitionWrapper) child).resolveInheritance(cmisMapping, serviceRegistry, registry,
- dictionaryService);
- }
- }
- }
-}
diff --git a/source/java/org/alfresco/opencmis/dictionary/TypeDefinitionWrapper.java b/source/java/org/alfresco/opencmis/dictionary/TypeDefinitionWrapper.java
deleted file mode 100644
index c026e72f96..0000000000
--- a/source/java/org/alfresco/opencmis/dictionary/TypeDefinitionWrapper.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (C) 2005-2010 Alfresco Software Limited.
- *
- * This file is part of Alfresco
- *
- * Alfresco is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Alfresco is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Alfresco. If not, see .
- */
-package org.alfresco.opencmis.dictionary;
-
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-
-import org.alfresco.opencmis.CMISActionEvaluator;
-import org.alfresco.service.namespace.QName;
-import org.apache.chemistry.opencmis.commons.definitions.TypeDefinition;
-import org.apache.chemistry.opencmis.commons.enums.Action;
-import org.apache.chemistry.opencmis.commons.enums.BaseTypeId;
-
-public interface TypeDefinitionWrapper
-{
- TypeDefinition getTypeDefinition(boolean includePropertyDefinitions);
-
- String getTypeId();
-
- BaseTypeId getBaseTypeId();
-
- boolean isBaseType();
-
- QName getAlfrescoName();
-
- QName getAlfrescoClass();
-
- TypeDefinitionWrapper getParent();
-
- List getChildren();
-
- Collection getProperties();
-
- PropertyDefintionWrapper getPropertyById(String propertyId);
-
- PropertyDefintionWrapper getPropertyByQueryName(String queryName);
-
- PropertyDefintionWrapper getPropertyByQName(QName name);
-
- Map> getActionEvaluators();
-}
diff --git a/source/java/org/alfresco/opencmis/mapping/AbstractActionEvaluator.java b/source/java/org/alfresco/opencmis/mapping/AbstractActionEvaluator.java
index e38e382028..b2d7f98914 100644
--- a/source/java/org/alfresco/opencmis/mapping/AbstractActionEvaluator.java
+++ b/source/java/org/alfresco/opencmis/mapping/AbstractActionEvaluator.java
@@ -18,7 +18,7 @@
*/
package org.alfresco.opencmis.mapping;
-import org.alfresco.opencmis.CMISActionEvaluator;
+import org.alfresco.opencmis.dictionary.CMISActionEvaluator;
import org.alfresco.service.ServiceRegistry;
import org.apache.chemistry.opencmis.commons.enums.Action;
diff --git a/source/java/org/alfresco/opencmis/mapping/AbstractProperty.java b/source/java/org/alfresco/opencmis/mapping/AbstractProperty.java
index cdaa2e217a..21aa5cdb49 100644
--- a/source/java/org/alfresco/opencmis/mapping/AbstractProperty.java
+++ b/source/java/org/alfresco/opencmis/mapping/AbstractProperty.java
@@ -19,19 +19,12 @@
package org.alfresco.opencmis.mapping;
import java.io.Serializable;
-import java.util.Collection;
-import org.alfresco.cmis.CMISPropertyAccessor;
-import org.alfresco.cmis.CMISPropertyLuceneBuilder;
-import org.alfresco.repo.search.impl.lucene.LuceneFunction;
-import org.alfresco.repo.search.impl.lucene.LuceneQueryParser;
-import org.alfresco.repo.search.impl.querymodel.PredicateMode;
+import org.alfresco.opencmis.dictionary.CMISPropertyAccessor;
import org.alfresco.service.ServiceRegistry;
import org.alfresco.service.cmr.repository.AssociationRef;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.namespace.QName;
-import org.apache.lucene.queryParser.ParseException;
-import org.apache.lucene.search.Query;
/**
* Base class for all property accessors
@@ -39,7 +32,7 @@ import org.apache.lucene.search.Query;
* @author andyh
*
*/
-public abstract class AbstractProperty implements CMISPropertyAccessor, CMISPropertyLuceneBuilder
+public abstract class AbstractProperty implements CMISPropertyAccessor
{
private ServiceRegistry serviceRegistry;
private String propertyName;
@@ -82,72 +75,19 @@ public abstract class AbstractProperty implements CMISPropertyAccessor, CMISProp
return null;
}
-
- public Query buildLuceneEquality(LuceneQueryParser lqp, Serializable value, PredicateMode mode, LuceneFunction luceneFunction) throws ParseException
- {
- return null;
- }
-
- public Query buildLuceneExists(LuceneQueryParser lqp, Boolean not) throws ParseException
- {
- return null;
- }
-
- public Query buildLuceneGreaterThan(LuceneQueryParser lqp, Serializable value, PredicateMode mode, LuceneFunction luceneFunction) throws ParseException
- {
- return null;
- }
-
- public Query buildLuceneGreaterThanOrEquals(LuceneQueryParser lqp, Serializable value, PredicateMode mode, LuceneFunction luceneFunction) throws ParseException
- {
- return null;
- }
-
- public Query buildLuceneIn(LuceneQueryParser lqp, Collection values, Boolean not, PredicateMode mode) throws ParseException
- {
- return null;
- }
-
- public Query buildLuceneInequality(LuceneQueryParser lqp, Serializable value, PredicateMode mode, LuceneFunction luceneFunction) throws ParseException
- {
- return null;
- }
-
- public Query buildLuceneLessThan(LuceneQueryParser lqp, Serializable value, PredicateMode mode, LuceneFunction luceneFunction) throws ParseException
- {
- return null;
- }
-
- public Query buildLuceneLessThanOrEquals(LuceneQueryParser lqp, Serializable value, PredicateMode mode, LuceneFunction luceneFunction) throws ParseException
- {
- return null;
- }
-
- public Query buildLuceneLike(LuceneQueryParser lqp, Serializable value, Boolean not) throws ParseException
- {
- return null;
- }
-
- public String getLuceneFieldName()
- {
- throw new UnsupportedOperationException();
- }
-
- public String getLuceneSortField(LuceneQueryParser lqp)
- {
- throw new UnsupportedOperationException();
- }
-
+ @Override
public Serializable getValue(NodeRef nodeRef)
{
throw new UnsupportedOperationException();
}
+ @Override
public void setValue(NodeRef nodeRef, Serializable value)
{
throw new UnsupportedOperationException();
}
+ @Override
public Serializable getValue(AssociationRef assocRef)
{
throw new UnsupportedOperationException();
diff --git a/source/java/org/alfresco/opencmis/mapping/AbstractSimpleProperty.java b/source/java/org/alfresco/opencmis/mapping/AbstractSimpleProperty.java
deleted file mode 100644
index d5532b4075..0000000000
--- a/source/java/org/alfresco/opencmis/mapping/AbstractSimpleProperty.java
+++ /dev/null
@@ -1,240 +0,0 @@
-/*
- * Copyright (C) 2005-2010 Alfresco Software Limited.
- *
- * This file is part of Alfresco
- *
- * Alfresco is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Alfresco is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Alfresco. If not, see .
- */
-package org.alfresco.opencmis.mapping;
-
-import java.io.Serializable;
-import java.util.Collection;
-
-import org.alfresco.repo.search.impl.lucene.AnalysisMode;
-import org.alfresco.repo.search.impl.lucene.LuceneFunction;
-import org.alfresco.repo.search.impl.lucene.LuceneQueryParser;
-import org.alfresco.repo.search.impl.querymodel.PredicateMode;
-import org.alfresco.service.ServiceRegistry;
-import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
-import org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter;
-import org.alfresco.service.namespace.QName;
-import org.apache.lucene.index.Term;
-import org.apache.lucene.queryParser.ParseException;
-import org.apache.lucene.search.BooleanQuery;
-import org.apache.lucene.search.MatchAllDocsQuery;
-import org.apache.lucene.search.Query;
-import org.apache.lucene.search.TermQuery;
-import org.apache.lucene.search.BooleanClause.Occur;
-
-/**
- * Common support for lucene query building.
- *
- * @author andyh
- *
- */
-public abstract class AbstractSimpleProperty extends AbstractProperty
-{
-
- protected AbstractSimpleProperty(ServiceRegistry serviceRegistry, String propertyName)
- {
- super(serviceRegistry, propertyName);
- }
-
- protected abstract String getValueAsString(Serializable value);
-
- protected String getRangeMax()
- {
- return "\uFFFF";
- }
-
- protected String getRangeMin()
- {
- return "\u0000";
- }
-
- protected abstract DataTypeDefinition getInDataType();
-
- protected abstract QName getQNameForExists();
-
- /*
- * (non-Javadoc)
- * @see org.alfresco.cmis.property.PropertyLuceneBuilder#buildLuceneEquality(org.alfresco.repo.search.impl.lucene.LuceneQueryParser, java.io.Serializable, org.alfresco.repo.search.impl.querymodel.PredicateMode)
- */
- public Query buildLuceneEquality(LuceneQueryParser lqp, Serializable value, PredicateMode mode, LuceneFunction luceneFunction) throws ParseException
- {
- return lqp.getFieldQuery(getLuceneFieldName(), getValueAsString(value), AnalysisMode.IDENTIFIER, luceneFunction);
- }
-
- /*
- * (non-Javadoc)
- * @see org.alfresco.cmis.property.PropertyLuceneBuilder#buildLuceneExists(org.alfresco.repo.search.impl.lucene.LuceneQueryParser, java.lang.Boolean)
- */
- public Query buildLuceneExists(LuceneQueryParser lqp, Boolean not) throws ParseException
- {
- if (not)
- {
- return lqp.getFieldQuery("ISNULL", getQNameForExists().toString(), AnalysisMode.DEFAULT, LuceneFunction.FIELD);
- }
- else
- {
- return lqp.getFieldQuery("ISNOTNULL", getQNameForExists().toString(), AnalysisMode.DEFAULT, LuceneFunction.FIELD);
- }
- }
-
- /*
- * (non-Javadoc)
- * @see org.alfresco.cmis.property.PropertyLuceneBuilder#buildLuceneGreaterThan(org.alfresco.repo.search.impl.lucene.LuceneQueryParser, java.io.Serializable, org.alfresco.repo.search.impl.querymodel.PredicateMode)
- */
- public Query buildLuceneGreaterThan(LuceneQueryParser lqp, Serializable value, PredicateMode mode, LuceneFunction luceneFunction) throws ParseException
- {
- String field = getLuceneFieldName();
- String stringValue = getValueAsString(value);
- return lqp.getRangeQuery(field, stringValue, getRangeMax(), false, true, AnalysisMode.IDENTIFIER, luceneFunction);
- }
-
- /*
- * (non-Javadoc)
- * @see org.alfresco.cmis.property.PropertyLuceneBuilder#buildLuceneGreaterThanOrEquals(org.alfresco.repo.search.impl.lucene.LuceneQueryParser, java.io.Serializable, org.alfresco.repo.search.impl.querymodel.PredicateMode)
- */
- public Query buildLuceneGreaterThanOrEquals(LuceneQueryParser lqp, Serializable value, PredicateMode mode, LuceneFunction luceneFunction) throws ParseException
- {
- String field = getLuceneFieldName();
- String stringValue = getValueAsString(value);
- return lqp.getRangeQuery(field, stringValue, getRangeMax(), true, true, AnalysisMode.IDENTIFIER, luceneFunction);
- }
-
- /*
- * (non-Javadoc)
- * @see org.alfresco.cmis.property.PropertyLuceneBuilder#buildLuceneIn(org.alfresco.repo.search.impl.lucene.LuceneQueryParser, java.util.Collection, java.lang.Boolean, org.alfresco.repo.search.impl.querymodel.PredicateMode)
- */
- public Query buildLuceneIn(LuceneQueryParser lqp, Collection values, Boolean not, PredicateMode mode) throws ParseException
- {
- String field = getLuceneFieldName();
-
- // Check type conversion
-
- @SuppressWarnings("unused")
- Object converted = DefaultTypeConverter.INSTANCE.convert(getInDataType(), values);
- Collection asStrings = DefaultTypeConverter.INSTANCE.convert(String.class, values);
-
- if (asStrings.size() == 0)
- {
- if (not)
- {
- return new MatchAllDocsQuery();
- }
- else
- {
- return new TermQuery(new Term("NO_TOKENS", "__"));
- }
- }
- else if (asStrings.size() == 1)
- {
- String value = asStrings.iterator().next();
- if (not)
- {
- return lqp.getDoesNotMatchFieldQuery(field, value, AnalysisMode.IDENTIFIER, LuceneFunction.FIELD);
- }
- else
- {
- return lqp.getFieldQuery(field, value, AnalysisMode.IDENTIFIER, LuceneFunction.FIELD);
- }
- }
- else
- {
- BooleanQuery booleanQuery = new BooleanQuery();
- if (not)
- {
- booleanQuery.add(new MatchAllDocsQuery(), Occur.MUST);
- }
- for (String value : asStrings)
- {
- Query any = lqp.getFieldQuery(field, value, AnalysisMode.IDENTIFIER, LuceneFunction.FIELD);
- if (not)
- {
- booleanQuery.add(any, Occur.MUST_NOT);
- }
- else
- {
- booleanQuery.add(any, Occur.SHOULD);
- }
- }
- return booleanQuery;
- }
- }
-
- /*
- * (non-Javadoc)
- * @see org.alfresco.cmis.property.PropertyLuceneBuilder#buildLuceneInequality(org.alfresco.repo.search.impl.lucene.LuceneQueryParser, java.io.Serializable, org.alfresco.repo.search.impl.querymodel.PredicateMode)
- */
- public Query buildLuceneInequality(LuceneQueryParser lqp, Serializable value, PredicateMode mode, LuceneFunction luceneFunction) throws ParseException
- {
- String field = getLuceneFieldName();
- String stringValue = getValueAsString(value);
- return lqp.getDoesNotMatchFieldQuery(field, stringValue, AnalysisMode.IDENTIFIER, luceneFunction);
- }
-
- /*
- * (non-Javadoc)
- * @see org.alfresco.cmis.property.PropertyLuceneBuilder#buildLuceneLessThan(org.alfresco.repo.search.impl.lucene.LuceneQueryParser, java.io.Serializable, org.alfresco.repo.search.impl.querymodel.PredicateMode)
- */
- public Query buildLuceneLessThan(LuceneQueryParser lqp, Serializable value, PredicateMode mode, LuceneFunction luceneFunction) throws ParseException
- {
- String field = getLuceneFieldName();
- String stringValue = getValueAsString(value);
- return lqp.getRangeQuery(field, getRangeMin(), stringValue, true, false, AnalysisMode.IDENTIFIER, luceneFunction);
- }
-
- /*
- * (non-Javadoc)
- * @see org.alfresco.cmis.property.PropertyLuceneBuilder#buildLuceneLessThanOrEquals(org.alfresco.repo.search.impl.lucene.LuceneQueryParser, java.io.Serializable, org.alfresco.repo.search.impl.querymodel.PredicateMode)
- */
- public Query buildLuceneLessThanOrEquals(LuceneQueryParser lqp, Serializable value, PredicateMode mode, LuceneFunction luceneFunction) throws ParseException
- {
- String field = getLuceneFieldName();
- String stringValue = getValueAsString(value);
- return lqp.getRangeQuery(field, getRangeMin(), stringValue, true, true, AnalysisMode.IDENTIFIER, luceneFunction);
- }
-
- /*
- * (non-Javadoc)
- * @see org.alfresco.cmis.property.PropertyLuceneBuilder#buildLuceneLike(org.alfresco.repo.search.impl.lucene.LuceneQueryParser, java.io.Serializable, java.lang.Boolean)
- */
- public Query buildLuceneLike(LuceneQueryParser lqp, Serializable value, Boolean not) throws ParseException
- {
- String field = getLuceneFieldName();
- String stringValue = getValueAsString(value);
-
- if (not)
- {
- BooleanQuery booleanQuery = new BooleanQuery();
- booleanQuery.add(new MatchAllDocsQuery(), Occur.MUST);
- booleanQuery.add(lqp.getLikeQuery(field, stringValue, AnalysisMode.IDENTIFIER), Occur.MUST_NOT);
- return booleanQuery;
- }
- else
- {
- return lqp.getLikeQuery(field, stringValue, AnalysisMode.IDENTIFIER);
- }
- }
-
- /*
- * (non-Javadoc)
- * @see org.alfresco.cmis.property.PropertyLuceneBuilder#getLuceneSortField()
- */
- public String getLuceneSortField(LuceneQueryParser lqp)
- {
- return getLuceneFieldName();
- }
-}
diff --git a/source/java/org/alfresco/opencmis/mapping/BaseTypeIdProperty.java b/source/java/org/alfresco/opencmis/mapping/BaseTypeIdProperty.java
index 659182e3a5..d532993f28 100644
--- a/source/java/org/alfresco/opencmis/mapping/BaseTypeIdProperty.java
+++ b/source/java/org/alfresco/opencmis/mapping/BaseTypeIdProperty.java
@@ -19,28 +19,14 @@
package org.alfresco.opencmis.mapping;
import java.io.Serializable;
-import java.util.Collection;
-import org.alfresco.cmis.CMISQueryException;
-import org.alfresco.cmis.CMISScope;
-import org.alfresco.cmis.CMISTypeDefinition;
-import org.alfresco.repo.search.impl.lucene.AnalysisMode;
-import org.alfresco.repo.search.impl.lucene.LuceneFunction;
-import org.alfresco.repo.search.impl.lucene.LuceneQueryParser;
-import org.alfresco.repo.search.impl.querymodel.PredicateMode;
+import org.alfresco.opencmis.dictionary.CMISDictionaryService;
import org.alfresco.service.ServiceRegistry;
import org.alfresco.service.cmr.repository.AssociationRef;
import org.alfresco.service.cmr.repository.NodeRef;
-import org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter;
import org.alfresco.service.namespace.QName;
import org.apache.chemistry.opencmis.commons.PropertyIds;
-import org.apache.lucene.index.Term;
-import org.apache.lucene.queryParser.ParseException;
-import org.apache.lucene.search.BooleanClause.Occur;
-import org.apache.lucene.search.BooleanQuery;
-import org.apache.lucene.search.MatchAllDocsQuery;
-import org.apache.lucene.search.Query;
-import org.apache.lucene.search.TermQuery;
+import org.apache.chemistry.opencmis.commons.enums.BaseTypeId;
/**
* Get the CMIS object type id property
@@ -49,14 +35,17 @@ import org.apache.lucene.search.TermQuery;
*/
public class BaseTypeIdProperty extends AbstractProperty
{
+ private CMISDictionaryService dictionaryService;
+
/**
* Construct
*
* @param serviceRegistry
*/
- public BaseTypeIdProperty(ServiceRegistry serviceRegistry)
+ public BaseTypeIdProperty(ServiceRegistry serviceRegistry, CMISDictionaryService dictionaryService)
{
super(serviceRegistry, PropertyIds.BASE_TYPE_ID);
+ this.dictionaryService = dictionaryService;
}
/*
@@ -66,7 +55,7 @@ public class BaseTypeIdProperty extends AbstractProperty
public Serializable getValue(NodeRef nodeRef)
{
QName type = getServiceRegistry().getNodeService().getType(nodeRef);
- return getServiceRegistry().getCMISDictionaryService().findTypeForClass(type).getBaseType().getTypeId().getId();
+ return dictionaryService.findTypeForClass(type).getBaseTypeId().value();
}
/*
@@ -75,113 +64,6 @@ public class BaseTypeIdProperty extends AbstractProperty
*/
public Serializable getValue(AssociationRef assocRef)
{
- QName type = assocRef.getTypeQName();
- return getServiceRegistry().getCMISDictionaryService().findTypeForClass(type, CMISScope.RELATIONSHIP).getBaseType().getTypeId().getId();
- }
-
- @Override
- public Query buildLuceneEquality(LuceneQueryParser lqp, Serializable value, PredicateMode mode, LuceneFunction luceneFunction) throws ParseException
- {
- return lqp.getFieldQuery("TYPE", getBaseType(getValueAsString(value)), AnalysisMode.IDENTIFIER, luceneFunction);
- }
-
- @Override
- public Query buildLuceneInequality(LuceneQueryParser lqp, Serializable value, PredicateMode mode, LuceneFunction luceneFunction) throws ParseException
- {
- return lqp.getDoesNotMatchFieldQuery("TYPE", getBaseType(getValueAsString(value)), AnalysisMode.IDENTIFIER, luceneFunction);
- }
-
- @Override
- public Query buildLuceneIn(LuceneQueryParser lqp, Collection values, Boolean not, PredicateMode mode) throws ParseException
- {
- String field = "TYPE";
-
- // Check type conversion
-
-
- Collection asStrings = DefaultTypeConverter.INSTANCE.convert(String.class, values);
-
- if (asStrings.size() == 0)
- {
- if (not)
- {
- return new MatchAllDocsQuery();
- }
- else
- {
- return new TermQuery(new Term("NO_TOKENS", "__"));
- }
- }
- else if (asStrings.size() == 1)
- {
- String value = asStrings.iterator().next();
- if (not)
- {
- return lqp.getDoesNotMatchFieldQuery(field, getBaseType(value), AnalysisMode.IDENTIFIER, LuceneFunction.FIELD);
- }
- else
- {
- return lqp.getFieldQuery(field, getBaseType(value), AnalysisMode.IDENTIFIER, LuceneFunction.FIELD);
- }
- }
- else
- {
- BooleanQuery booleanQuery = new BooleanQuery();
- if (not)
- {
- booleanQuery.add(new MatchAllDocsQuery(), Occur.MUST);
- }
- for (String value : asStrings)
- {
- Query any = lqp.getFieldQuery(field, getBaseType(value), AnalysisMode.IDENTIFIER, LuceneFunction.FIELD);
- if (not)
- {
- booleanQuery.add(any, Occur.MUST_NOT);
- }
- else
- {
- booleanQuery.add(any, Occur.SHOULD);
- }
- }
- return booleanQuery;
- }
- }
-
- @Override
- public Query buildLuceneExists(LuceneQueryParser lqp, Boolean not) throws ParseException
- {
- if (not)
- {
- return new TermQuery(new Term("NO_TOKENS", "__"));
- }
- else
- {
- return new MatchAllDocsQuery();
- }
- }
-
-
- private String getBaseType(String tableName)
- {
- CMISTypeDefinition typeDef = getServiceRegistry().getCMISDictionaryService().findTypeByQueryName(tableName);
- if (typeDef == null)
- {
- throw new CMISQueryException("Unknwon base type: " + tableName);
- }
- if(!typeDef.getBaseType().equals(typeDef))
- {
- throw new CMISQueryException("Not a base type: " + tableName);
- }
- if(!typeDef.isQueryable())
- {
- throw new CMISQueryException("Base type is not queryable: " + tableName);
- }
- return typeDef.getTypeId().getQName().toString();
- }
-
- private String getValueAsString(Serializable value)
- {
- String asString = DefaultTypeConverter.INSTANCE.convert(String.class, value);
- return asString;
+ return BaseTypeId.CMIS_RELATIONSHIP.value();
}
}
diff --git a/source/java/org/alfresco/opencmis/mapping/CMISMapping.java b/source/java/org/alfresco/opencmis/mapping/CMISMapping.java
deleted file mode 100644
index 91d05b0e1c..0000000000
--- a/source/java/org/alfresco/opencmis/mapping/CMISMapping.java
+++ /dev/null
@@ -1,871 +0,0 @@
-/*
- * Copyright (C) 2005-2010 Alfresco Software Limited.
- *
- * This file is part of Alfresco
- *
- * Alfresco is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Alfresco is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Alfresco. If not, see .
- */
-package org.alfresco.opencmis.mapping;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.Set;
-
-import org.alfresco.cmis.CMISAccessControlFormatEnum;
-import org.alfresco.error.AlfrescoRuntimeException;
-import org.alfresco.model.ContentModel;
-import org.alfresco.opencmis.CMISActionEvaluator;
-import org.alfresco.opencmis.CMISConnector;
-import org.alfresco.service.ServiceRegistry;
-import org.alfresco.service.cmr.dictionary.AspectDefinition;
-import org.alfresco.service.cmr.dictionary.AssociationDefinition;
-import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
-import org.alfresco.service.cmr.repository.AssociationRef;
-import org.alfresco.service.cmr.repository.NodeRef;
-import org.alfresco.service.cmr.security.PermissionService;
-import org.alfresco.service.namespace.NamespaceService;
-import org.alfresco.service.namespace.QName;
-import org.alfresco.util.Pair;
-import org.apache.chemistry.opencmis.commons.PropertyIds;
-import org.apache.chemistry.opencmis.commons.enums.Action;
-import org.apache.chemistry.opencmis.commons.enums.BaseTypeId;
-import org.apache.chemistry.opencmis.commons.enums.PropertyType;
-import org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException;
-import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.springframework.beans.factory.InitializingBean;
-
-/**
- * CMIS <-> Alfresco mappings
- *
- * @author andyh
- */
-public class CMISMapping implements InitializingBean
-{
- // Logger
- protected static final Log logger = LogFactory.getLog(CMISMapping.class);
-
- /**
- * The Alfresco CMIS Namespace
- */
- public static String CMIS_MODEL_NS = "cmis";
- public static String CMIS_MODEL_URI = "http://www.alfresco.org/model/cmis/1.0/cs01";
-
- public static String CMIS_EXT_NS = "cmisext";
- public static String CMIS_EXT_URI = "http://www.alfresco.org/model/cmis/1.0/cs01ext";
-
- /**
- * The Alfresco CMIS Model name.
- */
- public static String CMIS_MODEL_NAME = "cmismodel";
-
- /**
- * The QName for the Alfresco CMIS Model.
- */
- public static QName CMIS_MODEL_QNAME = QName.createQName(CMIS_MODEL_URI, CMIS_MODEL_NAME);
-
- // CMIS Data Types
- public static QName CMIS_DATATYPE_ID = QName.createQName(CMIS_MODEL_URI, "id");
- public static QName CMIS_DATATYPE_URI = QName.createQName(CMIS_MODEL_URI, "uri");
- public static QName CMIS_DATATYPE_XML = QName.createQName(CMIS_MODEL_URI, "xml");
- public static QName CMIS_DATATYPE_HTML = QName.createQName(CMIS_MODEL_URI, "html");
-
- // CMIS Types
- public static QName OBJECT_QNAME = QName.createQName(CMIS_EXT_URI, "object");
- public static QName DOCUMENT_QNAME = QName.createQName(CMIS_MODEL_URI, "document");
- public static QName FOLDER_QNAME = QName.createQName(CMIS_MODEL_URI, "folder");
- public static QName RELATIONSHIP_QNAME = QName.createQName(CMIS_MODEL_URI, "relationship");
- public static QName POLICY_QNAME = QName.createQName(CMIS_MODEL_URI, "policy");
- public static QName ASPECTS_QNAME = QName.createQName(CMIS_EXT_URI, "aspects");
-
- // CMIS Internal Type Ids
- public static String OBJECT_TYPE_ID = "cmisext:object";
-
- /**
- * Basic permissions.
- */
- public static final String CMIS_READ = "cmis:read";
- public static final String CMIS_WRITE = "cmis:write";
- public static final String CMIS_ALL = "cmis:all";
-
- // Service Dependencies
- private ServiceRegistry serviceRegistry;
- private CMISConnector cmisConnector;
-
- // Mappings
- private Map mapAlfrescoQNameToTypeId = new HashMap();
- private Map mapCmisQNameToAlfrescoQName = new HashMap();
- private Map mapAlfrescoQNameToCmisQName = new HashMap();
- private Map mapAlfrescoToCmisDataType = new HashMap();
- private Map mapCmisDataTypeToAlfresco = new HashMap();
- private Map propertyAccessors = new HashMap();
- private Map>> actionEvaluators = new HashMap>>();
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.springframework.beans.factory.InitializingBean#afterPropertiesSet()
- */
- public void afterPropertiesSet() throws Exception
- {
- //
- // Type Mappings
- //
-
- mapAlfrescoQNameToTypeId.put(OBJECT_QNAME, OBJECT_TYPE_ID);
- mapAlfrescoQNameToTypeId.put(DOCUMENT_QNAME, BaseTypeId.CMIS_DOCUMENT.value());
- mapAlfrescoQNameToTypeId.put(FOLDER_QNAME, BaseTypeId.CMIS_FOLDER.value());
- mapAlfrescoQNameToTypeId.put(RELATIONSHIP_QNAME, BaseTypeId.CMIS_RELATIONSHIP.value());
- mapAlfrescoQNameToTypeId.put(POLICY_QNAME, BaseTypeId.CMIS_POLICY.value());
-
- mapAlfrescoQNameToCmisQName.put(ContentModel.TYPE_CONTENT, DOCUMENT_QNAME);
- mapAlfrescoQNameToCmisQName.put(ContentModel.TYPE_FOLDER, FOLDER_QNAME);
-
- mapCmisQNameToAlfrescoQName.put(DOCUMENT_QNAME, ContentModel.TYPE_CONTENT);
- mapCmisQNameToAlfrescoQName.put(FOLDER_QNAME, ContentModel.TYPE_FOLDER);
- mapCmisQNameToAlfrescoQName.put(RELATIONSHIP_QNAME, null);
- mapCmisQNameToAlfrescoQName.put(POLICY_QNAME, null);
-
- //
- // Data Type Mappings
- //
-
- mapAlfrescoToCmisDataType.put(DataTypeDefinition.ANY, null);
- mapAlfrescoToCmisDataType.put(DataTypeDefinition.ASSOC_REF, null);
- mapAlfrescoToCmisDataType.put(DataTypeDefinition.BOOLEAN, PropertyType.BOOLEAN);
- mapAlfrescoToCmisDataType.put(DataTypeDefinition.CATEGORY, PropertyType.ID);
- mapAlfrescoToCmisDataType.put(DataTypeDefinition.CHILD_ASSOC_REF, null);
- mapAlfrescoToCmisDataType.put(DataTypeDefinition.CONTENT, null);
- mapAlfrescoToCmisDataType.put(DataTypeDefinition.DATE, PropertyType.DATETIME);
- mapAlfrescoToCmisDataType.put(DataTypeDefinition.DATETIME, PropertyType.DATETIME);
- mapAlfrescoToCmisDataType.put(DataTypeDefinition.DOUBLE, PropertyType.DECIMAL);
- mapAlfrescoToCmisDataType.put(DataTypeDefinition.FLOAT, PropertyType.DECIMAL);
- mapAlfrescoToCmisDataType.put(DataTypeDefinition.INT, PropertyType.INTEGER);
- mapAlfrescoToCmisDataType.put(DataTypeDefinition.LOCALE, null);
- mapAlfrescoToCmisDataType.put(DataTypeDefinition.PERIOD, null);
- mapAlfrescoToCmisDataType.put(DataTypeDefinition.LONG, PropertyType.INTEGER);
- mapAlfrescoToCmisDataType.put(DataTypeDefinition.MLTEXT, PropertyType.STRING);
- mapAlfrescoToCmisDataType.put(DataTypeDefinition.NODE_REF, PropertyType.ID);
- mapAlfrescoToCmisDataType.put(DataTypeDefinition.PATH, null);
- mapAlfrescoToCmisDataType.put(DataTypeDefinition.QNAME, null);
- mapAlfrescoToCmisDataType.put(DataTypeDefinition.TEXT, PropertyType.STRING);
- mapAlfrescoToCmisDataType.put(CMIS_DATATYPE_ID, PropertyType.ID);
- mapAlfrescoToCmisDataType.put(CMIS_DATATYPE_URI, PropertyType.URI);
- mapAlfrescoToCmisDataType.put(CMIS_DATATYPE_HTML, PropertyType.HTML);
-
- mapCmisDataTypeToAlfresco.put(PropertyType.ID, DataTypeDefinition.TEXT);
- mapCmisDataTypeToAlfresco.put(PropertyType.INTEGER, DataTypeDefinition.LONG);
- mapCmisDataTypeToAlfresco.put(PropertyType.STRING, DataTypeDefinition.TEXT);
- mapCmisDataTypeToAlfresco.put(PropertyType.DECIMAL, DataTypeDefinition.DOUBLE);
- mapCmisDataTypeToAlfresco.put(PropertyType.BOOLEAN, DataTypeDefinition.BOOLEAN);
- mapCmisDataTypeToAlfresco.put(PropertyType.DATETIME, DataTypeDefinition.DATETIME);
- mapCmisDataTypeToAlfresco.put(PropertyType.URI, DataTypeDefinition.TEXT);
- mapCmisDataTypeToAlfresco.put(PropertyType.HTML, DataTypeDefinition.TEXT);
-
- //
- // Property Mappings
- //
-
- registerPropertyAccessor(new ObjectIdProperty(serviceRegistry));
- registerPropertyAccessor(new NodeRefProperty(serviceRegistry));
- registerPropertyAccessor(new ObjectTypeIdProperty(serviceRegistry));
- registerPropertyAccessor(new BaseTypeIdProperty(serviceRegistry));
- registerPropertyAccessor(new DirectProperty(serviceRegistry, PropertyIds.CREATED_BY, ContentModel.PROP_CREATOR));
- registerPropertyAccessor(new DirectProperty(serviceRegistry, PropertyIds.CREATION_DATE,
- ContentModel.PROP_CREATED));
- registerPropertyAccessor(new DirectProperty(serviceRegistry, PropertyIds.LAST_MODIFIED_BY,
- ContentModel.PROP_MODIFIER));
- registerPropertyAccessor(new DirectProperty(serviceRegistry, PropertyIds.LAST_MODIFICATION_DATE,
- ContentModel.PROP_MODIFIED));
- registerPropertyAccessor(new FixedValueProperty(serviceRegistry, PropertyIds.CHANGE_TOKEN, null));
- registerPropertyAccessor(new DirectProperty(serviceRegistry, PropertyIds.NAME, ContentModel.PROP_NAME)
- {
- @Override
- public Serializable getValue(AssociationRef assocRef)
- {
- // Let's use the association ref as the name
- return assocRef.toString();
- }
- });
- registerPropertyAccessor(new IsImmutableProperty(serviceRegistry));
- registerPropertyAccessor(new IsLatestVersionProperty(serviceRegistry));
- registerPropertyAccessor(new IsMajorVersionProperty(serviceRegistry));
- registerPropertyAccessor(new IsLatestMajorVersionProperty(serviceRegistry));
- registerPropertyAccessor(new VersionLabelProperty(serviceRegistry));
- registerPropertyAccessor(new VersionSeriesIdProperty(serviceRegistry));
- registerPropertyAccessor(new IsVersionSeriesCheckedOutProperty(serviceRegistry));
- registerPropertyAccessor(new VersionSeriesCheckedOutByProperty(serviceRegistry));
- registerPropertyAccessor(new VersionSeriesCheckedOutIdProperty(serviceRegistry));
- registerPropertyAccessor(new CheckinCommentProperty(serviceRegistry));
- registerPropertyAccessor(new ContentStreamLengthProperty(serviceRegistry));
- registerPropertyAccessor(new ContentStreamMimetypeProperty(serviceRegistry));
- registerPropertyAccessor(new ContentStreamIdProperty(serviceRegistry));
- registerPropertyAccessor(new DirectProperty(serviceRegistry, PropertyIds.CONTENT_STREAM_FILE_NAME,
- ContentModel.PROP_NAME));
- registerPropertyAccessor(new ParentProperty(serviceRegistry));
- registerPropertyAccessor(new PathProperty(serviceRegistry, cmisConnector));
- registerPropertyAccessor(new AllowedChildObjectTypeIdsProperty(serviceRegistry, this));
- registerPropertyAccessor(new SourceIdProperty(serviceRegistry));
- registerPropertyAccessor(new TargetIdProperty(serviceRegistry));
-
- //
- // Action Evaluator Mappings
- //
-
- // NOTE: The order of evaluators is important - they must be in the
- // order as specified in CMIS-Core.xsd
- // so that schema validation passes
-
- registerEvaluator(BaseTypeId.CMIS_DOCUMENT,
- new CurrentVersionEvaluator(serviceRegistry, new PermissionActionEvaluator(serviceRegistry,
- Action.CAN_DELETE_OBJECT, PermissionService.DELETE_NODE), false));
- registerEvaluator(BaseTypeId.CMIS_DOCUMENT, new CurrentVersionEvaluator(serviceRegistry,
- new PermissionActionEvaluator(serviceRegistry, Action.CAN_UPDATE_PROPERTIES,
- PermissionService.WRITE_PROPERTIES), false));
- registerEvaluator(BaseTypeId.CMIS_DOCUMENT, new PermissionActionEvaluator(serviceRegistry,
- Action.CAN_GET_PROPERTIES, PermissionService.READ_PROPERTIES));
- registerEvaluator(BaseTypeId.CMIS_DOCUMENT, new FixedValueActionEvaluator(serviceRegistry,
- Action.CAN_GET_OBJECT_RELATIONSHIPS, true));
- registerEvaluator(BaseTypeId.CMIS_DOCUMENT, new ParentActionEvaluator(new PermissionActionEvaluator(
- serviceRegistry, Action.CAN_GET_OBJECT_PARENTS, PermissionService.READ_PERMISSIONS)));
- // Is CAN_MOVE correct mapping?
- registerEvaluator(BaseTypeId.CMIS_DOCUMENT, new CurrentVersionEvaluator(serviceRegistry,
- new PermissionActionEvaluator(serviceRegistry, Action.CAN_MOVE_OBJECT, PermissionService.DELETE_NODE),
- false));
- registerEvaluator(BaseTypeId.CMIS_DOCUMENT, new CurrentVersionEvaluator(serviceRegistry,
- new PermissionActionEvaluator(serviceRegistry, Action.CAN_DELETE_CONTENT_STREAM,
- PermissionService.WRITE_PROPERTIES, PermissionService.WRITE_CONTENT), false));
- registerEvaluator(BaseTypeId.CMIS_DOCUMENT, new CurrentVersionEvaluator(serviceRegistry,
- new CanCheckOutActionEvaluator(serviceRegistry), false));
- registerEvaluator(BaseTypeId.CMIS_DOCUMENT, new CurrentVersionEvaluator(serviceRegistry,
- new PermissionActionEvaluator(serviceRegistry, Action.CAN_CANCEL_CHECK_OUT,
- PermissionService.CANCEL_CHECK_OUT), false));
- registerEvaluator(BaseTypeId.CMIS_DOCUMENT, new PermissionActionEvaluator(serviceRegistry, Action.CAN_CHECK_IN,
- PermissionService.CHECK_IN));
- registerEvaluator(BaseTypeId.CMIS_DOCUMENT, new CurrentVersionEvaluator(serviceRegistry,
- new PermissionActionEvaluator(serviceRegistry, Action.CAN_SET_CONTENT_STREAM,
- PermissionService.WRITE_CONTENT), false));
- registerEvaluator(BaseTypeId.CMIS_DOCUMENT, new FixedValueActionEvaluator(serviceRegistry,
- Action.CAN_GET_ALL_VERSIONS, true));
- registerEvaluator(BaseTypeId.CMIS_DOCUMENT, new CurrentVersionEvaluator(serviceRegistry,
- new ParentActionEvaluator(new PermissionActionEvaluator(serviceRegistry,
- Action.CAN_ADD_OBJECT_TO_FOLDER, PermissionService.LINK_CHILDREN)), false));
- // Is CAN_REMOVE_FROM_FOLDER correct mapping?
- registerEvaluator(BaseTypeId.CMIS_DOCUMENT, new CurrentVersionEvaluator(serviceRegistry,
- new ParentActionEvaluator(new FixedValueActionEvaluator(serviceRegistry,
- Action.CAN_REMOVE_OBJECT_FROM_FOLDER, true)), false));
- registerEvaluator(BaseTypeId.CMIS_DOCUMENT, new PermissionActionEvaluator(serviceRegistry,
- Action.CAN_GET_CONTENT_STREAM, PermissionService.READ_CONTENT));
- registerEvaluator(BaseTypeId.CMIS_DOCUMENT, new FixedValueActionEvaluator(serviceRegistry,
- Action.CAN_APPLY_POLICY, false));
- registerEvaluator(BaseTypeId.CMIS_DOCUMENT, new FixedValueActionEvaluator(serviceRegistry,
- Action.CAN_GET_APPLIED_POLICIES, true));
- registerEvaluator(BaseTypeId.CMIS_DOCUMENT, new FixedValueActionEvaluator(serviceRegistry,
- Action.CAN_REMOVE_POLICY, false));
- registerEvaluator(BaseTypeId.CMIS_DOCUMENT, new CurrentVersionEvaluator(serviceRegistry,
- new FixedValueActionEvaluator(serviceRegistry, Action.CAN_CREATE_RELATIONSHIP, true), false));
- registerEvaluator(BaseTypeId.CMIS_DOCUMENT, new FixedValueActionEvaluator(serviceRegistry,
- Action.CAN_GET_RENDITIONS, true));
- registerEvaluator(BaseTypeId.CMIS_DOCUMENT, new PermissionActionEvaluator(serviceRegistry, Action.CAN_GET_ACL,
- PermissionService.READ_PERMISSIONS));
- registerEvaluator(BaseTypeId.CMIS_DOCUMENT, new CurrentVersionEvaluator(serviceRegistry,
- new PermissionActionEvaluator(serviceRegistry, Action.CAN_APPLY_ACL,
- PermissionService.CHANGE_PERMISSIONS), false));
-
- registerEvaluator(BaseTypeId.CMIS_FOLDER,
- new RootFolderEvaluator(serviceRegistry, cmisConnector, new PermissionActionEvaluator(serviceRegistry,
- Action.CAN_DELETE_OBJECT, PermissionService.DELETE_NODE), false));
- registerEvaluator(BaseTypeId.CMIS_FOLDER, new PermissionActionEvaluator(serviceRegistry,
- Action.CAN_UPDATE_PROPERTIES, PermissionService.WRITE_PROPERTIES));
- registerEvaluator(BaseTypeId.CMIS_FOLDER, new PermissionActionEvaluator(serviceRegistry,
- Action.CAN_GET_FOLDER_TREE, PermissionService.READ_CHILDREN));
- registerEvaluator(BaseTypeId.CMIS_FOLDER, new PermissionActionEvaluator(serviceRegistry,
- Action.CAN_GET_PROPERTIES, PermissionService.READ_PROPERTIES));
- registerEvaluator(BaseTypeId.CMIS_FOLDER, new FixedValueActionEvaluator(serviceRegistry,
- Action.CAN_GET_OBJECT_RELATIONSHIPS, true));
- registerEvaluator(BaseTypeId.CMIS_FOLDER, new ParentActionEvaluator(new PermissionActionEvaluator(
- serviceRegistry, Action.CAN_GET_OBJECT_PARENTS, PermissionService.READ_PERMISSIONS)));
- registerEvaluator(BaseTypeId.CMIS_FOLDER, new RootFolderEvaluator(serviceRegistry, cmisConnector,
- new ParentActionEvaluator(new PermissionActionEvaluator(serviceRegistry, Action.CAN_GET_FOLDER_PARENT,
- PermissionService.READ_PERMISSIONS)), false));
- registerEvaluator(BaseTypeId.CMIS_FOLDER, new PermissionActionEvaluator(serviceRegistry,
- Action.CAN_GET_DESCENDANTS, PermissionService.READ_CHILDREN));
- // Is CAN_MOVE_OBJECT correct mapping?
- registerEvaluator(BaseTypeId.CMIS_FOLDER, new RootFolderEvaluator(serviceRegistry, cmisConnector,
- new PermissionActionEvaluator(serviceRegistry, Action.CAN_MOVE_OBJECT, PermissionService.DELETE_NODE),
- false));
- registerEvaluator(BaseTypeId.CMIS_FOLDER, new FixedValueActionEvaluator(serviceRegistry,
- Action.CAN_APPLY_POLICY, false));
- registerEvaluator(BaseTypeId.CMIS_FOLDER, new FixedValueActionEvaluator(serviceRegistry,
- Action.CAN_GET_APPLIED_POLICIES, true));
- registerEvaluator(BaseTypeId.CMIS_FOLDER, new FixedValueActionEvaluator(serviceRegistry,
- Action.CAN_REMOVE_POLICY, false));
- registerEvaluator(BaseTypeId.CMIS_FOLDER, new PermissionActionEvaluator(serviceRegistry,
- Action.CAN_GET_CHILDREN, PermissionService.READ_CHILDREN));
- registerEvaluator(BaseTypeId.CMIS_FOLDER, new PermissionActionEvaluator(serviceRegistry,
- Action.CAN_CREATE_DOCUMENT, PermissionService.CREATE_CHILDREN));
- registerEvaluator(BaseTypeId.CMIS_FOLDER, new PermissionActionEvaluator(serviceRegistry,
- Action.CAN_CREATE_FOLDER, PermissionService.CREATE_CHILDREN));
- registerEvaluator(BaseTypeId.CMIS_FOLDER, new PermissionActionEvaluator(serviceRegistry,
- Action.CAN_CREATE_RELATIONSHIP, PermissionService.CREATE_ASSOCIATIONS));
- registerEvaluator(BaseTypeId.CMIS_FOLDER, new RootFolderEvaluator(serviceRegistry, cmisConnector,
- new PermissionActionEvaluator(serviceRegistry, Action.CAN_DELETE_TREE, PermissionService.DELETE_NODE),
- false));
- registerEvaluator(BaseTypeId.CMIS_FOLDER, new PermissionActionEvaluator(serviceRegistry, Action.CAN_GET_ACL,
- PermissionService.READ_PERMISSIONS));
- registerEvaluator(BaseTypeId.CMIS_FOLDER, new PermissionActionEvaluator(serviceRegistry, Action.CAN_APPLY_ACL,
- PermissionService.CHANGE_PERMISSIONS));
-
- registerEvaluator(BaseTypeId.CMIS_RELATIONSHIP, new FixedValueActionEvaluator(serviceRegistry,
- Action.CAN_DELETE_OBJECT, true));
- registerEvaluator(BaseTypeId.CMIS_RELATIONSHIP, new FixedValueActionEvaluator(serviceRegistry,
- Action.CAN_UPDATE_PROPERTIES, false));
- registerEvaluator(BaseTypeId.CMIS_RELATIONSHIP, new FixedValueActionEvaluator(serviceRegistry,
- Action.CAN_GET_PROPERTIES, true));
- registerEvaluator(BaseTypeId.CMIS_RELATIONSHIP, new FixedValueActionEvaluator(serviceRegistry,
- Action.CAN_GET_ACL, false));
- registerEvaluator(BaseTypeId.CMIS_RELATIONSHIP, new FixedValueActionEvaluator(serviceRegistry,
- Action.CAN_APPLY_ACL, false));
-
- registerEvaluator(BaseTypeId.CMIS_POLICY, new FixedValueActionEvaluator(serviceRegistry,
- Action.CAN_DELETE_OBJECT, false));
- registerEvaluator(BaseTypeId.CMIS_POLICY, new FixedValueActionEvaluator(serviceRegistry,
- Action.CAN_UPDATE_PROPERTIES, false));
- registerEvaluator(BaseTypeId.CMIS_POLICY, new FixedValueActionEvaluator(serviceRegistry,
- Action.CAN_GET_PROPERTIES, false));
- registerEvaluator(BaseTypeId.CMIS_POLICY, new FixedValueActionEvaluator(serviceRegistry,
- Action.CAN_GET_OBJECT_PARENTS, false));
- registerEvaluator(BaseTypeId.CMIS_POLICY, new FixedValueActionEvaluator(serviceRegistry,
- Action.CAN_MOVE_OBJECT, false));
- registerEvaluator(BaseTypeId.CMIS_POLICY, new FixedValueActionEvaluator(serviceRegistry,
- Action.CAN_ADD_OBJECT_TO_FOLDER, false));
- registerEvaluator(BaseTypeId.CMIS_POLICY, new FixedValueActionEvaluator(serviceRegistry,
- Action.CAN_REMOVE_OBJECT_FROM_FOLDER, false));
- registerEvaluator(BaseTypeId.CMIS_POLICY, new FixedValueActionEvaluator(serviceRegistry,
- Action.CAN_GET_OBJECT_RELATIONSHIPS, false));
- registerEvaluator(BaseTypeId.CMIS_POLICY, new FixedValueActionEvaluator(serviceRegistry,
- Action.CAN_GET_ACL, false));
- registerEvaluator(BaseTypeId.CMIS_POLICY, new FixedValueActionEvaluator(serviceRegistry,
- Action.CAN_APPLY_ACL, false));
-
- }
-
- /**
- * @param serviceRegistry
- */
- public void setServiceRegistry(ServiceRegistry serviceRegistry)
- {
- this.serviceRegistry = serviceRegistry;
- }
-
- public void setCmisConnector(CMISConnector cmisConnector)
- {
- this.cmisConnector = cmisConnector;
- }
-
- /**
- * @return namespaceService
- */
- /* package */NamespaceService getNamespaceService()
- {
- return serviceRegistry.getNamespaceService();
- }
-
- /**
- * Gets the CMIS Type Id given the Alfresco QName for the type in any
- * Alfresco model
- *
- * @param typeQName
- * @return
- */
- public String getCmisTypeId(BaseTypeId scope, QName typeQName)
- {
- String typeId = mapAlfrescoQNameToTypeId.get(typeQName);
- if (typeId == null)
- {
- String p = null;
- switch (scope)
- {
- case CMIS_DOCUMENT:
- p = "D";
- break;
- case CMIS_FOLDER:
- p = "F";
- break;
- case CMIS_RELATIONSHIP:
- p = "R";
- break;
- case CMIS_POLICY:
- p = "P";
- break;
- default:
- throw new CmisRuntimeException("Invalid base type!");
- }
-
- return p + ":" + typeQName.toPrefixString(serviceRegistry.getNamespaceService());
- } else
- {
- return typeId;
- }
- }
-
- public String getCmisTypeId(QName classQName)
- {
- if (classQName.equals(ContentModel.TYPE_CONTENT))
- {
- return getCmisTypeId(BaseTypeId.CMIS_DOCUMENT, classQName);
- }
- if (classQName.equals(ContentModel.TYPE_FOLDER))
- {
- return getCmisTypeId(BaseTypeId.CMIS_FOLDER, classQName);
- }
- if (classQName.equals(CMISMapping.RELATIONSHIP_QNAME))
- {
- return getCmisTypeId(BaseTypeId.CMIS_RELATIONSHIP, classQName);
- }
- if (classQName.equals(CMISMapping.POLICY_QNAME))
- {
- return getCmisTypeId(BaseTypeId.CMIS_POLICY, classQName);
- }
- if (classQName.equals(CMISMapping.ASPECTS_QNAME))
- {
- return getCmisTypeId(BaseTypeId.CMIS_POLICY, classQName);
- }
- if (isValidCmisDocument(classQName))
- {
- return getCmisTypeId(BaseTypeId.CMIS_DOCUMENT, classQName);
- }
- if (isValidCmisFolder(classQName))
- {
- return getCmisTypeId(BaseTypeId.CMIS_FOLDER, classQName);
- }
- if (isValidCmisRelationship(classQName))
- {
- return getCmisTypeId(BaseTypeId.CMIS_RELATIONSHIP, classQName);
- }
- if (isValidCmisPolicy(classQName))
- {
- return getCmisTypeId(BaseTypeId.CMIS_POLICY, classQName);
- }
-
- return null;
- }
-
- public String buildPrefixEncodedString(QName qname)
- {
- return qname.toPrefixString(serviceRegistry.getNamespaceService());
- }
-
- public QName getAlfrescoName(String typeId)
- {
- // Is it an Alfresco type id?
- if (typeId.length() < 4 || typeId.charAt(1) != ':')
- {
- throw new CmisInvalidArgumentException("Malformed type id '" + typeId + "'");
- }
-
- return QName.createQName(typeId.substring(2), serviceRegistry.getNamespaceService());
- }
-
- /**
- * Is this a valid cmis document or folder type (not a relationship)
- *
- * @param dictionaryService
- * @param typeQName
- * @return
- */
- public boolean isValidCmisDocumentOrFolder(QName typeQName)
- {
- return isValidCmisFolder(typeQName) || isValidCmisDocument(typeQName);
- }
-
- public boolean isValidCmisObject(BaseTypeId scope, QName qname)
- {
- switch (scope)
- {
- case CMIS_DOCUMENT:
- return isValidCmisDocument(qname);
- case CMIS_FOLDER:
- return isValidCmisFolder(qname);
- case CMIS_POLICY:
- return isValidCmisPolicy(qname);
- case CMIS_RELATIONSHIP:
- return isValidCmisRelationship(qname);
- }
-
- return false;
- }
-
- /**
- * Is this a valid CMIS folder type?
- *
- * @param dictionaryService
- * @param typeQName
- * @return
- */
- public boolean isValidCmisFolder(QName typeQName)
- {
- if (typeQName == null)
- {
- return false;
- }
- if (typeQName.equals(FOLDER_QNAME))
- {
- return true;
- }
-
- if (serviceRegistry.getDictionaryService().isSubClass(typeQName, ContentModel.TYPE_FOLDER))
- {
- if (typeQName.equals(ContentModel.TYPE_FOLDER))
- {
- return false;
- } else
- {
- return true;
- }
- }
-
- return false;
- }
-
- /**
- * Is this a valid CMIS document type?
- *
- * @param dictionaryService
- * @param typeQName
- * @return
- */
- public boolean isValidCmisDocument(QName typeQName)
- {
- if (typeQName == null)
- {
- return false;
- }
- if (typeQName.equals(DOCUMENT_QNAME))
- {
- return true;
- }
-
- if (serviceRegistry.getDictionaryService().isSubClass(typeQName, ContentModel.TYPE_CONTENT))
- {
- if (typeQName.equals(ContentModel.TYPE_CONTENT))
- {
- return false;
- } else
- {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Is this a valid CMIS policy type?
- *
- * @param dictionaryService
- * @param typeQName
- * @return
- */
- public boolean isValidCmisPolicy(QName typeQName)
- {
- if (typeQName == null)
- {
- return false;
- }
- if (typeQName.equals(POLICY_QNAME))
- {
- return true;
- }
- if (typeQName.equals(ASPECTS_QNAME))
- {
- return true;
- }
-
- AspectDefinition aspectDef = serviceRegistry.getDictionaryService().getAspect(typeQName);
- if (aspectDef == null)
- {
- return false;
- }
-
- if (aspectDef.getName().equals(ContentModel.ASPECT_VERSIONABLE)
- || aspectDef.getName().equals(ContentModel.ASPECT_AUDITABLE)
- || aspectDef.getName().equals(ContentModel.ASPECT_REFERENCEABLE))
- {
- return false;
- }
- return true;
- }
-
- /**
- * Is an association valid in CMIS? It must be a non-child relationship and
- * the source and target must both be valid CMIS types.
- *
- * @param dictionaryService
- * @param associationQName
- * @return
- */
- public boolean isValidCmisRelationship(QName associationQName)
- {
- if (associationQName == null)
- {
- return false;
- }
- if (associationQName.equals(RELATIONSHIP_QNAME))
- {
- return true;
- }
- AssociationDefinition associationDefinition = serviceRegistry.getDictionaryService().getAssociation(
- associationQName);
- if (associationDefinition == null)
- {
- return false;
- }
- if (associationDefinition.isChild())
- {
- return false;
- }
- return true;
- }
-
- /**
- * Given an Alfresco model type map it to the appropriate type. Maps
- * cm:folder and cm:content to the CMIS definitions
- */
- public QName getCmisType(QName typeQName)
- {
- QName mapped = mapAlfrescoQNameToCmisQName.get(typeQName);
- if (mapped != null)
- {
- return mapped;
- }
- return typeQName;
- }
-
- /**
- * Is Alfresco Type mapped to an alternative CMIS Type?
- */
- public boolean isRemappedType(QName typeQName)
- {
- return mapAlfrescoQNameToCmisQName.containsKey(typeQName);
- }
-
- /**
- * Given a CMIS model type map it to the appropriate Alfresco type.
- *
- * @param cmisTypeQName
- * @return
- */
- public QName getAlfrescoClass(QName cmisTypeQName)
- {
- QName mapped = mapCmisQNameToAlfrescoQName.get(cmisTypeQName);
- if (mapped != null)
- {
- return mapped;
- }
- return cmisTypeQName;
- }
-
- /**
- * Get the CMIS property type for a property
- *
- * @param dictionaryService
- * @param propertyQName
- * @return
- */
- public PropertyType getDataType(DataTypeDefinition datatype)
- {
- return getDataType(datatype.getName());
- }
-
- public PropertyType getDataType(QName dataType)
- {
- return mapAlfrescoToCmisDataType.get(dataType);
- }
-
- public QName getAlfrescoDataType(PropertyType propertyType)
- {
- return mapCmisDataTypeToAlfresco.get(propertyType);
- }
-
- /**
- * @param namespaceService
- * @param propertyQName
- * @return
- */
- public String getCmisPropertyId(QName propertyQName)
- {
- return propertyQName.toPrefixString(serviceRegistry.getNamespaceService());
- }
-
- /**
- * Get a Property Accessor
- */
- public AbstractProperty getPropertyAccessor(String propertyId)
- {
- return propertyAccessors.get(propertyId);
- }
-
- /**
- * Register pre-defined Property Accessor
- *
- * @param propertyAccessor
- */
- private void registerPropertyAccessor(AbstractProperty propertyAccessor)
- {
- propertyAccessors.put(propertyAccessor.getName(), propertyAccessor);
- }
-
- /**
- * Gets the Action Evaluators applicable for the given CMIS Scope
- */
- public Map> getActionEvaluators(BaseTypeId scope)
- {
- Map> evaluators = actionEvaluators.get(scope);
- if (evaluators == null)
- {
- evaluators = Collections.emptyMap();
- }
- return evaluators;
- }
-
- /**
- * Register an Action Evaluator
- *
- * @param scope
- * @param evaluator
- */
- private void registerEvaluator(BaseTypeId scope, CMISActionEvaluator extends Object> evaluator)
- {
- Map> evaluators = actionEvaluators.get(scope);
- if (evaluators == null)
- {
- evaluators = new LinkedHashMap>();
- actionEvaluators.put(scope, evaluators);
- }
- if (evaluators.get(evaluator.getAction()) != null)
- {
- throw new AlfrescoRuntimeException("Already registered Action Evaluator " + evaluator.getAction()
- + " for scope " + scope);
- }
- evaluators.put(evaluator.getAction(), evaluator);
-
- if (logger.isDebugEnabled())
- logger.debug("Registered Action Evaluator: scope=" + scope + ", evaluator=" + evaluator);
- }
-
- public Collection> getReportedPermissions(String permission, Set permissions,
- boolean hasFull, boolean isDirect, CMISAccessControlFormatEnum format)
- {
- ArrayList> answer = new ArrayList>(20);
- // indirect
-
- if (hasFull)
- {
- answer.add(new Pair(CMIS_READ, false));
- answer.add(new Pair(CMIS_WRITE, false));
- answer.add(new Pair(CMIS_ALL, false));
- }
-
- for (String perm : permissions)
- {
- if (PermissionService.READ.equals(perm))
- {
- answer.add(new Pair(CMIS_READ, false));
- } else if (PermissionService.WRITE.equals(perm))
- {
- answer.add(new Pair(CMIS_WRITE, false));
- } else if (PermissionService.ALL_PERMISSIONS.equals(perm))
- {
- answer.add(new Pair(CMIS_READ, false));
- answer.add(new Pair(CMIS_WRITE, false));
- answer.add(new Pair(CMIS_ALL, false));
- }
-
- if (hasFull)
- {
- answer.add(new Pair(CMIS_READ, false));
- answer.add(new Pair(CMIS_WRITE, false));
- answer.add(new Pair(CMIS_ALL, false));
- }
- }
-
- // permission
-
- if (format == CMISAccessControlFormatEnum.REPOSITORY_SPECIFIC_PERMISSIONS)
- {
- if (PermissionService.READ.equals(permission))
- {
- answer.add(new Pair(CMIS_READ, false));
- answer.add(new Pair(permission, isDirect));
- } else if (PermissionService.WRITE.equals(permission))
- {
- answer.add(new Pair(CMIS_WRITE, false));
- answer.add(new Pair(permission, isDirect));
- } else if (PermissionService.ALL_PERMISSIONS.equals(permission))
- {
- answer.add(new Pair(CMIS_ALL, false));
- answer.add(new Pair(permission, isDirect));
- } else
- {
- answer.add(new Pair(permission, isDirect));
- }
- } else if (format == CMISAccessControlFormatEnum.CMIS_BASIC_PERMISSIONS)
- {
- if (PermissionService.READ.equals(permission))
- {
- answer.add(new Pair(CMIS_READ, isDirect));
- } else if (PermissionService.WRITE.equals(permission))
- {
- answer.add(new Pair(CMIS_WRITE, isDirect));
- } else if (PermissionService.ALL_PERMISSIONS.equals(permission))
- {
- answer.add(new Pair(CMIS_ALL, isDirect));
- } else
- {
- // else nothing
- }
- }
-
- return answer;
- }
-
- /**
- * @param permission
- * @return permission to set
- */
- public String getSetPermission(String permission)
- {
- if (permission.equals(CMIS_READ))
- {
- return PermissionService.READ;
- } else if (permission.equals(CMIS_WRITE))
- {
- return PermissionService.WRITE;
- } else if (permission.equals(CMIS_ALL))
- {
- return PermissionService.ALL_PERMISSIONS;
- } else
- {
- return permission;
- }
- }
-
-}
diff --git a/source/java/org/alfresco/opencmis/mapping/ContentStreamLengthProperty.java b/source/java/org/alfresco/opencmis/mapping/ContentStreamLengthProperty.java
index 65f0c69b76..e994314764 100644
--- a/source/java/org/alfresco/opencmis/mapping/ContentStreamLengthProperty.java
+++ b/source/java/org/alfresco/opencmis/mapping/ContentStreamLengthProperty.java
@@ -22,11 +22,9 @@ import java.io.Serializable;
import org.alfresco.model.ContentModel;
import org.alfresco.service.ServiceRegistry;
-import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
import org.alfresco.service.cmr.repository.ContentData;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter;
-import org.alfresco.service.namespace.QName;
import org.apache.chemistry.opencmis.commons.PropertyIds;
/**
@@ -34,7 +32,7 @@ import org.apache.chemistry.opencmis.commons.PropertyIds;
*
* @author andyh
*/
-public class ContentStreamLengthProperty extends AbstractSimpleProperty
+public class ContentStreamLengthProperty extends AbstractProperty
{
/**
* Construct
@@ -65,31 +63,4 @@ public class ContentStreamLengthProperty extends AbstractSimpleProperty
return 0L;
}
}
-
- public String getLuceneFieldName()
- {
- StringBuilder field = new StringBuilder(128);
- field.append("@");
- field.append(ContentModel.PROP_CONTENT);
- field.append(".size");
- return field.toString();
- }
-
- protected String getValueAsString(Serializable value)
- {
- Object converted = DefaultTypeConverter.INSTANCE.convert(getServiceRegistry().getDictionaryService()
- .getDataType(DataTypeDefinition.LONG), value);
- String asString = DefaultTypeConverter.INSTANCE.convert(String.class, converted);
- return asString;
- }
-
- protected QName getQNameForExists()
- {
- return ContentModel.PROP_CONTENT;
- }
-
- protected DataTypeDefinition getInDataType()
- {
- return getServiceRegistry().getDictionaryService().getDataType(DataTypeDefinition.LONG);
- }
}
diff --git a/source/java/org/alfresco/opencmis/mapping/ContentStreamMimetypeProperty.java b/source/java/org/alfresco/opencmis/mapping/ContentStreamMimetypeProperty.java
index d7106c7e42..6af16d7d64 100644
--- a/source/java/org/alfresco/opencmis/mapping/ContentStreamMimetypeProperty.java
+++ b/source/java/org/alfresco/opencmis/mapping/ContentStreamMimetypeProperty.java
@@ -34,7 +34,7 @@ import org.apache.chemistry.opencmis.commons.PropertyIds;
*
* @author andyh
*/
-public class ContentStreamMimetypeProperty extends AbstractSimpleProperty
+public class ContentStreamMimetypeProperty extends AbstractProperty
{
/**
* Construct
diff --git a/source/java/org/alfresco/opencmis/mapping/CurrentVersionEvaluator.java b/source/java/org/alfresco/opencmis/mapping/CurrentVersionEvaluator.java
index 7c4770e38b..ccb5f35e68 100644
--- a/source/java/org/alfresco/opencmis/mapping/CurrentVersionEvaluator.java
+++ b/source/java/org/alfresco/opencmis/mapping/CurrentVersionEvaluator.java
@@ -21,7 +21,7 @@ package org.alfresco.opencmis.mapping;
import java.io.Serializable;
import org.alfresco.model.ContentModel;
-import org.alfresco.opencmis.CMISActionEvaluator;
+import org.alfresco.opencmis.dictionary.CMISActionEvaluator;
import org.alfresco.repo.version.VersionBaseModel;
import org.alfresco.service.ServiceRegistry;
import org.alfresco.service.cmr.repository.NodeRef;
diff --git a/source/java/org/alfresco/opencmis/mapping/DirectProperty.java b/source/java/org/alfresco/opencmis/mapping/DirectProperty.java
index ddac3b618f..062e13706e 100644
--- a/source/java/org/alfresco/opencmis/mapping/DirectProperty.java
+++ b/source/java/org/alfresco/opencmis/mapping/DirectProperty.java
@@ -19,122 +19,19 @@
package org.alfresco.opencmis.mapping;
import java.io.Serializable;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Locale;
-import org.alfresco.repo.search.MLAnalysisMode;
-import org.alfresco.repo.search.SearcherException;
-import org.alfresco.repo.search.impl.lucene.LuceneQueryParser;
-import org.alfresco.repo.search.impl.lucene.analysis.DateTimeAnalyser;
import org.alfresco.service.ServiceRegistry;
-import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
-import org.alfresco.service.cmr.dictionary.PropertyDefinition;
import org.alfresco.service.cmr.repository.AssociationRef;
import org.alfresco.service.cmr.repository.NodeRef;
-import org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter;
import org.alfresco.service.namespace.QName;
-import org.apache.lucene.index.IndexReader.FieldOption;
-import org.springframework.extensions.surf.util.I18NUtil;
/**
* A simple 1-1 property mapping from a CMIS property name to an alfresco property
*
* @author andyh
*/
-public class DirectProperty extends AbstractSimpleProperty
+public class DirectProperty extends AbstractProperty
{
- /*
- * (non-Javadoc)
- * @see org.alfresco.cmis.mapping.AbstractSimpleProperty#getLuceneSortField()
- */
- @Override
- public String getLuceneSortField(LuceneQueryParser lqp)
- {
-
- String field = getLuceneFieldName();
- // need to find the real field to use
- Locale sortLocale = null;
-
- PropertyDefinition propertyDef = getServiceRegistry().getDictionaryService().getProperty(QName.createQName(field.substring(1)));
-
- if (propertyDef.getDataType().getName().equals(DataTypeDefinition.CONTENT))
- {
- throw new SearcherException("Order on content properties is not curently supported");
- }
- else if ((propertyDef.getDataType().getName().equals(DataTypeDefinition.MLTEXT)) || (propertyDef.getDataType().getName().equals(DataTypeDefinition.TEXT)))
- {
- List locales = lqp.getSearchParameters().getLocales();
- if (((locales == null) || (locales.size() == 0)))
- {
- locales = Collections.singletonList(I18NUtil.getLocale());
- }
-
- if (locales.size() > 1)
- {
- throw new SearcherException("Order on text/mltext properties with more than one locale is not curently supported");
- }
-
- sortLocale = locales.get(0);
- // find best field match
-
- HashSet allowableLocales = new HashSet();
- MLAnalysisMode analysisMode = lqp.getDefaultSearchMLAnalysisMode();
- for (Locale l : MLAnalysisMode.getLocales(analysisMode, sortLocale, false))
- {
- allowableLocales.add(l.toString());
- }
-
- String sortField = field;
-
- for (Object current : lqp.getIndexReader().getFieldNames(FieldOption.INDEXED))
- {
- String currentString = (String) current;
- if (currentString.startsWith(field) && currentString.endsWith(".sort"))
- {
- String fieldLocale = currentString.substring(field.length() + 1, currentString.length() - 5);
- if (allowableLocales.contains(fieldLocale))
- {
- if (fieldLocale.equals(sortLocale.toString()))
- {
- sortField = currentString;
- break;
- }
- else if (sortLocale.toString().startsWith(fieldLocale))
- {
- if (sortField.equals(field) || (currentString.length() < sortField.length()))
- {
- sortField = currentString;
- }
- }
- else if (fieldLocale.startsWith(sortLocale.toString()))
- {
- if (sortField.equals(field) || (currentString.length() < sortField.length()))
- {
- sortField = currentString;
- }
- }
- }
- }
- }
-
- field = sortField;
-
- }
- else if (propertyDef.getDataType().getName().equals(DataTypeDefinition.DATETIME))
- {
- DataTypeDefinition dataType = propertyDef.getDataType();
- String analyserClassName = dataType.getAnalyserClassName();
- if (analyserClassName.equals(DateTimeAnalyser.class.getCanonicalName()))
- {
- field = field + ".sort";
- }
- }
-
- return field;
- }
-
private QName alfrescoName;
/**
@@ -176,32 +73,5 @@ public class DirectProperty extends AbstractSimpleProperty
{
return null;
}
-
- public String getLuceneFieldName()
- {
- StringBuilder field = new StringBuilder(64);
- field.append("@");
- field.append(alfrescoName);
- return field.toString();
- }
-
- protected String getValueAsString(Serializable value)
- {
- PropertyDefinition pd = getServiceRegistry().getDictionaryService().getProperty(alfrescoName);
- Object converted = DefaultTypeConverter.INSTANCE.convert(pd.getDataType(), value);
- String asString = DefaultTypeConverter.INSTANCE.convert(String.class, converted);
- return asString;
- }
-
- protected QName getQNameForExists()
- {
- return alfrescoName;
- }
-
- protected DataTypeDefinition getInDataType()
- {
- PropertyDefinition pd = getServiceRegistry().getDictionaryService().getProperty(alfrescoName);
- return pd.getDataType();
- }
-
+
}
diff --git a/source/java/org/alfresco/opencmis/mapping/FixedValueProperty.java b/source/java/org/alfresco/opencmis/mapping/FixedValueProperty.java
index b6fa336fb4..4e78fe081f 100644
--- a/source/java/org/alfresco/opencmis/mapping/FixedValueProperty.java
+++ b/source/java/org/alfresco/opencmis/mapping/FixedValueProperty.java
@@ -19,24 +19,10 @@
package org.alfresco.opencmis.mapping;
import java.io.Serializable;
-import java.util.Collection;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import org.alfresco.repo.search.impl.lucene.LuceneFunction;
-import org.alfresco.repo.search.impl.lucene.LuceneQueryParser;
-import org.alfresco.repo.search.impl.querymodel.PredicateMode;
import org.alfresco.service.ServiceRegistry;
import org.alfresco.service.cmr.repository.AssociationRef;
import org.alfresco.service.cmr.repository.NodeRef;
-import org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter;
-import org.alfresco.util.EqualsHelper;
-import org.alfresco.util.SearchLanguageConversion;
-import org.apache.lucene.index.Term;
-import org.apache.lucene.queryParser.ParseException;
-import org.apache.lucene.search.MatchAllDocsQuery;
-import org.apache.lucene.search.Query;
-import org.apache.lucene.search.TermQuery;
/**
* Property accessor for fixed value mapping (eg to null, true, etc)
@@ -77,244 +63,4 @@ public class FixedValueProperty extends AbstractProperty
{
return value;
}
-
- /*
- * (non-Javadoc)
- * @see org.alfresco.cmis.property.PropertyLuceneBuilder#buildLuceneEquality(org.alfresco.repo.search.impl.lucene.LuceneQueryParser, java.io.Serializable, org.alfresco.repo.search.impl.querymodel.PredicateMode)
- */
- public Query buildLuceneEquality(LuceneQueryParser lqp, Serializable value, PredicateMode mode, LuceneFunction luceneFunction) throws ParseException
- {
- if (EqualsHelper.nullSafeEquals(value, value))
- {
- return new MatchAllDocsQuery();
- }
- else
- {
- return new TermQuery(new Term("NO_TOKENS", "__"));
- }
- }
-
- /*
- * (non-Javadoc)
- * @see org.alfresco.cmis.property.PropertyLuceneBuilder#buildLuceneExists(org.alfresco.repo.search.impl.lucene.LuceneQueryParser, java.lang.Boolean)
- */
- public Query buildLuceneExists(LuceneQueryParser lqp, Boolean not) throws ParseException
- {
- if (not)
- {
- if (value == null)
- {
- return new MatchAllDocsQuery();
- }
- else
- {
- return new TermQuery(new Term("NO_TOKENS", "__"));
- }
- }
- else
- {
- if (value == null)
- {
- return new TermQuery(new Term("NO_TOKENS", "__"));
- }
- else
- {
- return new MatchAllDocsQuery();
- }
- }
-
- }
-
- /*
- * (non-Javadoc)
- * @see org.alfresco.cmis.property.PropertyLuceneBuilder#buildLuceneGreaterThan(org.alfresco.repo.search.impl.lucene.LuceneQueryParser, java.io.Serializable, org.alfresco.repo.search.impl.querymodel.PredicateMode)
- */
- @SuppressWarnings("unchecked")
- public Query buildLuceneGreaterThan(LuceneQueryParser lqp, Serializable value, PredicateMode mode, LuceneFunction luceneFunction) throws ParseException
- {
- if (value instanceof Comparable)
- {
- Comparable comparable = (Comparable) value;
- if (comparable.compareTo(value) > 0)
- {
- return new MatchAllDocsQuery();
- }
- else
- {
- return new TermQuery(new Term("NO_TOKENS", "__"));
- }
- }
- else
- {
- return new TermQuery(new Term("NO_TOKENS", "__"));
- }
- }
-
- /*
- * (non-Javadoc)
- * @see org.alfresco.cmis.property.PropertyLuceneBuilder#buildLuceneGreaterThanOrEquals(org.alfresco.repo.search.impl.lucene.LuceneQueryParser, java.io.Serializable, org.alfresco.repo.search.impl.querymodel.PredicateMode)
- */
- @SuppressWarnings("unchecked")
- public Query buildLuceneGreaterThanOrEquals(LuceneQueryParser lqp, Serializable value, PredicateMode mode, LuceneFunction luceneFunction) throws ParseException
- {
- if (value instanceof Comparable)
- {
- Comparable comparable = (Comparable) value;
- if (comparable.compareTo(value) >= 0)
- {
- return new MatchAllDocsQuery();
- }
- else
- {
- return new TermQuery(new Term("NO_TOKENS", "__"));
- }
- }
- else
- {
- return new TermQuery(new Term("NO_TOKENS", "__"));
- }
- }
-
- /*
- * (non-Javadoc)
- * @see org.alfresco.cmis.property.PropertyLuceneBuilder#buildLuceneIn(org.alfresco.repo.search.impl.lucene.LuceneQueryParser, java.util.Collection, java.lang.Boolean, org.alfresco.repo.search.impl.querymodel.PredicateMode)
- */
- public Query buildLuceneIn(LuceneQueryParser lqp, Collection values, Boolean not, PredicateMode mode) throws ParseException
- {
- boolean in = false;
- for (Serializable value : values)
- {
- if (EqualsHelper.nullSafeEquals(value, value))
- {
- in = true;
- break;
- }
- }
-
- if (in == !not)
- {
- return new MatchAllDocsQuery();
- }
- else
- {
- return new TermQuery(new Term("NO_TOKENS", "__"));
- }
- }
-
- /*
- * (non-Javadoc)
- * @see org.alfresco.cmis.property.PropertyLuceneBuilder#buildLuceneInequality(org.alfresco.repo.search.impl.lucene.LuceneQueryParser, java.io.Serializable, org.alfresco.repo.search.impl.querymodel.PredicateMode)
- */
- public Query buildLuceneInequality(LuceneQueryParser lqp, Serializable value, PredicateMode mode, LuceneFunction luceneFunction) throws ParseException
- {
- if (!EqualsHelper.nullSafeEquals(value, value))
- {
- return new MatchAllDocsQuery();
- }
- else
- {
- return new TermQuery(new Term("NO_TOKENS", "__"));
- }
- }
-
- /*
- * (non-Javadoc)
- * @see org.alfresco.cmis.property.PropertyLuceneBuilder#buildLuceneLessThan(org.alfresco.repo.search.impl.lucene.LuceneQueryParser, java.io.Serializable, org.alfresco.repo.search.impl.querymodel.PredicateMode)
- */
- @SuppressWarnings("unchecked")
- public Query buildLuceneLessThan(LuceneQueryParser lqp, Serializable value, PredicateMode mode, LuceneFunction luceneFunction) throws ParseException
- {
- if (value instanceof Comparable)
- {
- Comparable comparable = (Comparable) value;
- if (comparable.compareTo(value) < 0)
- {
- return new MatchAllDocsQuery();
- }
- else
- {
- return new TermQuery(new Term("NO_TOKENS", "__"));
- }
- }
- else
- {
- return new TermQuery(new Term("NO_TOKENS", "__"));
- }
- }
-
- /*
- * (non-Javadoc)
- * @see org.alfresco.cmis.property.PropertyLuceneBuilder#buildLuceneLessThanOrEquals(org.alfresco.repo.search.impl.lucene.LuceneQueryParser, java.io.Serializable, org.alfresco.repo.search.impl.querymodel.PredicateMode)
- */
- @SuppressWarnings("unchecked")
- public Query buildLuceneLessThanOrEquals(LuceneQueryParser lqp, Serializable value, PredicateMode mode, LuceneFunction luceneFunction) throws ParseException
- {
- if (value instanceof Comparable)
- {
- Comparable comparable = (Comparable) value;
- if (comparable.compareTo(value) <= 0)
- {
- return new MatchAllDocsQuery();
- }
- else
- {
- return new TermQuery(new Term("NO_TOKENS", "__"));
- }
- }
- else
- {
- return new TermQuery(new Term("NO_TOKENS", "__"));
- }
- }
-
- /*
- * (non-Javadoc)
- * @see org.alfresco.cmis.property.PropertyLuceneBuilder#buildLuceneLike(org.alfresco.repo.search.impl.lucene.LuceneQueryParser, java.io.Serializable, java.lang.Boolean)
- */
- public Query buildLuceneLike(LuceneQueryParser lqp, Serializable value, Boolean not) throws ParseException
- {
- if (value != null)
- {
- boolean matches = false;
-
- Object converted = DefaultTypeConverter.INSTANCE.convert(value.getClass(), value);
- String asString = DefaultTypeConverter.INSTANCE.convert(String.class, converted);
- String regExpression = SearchLanguageConversion.convertSQLLikeToRegex(asString);
- Pattern pattern = Pattern.compile(regExpression);
- String target = DefaultTypeConverter.INSTANCE.convert(String.class, value);
- Matcher matcher = pattern.matcher(target);
- if (matcher.matches())
- {
- matches = true;
- }
-
- if (matches == !not)
- {
- return new MatchAllDocsQuery();
- }
- else
- {
- return new TermQuery(new Term("NO_TOKENS", "__"));
- }
- }
- else
- {
- return new TermQuery(new Term("NO_TOKENS", "__"));
- }
- }
-
- /*
- * (non-Javadoc)
- * @see org.alfresco.cmis.property.PropertyLuceneBuilder#getLuceneSortField()
- */
- public String getLuceneSortField(LuceneQueryParser lqp)
- {
- throw new UnsupportedOperationException();
- }
-
- public String getLuceneFieldName()
- {
- throw new UnsupportedOperationException();
- }
-
}
diff --git a/source/java/org/alfresco/opencmis/mapping/NodeRefProperty.java b/source/java/org/alfresco/opencmis/mapping/NodeRefProperty.java
index 9dd8fd6452..ee456cb6f7 100644
--- a/source/java/org/alfresco/opencmis/mapping/NodeRefProperty.java
+++ b/source/java/org/alfresco/opencmis/mapping/NodeRefProperty.java
@@ -29,7 +29,7 @@ import org.alfresco.service.cmr.repository.NodeRef;
*/
public class NodeRefProperty extends AbstractVersioningProperty
{
- public static final String NodeRefPropertyId = "alf:nodeRef";
+ public static final String NodeRefPropertyId = "alfcmis:nodeRef";
/**
* Construct
diff --git a/source/java/org/alfresco/opencmis/mapping/ObjectIdProperty.java b/source/java/org/alfresco/opencmis/mapping/ObjectIdProperty.java
index 892b9041f9..4b876dd138 100644
--- a/source/java/org/alfresco/opencmis/mapping/ObjectIdProperty.java
+++ b/source/java/org/alfresco/opencmis/mapping/ObjectIdProperty.java
@@ -19,29 +19,14 @@
package org.alfresco.opencmis.mapping;
import java.io.Serializable;
-import java.util.Collection;
-import org.alfresco.cmis.CMISQueryException;
import org.alfresco.model.ContentModel;
import org.alfresco.opencmis.CMISConnector;
-import org.alfresco.repo.search.impl.lucene.AnalysisMode;
-import org.alfresco.repo.search.impl.lucene.LuceneFunction;
-import org.alfresco.repo.search.impl.lucene.LuceneQueryParser;
-import org.alfresco.repo.search.impl.querymodel.PredicateMode;
import org.alfresco.service.ServiceRegistry;
-import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
import org.alfresco.service.cmr.repository.AssociationRef;
import org.alfresco.service.cmr.repository.NodeRef;
-import org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter;
import org.alfresco.service.namespace.QName;
import org.apache.chemistry.opencmis.commons.PropertyIds;
-import org.apache.lucene.index.Term;
-import org.apache.lucene.queryParser.ParseException;
-import org.apache.lucene.search.BooleanClause.Occur;
-import org.apache.lucene.search.BooleanQuery;
-import org.apache.lucene.search.MatchAllDocsQuery;
-import org.apache.lucene.search.Query;
-import org.apache.lucene.search.TermQuery;
/**
* Get the CMIS object id property.
@@ -106,229 +91,4 @@ public class ObjectIdProperty extends AbstractVersioningProperty
return CMISConnector.ASSOC_ID_PREFIX + assocRef.getId();
}
- public String getLuceneFieldName()
- {
- return "ID";
- }
-
- private String getValueAsString(Serializable value)
- {
- Object converted = DefaultTypeConverter.INSTANCE.convert(getServiceRegistry().getDictionaryService()
- .getDataType(DataTypeDefinition.NODE_REF), value);
- String asString = DefaultTypeConverter.INSTANCE.convert(String.class, converted);
- return asString;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.alfresco.cmis.property.PropertyLuceneBuilder#buildLuceneEquality(
- * org.alfresco.repo.search.impl.lucene.LuceneQueryParser,
- * java.io.Serializable,
- * org.alfresco.repo.search.impl.querymodel.PredicateMode)
- */
- public Query buildLuceneEquality(LuceneQueryParser lqp, Serializable value, PredicateMode mode,
- LuceneFunction luceneFunction) throws ParseException
- {
- String field = getLuceneFieldName();
- String stringValue = getValueAsString(value);
- return lqp.getFieldQuery(field, stringValue, AnalysisMode.IDENTIFIER, luceneFunction);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.alfresco.cmis.property.PropertyLuceneBuilder#buildLuceneExists(org
- * .alfresco.repo.search.impl.lucene.LuceneQueryParser, java.lang.Boolean)
- */
- public Query buildLuceneExists(LuceneQueryParser lqp, Boolean not) throws ParseException
- {
- if (not)
- {
- return new TermQuery(new Term("NO_TOKENS", "__"));
- } else
- {
- return new MatchAllDocsQuery();
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.alfresco.cmis.property.PropertyLuceneBuilder#buildLuceneGreaterThan
- * (org.alfresco.repo.search.impl.lucene.LuceneQueryParser,
- * java.io.Serializable,
- * org.alfresco.repo.search.impl.querymodel.PredicateMode)
- */
- public Query buildLuceneGreaterThan(LuceneQueryParser lqp, Serializable value, PredicateMode mode,
- LuceneFunction luceneFunction) throws ParseException
- {
- throw new CMISQueryException("Property " + getName() + " can not be used in a 'greater than' comparison");
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.alfresco.cmis.property.PropertyLuceneBuilder#
- * buildLuceneGreaterThanOrEquals
- * (org.alfresco.repo.search.impl.lucene.LuceneQueryParser,
- * java.io.Serializable,
- * org.alfresco.repo.search.impl.querymodel.PredicateMode)
- */
- public Query buildLuceneGreaterThanOrEquals(LuceneQueryParser lqp, Serializable value, PredicateMode mode,
- LuceneFunction luceneFunction) throws ParseException
- {
- throw new CMISQueryException("Property " + getName()
- + " can not be used in a 'greater than or equals' comparison");
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.alfresco.cmis.property.PropertyLuceneBuilder#buildLuceneIn(org.alfresco
- * .repo.search.impl.lucene.LuceneQueryParser, java.util.Collection,
- * java.lang.Boolean,
- * org.alfresco.repo.search.impl.querymodel.PredicateMode)
- */
- public Query buildLuceneIn(LuceneQueryParser lqp, Collection values, Boolean not, PredicateMode mode)
- throws ParseException
- {
- String field = getLuceneFieldName();
-
- // Check type conversion
-
- @SuppressWarnings("unused")
- Object converted = DefaultTypeConverter.INSTANCE.convert(getServiceRegistry().getDictionaryService()
- .getDataType(DataTypeDefinition.NODE_REF), values);
- Collection asStrings = DefaultTypeConverter.INSTANCE.convert(String.class, values);
-
- if (asStrings.size() == 0)
- {
- if (not)
- {
- return new MatchAllDocsQuery();
- } else
- {
- return new TermQuery(new Term("NO_TOKENS", "__"));
- }
- } else if (asStrings.size() == 1)
- {
- String value = asStrings.iterator().next();
- if (not)
- {
- return lqp.getDoesNotMatchFieldQuery(field, value, AnalysisMode.IDENTIFIER, LuceneFunction.FIELD);
- } else
- {
- return lqp.getFieldQuery(field, value, AnalysisMode.IDENTIFIER, LuceneFunction.FIELD);
- }
- } else
- {
- BooleanQuery booleanQuery = new BooleanQuery();
- if (not)
- {
- booleanQuery.add(new MatchAllDocsQuery(), Occur.MUST);
- }
- for (String value : asStrings)
- {
- Query any = lqp.getFieldQuery(field, value, AnalysisMode.IDENTIFIER, LuceneFunction.FIELD);
- if (not)
- {
- booleanQuery.add(any, Occur.MUST_NOT);
- } else
- {
- booleanQuery.add(any, Occur.SHOULD);
- }
- }
- return booleanQuery;
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.alfresco.cmis.property.PropertyLuceneBuilder#buildLuceneInequality
- * (org.alfresco.repo.search.impl.lucene.LuceneQueryParser,
- * java.io.Serializable,
- * org.alfresco.repo.search.impl.querymodel.PredicateMode)
- */
- public Query buildLuceneInequality(LuceneQueryParser lqp, Serializable value, PredicateMode mode,
- LuceneFunction luceneFunction) throws ParseException
- {
- String field = getLuceneFieldName();
- String stringValue = getValueAsString(value);
- return lqp.getDoesNotMatchFieldQuery(field, stringValue, AnalysisMode.IDENTIFIER, luceneFunction);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.alfresco.cmis.property.PropertyLuceneBuilder#buildLuceneLessThan(
- * org.alfresco.repo.search.impl.lucene.LuceneQueryParser,
- * java.io.Serializable,
- * org.alfresco.repo.search.impl.querymodel.PredicateMode)
- */
- public Query buildLuceneLessThan(LuceneQueryParser lqp, Serializable value, PredicateMode mode,
- LuceneFunction luceneFunction) throws ParseException
- {
- throw new CMISQueryException("Property " + getName() + " can not be used in a 'less than' comparison");
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.alfresco.cmis.property.PropertyLuceneBuilder#buildLuceneLessThanOrEquals
- * (org.alfresco.repo.search.impl.lucene.LuceneQueryParser,
- * java.io.Serializable,
- * org.alfresco.repo.search.impl.querymodel.PredicateMode)
- */
- public Query buildLuceneLessThanOrEquals(LuceneQueryParser lqp, Serializable value, PredicateMode mode,
- LuceneFunction luceneFunction) throws ParseException
- {
- throw new CMISQueryException("Property " + getName() + " can not be used in a 'less than or equals' comparison");
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.alfresco.cmis.property.NamedPropertyAccessor#buildLuceneLike(org.
- * alfresco.repo.search.impl.lucene.LuceneQueryParser, java.lang.String,
- * java.io.Serializable, java.lang.Boolean)
- */
- public Query buildLuceneLike(LuceneQueryParser lqp, Serializable value, Boolean not) throws ParseException
- {
- String field = getLuceneFieldName();
- String stringValue = getValueAsString(value);
-
- if (not)
- {
- BooleanQuery booleanQuery = new BooleanQuery();
- booleanQuery.add(new MatchAllDocsQuery(), Occur.MUST);
- booleanQuery.add(lqp.getLikeQuery(field, stringValue, AnalysisMode.IDENTIFIER), Occur.MUST_NOT);
- return booleanQuery;
- } else
- {
- return lqp.getLikeQuery(field, stringValue, AnalysisMode.IDENTIFIER);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.alfresco.cmis.property.NamedPropertyAccessor#getLuceneSortField(java
- * .lang.String)
- */
- public String getLuceneSortField(LuceneQueryParser lqp)
- {
- return getLuceneFieldName();
- }
-
}
diff --git a/source/java/org/alfresco/opencmis/mapping/ObjectTypeIdProperty.java b/source/java/org/alfresco/opencmis/mapping/ObjectTypeIdProperty.java
index d8704f9e5e..bc5fcea0a1 100644
--- a/source/java/org/alfresco/opencmis/mapping/ObjectTypeIdProperty.java
+++ b/source/java/org/alfresco/opencmis/mapping/ObjectTypeIdProperty.java
@@ -19,29 +19,14 @@
package org.alfresco.opencmis.mapping;
import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Collection;
-import org.alfresco.cmis.CMISQueryException;
-import org.alfresco.cmis.CMISScope;
-import org.alfresco.cmis.CMISTypeDefinition;
-import org.alfresco.repo.search.impl.lucene.AnalysisMode;
-import org.alfresco.repo.search.impl.lucene.LuceneFunction;
-import org.alfresco.repo.search.impl.lucene.LuceneQueryParser;
-import org.alfresco.repo.search.impl.querymodel.PredicateMode;
+import org.alfresco.opencmis.dictionary.CMISDictionaryService;
import org.alfresco.service.ServiceRegistry;
import org.alfresco.service.cmr.repository.AssociationRef;
import org.alfresco.service.cmr.repository.NodeRef;
-import org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter;
import org.alfresco.service.namespace.QName;
import org.apache.chemistry.opencmis.commons.PropertyIds;
-import org.apache.lucene.index.Term;
-import org.apache.lucene.queryParser.ParseException;
-import org.apache.lucene.search.BooleanClause.Occur;
-import org.apache.lucene.search.BooleanQuery;
-import org.apache.lucene.search.MatchAllDocsQuery;
-import org.apache.lucene.search.Query;
-import org.apache.lucene.search.TermQuery;
+import org.apache.chemistry.opencmis.commons.enums.BaseTypeId;
/**
* Get the CMIS object type id property
@@ -50,14 +35,17 @@ import org.apache.lucene.search.TermQuery;
*/
public class ObjectTypeIdProperty extends AbstractProperty
{
+ private CMISDictionaryService dictionaryService;
+
/**
* Construct
*
* @param serviceRegistry
*/
- public ObjectTypeIdProperty(ServiceRegistry serviceRegistry)
+ public ObjectTypeIdProperty(ServiceRegistry serviceRegistry, CMISDictionaryService dictionaryService)
{
super(serviceRegistry, PropertyIds.OBJECT_TYPE_ID);
+ this.dictionaryService = dictionaryService;
}
/*
@@ -70,7 +58,7 @@ public class ObjectTypeIdProperty extends AbstractProperty
public Serializable getValue(NodeRef nodeRef)
{
QName type = getServiceRegistry().getNodeService().getType(nodeRef);
- return getServiceRegistry().getCMISDictionaryService().findTypeForClass(type).getTypeId().getId();
+ return dictionaryService.findTypeForClass(type).getTypeId();
}
/*
@@ -83,239 +71,6 @@ public class ObjectTypeIdProperty extends AbstractProperty
public Serializable getValue(AssociationRef assocRef)
{
QName type = assocRef.getTypeQName();
- return getServiceRegistry().getCMISDictionaryService().findTypeForClass(type, CMISScope.RELATIONSHIP)
- .getTypeId().getId();
- }
-
- public String getLuceneFieldName()
- {
- return "TYPE";
- }
-
- private String getValueAsString(Serializable value)
- {
- // Object converted =
- // DefaultTypeConverter.INSTANCE.convert(getServiceRegistry().getDictionaryService().getDataType(DataTypeDefinition.QNAME),
- // value);
- String asString = DefaultTypeConverter.INSTANCE.convert(String.class, value);
- return asString;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.alfresco.cmis.property.PropertyLuceneBuilder#buildLuceneEquality(
- * org.alfresco.repo.search.impl.lucene.LuceneQueryParser,
- * java.io.Serializable,
- * org.alfresco.repo.search.impl.querymodel.PredicateMode)
- */
- public Query buildLuceneEquality(LuceneQueryParser lqp, Serializable value, PredicateMode mode,
- LuceneFunction luceneFunction) throws ParseException
- {
- String field = getLuceneFieldName();
- String stringValue = getValueAsString(value);
- CMISTypeDefinition type = getServiceRegistry().getCMISDictionaryService().findType(stringValue);
- return lqp
- .getFieldQuery(field, type.getTypeId().getQName().toString(), AnalysisMode.IDENTIFIER, luceneFunction);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.alfresco.cmis.property.PropertyLuceneBuilder#buildLuceneExists(org
- * .alfresco.repo.search.impl.lucene.LuceneQueryParser, java.lang.Boolean)
- */
- public Query buildLuceneExists(LuceneQueryParser lqp, Boolean not) throws ParseException
- {
- if (not)
- {
- return new TermQuery(new Term("NO_TOKENS", "__"));
- } else
- {
- return new MatchAllDocsQuery();
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.alfresco.cmis.property.PropertyLuceneBuilder#buildLuceneGreaterThan
- * (org.alfresco.repo.search.impl.lucene.LuceneQueryParser,
- * java.io.Serializable,
- * org.alfresco.repo.search.impl.querymodel.PredicateMode)
- */
- public Query buildLuceneGreaterThan(LuceneQueryParser lqp, Serializable value, PredicateMode mode,
- LuceneFunction luceneFunction) throws ParseException
- {
- throw new CMISQueryException("Property " + getName() + " can not be used in a 'greater than' comparison");
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.alfresco.cmis.property.PropertyLuceneBuilder#
- * buildLuceneGreaterThanOrEquals
- * (org.alfresco.repo.search.impl.lucene.LuceneQueryParser,
- * java.io.Serializable,
- * org.alfresco.repo.search.impl.querymodel.PredicateMode)
- */
- public Query buildLuceneGreaterThanOrEquals(LuceneQueryParser lqp, Serializable value, PredicateMode mode,
- LuceneFunction luceneFunction) throws ParseException
- {
- throw new CMISQueryException("Property " + getName()
- + " can not be used in a 'greater than or equals' comparison");
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.alfresco.cmis.property.PropertyLuceneBuilder#buildLuceneIn(org.alfresco
- * .repo.search.impl.lucene.LuceneQueryParser, java.util.Collection,
- * java.lang.Boolean,
- * org.alfresco.repo.search.impl.querymodel.PredicateMode)
- */
- public Query buildLuceneIn(LuceneQueryParser lqp, Collection values, Boolean not, PredicateMode mode)
- throws ParseException
- {
- String field = getLuceneFieldName();
-
- Collection asStrings = new ArrayList(values.size());
- for (Serializable value : values)
- {
- String stringValue = getValueAsString(value);
- CMISTypeDefinition type = getServiceRegistry().getCMISDictionaryService().findType(stringValue);
- asStrings.add(type.getTypeId().getQName().toString());
- }
-
- if (asStrings.size() == 0)
- {
- if (not)
- {
- return new MatchAllDocsQuery();
- } else
- {
- return new TermQuery(new Term("NO_TOKENS", "__"));
- }
- } else if (asStrings.size() == 1)
- {
- String value = asStrings.iterator().next();
- if (not)
- {
- return lqp.getDoesNotMatchFieldQuery(field, value, AnalysisMode.IDENTIFIER, LuceneFunction.FIELD);
- } else
- {
- return lqp.getFieldQuery(field, value, AnalysisMode.IDENTIFIER, LuceneFunction.FIELD);
- }
- } else
- {
- BooleanQuery booleanQuery = new BooleanQuery();
- if (not)
- {
- booleanQuery.add(new MatchAllDocsQuery(), Occur.MUST);
- }
- for (String value : asStrings)
- {
- Query any = lqp.getFieldQuery(field, value, AnalysisMode.IDENTIFIER, LuceneFunction.FIELD);
- if (not)
- {
- booleanQuery.add(any, Occur.MUST_NOT);
- } else
- {
- booleanQuery.add(any, Occur.SHOULD);
- }
- }
- return booleanQuery;
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.alfresco.cmis.property.PropertyLuceneBuilder#buildLuceneInequality
- * (org.alfresco.repo.search.impl.lucene.LuceneQueryParser,
- * java.io.Serializable,
- * org.alfresco.repo.search.impl.querymodel.PredicateMode)
- */
- public Query buildLuceneInequality(LuceneQueryParser lqp, Serializable value, PredicateMode mode,
- LuceneFunction luceneFunction) throws ParseException
- {
- String field = getLuceneFieldName();
- String stringValue = getValueAsString(value);
- CMISTypeDefinition type = getServiceRegistry().getCMISDictionaryService().findType(stringValue);
- return lqp.getDoesNotMatchFieldQuery(field, type.getTypeId().getQName().toString(), AnalysisMode.IDENTIFIER,
- luceneFunction);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.alfresco.cmis.property.PropertyLuceneBuilder#buildLuceneLessThan(
- * org.alfresco.repo.search.impl.lucene.LuceneQueryParser,
- * java.io.Serializable,
- * org.alfresco.repo.search.impl.querymodel.PredicateMode)
- */
- public Query buildLuceneLessThan(LuceneQueryParser lqp, Serializable value, PredicateMode mode,
- LuceneFunction luceneFunction) throws ParseException
- {
- throw new CMISQueryException("Property " + getName() + " can not be used in a 'less than' comparison");
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.alfresco.cmis.property.PropertyLuceneBuilder#buildLuceneLessThanOrEquals
- * (org.alfresco.repo.search.impl.lucene.LuceneQueryParser,
- * java.io.Serializable,
- * org.alfresco.repo.search.impl.querymodel.PredicateMode)
- */
- public Query buildLuceneLessThanOrEquals(LuceneQueryParser lqp, Serializable value, PredicateMode mode,
- LuceneFunction luceneFunction) throws ParseException
- {
- throw new CMISQueryException("Property " + getName() + " can not be used in a 'less than or equals' comparison");
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.alfresco.cmis.property.PropertyLuceneBuilder#buildLuceneLike(org.
- * alfresco.repo.search.impl.lucene.LuceneQueryParser, java.io.Serializable,
- * java.lang.Boolean)
- */
- public Query buildLuceneLike(LuceneQueryParser lqp, Serializable value, Boolean not) throws ParseException
- {
- String field = getLuceneFieldName();
- String stringValue = getValueAsString(value);
- CMISTypeDefinition type = getServiceRegistry().getCMISDictionaryService().findType(stringValue);
- String typeQName = type.getTypeId().getQName().toString();
-
- if (not)
- {
- BooleanQuery booleanQuery = new BooleanQuery();
- booleanQuery.add(new MatchAllDocsQuery(), Occur.MUST);
- booleanQuery.add(lqp.getLikeQuery(field, typeQName, AnalysisMode.IDENTIFIER), Occur.MUST_NOT);
- return booleanQuery;
- } else
- {
- return lqp.getLikeQuery(field, typeQName, AnalysisMode.IDENTIFIER);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.alfresco.cmis.property.PropertyLuceneBuilder#getLuceneSortField()
- */
- public String getLuceneSortField(LuceneQueryParser lqp)
- {
- return getLuceneFieldName();
+ return dictionaryService.findTypeForClass(type, BaseTypeId.CMIS_RELATIONSHIP).getTypeId();
}
}
diff --git a/source/java/org/alfresco/opencmis/mapping/ParentProperty.java b/source/java/org/alfresco/opencmis/mapping/ParentProperty.java
index 1d30a748cc..c257ed275f 100644
--- a/source/java/org/alfresco/opencmis/mapping/ParentProperty.java
+++ b/source/java/org/alfresco/opencmis/mapping/ParentProperty.java
@@ -19,25 +19,11 @@
package org.alfresco.opencmis.mapping;
import java.io.Serializable;
-import java.util.Collection;
-import org.alfresco.repo.search.impl.lucene.AnalysisMode;
-import org.alfresco.repo.search.impl.lucene.LuceneFunction;
-import org.alfresco.repo.search.impl.lucene.LuceneQueryParser;
-import org.alfresco.repo.search.impl.querymodel.PredicateMode;
import org.alfresco.service.ServiceRegistry;
-import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.NodeRef;
-import org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter;
import org.apache.chemistry.opencmis.commons.PropertyIds;
-import org.apache.lucene.index.Term;
-import org.apache.lucene.queryParser.ParseException;
-import org.apache.lucene.search.BooleanClause.Occur;
-import org.apache.lucene.search.BooleanQuery;
-import org.apache.lucene.search.MatchAllDocsQuery;
-import org.apache.lucene.search.Query;
-import org.apache.lucene.search.TermQuery;
/**
* Get the CMIS parent property
@@ -80,167 +66,4 @@ public class ParentProperty extends AbstractProperty
return null;
}
}
-
- public String getLuceneFieldName()
- {
- return "PARENT";
- }
-
- private String getValueAsString(Serializable value)
- {
- Object converted = DefaultTypeConverter.INSTANCE.convert(getServiceRegistry().getDictionaryService()
- .getDataType(DataTypeDefinition.NODE_REF), value);
- String asString = DefaultTypeConverter.INSTANCE.convert(String.class, converted);
- return asString;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.alfresco.cmis.property.PropertyLuceneBuilder#buildLuceneEquality(
- * org.alfresco.repo.search.impl.lucene.LuceneQueryParser,
- * java.io.Serializable,
- * org.alfresco.repo.search.impl.querymodel.PredicateMode)
- */
- public Query buildLuceneEquality(LuceneQueryParser lqp, Serializable value, PredicateMode mode,
- LuceneFunction luceneFunction) throws ParseException
- {
- String field = getLuceneFieldName();
- String stringValue = getValueAsString(value);
- return lqp.getFieldQuery(field, stringValue, AnalysisMode.IDENTIFIER, luceneFunction);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.alfresco.cmis.property.PropertyLuceneBuilder#buildLuceneExists(org
- * .alfresco.repo.search.impl.lucene.LuceneQueryParser, java.lang.Boolean)
- */
- public Query buildLuceneExists(LuceneQueryParser lqp, Boolean not) throws ParseException
- {
- if (not)
- {
- return new TermQuery(new Term("ISROOT", "T"));
- } else
- {
- return new MatchAllDocsQuery();
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.alfresco.cmis.property.PropertyLuceneBuilder#buildLuceneIn(org.alfresco
- * .repo.search.impl.lucene.LuceneQueryParser, java.util.Collection,
- * java.lang.Boolean,
- * org.alfresco.repo.search.impl.querymodel.PredicateMode)
- */
- public Query buildLuceneIn(LuceneQueryParser lqp, Collection values, Boolean not, PredicateMode mode)
- throws ParseException
- {
- String field = getLuceneFieldName();
-
- // Check type conversion
-
- @SuppressWarnings("unused")
- Object converted = DefaultTypeConverter.INSTANCE.convert(getServiceRegistry().getDictionaryService()
- .getDataType(DataTypeDefinition.NODE_REF), values);
- Collection asStrings = DefaultTypeConverter.INSTANCE.convert(String.class, values);
-
- if (asStrings.size() == 0)
- {
- if (not)
- {
- return new MatchAllDocsQuery();
- } else
- {
- return new TermQuery(new Term("NO_TOKENS", "__"));
- }
- } else if (asStrings.size() == 1)
- {
- String value = asStrings.iterator().next();
- if (not)
- {
- return lqp.getDoesNotMatchFieldQuery(field, value, AnalysisMode.IDENTIFIER, LuceneFunction.FIELD);
- } else
- {
- return lqp.getFieldQuery(field, value, AnalysisMode.IDENTIFIER, LuceneFunction.FIELD);
- }
- } else
- {
- BooleanQuery booleanQuery = new BooleanQuery();
- if (not)
- {
- booleanQuery.add(new MatchAllDocsQuery(), Occur.MUST);
- }
- for (String value : asStrings)
- {
- Query any = lqp.getFieldQuery(field, value, AnalysisMode.IDENTIFIER, LuceneFunction.FIELD);
- if (not)
- {
- booleanQuery.add(any, Occur.MUST_NOT);
- } else
- {
- booleanQuery.add(any, Occur.SHOULD);
- }
- }
- return booleanQuery;
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.alfresco.cmis.property.PropertyLuceneBuilder#buildLuceneInequality
- * (org.alfresco.repo.search.impl.lucene.LuceneQueryParser,
- * java.io.Serializable,
- * org.alfresco.repo.search.impl.querymodel.PredicateMode)
- */
- public Query buildLuceneInequality(LuceneQueryParser lqp, Serializable value, PredicateMode mode,
- LuceneFunction luceneFunction) throws ParseException
- {
- String field = getLuceneFieldName();
- String stringValue = getValueAsString(value);
- return lqp.getDoesNotMatchFieldQuery(field, stringValue, AnalysisMode.IDENTIFIER, luceneFunction);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.alfresco.cmis.property.PropertyLuceneBuilder#buildLuceneLike(org.
- * alfresco.repo.search.impl.lucene.LuceneQueryParser, java.io.Serializable,
- * java.lang.Boolean)
- */
- public Query buildLuceneLike(LuceneQueryParser lqp, Serializable value, Boolean not) throws ParseException
- {
- String field = getLuceneFieldName();
- String stringValue = getValueAsString(value);
-
- if (not)
- {
- BooleanQuery booleanQuery = new BooleanQuery();
- booleanQuery.add(new MatchAllDocsQuery(), Occur.MUST);
- booleanQuery.add(lqp.getLikeQuery(field, stringValue, AnalysisMode.IDENTIFIER), Occur.MUST_NOT);
- return booleanQuery;
- } else
- {
- return lqp.getLikeQuery(field, stringValue, AnalysisMode.IDENTIFIER);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.alfresco.cmis.property.PropertyLuceneBuilder#getLuceneSortField()
- */
- public String getLuceneSortField(LuceneQueryParser lqp)
- {
- return getLuceneFieldName();
- }
}
diff --git a/source/java/org/alfresco/opencmis/mapping/RootFolderEvaluator.java b/source/java/org/alfresco/opencmis/mapping/RootFolderEvaluator.java
index de53660748..dde89126b4 100644
--- a/source/java/org/alfresco/opencmis/mapping/RootFolderEvaluator.java
+++ b/source/java/org/alfresco/opencmis/mapping/RootFolderEvaluator.java
@@ -18,8 +18,8 @@
*/
package org.alfresco.opencmis.mapping;
-import org.alfresco.opencmis.CMISActionEvaluator;
import org.alfresco.opencmis.CMISConnector;
+import org.alfresco.opencmis.dictionary.CMISActionEvaluator;
import org.alfresco.service.ServiceRegistry;
import org.alfresco.service.cmr.repository.NodeRef;
diff --git a/source/java/org/alfresco/opencmis/mapping/RuntimePropertyAccessorMapping.java b/source/java/org/alfresco/opencmis/mapping/RuntimePropertyAccessorMapping.java
new file mode 100644
index 0000000000..ebf1021f10
--- /dev/null
+++ b/source/java/org/alfresco/opencmis/mapping/RuntimePropertyAccessorMapping.java
@@ -0,0 +1,363 @@
+/*
+ * Copyright (C) 2005-2010 Alfresco Software Limited.
+ *
+ * This file is part of Alfresco
+ *
+ * Alfresco is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Alfresco is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Alfresco. If not, see .
+ */
+package org.alfresco.opencmis.mapping;
+
+import java.io.Serializable;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+import org.alfresco.error.AlfrescoRuntimeException;
+import org.alfresco.model.ContentModel;
+import org.alfresco.opencmis.CMISConnector;
+import org.alfresco.opencmis.dictionary.CMISActionEvaluator;
+import org.alfresco.opencmis.dictionary.CMISDictionaryService;
+import org.alfresco.opencmis.dictionary.CMISPropertyAccessor;
+import org.alfresco.opencmis.dictionary.PropertyAccessorMapping;
+import org.alfresco.service.ServiceRegistry;
+import org.alfresco.service.cmr.repository.AssociationRef;
+import org.alfresco.service.cmr.repository.NodeRef;
+import org.alfresco.service.cmr.security.PermissionService;
+import org.alfresco.service.namespace.QName;
+import org.apache.chemistry.opencmis.commons.PropertyIds;
+import org.apache.chemistry.opencmis.commons.enums.Action;
+import org.apache.chemistry.opencmis.commons.enums.BaseTypeId;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.springframework.beans.factory.InitializingBean;
+
+
+/**
+ * Registry of property accessors which map the retrieval and setting of properties
+ * within Alfresco.
+ *
+ * @author davidc
+ */
+public class RuntimePropertyAccessorMapping implements PropertyAccessorMapping, InitializingBean
+{
+ // Logger
+ protected static final Log logger = LogFactory.getLog(CMISMapping.class);
+
+ // Service dependencies
+ private ServiceRegistry serviceRegistry;
+ private CMISConnector cmisConnector;
+ private CMISMapping cmisMapping;
+ private CMISDictionaryService cmisDictionaryService;
+
+ private Map propertyAccessors = new HashMap();
+ private Map>> actionEvaluators = new HashMap>>();
+
+ /**
+ * @param service registry
+ */
+ public void setServiceRegistry(ServiceRegistry serviceRegistry)
+ {
+ this.serviceRegistry = serviceRegistry;
+ }
+
+ /**
+ * @param cmis connector
+ */
+ public void setCmisConnector(CMISConnector cmisConnector)
+ {
+ this.cmisConnector = cmisConnector;
+ }
+
+ /**
+ * @param cmis mapping
+ */
+ public void setCmisMapping(CMISMapping cmisMapping)
+ {
+ this.cmisMapping = cmisMapping;
+ }
+
+ /**
+ * @param cmis mapping
+ */
+ public void setCmisDictionaryService(CMISDictionaryService cmisDictionaryService)
+ {
+ this.cmisDictionaryService = cmisDictionaryService;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.springframework.beans.factory.InitializingBean#afterPropertiesSet()
+ */
+ public void afterPropertiesSet() throws Exception
+ {
+ //
+ // Property Mappings
+ //
+
+ registerPropertyAccessor(new ObjectIdProperty(serviceRegistry));
+ registerPropertyAccessor(new NodeRefProperty(serviceRegistry));
+ registerPropertyAccessor(new ObjectTypeIdProperty(serviceRegistry, cmisDictionaryService));
+ registerPropertyAccessor(new BaseTypeIdProperty(serviceRegistry, cmisDictionaryService));
+ registerPropertyAccessor(new DirectProperty(serviceRegistry, PropertyIds.CREATED_BY, ContentModel.PROP_CREATOR));
+ registerPropertyAccessor(new DirectProperty(serviceRegistry, PropertyIds.CREATION_DATE, ContentModel.PROP_CREATED));
+ registerPropertyAccessor(new DirectProperty(serviceRegistry, PropertyIds.LAST_MODIFIED_BY, ContentModel.PROP_MODIFIER));
+ registerPropertyAccessor(new DirectProperty(serviceRegistry, PropertyIds.LAST_MODIFICATION_DATE, ContentModel.PROP_MODIFIED));
+ registerPropertyAccessor(new FixedValueProperty(serviceRegistry, PropertyIds.CHANGE_TOKEN, null));
+ registerPropertyAccessor(new DirectProperty(serviceRegistry, PropertyIds.NAME, ContentModel.PROP_NAME)
+ {
+ @Override
+ public Serializable getValue(AssociationRef assocRef)
+ {
+ // Let's use the association ref as the name
+ return assocRef.toString();
+ }
+ });
+ registerPropertyAccessor(new IsImmutableProperty(serviceRegistry));
+ registerPropertyAccessor(new IsLatestVersionProperty(serviceRegistry));
+ registerPropertyAccessor(new IsMajorVersionProperty(serviceRegistry));
+ registerPropertyAccessor(new IsLatestMajorVersionProperty(serviceRegistry));
+ registerPropertyAccessor(new VersionLabelProperty(serviceRegistry));
+ registerPropertyAccessor(new VersionSeriesIdProperty(serviceRegistry));
+ registerPropertyAccessor(new IsVersionSeriesCheckedOutProperty(serviceRegistry));
+ registerPropertyAccessor(new VersionSeriesCheckedOutByProperty(serviceRegistry));
+ registerPropertyAccessor(new VersionSeriesCheckedOutIdProperty(serviceRegistry));
+ registerPropertyAccessor(new CheckinCommentProperty(serviceRegistry));
+ registerPropertyAccessor(new ContentStreamLengthProperty(serviceRegistry));
+ registerPropertyAccessor(new ContentStreamMimetypeProperty(serviceRegistry));
+ registerPropertyAccessor(new ContentStreamIdProperty(serviceRegistry));
+ registerPropertyAccessor(new DirectProperty(serviceRegistry, PropertyIds.CONTENT_STREAM_FILE_NAME, ContentModel.PROP_NAME));
+ registerPropertyAccessor(new ParentProperty(serviceRegistry));
+ registerPropertyAccessor(new PathProperty(serviceRegistry, cmisConnector));
+ registerPropertyAccessor(new AllowedChildObjectTypeIdsProperty(serviceRegistry, cmisMapping));
+ registerPropertyAccessor(new SourceIdProperty(serviceRegistry));
+ registerPropertyAccessor(new TargetIdProperty(serviceRegistry));
+
+ //
+ // Action Evaluator Mappings
+ //
+
+ // NOTE: The order of evaluators is important - they must be in the
+ // order as specified in CMIS-Core.xsd
+ // so that schema validation passes
+
+ registerEvaluator(BaseTypeId.CMIS_DOCUMENT,
+ new CurrentVersionEvaluator(serviceRegistry, new PermissionActionEvaluator(serviceRegistry,
+ Action.CAN_DELETE_OBJECT, PermissionService.DELETE_NODE), false));
+ registerEvaluator(BaseTypeId.CMIS_DOCUMENT, new CurrentVersionEvaluator(serviceRegistry,
+ new PermissionActionEvaluator(serviceRegistry, Action.CAN_UPDATE_PROPERTIES,
+ PermissionService.WRITE_PROPERTIES), false));
+ registerEvaluator(BaseTypeId.CMIS_DOCUMENT, new PermissionActionEvaluator(serviceRegistry,
+ Action.CAN_GET_PROPERTIES, PermissionService.READ_PROPERTIES));
+ registerEvaluator(BaseTypeId.CMIS_DOCUMENT, new FixedValueActionEvaluator(serviceRegistry,
+ Action.CAN_GET_OBJECT_RELATIONSHIPS, true));
+ registerEvaluator(BaseTypeId.CMIS_DOCUMENT, new ParentActionEvaluator(new PermissionActionEvaluator(
+ serviceRegistry, Action.CAN_GET_OBJECT_PARENTS, PermissionService.READ_PERMISSIONS)));
+ // Is CAN_MOVE correct mapping?
+ registerEvaluator(BaseTypeId.CMIS_DOCUMENT, new CurrentVersionEvaluator(serviceRegistry,
+ new PermissionActionEvaluator(serviceRegistry, Action.CAN_MOVE_OBJECT, PermissionService.DELETE_NODE),
+ false));
+ registerEvaluator(BaseTypeId.CMIS_DOCUMENT, new CurrentVersionEvaluator(serviceRegistry,
+ new PermissionActionEvaluator(serviceRegistry, Action.CAN_DELETE_CONTENT_STREAM,
+ PermissionService.WRITE_PROPERTIES, PermissionService.WRITE_CONTENT), false));
+ registerEvaluator(BaseTypeId.CMIS_DOCUMENT, new CurrentVersionEvaluator(serviceRegistry,
+ new CanCheckOutActionEvaluator(serviceRegistry), false));
+ registerEvaluator(BaseTypeId.CMIS_DOCUMENT, new CurrentVersionEvaluator(serviceRegistry,
+ new PermissionActionEvaluator(serviceRegistry, Action.CAN_CANCEL_CHECK_OUT,
+ PermissionService.CANCEL_CHECK_OUT), false));
+ registerEvaluator(BaseTypeId.CMIS_DOCUMENT, new PermissionActionEvaluator(serviceRegistry, Action.CAN_CHECK_IN,
+ PermissionService.CHECK_IN));
+ registerEvaluator(BaseTypeId.CMIS_DOCUMENT, new CurrentVersionEvaluator(serviceRegistry,
+ new PermissionActionEvaluator(serviceRegistry, Action.CAN_SET_CONTENT_STREAM,
+ PermissionService.WRITE_CONTENT), false));
+ registerEvaluator(BaseTypeId.CMIS_DOCUMENT, new FixedValueActionEvaluator(serviceRegistry,
+ Action.CAN_GET_ALL_VERSIONS, true));
+ registerEvaluator(BaseTypeId.CMIS_DOCUMENT, new CurrentVersionEvaluator(serviceRegistry,
+ new ParentActionEvaluator(new PermissionActionEvaluator(serviceRegistry,
+ Action.CAN_ADD_OBJECT_TO_FOLDER, PermissionService.LINK_CHILDREN)), false));
+ // Is CAN_REMOVE_FROM_FOLDER correct mapping?
+ registerEvaluator(BaseTypeId.CMIS_DOCUMENT, new CurrentVersionEvaluator(serviceRegistry,
+ new ParentActionEvaluator(new FixedValueActionEvaluator(serviceRegistry,
+ Action.CAN_REMOVE_OBJECT_FROM_FOLDER, true)), false));
+ registerEvaluator(BaseTypeId.CMIS_DOCUMENT, new PermissionActionEvaluator(serviceRegistry,
+ Action.CAN_GET_CONTENT_STREAM, PermissionService.READ_CONTENT));
+ registerEvaluator(BaseTypeId.CMIS_DOCUMENT, new FixedValueActionEvaluator(serviceRegistry,
+ Action.CAN_APPLY_POLICY, false));
+ registerEvaluator(BaseTypeId.CMIS_DOCUMENT, new FixedValueActionEvaluator(serviceRegistry,
+ Action.CAN_GET_APPLIED_POLICIES, true));
+ registerEvaluator(BaseTypeId.CMIS_DOCUMENT, new FixedValueActionEvaluator(serviceRegistry,
+ Action.CAN_REMOVE_POLICY, false));
+ registerEvaluator(BaseTypeId.CMIS_DOCUMENT, new CurrentVersionEvaluator(serviceRegistry,
+ new FixedValueActionEvaluator(serviceRegistry, Action.CAN_CREATE_RELATIONSHIP, true), false));
+ registerEvaluator(BaseTypeId.CMIS_DOCUMENT, new FixedValueActionEvaluator(serviceRegistry,
+ Action.CAN_GET_RENDITIONS, true));
+ registerEvaluator(BaseTypeId.CMIS_DOCUMENT, new PermissionActionEvaluator(serviceRegistry, Action.CAN_GET_ACL,
+ PermissionService.READ_PERMISSIONS));
+ registerEvaluator(BaseTypeId.CMIS_DOCUMENT, new CurrentVersionEvaluator(serviceRegistry,
+ new PermissionActionEvaluator(serviceRegistry, Action.CAN_APPLY_ACL,
+ PermissionService.CHANGE_PERMISSIONS), false));
+
+ registerEvaluator(BaseTypeId.CMIS_FOLDER,
+ new RootFolderEvaluator(serviceRegistry, cmisConnector, new PermissionActionEvaluator(serviceRegistry,
+ Action.CAN_DELETE_OBJECT, PermissionService.DELETE_NODE), false));
+ registerEvaluator(BaseTypeId.CMIS_FOLDER, new PermissionActionEvaluator(serviceRegistry,
+ Action.CAN_UPDATE_PROPERTIES, PermissionService.WRITE_PROPERTIES));
+ registerEvaluator(BaseTypeId.CMIS_FOLDER, new PermissionActionEvaluator(serviceRegistry,
+ Action.CAN_GET_FOLDER_TREE, PermissionService.READ_CHILDREN));
+ registerEvaluator(BaseTypeId.CMIS_FOLDER, new PermissionActionEvaluator(serviceRegistry,
+ Action.CAN_GET_PROPERTIES, PermissionService.READ_PROPERTIES));
+ registerEvaluator(BaseTypeId.CMIS_FOLDER, new FixedValueActionEvaluator(serviceRegistry,
+ Action.CAN_GET_OBJECT_RELATIONSHIPS, true));
+ registerEvaluator(BaseTypeId.CMIS_FOLDER, new ParentActionEvaluator(new PermissionActionEvaluator(
+ serviceRegistry, Action.CAN_GET_OBJECT_PARENTS, PermissionService.READ_PERMISSIONS)));
+ registerEvaluator(BaseTypeId.CMIS_FOLDER, new RootFolderEvaluator(serviceRegistry, cmisConnector,
+ new ParentActionEvaluator(new PermissionActionEvaluator(serviceRegistry, Action.CAN_GET_FOLDER_PARENT,
+ PermissionService.READ_PERMISSIONS)), false));
+ registerEvaluator(BaseTypeId.CMIS_FOLDER, new PermissionActionEvaluator(serviceRegistry,
+ Action.CAN_GET_DESCENDANTS, PermissionService.READ_CHILDREN));
+ // Is CAN_MOVE_OBJECT correct mapping?
+ registerEvaluator(BaseTypeId.CMIS_FOLDER, new RootFolderEvaluator(serviceRegistry, cmisConnector,
+ new PermissionActionEvaluator(serviceRegistry, Action.CAN_MOVE_OBJECT, PermissionService.DELETE_NODE),
+ false));
+ registerEvaluator(BaseTypeId.CMIS_FOLDER, new FixedValueActionEvaluator(serviceRegistry,
+ Action.CAN_APPLY_POLICY, false));
+ registerEvaluator(BaseTypeId.CMIS_FOLDER, new FixedValueActionEvaluator(serviceRegistry,
+ Action.CAN_GET_APPLIED_POLICIES, true));
+ registerEvaluator(BaseTypeId.CMIS_FOLDER, new FixedValueActionEvaluator(serviceRegistry,
+ Action.CAN_REMOVE_POLICY, false));
+ registerEvaluator(BaseTypeId.CMIS_FOLDER, new PermissionActionEvaluator(serviceRegistry,
+ Action.CAN_GET_CHILDREN, PermissionService.READ_CHILDREN));
+ registerEvaluator(BaseTypeId.CMIS_FOLDER, new PermissionActionEvaluator(serviceRegistry,
+ Action.CAN_CREATE_DOCUMENT, PermissionService.CREATE_CHILDREN));
+ registerEvaluator(BaseTypeId.CMIS_FOLDER, new PermissionActionEvaluator(serviceRegistry,
+ Action.CAN_CREATE_FOLDER, PermissionService.CREATE_CHILDREN));
+ registerEvaluator(BaseTypeId.CMIS_FOLDER, new PermissionActionEvaluator(serviceRegistry,
+ Action.CAN_CREATE_RELATIONSHIP, PermissionService.CREATE_ASSOCIATIONS));
+ registerEvaluator(BaseTypeId.CMIS_FOLDER, new RootFolderEvaluator(serviceRegistry, cmisConnector,
+ new PermissionActionEvaluator(serviceRegistry, Action.CAN_DELETE_TREE, PermissionService.DELETE_NODE),
+ false));
+ registerEvaluator(BaseTypeId.CMIS_FOLDER, new PermissionActionEvaluator(serviceRegistry, Action.CAN_GET_ACL,
+ PermissionService.READ_PERMISSIONS));
+ registerEvaluator(BaseTypeId.CMIS_FOLDER, new PermissionActionEvaluator(serviceRegistry, Action.CAN_APPLY_ACL,
+ PermissionService.CHANGE_PERMISSIONS));
+
+ registerEvaluator(BaseTypeId.CMIS_RELATIONSHIP, new FixedValueActionEvaluator(serviceRegistry,
+ Action.CAN_DELETE_OBJECT, true));
+ registerEvaluator(BaseTypeId.CMIS_RELATIONSHIP, new FixedValueActionEvaluator(serviceRegistry,
+ Action.CAN_UPDATE_PROPERTIES, false));
+ registerEvaluator(BaseTypeId.CMIS_RELATIONSHIP, new FixedValueActionEvaluator(serviceRegistry,
+ Action.CAN_GET_PROPERTIES, true));
+ registerEvaluator(BaseTypeId.CMIS_RELATIONSHIP, new FixedValueActionEvaluator(serviceRegistry,
+ Action.CAN_GET_ACL, false));
+ registerEvaluator(BaseTypeId.CMIS_RELATIONSHIP, new FixedValueActionEvaluator(serviceRegistry,
+ Action.CAN_APPLY_ACL, false));
+
+ registerEvaluator(BaseTypeId.CMIS_POLICY, new FixedValueActionEvaluator(serviceRegistry,
+ Action.CAN_DELETE_OBJECT, false));
+ registerEvaluator(BaseTypeId.CMIS_POLICY, new FixedValueActionEvaluator(serviceRegistry,
+ Action.CAN_UPDATE_PROPERTIES, false));
+ registerEvaluator(BaseTypeId.CMIS_POLICY, new FixedValueActionEvaluator(serviceRegistry,
+ Action.CAN_GET_PROPERTIES, false));
+ registerEvaluator(BaseTypeId.CMIS_POLICY, new FixedValueActionEvaluator(serviceRegistry,
+ Action.CAN_GET_OBJECT_PARENTS, false));
+ registerEvaluator(BaseTypeId.CMIS_POLICY, new FixedValueActionEvaluator(serviceRegistry,
+ Action.CAN_MOVE_OBJECT, false));
+ registerEvaluator(BaseTypeId.CMIS_POLICY, new FixedValueActionEvaluator(serviceRegistry,
+ Action.CAN_ADD_OBJECT_TO_FOLDER, false));
+ registerEvaluator(BaseTypeId.CMIS_POLICY, new FixedValueActionEvaluator(serviceRegistry,
+ Action.CAN_REMOVE_OBJECT_FROM_FOLDER, false));
+ registerEvaluator(BaseTypeId.CMIS_POLICY, new FixedValueActionEvaluator(serviceRegistry,
+ Action.CAN_GET_OBJECT_RELATIONSHIPS, false));
+ registerEvaluator(BaseTypeId.CMIS_POLICY, new FixedValueActionEvaluator(serviceRegistry,
+ Action.CAN_GET_ACL, false));
+ registerEvaluator(BaseTypeId.CMIS_POLICY, new FixedValueActionEvaluator(serviceRegistry,
+ Action.CAN_APPLY_ACL, false));
+ }
+
+ /**
+ * Gets a property accessor
+ *
+ * @param propertyId property id
+ * @return property accessor
+ */
+ public CMISPropertyAccessor getPropertyAccessor(String propertyId)
+ {
+ return propertyAccessors.get(propertyId);
+ }
+
+ /**
+ * Create a direct node property accessor
+ *
+ * @param propertyId property id
+ * @param propertyName node property name
+ * @return property accessor
+ */
+ public CMISPropertyAccessor createDirectPropertyAccessor(String propertyId, QName propertyName)
+ {
+ return new DirectProperty(serviceRegistry, propertyId, propertyName);
+ }
+
+ /**
+ * Register pre-defined Property Accessor
+ *
+ * @param propertyAccessor
+ */
+ private void registerPropertyAccessor(AbstractProperty propertyAccessor)
+ {
+ propertyAccessors.put(propertyAccessor.getName(), propertyAccessor);
+ }
+
+ /**
+ * Gets the Action Evaluators applicable for the given CMIS Scope
+ *
+ * @param scope
+ */
+ public Map> getActionEvaluators(BaseTypeId scope)
+ {
+ Map> evaluators = actionEvaluators.get(scope);
+ if (evaluators == null)
+ {
+ evaluators = Collections.emptyMap();
+ }
+ return evaluators;
+ }
+
+ /**
+ * Register an Action Evaluator
+ *
+ * @param scope
+ * @param evaluator
+ */
+ private void registerEvaluator(BaseTypeId scope, CMISActionEvaluator extends Object> evaluator)
+ {
+ Map> evaluators = actionEvaluators.get(scope);
+ if (evaluators == null)
+ {
+ evaluators = new LinkedHashMap>();
+ actionEvaluators.put(scope, evaluators);
+ }
+ if (evaluators.get(evaluator.getAction()) != null)
+ {
+ throw new AlfrescoRuntimeException("Already registered Action Evaluator " + evaluator.getAction()
+ + " for scope " + scope);
+ }
+ evaluators.put(evaluator.getAction(), evaluator);
+
+ if (logger.isDebugEnabled())
+ logger.debug("Registered Action Evaluator: scope=" + scope + ", evaluator=" + evaluator);
+ }
+
+}
diff --git a/source/java/org/alfresco/repo/audit/extractor/AbstractDataExtractor.java b/source/java/org/alfresco/repo/audit/extractor/AbstractDataExtractor.java
index 374c2a75e2..ad9ad87b28 100644
--- a/source/java/org/alfresco/repo/audit/extractor/AbstractDataExtractor.java
+++ b/source/java/org/alfresco/repo/audit/extractor/AbstractDataExtractor.java
@@ -50,7 +50,6 @@ public abstract class AbstractDataExtractor implements DataExtractor, Initializi
/**
* Set the registry with which to register
- * @param registry
*/
public void setRegistry(NamedObjectRegistry registry)
{
diff --git a/source/java/org/alfresco/repo/domain/permissions/AclDAOImpl.java b/source/java/org/alfresco/repo/domain/permissions/AclDAOImpl.java
index 877f6da243..7bd8dd3412 100644
--- a/source/java/org/alfresco/repo/domain/permissions/AclDAOImpl.java
+++ b/source/java/org/alfresco/repo/domain/permissions/AclDAOImpl.java
@@ -44,7 +44,6 @@ import org.alfresco.repo.security.permissions.impl.SimplePermissionReference;
import org.alfresco.repo.tenant.TenantService;
import org.alfresco.repo.transaction.AlfrescoTransactionSupport;
import org.alfresco.service.cmr.repository.NodeRef;
-import org.alfresco.service.cmr.repository.StoreRef;
import org.alfresco.service.cmr.security.AccessStatus;
import org.alfresco.service.cmr.security.AuthorityType;
import org.alfresco.service.namespace.QName;
@@ -66,20 +65,11 @@ public class AclDAOImpl implements AclDAO
{
private static Log logger = LogFactory.getLog(AclDAOImpl.class);
- /** Access to QName entities */
private QNameDAO qnameDAO;
-
- /** Access to ACL entities */
private AclCrudDAO aclCrudDAO;
-
- /** Access to Nodes entities */
private NodeDAO nodeDAO;
-
private TenantService tenantService;
-
- /** a transactionally-safe cache to be injected */
private SimpleCache aclCache;
-
private SimpleCache> readersCache;
private enum WriteMode
@@ -152,17 +142,19 @@ public class AclDAOImpl implements AclDAO
this.readersCache = readersCache;
}
- /* (non-Javadoc)
- * @see org.alfresco.repo.domain.permissions.AclDAO#createAccessControlList()
+ /**
+ * {@inheritDoc}
*/
+ @Override
public Long createAccessControlList()
{
return createAccessControlList(getDefaultProperties()).getId();
}
- /* (non-Javadoc)
- * @see org.alfresco.repo.domain.permissions.AclDAO#getDefaultProperties()
+ /**
+ * {@inheritDoc}
*/
+ @Override
public AccessControlListProperties getDefaultProperties()
{
SimpleAccessControlListProperties properties = new SimpleAccessControlListProperties();
@@ -172,9 +164,10 @@ public class AclDAOImpl implements AclDAO
return properties;
}
- /* (non-Javadoc)
- * @see org.alfresco.repo.domain.permissions.AclDAO#createAcl(org.alfresco.repo.security.permissions.AccessControlListProperties)
+ /**
+ * {@inheritDoc}
*/
+ @Override
public Acl createAccessControlList(AccessControlListProperties properties)
{
if (properties == null)
@@ -215,9 +208,10 @@ public class AclDAOImpl implements AclDAO
return createAccessControlList(properties, null, null);
}
- /* (non-Javadoc)
- * @see org.alfresco.repo.domain.permissions.AclDAO#createAcl(org.alfresco.repo.security.permissions.AccessControlListProperties, java.util.List, java.lang.Long)
+ /**
+ * {@inheritDoc}
*/
+ @Override
public Acl createAccessControlList(AccessControlListProperties properties, List aces, Long inherited)
{
if (properties == null)
@@ -347,7 +341,10 @@ public class AclDAOImpl implements AclDAO
return createdAcl;
}
- private void getWritable(final Long id, final Long parent, List extends AccessControlEntry> exclude, List toAdd, Long inheritsFrom, boolean cascade,
+ private void getWritable(
+ final Long id, final Long parent,
+ List extends AccessControlEntry> exclude, List toAdd,
+ Long inheritsFrom, boolean cascade,
List changes, WriteMode mode)
{
List inherited = null;
@@ -392,18 +389,12 @@ public class AclDAOImpl implements AclDAO
/**
* Make a whole tree of ACLs copy on write if required Includes adding and removing ACEs which can be optimised
* slightly for copy on write (no need to add and then remove)
- *
- * @param id
- * @param parent
- * @param exclude
- * @param toAdd
- * @param inheritsFrom
- * @param cascade
- * @param depth
- * @param changes
*/
- private void getWritable(final Long id, final Long parent, List extends AccessControlEntry> exclude, List toAdd, Long inheritsFrom,
- List inherited, List positions, boolean cascade, int depth, List changes, WriteMode mode, boolean requiresVersion)
+ private void getWritable(
+ final Long id, final Long parent,
+ List extends AccessControlEntry> exclude, List toAdd, Long inheritsFrom,
+ List inherited, List positions,
+ boolean cascade, int depth, List changes, WriteMode mode, boolean requiresVersion)
{
AclChange current = getWritable(id, parent, exclude, toAdd, inheritsFrom, inherited, positions, depth, mode, requiresVersion);
changes.add(current);
@@ -430,16 +421,11 @@ public class AclDAOImpl implements AclDAO
/**
* COW for an individual ACL
- *
- * @param id
- * @param parent
- * @param exclude
- * @param toAdd
- * @param inheritsFrom
- * @param depth
* @return - an AclChange
*/
- private AclChange getWritable(final Long id, final Long parent, List extends AccessControlEntry> exclude, List acesToAdd, Long inheritsFrom,
+ private AclChange getWritable(
+ final Long id, final Long parent,
+ List extends AccessControlEntry> exclude, List acesToAdd, Long inheritsFrom,
List inherited, List positions, int depth, WriteMode mode, boolean requiresVersion)
{
AclUpdateEntity acl = aclCrudDAO.getAclForUpdate(id);
@@ -630,10 +616,6 @@ public class AclDAOImpl implements AclDAO
/**
* Helper to remove ACEs from an ACL
- *
- * @param id
- * @param exclude
- * @param depth
*/
private void removeAcesFromAcl(final Long id, final List extends AccessControlEntry> exclude, final int depth)
{
@@ -747,9 +729,10 @@ public class AclDAOImpl implements AclDAO
addInherited(acl, inherited, positions, depth);
}
- /* (non-Javadoc)
- * @see org.alfresco.repo.domain.permissions.AclDAO#deleteAccessControlEntries(java.lang.String)
+ /**
+ * {@inheritDoc}
*/
+ @Override
public List deleteAccessControlEntries(final String authority)
{
List acls = new ArrayList();
@@ -859,9 +842,10 @@ public class AclDAOImpl implements AclDAO
return acls;
}
- /* (non-Javadoc)
- * @see org.alfresco.repo.domain.permissions.AclDAO#deleteAclForNode(long, boolean)
+ /**
+ * {@inheritDoc}
*/
+ @Override
public void deleteAclForNode(long aclId, boolean isAVMNode)
{
Acl dbAcl = getAcl(aclId);
@@ -901,9 +885,10 @@ public class AclDAOImpl implements AclDAO
}
}
- /* (non-Javadoc)
- * @see org.alfresco.repo.domain.permissions.AclDAO#deleteAccessControlList(java.lang.Long)
+ /**
+ * {@inheritDoc}
*/
+ @Override
public List deleteAccessControlList(final Long id)
{
if (logger.isDebugEnabled())
@@ -1010,6 +995,7 @@ public class AclDAOImpl implements AclDAO
/**
* {@inheritDoc}
*/
+ @Override
public List deleteLocalAccessControlEntries(Long id)
{
List changes = new ArrayList();
@@ -1023,6 +1009,7 @@ public class AclDAOImpl implements AclDAO
/**
* {@inheritDoc}
*/
+ @Override
public List deleteInheritedAccessControlEntries(Long id)
{
List changes = new ArrayList();
@@ -1036,6 +1023,7 @@ public class AclDAOImpl implements AclDAO
/**
* {@inheritDoc}
*/
+ @Override
public List deleteAccessControlEntries(Long id, AccessControlEntry pattern)
{
List changes = new ArrayList();
@@ -1047,6 +1035,7 @@ public class AclDAOImpl implements AclDAO
/**
* {@inheritDoc}
*/
+ @Override
public Acl getAcl(Long id)
{
return aclCrudDAO.getAcl(id);
@@ -1055,6 +1044,7 @@ public class AclDAOImpl implements AclDAO
/**
* {@inheritDoc}
*/
+ @Override
public AccessControlListProperties getAccessControlListProperties(Long id)
{
ParameterCheck.mandatory("id", id); // Prevent unboxing failures
@@ -1064,6 +1054,7 @@ public class AclDAOImpl implements AclDAO
/**
* {@inheritDoc}
*/
+ @Override
public AccessControlList getAccessControlList(Long id)
{
AccessControlList acl = aclCache.get(id);
@@ -1132,9 +1123,10 @@ public class AclDAOImpl implements AclDAO
return acl;
}
- /* (non-Javadoc)
- * @see org.alfresco.repo.domain.permissions.AclDAO#getInheritedAccessControlList(java.lang.Long)
+ /**
+ * {@inheritDoc}
*/
+ @Override
public Long getInheritedAccessControlList(Long id)
{
aclCache.remove(id);
@@ -1173,9 +1165,10 @@ public class AclDAOImpl implements AclDAO
return inheritedAclId;
}
- /* (non-Javadoc)
- * @see org.alfresco.repo.domain.permissions.AclDAO#mergeInheritedAccessControlList(java.lang.Long, java.lang.Long)
+ /**
+ * {@inheritDoc}
*/
+ @Override
public List mergeInheritedAccessControlList(Long inherited, Long target)
{
// TODO: For now we do a replace - we could do an insert if both inherit from the same acl
@@ -1268,9 +1261,10 @@ public class AclDAOImpl implements AclDAO
return changes;
}
- /* (non-Javadoc)
- * @see org.alfresco.repo.domain.permissions.AclDAO#setAccessControlEntry(java.lang.Long, org.alfresco.repo.security.permissions.AccessControlEntry)
+ /**
+ * {@inheritDoc}
*/
+ @Override
public List