Merged V2.2 to HEAD

10963: Merged DEV/LARGE_COLLECTION_PROPERTIES_2.2.1 to V2.2
          - PersonService: Lucene removal
          - Lucene optimizations (in progress)
          - Multi-valued and locale-specific properties persisted in alf_node_properties
          - Removal of unused AVM tables
   10987: Oracle dialects and enhanced SQL patch support
          - Only support Alfresco's 9i and 10g dialects (with auto-switching)
          - SQL script patches can now apply selectively to ranges
   11007: Test to check cached retrieval of QNames


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@11206 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2008-10-06 13:26:18 +00:00
parent dd2ce5da0a
commit 6f302f0350
100 changed files with 8759 additions and 3628 deletions

View File

@@ -25,7 +25,6 @@
package org.alfresco.repo.node;
import java.io.Serializable;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
@@ -34,7 +33,6 @@ import java.util.Set;
import java.util.concurrent.locks.ReentrantLock;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.domain.PropertyValue;
import org.alfresco.repo.node.NodeServicePolicies.BeforeAddAspectPolicy;
import org.alfresco.repo.node.NodeServicePolicies.BeforeCreateChildAssociationPolicy;
import org.alfresco.repo.node.NodeServicePolicies.BeforeCreateNodeAssociationPolicy;
@@ -65,7 +63,6 @@ import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
import org.alfresco.service.cmr.dictionary.ClassDefinition;
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
import org.alfresco.service.cmr.dictionary.DictionaryException;
import org.alfresco.service.cmr.dictionary.DictionaryService;
import org.alfresco.service.cmr.dictionary.PropertyDefinition;
import org.alfresco.service.cmr.repository.AssociationRef;
@@ -74,7 +71,6 @@ import org.alfresco.service.cmr.repository.InvalidNodeRefException;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.repository.StoreRef;
import org.alfresco.service.cmr.repository.datatype.TypeConversionException;
import org.alfresco.service.namespace.QName;
import org.alfresco.service.namespace.QNamePattern;
import org.alfresco.service.namespace.RegexQNamePattern;
@@ -605,115 +601,6 @@ public abstract class AbstractNodeServiceImpl implements NodeService
{
return getChildAssocs(nodeRef, RegexQNamePattern.MATCH_ALL, RegexQNamePattern.MATCH_ALL);
}
/**
* Helper method to convert the <code>Serializable</code> value into a full,
* persistable {@link PropertyValue}.
* <p>
* Where the property definition is null, the value will take on the
* {@link DataTypeDefinition#ANY generic ANY} value.
* <p>
* Where the property definition specifies a multi-valued property but the
* value provided is not a collection, the value will be wrapped in a collection.
*
* @param propertyDef the property dictionary definition, may be null
* @param value the value, which will be converted according to the definition -
* may be null
* @return Returns the persistable property value
*/
protected PropertyValue makePropertyValue(PropertyDefinition propertyDef, Serializable value)
{
// get property attributes
QName propertyTypeQName = null;
if (propertyDef == null) // property not recognised
{
// allow it for now - persisting excess properties can be useful sometimes
propertyTypeQName = DataTypeDefinition.ANY;
}
else
{
propertyTypeQName = propertyDef.getDataType().getName();
// check that multi-valued properties are allowed
boolean isMultiValued = propertyDef.isMultiValued();
if (isMultiValued && !(value instanceof Collection))
{
if (value != null)
{
// put the value into a collection
// the implementation gives back a Serializable list
value = (Serializable) Collections.singletonList(value);
}
}
else if (!isMultiValued && (value instanceof Collection))
{
// we only allow this case if the property type is ANY
if (!propertyTypeQName.equals(DataTypeDefinition.ANY))
{
throw new DictionaryException(
"A single-valued property of this type may not be a collection: \n" +
" Property: " + propertyDef + "\n" +
" Type: " + propertyTypeQName + "\n" +
" Value: " + value);
}
}
}
try
{
PropertyValue propertyValue = new PropertyValue(propertyTypeQName, value);
// done
return propertyValue;
}
catch (TypeConversionException e)
{
throw new TypeConversionException(
"The property value is not compatible with the type defined for the property: \n" +
" property: " + (propertyDef == null ? "unknown" : propertyDef) + "\n" +
" value: " + value + "\n" +
" value type: " + value.getClass(),
e);
}
}
/**
* Extracts the externally-visible property from the {@link PropertyValue propertyValue}.
*
* @param propertyDef the model property definition - may be <tt>null</tt>
* @param propertyValue the persisted property
* @return Returns the value of the property in the format dictated by the property
* definition, or null if the property value is null
*/
protected Serializable makeSerializableValue(PropertyDefinition propertyDef, PropertyValue propertyValue)
{
if (propertyValue == null)
{
return null;
}
// get property attributes
QName propertyTypeQName = null;
if (propertyDef == null)
{
// allow this for now
propertyTypeQName = DataTypeDefinition.ANY;
}
else
{
propertyTypeQName = propertyDef.getDataType().getName();
}
try
{
Serializable value = propertyValue.getValue(propertyTypeQName);
// done
return value;
}
catch (TypeConversionException e)
{
throw new TypeConversionException(
"The property value is not compatible with the type defined for the property: \n" +
" property: " + (propertyDef == null ? "unknown" : propertyDef) + "\n" +
" property value: " + propertyValue,
e);
}
}
protected Map<QName, Serializable> getDefaultProperties(QName typeQName)
{