Heinous merge from HEAD. Seems to basically work. Be on guard however.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@4137 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Britt Park
2006-10-18 02:24:36 +00:00
parent 6441f470f5
commit 111296d4dc
156 changed files with 18940 additions and 14167 deletions

View File

@@ -19,6 +19,7 @@ package org.alfresco.repo.domain;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@@ -438,19 +439,32 @@ public class PropertyValue implements Cloneable, Serializable
*
* @return Returns the <code>ValueType</code> - never null
*/
private ValueType makeValueType(QName typeQName)
private static ValueType makeValueType(QName typeQName)
{
ValueType valueType = valueTypesByPropertyType.get(typeQName);
if (valueType == null)
{
throw new AlfrescoRuntimeException(
"Property type not recognised: \n" +
" type: " + typeQName + "\n" +
" property: " + this);
" type: " + typeQName);
}
return valueType;
}
/**
* Given an actual type qualified name, returns the <tt>String</tt> that represents it in
* the database.
*
* @param typeQName the type qualified name
* @return Returns the <tt>String</tt> representation of the type,
* e.g. <b>CONTENT</b> for type <b>d:content</b>.
*/
public static String getActualTypeString(QName typeQName)
{
ValueType valueType = makeValueType(typeQName);
return valueType.toString();
}
@Override
public boolean equals(Object obj)
{
@@ -632,15 +646,16 @@ public class PropertyValue implements Cloneable, Serializable
* @return Returns the value of this property as the desired type, or a <code>Collection</code>
* of values of the required type
*
* @throws java.lang.UnsupportedOperationException if the value cannot be converted to the
* type given
* @throws AlfrescoRuntimeException
* if the type given is not recognized
* @throws org.alfresco.service.cmr.repository.datatype.TypeConversionException
* if the conversion to the required type fails
*
* @see DataTypeDefinition#ANY The static qualified names for the types
*/
public Serializable getValue(QName typeQName)
{
// first check for null
ValueType requiredType = makeValueType(typeQName);
if (requiredType == ValueType.SERIALIZABLE)
{
@@ -680,6 +695,24 @@ public class PropertyValue implements Cloneable, Serializable
return ret;
}
/**
* Gets the value or values as a guaranteed collection.
*
* @see #getValue(QName)
*/
public Collection<Serializable> getCollection(QName typeQName)
{
Serializable value = getValue(typeQName);
if (value instanceof Collection)
{
return (Collection<Serializable>) value;
}
else
{
return Collections.singletonList(value);
}
}
public boolean getBooleanValue()
{
if (booleanValue == null)