Merged V2.2 to HEAD

8371: Merged V2.1 to V2.2
      8307: Next round of fixes for session management.
      8309: Fixed AR-1891: Long MLText strings fail in Oracle
      8313: Fix for case where existing MLText entry is null
      8319: Follow-up fix for NPE where StringValue is null when persisting
      8331: Fix for AR-1696: Long text in an aspect property causes an exception


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@8496 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2008-03-11 06:03:17 +00:00
parent 78c695fc0a
commit ceed05d26f
40 changed files with 1276 additions and 1445 deletions

View File

@@ -0,0 +1,373 @@
/*
* Copyright (C) 2005-2007 Alfresco Software Limited.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program 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 General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* As a special exception to the terms and conditions of version 2.0 of
* the GPL, you may redistribute this Program in connection with Free/Libre
* and Open Source Software ("FLOSS") applications as described in Alfresco's
* FLOSS exception. You should have recieved a copy of the text describing
* the FLOSS exception, and it is also available here:
* http://www.alfresco.com/legal/licensing
*/
package org.alfresco.repo.attributes;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.Collection;
import java.util.Iterator;
import java.util.Set;
import java.util.Map.Entry;
import org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter;
import org.alfresco.service.cmr.repository.datatype.TypeConversionException;
/**
* Base class for handling basic type conversions.
*
* @author Derek Hulley
* @since V2.1.2
*/
public abstract class AbstractAttribute implements Attribute
{
public final AttributeImpl getAttributeImpl()
{
if (this instanceof AttributeImpl)
{
// No conversion necessary
return (AttributeImpl) this;
}
else
{
// Use Type's factory method
return getType().getAttributeImpl(this);
}
}
public final AttributeValue getAttributeValue()
{
if (this instanceof AttributeValue)
{
// No conversion necessary
return (AttributeValue) this;
}
else
{
// Use Type's factory method
return getType().getAttributeValue(this);
}
}
/**
* {@link ListAttributeValue}-specific method.
*/
public void add(Attribute attr)
{
throw new AttributeMethodNotImplemented("Not a List.");
}
/**
* {@link ListAttributeValue}-specific method.
*/
public void add(int index, Attribute attr)
{
throw new AttributeMethodNotImplemented("Not a List.");
}
/**
* {@link ListAttributeValue}-specific method.
*/
public Iterator<Attribute> iterator()
{
throw new AttributeMethodNotImplemented("Not a List.");
}
/**
* {@link ListAttributeValue} or {@link MapAttributeValue}-specific method.
*/
public int size()
{
throw new AttributeMethodNotImplemented("Not a List or Map.");
}
/**
* {@link ListAttributeValue}-specific method.
*/
public Attribute get(int index)
{
throw new AttributeMethodNotImplemented("Not a List.");
}
/**
* {@link ListAttributeValue}-specific method.
*/
public void remove(int index)
{
throw new AttributeMethodNotImplemented("Not a List.");
}
/**
* {@link ListAttributeValue}-specific method.
*/
public void set(int index, Attribute value)
{
throw new AttributeMethodNotImplemented("Not a List.");
}
/**
* {@link MapAttributeValue}-specific method.
*/
public void clear()
{
throw new AttributeMethodNotImplemented("Not a Map.");
}
/**
* {@link MapAttributeValue}-specific method.
*/
public Set<Entry<String, Attribute>> entrySet()
{
throw new AttributeMethodNotImplemented("Not a Map.");
}
/**
* {@link MapAttributeValue}-specific method.
*/
public Set<String> keySet()
{
throw new AttributeMethodNotImplemented("Not a map.");
}
/**
* {@link MapAttributeValue}-specific method.
*/
public Collection<Attribute> values()
{
throw new AttributeMethodNotImplemented("Not a map.");
}
/**
* {@link MapAttributeValue}-specific method.
*/
public void put(String key, Attribute value)
{
throw new AttributeMethodNotImplemented("Not a map.");
}
/**
* {@link MapAttributeValue}-specific method.
*/
public void remove(String key)
{
throw new AttributeMethodNotImplemented("Not a map.");
}
/**
* {@link MapAttributeValue}-specific method.
*/
public Attribute get(String key)
{
throw new AttributeMethodNotImplemented("Not a Map.");
}
public byte[] getBlobValue()
{
Serializable raw = getRawValue();
// Just serialize it
try
{
ByteArrayOutputStream bos = new ByteArrayOutputStream(1024);
ObjectOutputStream oos = new ObjectOutputStream(bos);
oos.writeObject(raw);
byte[] bytes = bos.toByteArray();
return bytes;
}
catch (IOException e)
{
throw new TypeConversionException("Unable to get blob value: " + this);
}
}
public boolean getBooleanValue()
{
Serializable raw = getRawValue();
try
{
Boolean obj = DefaultTypeConverter.INSTANCE.convert(Boolean.class, raw);
return obj;
}
catch (TypeConversionException e)
{
throw new AttributeMethodNotImplemented("Unable to convert to Boolean value: " + this);
}
}
public byte getByteValue()
{
Serializable raw = getRawValue();
try
{
Byte obj = DefaultTypeConverter.INSTANCE.convert(Byte.class, raw);
return obj;
}
catch (TypeConversionException e)
{
throw new AttributeMethodNotImplemented("Unable to convert to Byte value: " + this);
}
}
public short getShortValue()
{
Serializable raw = getRawValue();
try
{
Short obj = DefaultTypeConverter.INSTANCE.convert(Short.class, raw);
return obj;
}
catch (TypeConversionException e)
{
throw new AttributeMethodNotImplemented("Unable to convert to Short value: " + this);
}
}
public int getIntValue()
{
Serializable raw = getRawValue();
try
{
Integer obj = DefaultTypeConverter.INSTANCE.convert(Integer.class, raw);
return obj;
}
catch (TypeConversionException e)
{
throw new AttributeMethodNotImplemented("Unable to convert to Integer value: " + this);
}
}
public long getLongValue()
{
Serializable raw = getRawValue();
try
{
Long obj = DefaultTypeConverter.INSTANCE.convert(Long.class, raw);
return obj;
}
catch (TypeConversionException e)
{
throw new AttributeMethodNotImplemented("Unable to convert to Long value: " + this);
}
}
public double getDoubleValue()
{
Serializable raw = getRawValue();
try
{
Double obj = DefaultTypeConverter.INSTANCE.convert(Double.class, raw);
return obj;
}
catch (TypeConversionException e)
{
throw new AttributeMethodNotImplemented("Unable to convert to Double value: " + this);
}
}
public float getFloatValue()
{
Serializable raw = getRawValue();
try
{
Float obj = DefaultTypeConverter.INSTANCE.convert(Float.class, raw);
return obj;
}
catch (TypeConversionException e)
{
throw new AttributeMethodNotImplemented("Unable to convert to Float value: " + this);
}
}
public String getStringValue()
{
Serializable raw = getRawValue();
try
{
String obj = DefaultTypeConverter.INSTANCE.convert(String.class, raw);
return obj;
}
catch (TypeConversionException e)
{
throw new AttributeMethodNotImplemented("Unable to convert to String value: " + this);
}
}
public Serializable getSerializableValue()
{
// This can always be fulfilled by the raw value
return getRawValue();
}
public void setBlobValue(byte[] value)
{
throw new AttributeMethodNotImplemented("Not a Blob.");
}
public void setBooleanValue(boolean value)
{
throw new AttributeMethodNotImplemented("Not a boolean.");
}
public void setByteValue(byte value)
{
throw new AttributeMethodNotImplemented("Not a byte.");
}
public void setShortValue(short value)
{
throw new AttributeMethodNotImplemented("Not a short.");
}
public void setIntValue(int value)
{
throw new AttributeMethodNotImplemented("Not an int.");
}
public void setLongValue(long value)
{
throw new AttributeMethodNotImplemented("Not a long.");
}
public void setDoubleValue(double value)
{
throw new AttributeMethodNotImplemented("Not a double.");
}
public void setFloatValue(float value)
{
throw new AttributeMethodNotImplemented("Not a float.");
}
public void setStringValue(String value)
{
throw new AttributeMethodNotImplemented("Not a String.");
}
public void setSerializableValue(Serializable value)
{
throw new AttributeMethodNotImplemented("Not a Serializable.");
}
}

View File

@@ -32,6 +32,7 @@ import java.util.Map;
import java.util.Set;
import org.alfresco.repo.domain.DbAccessControlList;
import org.alfresco.repo.domain.schema.SchemaBootstrap;
/**
* Interface for polymorphic attributes.
@@ -41,17 +42,373 @@ public interface Attribute extends Serializable, Iterable<Attribute>
{
public static enum Type implements Serializable
{
BOOLEAN,
BYTE,
SHORT,
INT,
LONG,
FLOAT,
DOUBLE,
STRING,
SERIALIZABLE,
MAP,
BOOLEAN
{
@Override
public AttributeValue getAttributeValue(Attribute from)
{
if (from instanceof BooleanAttribute)
{
return new BooleanAttributeValue((BooleanAttribute)from);
}
else
{
throw new IllegalArgumentException(
"Conversion to " + this + " not supported for " + from.getType() + "(" + from + ")");
}
}
@Override
public AttributeImpl getAttributeImpl(Attribute from)
{
if (from instanceof BooleanAttribute)
{
return new BooleanAttributeImpl((BooleanAttribute)from);
}
else
{
throw new IllegalArgumentException(
"Conversion to " + this + " not supported for " + from.getType() + "(" + from + ")");
}
}
},
BYTE
{
@Override
public AttributeValue getAttributeValue(Attribute from)
{
if (from instanceof ByteAttribute)
{
return new ByteAttributeValue((ByteAttribute)from);
}
else
{
throw new IllegalArgumentException(
"Conversion to " + this + " not supported for " + from.getType() + "(" + from + ")");
}
}
@Override
public AttributeImpl getAttributeImpl(Attribute from)
{
if (from instanceof ByteAttribute)
{
return new ByteAttributeImpl((ByteAttribute)from);
}
else
{
throw new IllegalArgumentException(
"Conversion to " + this + " not supported for " + from.getType() + "(" + from + ")");
}
}
},
SHORT
{
@Override
public AttributeValue getAttributeValue(Attribute from)
{
if (from instanceof ShortAttribute)
{
return new ShortAttributeValue((ShortAttribute)from);
}
else
{
throw new IllegalArgumentException(
"Conversion to " + this + " not supported for " + from.getType() + "(" + from + ")");
}
}
@Override
public AttributeImpl getAttributeImpl(Attribute from)
{
if (from instanceof ShortAttribute)
{
return new ShortAttributeImpl((ShortAttribute)from);
}
else
{
throw new IllegalArgumentException(
"Conversion to " + this + " not supported for " + from.getType() + "(" + from + ")");
}
}
},
INT
{
@Override
public AttributeValue getAttributeValue(Attribute from)
{
if (from instanceof IntAttribute)
{
return new IntAttributeValue((IntAttribute)from);
}
else
{
throw new IllegalArgumentException(
"Conversion to " + this + " not supported for " + from.getType() + "(" + from + ")");
}
}
@Override
public AttributeImpl getAttributeImpl(Attribute from)
{
if (from instanceof IntAttribute)
{
return new IntAttributeImpl((IntAttribute)from);
}
else
{
throw new IllegalArgumentException(
"Conversion to " + this + " not supported for " + from.getType() + "(" + from + ")");
}
}
},
LONG
{
@Override
public AttributeValue getAttributeValue(Attribute from)
{
if (from instanceof LongAttribute)
{
return new LongAttributeValue((LongAttribute)from);
}
else
{
throw new IllegalArgumentException(
"Conversion to " + this + " not supported for " + from.getType() + "(" + from + ")");
}
}
@Override
public AttributeImpl getAttributeImpl(Attribute from)
{
if (from instanceof LongAttribute)
{
return new LongAttributeImpl((LongAttribute)from);
}
else
{
throw new IllegalArgumentException(
"Conversion to " + this + " not supported for " + from.getType() + "(" + from + ")");
}
}
},
FLOAT
{
@Override
public AttributeValue getAttributeValue(Attribute from)
{
if (from instanceof FloatAttribute)
{
return new FloatAttributeValue((FloatAttribute)from);
}
else
{
throw new IllegalArgumentException(
"Conversion to " + this + " not supported for " + from.getType() + "(" + from + ")");
}
}
@Override
public AttributeImpl getAttributeImpl(Attribute from)
{
if (from instanceof FloatAttribute)
{
return new FloatAttributeImpl((FloatAttribute)from);
}
else
{
throw new IllegalArgumentException(
"Conversion to " + this + " not supported for " + from.getType() + "(" + from + ")");
}
}
},
DOUBLE
{
@Override
public AttributeValue getAttributeValue(Attribute from)
{
if (from instanceof DoubleAttribute)
{
return new DoubleAttributeValue((DoubleAttribute)from);
}
else
{
throw new IllegalArgumentException(
"Conversion to " + this + " not supported for " + from.getType() + "(" + from + ")");
}
}
@Override
public AttributeImpl getAttributeImpl(Attribute from)
{
if (from instanceof DoubleAttribute)
{
return new DoubleAttributeImpl((DoubleAttribute)from);
}
else
{
throw new IllegalArgumentException(
"Conversion to " + this + " not supported for " + from.getType() + "(" + from + ")");
}
}
},
STRING
{
@Override
public AttributeValue getAttributeValue(Attribute from)
{
if (from instanceof StringAttribute)
{
return new StringAttributeValue((StringAttribute)from);
}
else
{
throw new IllegalArgumentException(
"Conversion to " + this + " not supported for " + from.getType() + "(" + from + ")");
}
}
@Override
public AttributeImpl getAttributeImpl(Attribute from)
{
if (from instanceof StringAttribute)
{
// We need to check that the String will fit into the database
StringAttribute stringAttr = (StringAttribute) from;
String stringValue = stringAttr.getStringValue();
if (stringValue != null && stringValue.length() > SchemaBootstrap.getMaxStringLength())
{
// Need to serialize it
return new SerializableAttributeImpl(stringValue);
}
else
{
return new StringAttributeImpl(stringValue);
}
}
else
{
throw new IllegalArgumentException(
"Conversion to " + this + " not supported for " + from.getType() + "(" + from + ")");
}
}
},
SERIALIZABLE
{
@Override
public AttributeValue getAttributeValue(Attribute from)
{
if (from instanceof SerializableAttribute)
{
return new SerializableAttributeValue((SerializableAttribute)from);
}
else
{
throw new IllegalArgumentException(
"Conversion to " + this + " not supported for " + from.getType() + "(" + from + ")");
}
}
@Override
public AttributeImpl getAttributeImpl(Attribute from)
{
if (from instanceof SerializableAttribute)
{
return new SerializableAttributeImpl((SerializableAttribute)from);
}
else
{
throw new IllegalArgumentException(
"Conversion to " + this + " not supported for " + from.getType() + "(" + from + ")");
}
}
},
MAP
{
@Override
public AttributeValue getAttributeValue(Attribute from)
{
if (from instanceof MapAttribute)
{
return new MapAttributeValue((MapAttribute)from);
}
else
{
throw new IllegalArgumentException(
"Conversion to " + this + " not supported for " + from.getType() + "(" + from + ")");
}
}
@Override
public AttributeImpl getAttributeImpl(Attribute from)
{
if (from instanceof MapAttribute)
{
return new MapAttributeImpl((MapAttribute)from);
}
else
{
throw new IllegalArgumentException(
"Conversion to " + this + " not supported for " + from.getType() + "(" + from + ")");
}
}
},
LIST
{
@Override
public AttributeValue getAttributeValue(Attribute from)
{
if (from instanceof ListAttribute)
{
return new ListAttributeValue((ListAttribute)from);
}
else
{
throw new IllegalArgumentException(
"Conversion to " + this + " not supported for " + from.getType() + "(" + from + ")");
}
}
@Override
public AttributeImpl getAttributeImpl(Attribute from)
{
if (from instanceof ListAttribute)
{
return new ListAttributeImpl((ListAttribute)from);
}
else
{
throw new IllegalArgumentException(
"Conversion to " + this + " not supported for " + from.getType() + "(" + from + ")");
}
}
};
/**
* Get the unpersisted attribute value implementation of the {@link Attribute} given an existing attribute.
* The <tt>from</tt> attribute may be a persistable entity or not but a new instance will
* be created.
* <p>
* No assumptions should be made about the return type. The raw type might not match the persisted type.
*
* @param from the instance supplying the data
* @return Returns a value object based on the provided data
*/
public abstract AttributeValue getAttributeValue(Attribute from);
/**
* Get a persistable implementation of the {@link Attribute} given an existing attribute.
* The <tt>from</tt> attribute may be a persistable entity or not but a new instance will
* be created.
* <p>
* No assumptions should be made about the return type. It is possible that the data will
* be converted to a different persistable type.
*
* @param from the instance supplying the data
* @return Returns a persistable entity based on the provided data
*/
public abstract AttributeImpl getAttributeImpl(Attribute from);
};
/**
@@ -67,10 +424,25 @@ public interface Attribute extends Serializable, Iterable<Attribute>
public DbAccessControlList getAcl();
/**
* Get the value type for this node.
* @return
* @return the enumerated type
*/
public Type getType();
/**
* Method to return the underlying raw data for possible conversion to the descired type.
* @return Returns a raw data value
*/
public Serializable getRawValue();
/**
* @see Type#getAttributeValue(Attribute)
*/
public abstract AttributeValue getAttributeValue();
/**
* @see Type#getAttributeImpl(Attribute)
*/
public abstract AttributeImpl getAttributeImpl();
/**
* Set a boolean value.

View File

@@ -25,13 +25,14 @@
package org.alfresco.repo.attributes;
import java.util.Map;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.repo.avm.AVMDAOs;
/**
* Handles conversions between persistent and value based Attributes.
*
* @see Attribute.Type#getAttributeImpl(Attribute)
* @see Attribute.Type#getAttributeValue(Attribute)
*
* @author britt
*/
public class AttributeConverter
@@ -44,133 +45,16 @@ public class AttributeConverter
*/
public Attribute toPersistent(Attribute from)
{
switch (from.getType())
{
case BOOLEAN :
{
return new BooleanAttributeImpl((BooleanAttribute)from);
}
case BYTE :
{
return new ByteAttributeImpl((ByteAttribute)from);
}
case SHORT :
{
return new ShortAttributeImpl((ShortAttribute)from);
}
case INT :
{
return new IntAttributeImpl((IntAttribute)from);
}
case LONG :
{
return new LongAttributeImpl((LongAttribute)from);
}
case FLOAT :
{
return new FloatAttributeImpl((FloatAttribute)from);
}
case DOUBLE :
{
return new DoubleAttributeImpl((DoubleAttribute)from);
}
case STRING :
{
return new StringAttributeImpl((StringAttribute)from);
}
case SERIALIZABLE :
{
return new SerializableAttributeImpl((SerializableAttribute)from);
}
case MAP :
{
return new MapAttributeImpl((MapAttribute)from);
}
case LIST :
{
return new ListAttributeImpl((ListAttribute)from);
}
default :
{
throw new AlfrescoRuntimeException("Invalid Attribute Type: " + from.getType());
}
}
AttributeImpl attributeEntity = from.getAttributeImpl();
// Done
return attributeEntity;
}
public Attribute toValue(Attribute from)
{
Attribute ret = null;
switch (from.getType())
{
case BOOLEAN :
{
ret = new BooleanAttributeValue((BooleanAttribute)from);
break;
}
case BYTE :
{
ret = new ByteAttributeValue((ByteAttribute)from);
break;
}
case SHORT :
{
ret = new ShortAttributeValue((ShortAttribute)from);
break;
}
case INT :
{
ret = new IntAttributeValue((IntAttribute)from);
break;
}
case LONG :
{
ret = new LongAttributeValue((LongAttribute)from);
break;
}
case FLOAT :
{
ret = new FloatAttributeValue((FloatAttribute)from);
break;
}
case DOUBLE :
{
ret = new DoubleAttributeValue((DoubleAttribute)from);
break;
}
case STRING :
{
ret = new StringAttributeValue((StringAttribute)from);
break;
}
case SERIALIZABLE :
{
ret = new SerializableAttributeValue((SerializableAttribute)from);
break;
}
case MAP :
{
ret = new MapAttributeValue();
for (Map.Entry<String, Attribute> entry : from.entrySet())
{
ret.put(entry.getKey(), toValue(entry.getValue()));
}
break;
}
case LIST :
{
ret = new ListAttributeValue();
for (Attribute child : from)
{
ret.add(toValue(child));
}
break;
}
default :
{
throw new AlfrescoRuntimeException("Invalid Attribute Type: " + from.getType());
}
}
AttributeValue attributeValue = from.getAttributeValue();
AVMDAOs.Instance().fAttributeDAO.evictFlat(from);
return ret;
// Done
return attributeValue;
}
}

View File

@@ -25,19 +25,13 @@
package org.alfresco.repo.attributes;
import java.io.Serializable;
import java.util.Collection;
import java.util.Iterator;
import java.util.Set;
import java.util.Map.Entry;
import org.alfresco.repo.domain.DbAccessControlList;
/**
* The base class of the implementation of Values.
* @author britt
*/
public abstract class AttributeImpl implements Attribute
public abstract class AttributeImpl extends AbstractAttribute implements Attribute
{
/**
* The primary key.
@@ -89,226 +83,17 @@ public abstract class AttributeImpl implements Attribute
{
return fVersion;
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Value#clear()
*/
public void clear()
public DbAccessControlList getAcl()
{
throw new AttributeMethodNotImplemented("Not ListValue or MapValue");
return fACL;
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Value#entrySet()
*/
public Set<Entry<String, Attribute>> entrySet()
public void setAcl(DbAccessControlList acl)
{
throw new AttributeMethodNotImplemented("Not MapValue");
fACL = acl;
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Value#get(java.lang.String)
*/
public Attribute get(String key)
{
throw new AttributeMethodNotImplemented("Not Map or List");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Value#getBlobValue()
*/
public byte[] getBlobValue()
{
throw new AttributeMethodNotImplemented("Not BlobValue");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Value#getDoubleValue()
*/
public double getDoubleValue()
{
throw new AttributeMethodNotImplemented("Not DoubleValue");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Value#getIntValue()
*/
public int getIntValue()
{
throw new AttributeMethodNotImplemented("Not IntValue");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Value#getLongValue()
*/
public long getLongValue()
{
throw new AttributeMethodNotImplemented("Not LongValue");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Value#getSerializableValue()
*/
public Serializable getSerializableValue()
{
throw new AttributeMethodNotImplemented("Not SerializableValue");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Value#getStringValue()
*/
public String getStringValue()
{
throw new AttributeMethodNotImplemented("Not StringValue");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Value#keySet()
*/
public Set<String> keySet()
{
throw new AttributeMethodNotImplemented("Not MapValue");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Value#put(java.lang.String, org.alfresco.repo.attributes.Value)
*/
public void put(String key, Attribute value)
{
throw new AttributeMethodNotImplemented("Not Map or List.");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Value#remove(java.lang.String)
*/
public void remove(String key)
{
throw new AttributeMethodNotImplemented("Not MapValue");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Value#setBlobValue(byte[])
*/
public void setBlobValue(byte[] value)
{
throw new AttributeMethodNotImplemented("Not BlobValue");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Value#setDoubleValue(double)
*/
public void setDoubleValue(double value)
{
throw new AttributeMethodNotImplemented("Not DoubleValue");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Value#setIntValue(int)
*/
public void setIntValue(int value)
{
throw new AttributeMethodNotImplemented("Not IntValue");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Value#setLongValue(long)
*/
public void setLongValue(long value)
{
throw new AttributeMethodNotImplemented("Not LongValue");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Value#setSerializableValue(java.io.Serializable)
*/
public void setSerializableValue(Serializable value)
{
throw new AttributeMethodNotImplemented("Not SerializableValue");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Value#setStringValue(java.lang.String)
*/
public void setStringValue(String value)
{
throw new AttributeMethodNotImplemented("Not StringValue");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Value#values()
*/
public Collection<Attribute> values()
{
throw new AttributeMethodNotImplemented("Not MapValue");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Value#getBooleanValue()
*/
public boolean getBooleanValue()
{
throw new AttributeMethodNotImplemented("Not BooleanValue");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Value#getByteValue()
*/
public byte getByteValue()
{
throw new AttributeMethodNotImplemented("Not ByteValue");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Value#getFloatValue()
*/
public float getFloatValue()
{
throw new AttributeMethodNotImplemented("Not FloatValue");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Value#getShortValue()
*/
public short getShortValue()
{
throw new AttributeMethodNotImplemented("Not ShortValue");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Value#setBooleanValue(boolean)
*/
public void setBooleanValue(boolean value)
{
throw new AttributeMethodNotImplemented("Not BooleanValue");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Value#setByteValue(byte)
*/
public void setByteValue(byte value)
{
throw new AttributeMethodNotImplemented("Not ByteValue");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Value#setFloatValue(float)
*/
public void setFloatValue(float value)
{
throw new AttributeMethodNotImplemented("Not FloatValue");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Value#setShortValue(short)
*/
public void setShortValue(short value)
{
throw new AttributeMethodNotImplemented("Not ShortValue");
}
/* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object obj)
{
@@ -323,84 +108,9 @@ public abstract class AttributeImpl implements Attribute
return fID == ((AttributeImpl)obj).fID;
}
/* (non-Javadoc)
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode()
{
return (int)fID;
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Attribute#getAcl()
*/
public DbAccessControlList getAcl()
{
return fACL;
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Attribute#setAcl(org.alfresco.repo.domain.DbAccessControlList)
*/
public void setAcl(DbAccessControlList acl)
{
fACL = acl;
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Attribute#add(org.alfresco.repo.attributes.Attribute)
*/
public void add(Attribute attr)
{
throw new AttributeMethodNotImplemented("Not a List.");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Attribute#add(int, org.alfresco.repo.attributes.Attribute)
*/
public void add(int index, Attribute attr)
{
throw new AttributeMethodNotImplemented("Not a List.");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Attribute#iterator()
*/
public Iterator<Attribute> iterator()
{
throw new AttributeMethodNotImplemented("Not a List.");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Attribute#size()
*/
public int size()
{
throw new AttributeMethodNotImplemented("Not a List or Map.");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Attribute#get(int)
*/
public Attribute get(int index)
{
throw new AttributeMethodNotImplemented("Not a List.");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Attribute#remove(int)
*/
public void remove(int index)
{
throw new AttributeMethodNotImplemented("Not a List.");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Attribute#set(int, org.alfresco.repo.attributes.Attribute)
*/
public void set(int index, Attribute value)
{
throw new AttributeMethodNotImplemented("Not a List.");
}
}

View File

@@ -489,7 +489,7 @@ public class AttributeServiceImpl implements AttributeService
throw new AVMWrongTypeException("Attribute Not List: " + keys);
}
Attribute converted = fAttributeConverter.toPersistent(value);
found.set(index, fAttributeConverter.toPersistent(value));
found.set(index, converted);
}
/* (non-Javadoc)

View File

@@ -25,6 +25,7 @@
package org.alfresco.repo.attributes;
import java.rmi.server.LogStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -82,7 +83,7 @@ public class AttributeServiceTest extends TestCase
}
}
public void testBasic()
public void testBasic() throws Exception
{
try
{
@@ -126,15 +127,30 @@ public class AttributeServiceTest extends TestCase
}
catch (Exception e)
{
e.printStackTrace();
fail();
throw e;
}
}
public void testLongStrings() throws Exception
{
StringBuilder sb = new StringBuilder();
for (int i = 0; i < 1000; i++)
{
sb.append(i);
}
String longStr = sb.toString();
StringAttributeValue attributeValue = new StringAttributeValue(longStr);
fService.setAttribute("", "long-string", attributeValue);
// Check that we can get it back
Attribute checkAttribute = fService.getAttribute("long-string");
String checkStr = checkAttribute.getStringValue();
assertEquals("Retrieved String is not the same as the persisted one", longStr, checkStr);
}
/**
* Test the query capability.
*/
public void testQuery()
public void testQuery() throws Exception
{
try
{
@@ -236,12 +252,11 @@ public class AttributeServiceTest extends TestCase
}
catch (Exception e)
{
e.printStackTrace();
fail();
throw e;
}
}
public void testDelete()
public void testDelete() throws Exception
{
try
{
@@ -290,14 +305,14 @@ public class AttributeServiceTest extends TestCase
}
catch (Exception e)
{
e.printStackTrace();
throw e;
}
}
/**
* Test ListAttributes
*/
public void testList()
public void testList() throws Exception
{
try
{
@@ -344,8 +359,7 @@ public class AttributeServiceTest extends TestCase
}
catch (Exception e)
{
e.printStackTrace();
fail();
throw e;
}
}
}

View File

@@ -25,19 +25,13 @@
package org.alfresco.repo.attributes;
import java.io.Serializable;
import java.util.Collection;
import java.util.Iterator;
import java.util.Set;
import java.util.Map.Entry;
import org.alfresco.repo.domain.DbAccessControlList;
/**
* Value based non-persistent implementation of Attribute.
* @author britt
*/
public abstract class AttributeValue implements Attribute
public abstract class AttributeValue extends AbstractAttribute implements Attribute
{
/**
* ACL for this Attribute
@@ -55,292 +49,14 @@ public abstract class AttributeValue implements Attribute
{
fACL = acl;
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Attribute#clear()
*/
public void clear()
{
throw new AttributeMethodNotImplemented("Not a Map.");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Attribute#entrySet()
*/
public Set<Entry<String, Attribute>> entrySet()
{
throw new AttributeMethodNotImplemented("Not a Map.");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Attribute#get(java.lang.String)
*/
public Attribute get(String key)
{
throw new AttributeMethodNotImplemented("Not a Map.");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Attribute#getBlobValue()
*/
public byte[] getBlobValue()
{
throw new AttributeMethodNotImplemented("Not a Blob.");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Attribute#getBooleanValue()
*/
public boolean getBooleanValue()
{
throw new AttributeMethodNotImplemented("Not a boolean.");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Attribute#getByteValue()
*/
public byte getByteValue()
{
throw new AttributeMethodNotImplemented("Not a byte.");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Attribute#getDoubleValue()
*/
public double getDoubleValue()
{
throw new AttributeMethodNotImplemented("Not a double.");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Attribute#getFloatValue()
*/
public float getFloatValue()
{
throw new AttributeMethodNotImplemented("Not a float.");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Attribute#getIntValue()
*/
public int getIntValue()
{
throw new AttributeMethodNotImplemented("Not an int.");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Attribute#getLongValue()
*/
public long getLongValue()
{
throw new AttributeMethodNotImplemented("Not a long.");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Attribute#getSerializableValue()
*/
public Serializable getSerializableValue()
{
throw new AttributeMethodNotImplemented("Not a Serializable.");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Attribute#getShortValue()
*/
public short getShortValue()
{
throw new AttributeMethodNotImplemented("Not a short.");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Attribute#getStringValue()
*/
public String getStringValue()
{
throw new AttributeMethodNotImplemented("Not a String.");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Attribute#keySet()
*/
public Set<String> keySet()
{
throw new AttributeMethodNotImplemented("Not a map.");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Attribute#put(java.lang.String, org.alfresco.repo.attributes.Attribute)
*/
public void put(String key, Attribute value)
{
throw new AttributeMethodNotImplemented("Not a map.");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Attribute#remove(java.lang.String)
*/
public void remove(String key)
{
throw new AttributeMethodNotImplemented("Not a map.");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Attribute#setBlobValue(byte[])
*/
public void setBlobValue(byte[] value)
{
throw new AttributeMethodNotImplemented("Not a Blob.");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Attribute#setBooleanValue(boolean)
*/
public void setBooleanValue(boolean value)
{
throw new AttributeMethodNotImplemented("Not a boolean.");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Attribute#setByteValue(byte)
*/
public void setByteValue(byte value)
{
throw new AttributeMethodNotImplemented("Not a byte.");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Attribute#setDoubleValue(double)
*/
public void setDoubleValue(double value)
{
throw new AttributeMethodNotImplemented("Not a double.");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Attribute#setFloatValue(float)
*/
public void setFloatValue(float value)
{
throw new AttributeMethodNotImplemented("Not a float.");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Attribute#setIntValue(int)
*/
public void setIntValue(int value)
{
throw new AttributeMethodNotImplemented("Not an int.");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Attribute#setLongValue(long)
*/
public void setLongValue(long value)
{
throw new AttributeMethodNotImplemented("Not a long.");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Attribute#setSerializableValue(java.io.Serializable)
*/
public void setSerializableValue(Serializable value)
{
throw new AttributeMethodNotImplemented("Not a Serializable.");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Attribute#setShortValue(short)
*/
public void setShortValue(short value)
{
throw new AttributeMethodNotImplemented("Not a short.");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Attribute#setStringValue(java.lang.String)
*/
public void setStringValue(String value)
{
throw new AttributeMethodNotImplemented("Not a String.");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Attribute#values()
*/
public Collection<Attribute> values()
{
throw new AttributeMethodNotImplemented("Not a map.");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Attribute#getAcl()
*/
public DbAccessControlList getAcl()
{
return fACL;
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Attribute#setAcl(org.alfresco.repo.domain.DbAccessControlList)
*/
public void setAcl(DbAccessControlList acl)
{
fACL = acl;
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Attribute#add(org.alfresco.repo.attributes.Attribute)
*/
public void add(Attribute attr)
{
throw new AttributeMethodNotImplemented("Not a List.");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Attribute#add(int, org.alfresco.repo.attributes.Attribute)
*/
public void add(int index, Attribute attr)
{
throw new AttributeMethodNotImplemented("Not a List.");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Attribute#iterator()
*/
public Iterator<Attribute> iterator()
{
throw new AttributeMethodNotImplemented("Not a List.");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Attribute#size()
*/
public int size()
{
throw new AttributeMethodNotImplemented("Not a List or Map.");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Attribute#get(int)
*/
public Attribute get(int index)
{
throw new AttributeMethodNotImplemented("Not a List.");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Attribute#remove(int)
*/
public void remove(int index)
{
throw new AttributeMethodNotImplemented("Not a List.");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Attribute#set(int, org.alfresco.repo.attributes.Attribute)
*/
public void set(int index, Attribute value)
{
throw new AttributeMethodNotImplemented("Not a List.");
}
}

View File

@@ -25,6 +25,8 @@
package org.alfresco.repo.attributes;
import java.io.Serializable;
import org.alfresco.repo.avm.AVMDAOs;
/**
@@ -55,35 +57,28 @@ public class BooleanAttributeImpl extends AttributeImpl implements
AVMDAOs.Instance().fAttributeDAO.save(this);
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.AttributeImpl#getBooleanValue()
*/
@Override
public boolean getBooleanValue()
{
return fValue;
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.AttributeImpl#setBooleanValue(boolean)
*/
@Override
public void setBooleanValue(boolean value)
{
fValue = value;
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Attribute#getType()
*/
public Type getType()
{
return Type.BOOLEAN;
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
public Serializable getRawValue()
{
return Boolean.valueOf(fValue);
}
@Override
public String toString()
{

View File

@@ -25,6 +25,8 @@
package org.alfresco.repo.attributes;
import java.io.Serializable;
/**
* Value based implementation of a boolean attribute.
* @author britt
@@ -47,35 +49,28 @@ public class BooleanAttributeValue extends AttributeValue implements
fData = attr.getBooleanValue();
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Attribute#getType()
*/
public Type getType()
{
return Type.BOOLEAN;
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.AttributeValue#getBooleanValue()
*/
public Serializable getRawValue()
{
return Boolean.valueOf(fData);
}
@Override
public boolean getBooleanValue()
{
return fData;
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.AttributeValue#setBooleanValue(boolean)
*/
@Override
public void setBooleanValue(boolean value)
{
fData = value;
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public String toString()
{

View File

@@ -25,6 +25,8 @@
package org.alfresco.repo.attributes;
import java.io.Serializable;
import org.alfresco.repo.avm.AVMDAOs;
/**
@@ -54,35 +56,28 @@ public class ByteAttributeImpl extends AttributeImpl implements ByteAttribute
AVMDAOs.Instance().fAttributeDAO.save(this);
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Attribute#getType()
*/
public Type getType()
{
return Type.BYTE;
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.AttributeImpl#getByteValue()
*/
public Serializable getRawValue()
{
return Byte.valueOf(fValue);
}
@Override
public byte getByteValue()
{
return fValue;
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.AttributeImpl#setByteValue(byte)
*/
@Override
public void setByteValue(byte value)
{
fValue = value;
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public String toString()
{

View File

@@ -25,6 +25,8 @@
package org.alfresco.repo.attributes;
import java.io.Serializable;
/**
* Value based implementation of byte attribute.
* @author britt
@@ -46,35 +48,28 @@ public class ByteAttributeValue extends AttributeValue implements ByteAttribute
fData = attr.getByteValue();
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Attribute#getType()
*/
public Type getType()
{
return Type.BYTE;
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.AttributeValue#getByteValue()
*/
public Serializable getRawValue()
{
return Byte.valueOf(fData);
}
@Override
public byte getByteValue()
{
return fData;
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.AttributeValue#setByteValue(byte)
*/
@Override
public void setByteValue(byte value)
{
fData = value;
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public String toString()
{

View File

@@ -25,6 +25,8 @@
package org.alfresco.repo.attributes;
import java.io.Serializable;
import org.alfresco.repo.avm.AVMDAOs;
/**
@@ -54,35 +56,28 @@ public class DoubleAttributeImpl extends AttributeImpl implements DoubleAttribut
AVMDAOs.Instance().fAttributeDAO.save(this);
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Attribute#getType()
*/
public Type getType()
{
return Type.DOUBLE;
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.AttributeImpl#getDoubleValue()
*/
public Serializable getRawValue()
{
return Double.valueOf(fValue);
}
@Override
public double getDoubleValue()
{
return fValue;
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.AttributeImpl#setDoubleValue(double)
*/
@Override
public void setDoubleValue(double value)
{
fValue = value;
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public String toString()
{

View File

@@ -25,6 +25,8 @@
package org.alfresco.repo.attributes;
import java.io.Serializable;
/**
* Value based implementation of a double attribute.
* @author britt
@@ -47,35 +49,28 @@ public class DoubleAttributeValue extends AttributeValue implements
fData = attr.getDoubleValue();
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Attribute#getType()
*/
public Type getType()
{
return Type.DOUBLE;
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.AttributeValue#getDoubleValue()
*/
public Serializable getRawValue()
{
return Double.valueOf(fData);
}
@Override
public double getDoubleValue()
{
return fData;
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.AttributeValue#setDoubleValue(double)
*/
@Override
public void setDoubleValue(double value)
{
fData = value;
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public String toString()
{

View File

@@ -25,6 +25,8 @@
package org.alfresco.repo.attributes;
import java.io.Serializable;
import org.alfresco.repo.avm.AVMDAOs;
/**
@@ -54,35 +56,28 @@ public class FloatAttributeImpl extends AttributeImpl implements FloatAttribute
AVMDAOs.Instance().fAttributeDAO.save(this);
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Attribute#getType()
*/
public Type getType()
{
return Type.FLOAT;
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.AttributeImpl#getFloatValue()
*/
public Serializable getRawValue()
{
return Float.valueOf(fValue);
}
@Override
public float getFloatValue()
{
return fValue;
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.AttributeImpl#setFloatValue(float)
*/
@Override
public void setFloatValue(float value)
{
fValue = value;
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public String toString()
{

View File

@@ -25,6 +25,8 @@
package org.alfresco.repo.attributes;
import java.io.Serializable;
/**
* Value based implementation of float attribute
* @author britt
@@ -47,35 +49,28 @@ public class FloatAttributeValue extends AttributeValue implements
fData = attr.getFloatValue();
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Attribute#getType()
*/
public Type getType()
{
return Type.FLOAT;
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.AttributeValue#getFloatValue()
*/
public Serializable getRawValue()
{
return Float.valueOf(fData);
}
@Override
public float getFloatValue()
{
return fData;
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.AttributeValue#setFloatValue(float)
*/
@Override
public void setFloatValue(float value)
{
fData = value;
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public String toString()
{

View File

@@ -25,6 +25,8 @@
package org.alfresco.repo.attributes;
import java.io.Serializable;
import org.alfresco.repo.avm.AVMDAOs;
/**
@@ -54,35 +56,28 @@ public class IntAttributeImpl extends AttributeImpl implements IntAttribute
AVMDAOs.Instance().fAttributeDAO.save(this);
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Attribute#getType()
*/
public Type getType()
{
return Type.INT;
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.AttributeImpl#getIntValue()
*/
public Serializable getRawValue()
{
return Integer.valueOf(fValue);
}
@Override
public int getIntValue()
{
return fValue;
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.AttributeImpl#setIntValue(int)
*/
@Override
public void setIntValue(int value)
{
fValue = value;
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public String toString()
{

View File

@@ -25,6 +25,8 @@
package org.alfresco.repo.attributes;
import java.io.Serializable;
/**
* Value based implementation of int attribute.
* @author britt
@@ -46,35 +48,28 @@ public class IntAttributeValue extends AttributeValue implements IntAttribute
fData = attr.getIntValue();
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Attribute#getType()
*/
public Type getType()
{
return Type.INT;
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.AttributeValue#getIntValue()
*/
public Serializable getRawValue()
{
return Integer.valueOf(fData);
}
@Override
public int getIntValue()
{
return fData;
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.AttributeValue#setIntValue(int)
*/
@Override
public void setIntValue(int value)
{
fData = value;
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public String toString()
{

View File

@@ -25,11 +25,11 @@
package org.alfresco.repo.attributes;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.repo.avm.AVMDAOs;
import org.alfresco.service.cmr.avm.AVMBadArgumentException;
@@ -52,86 +52,30 @@ public class ListAttributeImpl extends AttributeImpl implements ListAttribute
AVMDAOs.Instance().fAttributeDAO.save(this);
for (Attribute entry : other)
{
Attribute newEntry = null;
switch (entry.getType())
{
case BOOLEAN :
{
newEntry = new BooleanAttributeImpl((BooleanAttribute)entry);
break;
}
case BYTE :
{
newEntry = new ByteAttributeImpl((ByteAttribute)entry);
break;
}
case SHORT :
{
newEntry = new ShortAttributeImpl((ShortAttribute)entry);
break;
}
case INT :
{
newEntry = new IntAttributeImpl((IntAttribute)entry);
break;
}
case LONG :
{
newEntry = new LongAttributeImpl((LongAttribute)entry);
break;
}
case FLOAT :
{
newEntry = new FloatAttributeImpl((FloatAttribute)entry);
break;
}
case DOUBLE :
{
newEntry = new DoubleAttributeImpl((DoubleAttribute)entry);
break;
}
case STRING :
{
newEntry = new StringAttributeImpl((StringAttribute)entry);
break;
}
case SERIALIZABLE :
{
newEntry = new SerializableAttributeImpl((SerializableAttribute)entry);
break;
}
case MAP :
{
newEntry = new MapAttributeImpl((MapAttribute)entry);
break;
}
case LIST :
{
newEntry = new ListAttributeImpl((ListAttribute)entry);
break;
}
default :
{
throw new AlfrescoRuntimeException("Unknown Attribute Type: " + entry.getType());
}
}
Attribute newAttr = entry.getAttributeImpl();
ListEntryKey key = new ListEntryKey(this, index++);
ListEntry listEntry = new ListEntryImpl(key, newEntry);
ListEntry listEntry = new ListEntryImpl(key, newAttr);
AVMDAOs.Instance().fListEntryDAO.save(listEntry);
}
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Attribute#getType()
*/
public Type getType()
{
return Type.LIST;
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.AttributeImpl#add(org.alfresco.repo.attributes.Attribute)
*/
public Serializable getRawValue()
{
List<ListEntry> entries = AVMDAOs.Instance().fListEntryDAO.get(this);
ArrayList<Serializable> ret = new ArrayList<Serializable>(entries.size());
for (ListEntry listEntry : entries)
{
Serializable rawEntry = listEntry.getAttribute().getRawValue();
ret.add(rawEntry);
}
return ret;
}
@Override
public void add(Attribute attr)
{
@@ -141,9 +85,6 @@ public class ListAttributeImpl extends AttributeImpl implements ListAttribute
AVMDAOs.Instance().fListEntryDAO.save(entry);
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.AttributeImpl#add(int, org.alfresco.repo.attributes.Attribute)
*/
@Override
public void add(int index, Attribute attr)
{
@@ -167,18 +108,12 @@ public class ListAttributeImpl extends AttributeImpl implements ListAttribute
dao.save(newEntry);
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.AttributeImpl#clear()
*/
@Override
public void clear()
{
AVMDAOs.Instance().fListEntryDAO.delete(this);
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.AttributeImpl#get(int)
*/
@Override
public Attribute get(int index)
{
@@ -191,9 +126,6 @@ public class ListAttributeImpl extends AttributeImpl implements ListAttribute
return entry.getAttribute();
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.AttributeImpl#iterator()
*/
@Override
public Iterator<Attribute> iterator()
{
@@ -206,18 +138,12 @@ public class ListAttributeImpl extends AttributeImpl implements ListAttribute
return attrList.iterator();
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.AttributeImpl#size()
*/
@Override
public int size()
{
return AVMDAOs.Instance().fListEntryDAO.size(this);
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.AttributeImpl#remove(java.lang.String)
*/
@Override
public void remove(int index)
{
@@ -242,9 +168,6 @@ public class ListAttributeImpl extends AttributeImpl implements ListAttribute
}
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public String toString()
{
@@ -259,9 +182,6 @@ public class ListAttributeImpl extends AttributeImpl implements ListAttribute
return builder.toString();
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.AttributeImpl#set(int, org.alfresco.repo.attributes.Attribute)
*/
@Override
public void set(int index, Attribute value)
{

View File

@@ -25,12 +25,11 @@
package org.alfresco.repo.attributes;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.alfresco.error.AlfrescoRuntimeException;
/**
* Value based implementation of a list attribute.
* @author britt
@@ -49,139 +48,59 @@ public class ListAttributeValue extends AttributeValue implements ListAttribute
public ListAttributeValue(ListAttribute attr)
{
this();
for (Attribute child : attr)
for (Attribute entry : attr)
{
Attribute newAttr = null;
switch (child.getType())
{
case BOOLEAN :
{
newAttr = new BooleanAttributeValue((BooleanAttribute)child);
break;
}
case BYTE :
{
newAttr = new ByteAttributeValue((ByteAttribute)child);
break;
}
case SHORT :
{
newAttr = new ShortAttributeValue((ShortAttribute)child);
break;
}
case INT :
{
newAttr = new IntAttributeValue((IntAttribute)child);
break;
}
case LONG :
{
newAttr = new LongAttributeValue((LongAttribute)child);
break;
}
case FLOAT :
{
newAttr = new FloatAttributeValue((FloatAttribute)child);
break;
}
case DOUBLE :
{
newAttr = new DoubleAttributeValue((DoubleAttribute)child);
break;
}
case STRING :
{
newAttr = new StringAttributeValue((StringAttribute)child);
break;
}
case SERIALIZABLE :
{
newAttr = new SerializableAttributeValue((SerializableAttribute)child);
break;
}
case MAP :
{
newAttr = new MapAttributeValue((MapAttribute)child);
break;
}
case LIST :
{
newAttr = new ListAttributeValue((ListAttribute)child);
break;
}
default :
{
throw new AlfrescoRuntimeException("Unknown Attribute Type: " + child.getType());
}
}
// Use the type's factory for AttributeValue
Attribute newAttr = entry.getAttributeValue();
fData.add(newAttr);
}
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Attribute#get(int)
*/
public Attribute get(int index)
{
return fData.get(index);
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Attribute#getType()
*/
public Type getType()
{
return Type.LIST;
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.AttributeValue#add(org.alfresco.repo.attributes.Attribute)
*/
public Serializable getRawValue()
{
return (Serializable) fData;
}
@Override
public void add(Attribute attr)
{
fData.add(attr);
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.AttributeValue#add(int, org.alfresco.repo.attributes.Attribute)
*/
@Override
public void add(int index, Attribute attr)
{
fData.add(index, attr);
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.AttributeValue#iterator()
*/
@Override
public Iterator<Attribute> iterator()
{
return fData.iterator();
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.AttributeValue#size()
*/
@Override
public int size()
{
return fData.size();
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.AttributeValue#remove(int)
*/
@Override
public void remove(int index)
{
fData.remove(index);
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public String toString()
{
@@ -196,9 +115,6 @@ public class ListAttributeValue extends AttributeValue implements ListAttribute
return builder.toString();
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.AttributeValue#set(int, org.alfresco.repo.attributes.Attribute)
*/
@Override
public void set(int index, Attribute value)
{

View File

@@ -25,6 +25,8 @@
package org.alfresco.repo.attributes;
import java.io.Serializable;
import org.alfresco.repo.avm.AVMDAOs;
/**
@@ -54,35 +56,28 @@ public class LongAttributeImpl extends AttributeImpl implements LongAttribute
AVMDAOs.Instance().fAttributeDAO.save(this);
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Attribute#getType()
*/
public Type getType()
{
return Type.LONG;
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.AttributeImpl#getLongValue()
*/
public Serializable getRawValue()
{
return Long.valueOf(fValue);
}
@Override
public long getLongValue()
{
return fValue;
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.AttributeImpl#setLongValue(long)
*/
@Override
public void setLongValue(long value)
{
fValue = value;
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public String toString()
{

View File

@@ -25,6 +25,8 @@
package org.alfresco.repo.attributes;
import java.io.Serializable;
/**
* Value based implementation of a long attribute.
* @author britt
@@ -46,35 +48,28 @@ public class LongAttributeValue extends AttributeValue implements LongAttribute
fData = attr.getLongValue();
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Attribute#getType()
*/
public Type getType()
{
return Type.LONG;
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.AttributeValue#getLongValue()
*/
public Serializable getRawValue()
{
return Long.valueOf(fData);
}
@Override
public long getLongValue()
{
return fData;
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.AttributeValue#setLongValue(long)
*/
@Override
public void setLongValue(long value)
{
fData = value;
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public String toString()
{

View File

@@ -25,6 +25,7 @@
package org.alfresco.repo.attributes;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
@@ -34,7 +35,6 @@ import java.util.Map;
import java.util.Set;
import java.util.Map.Entry;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.repo.avm.AVMDAOs;
import org.alfresco.service.cmr.avm.AVMNotFoundException;
@@ -56,96 +56,39 @@ public class MapAttributeImpl extends AttributeImpl implements MapAttribute
AVMDAOs.Instance().fAttributeDAO.save(this);
for (Map.Entry<String, Attribute> entry : attr.entrySet())
{
String key = entry.getKey();
Attribute value = entry.getValue();
Attribute newAttr = null;
switch (value.getType())
{
case BOOLEAN :
{
newAttr = new BooleanAttributeImpl(value.getBooleanValue());
break;
}
case BYTE :
{
newAttr = new ByteAttributeImpl(value.getByteValue());
break;
}
case SHORT :
{
newAttr = new ShortAttributeImpl(value.getShortValue());
break;
}
case INT :
{
newAttr = new IntAttributeImpl(value.getIntValue());
break;
}
case LONG :
{
newAttr = new LongAttributeImpl(value.getLongValue());
break;
}
case FLOAT :
{
newAttr = new FloatAttributeImpl(value.getFloatValue());
break;
}
case DOUBLE :
{
newAttr = new DoubleAttributeImpl(value.getDoubleValue());
break;
}
case STRING :
{
newAttr = new StringAttributeImpl(value.getStringValue());
break;
}
case SERIALIZABLE :
{
newAttr = new SerializableAttributeImpl(value.getSerializableValue());
break;
}
case MAP :
{
newAttr = new MapAttributeImpl((MapAttribute)value);
break;
}
case LIST :
{
newAttr = new ListAttributeImpl((ListAttribute)value);
break;
}
default :
{
throw new AlfrescoRuntimeException("Unknown Attribute Type: " + value.getType());
}
}
MapEntryKey key = new MapEntryKey(this, entry.getKey());
MapEntry mapEntry = new MapEntryImpl(key, newAttr);
// Use the object's factory for AttributeValue
Attribute newAttr = value.getAttributeImpl();
// Persist it
MapEntryKey keyEntity = new MapEntryKey(this, key);
MapEntry mapEntry = new MapEntryImpl(keyEntity, newAttr);
AVMDAOs.Instance().fMapEntryDAO.save(mapEntry);
}
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Attribute#getType()
*/
public Type getType()
{
return Type.MAP;
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.AttributeImpl#clear()
*/
public Serializable getRawValue()
{
List<MapEntry> entries = AVMDAOs.Instance().fMapEntryDAO.get(this);
HashMap<String, Serializable> ret = new HashMap<String, Serializable>(entries.size() * 2);
for (MapEntry entry : entries)
{
ret.put(entry.getKey().getKey(), entry.getAttribute().getSerializableValue());
}
return ret;
}
@Override
public void clear()
{
AVMDAOs.Instance().fMapEntryDAO.delete(this);
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.AttributeImpl#entrySet()
*/
@Override
public Set<Entry<String, Attribute>> entrySet()
{
@@ -158,9 +101,6 @@ public class MapAttributeImpl extends AttributeImpl implements MapAttribute
return map.entrySet();
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.AttributeImpl#get(java.lang.String)
*/
@Override
public Attribute get(String key)
{
@@ -174,9 +114,6 @@ public class MapAttributeImpl extends AttributeImpl implements MapAttribute
return attr;
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.AttributeImpl#keySet()
*/
@Override
public Set<String> keySet()
{
@@ -189,9 +126,6 @@ public class MapAttributeImpl extends AttributeImpl implements MapAttribute
return keys;
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.AttributeImpl#put(java.lang.String, org.alfresco.repo.attributes.Attribute)
*/
@Override
public void put(String key, Attribute value)
{
@@ -208,9 +142,6 @@ public class MapAttributeImpl extends AttributeImpl implements MapAttribute
AVMDAOs.Instance().fMapEntryDAO.save(entry);
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.AttributeImpl#remove(java.lang.String)
*/
@Override
public void remove(String key)
{
@@ -225,9 +156,6 @@ public class MapAttributeImpl extends AttributeImpl implements MapAttribute
AVMDAOs.Instance().fAttributeDAO.delete(attr);
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.AttributeImpl#values()
*/
@Override
public Collection<Attribute> values()
{
@@ -240,9 +168,6 @@ public class MapAttributeImpl extends AttributeImpl implements MapAttribute
return attrs;
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public String toString()
{
@@ -259,9 +184,6 @@ public class MapAttributeImpl extends AttributeImpl implements MapAttribute
return builder.toString();
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.AttributeImpl#size()
*/
@Override
public int size()
{

View File

@@ -25,14 +25,13 @@
package org.alfresco.repo.attributes;
import java.io.Serializable;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.Map.Entry;
import org.alfresco.error.AlfrescoRuntimeException;
/**
* Value based implementation of a map attribute.
* @author britt
@@ -54,148 +53,67 @@ public class MapAttributeValue extends AttributeValue implements MapAttribute
fData = new HashMap<String, Attribute>();
for (Map.Entry<String, Attribute> entry : attr.entrySet())
{
String key = entry.getKey();
Attribute value = entry.getValue();
Attribute newAttr = null;
switch (value.getType())
{
case BOOLEAN :
{
newAttr = new BooleanAttributeValue((BooleanAttribute)value);
break;
}
case BYTE :
{
newAttr = new ByteAttributeValue((ByteAttribute)value);
break;
}
case SHORT :
{
newAttr = new ShortAttributeValue((ShortAttribute)value);
break;
}
case INT :
{
newAttr = new IntAttributeValue((IntAttribute)value);
break;
}
case LONG :
{
newAttr = new LongAttributeValue((LongAttribute)value);
break;
}
case FLOAT :
{
newAttr = new FloatAttributeValue((FloatAttribute)value);
break;
}
case DOUBLE :
{
newAttr = new DoubleAttributeValue((DoubleAttribute)value);
break;
}
case STRING :
{
newAttr = new StringAttributeValue((StringAttribute)value);
break;
}
case SERIALIZABLE :
{
newAttr = new SerializableAttributeValue((SerializableAttribute)value);
break;
}
case MAP :
{
newAttr = new MapAttributeValue((MapAttribute)value);
break;
}
case LIST :
{
newAttr = new ListAttributeValue((ListAttribute)value);
break;
}
default :
{
throw new AlfrescoRuntimeException("Unknown Attribute Type: " + value.getType());
}
}
fData.put(entry.getKey(), newAttr);
// Use the object's factory for AttributeValue
Attribute newAttr = value.getAttributeValue();
// Put it into the map
fData.put(key, newAttr);
}
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Attribute#getType()
*/
public Type getType()
{
return Type.MAP;
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.AttributeValue#clear()
*/
public Serializable getRawValue()
{
return (Serializable) fData;
}
@Override
public void clear()
{
fData.clear();
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.AttributeValue#entrySet()
*/
@Override
public Set<Entry<String, Attribute>> entrySet()
{
return fData.entrySet();
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.AttributeValue#get(java.lang.String)
*/
@Override
public Attribute get(String key)
{
return fData.get(key);
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.AttributeValue#keySet()
*/
@Override
public Set<String> keySet()
{
return fData.keySet();
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.AttributeValue#put(java.lang.String, org.alfresco.repo.attributes.Attribute)
*/
@Override
public void put(String key, Attribute value)
{
fData.put(key, value);
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.AttributeValue#remove(java.lang.String)
*/
@Override
public void remove(String key)
{
fData.remove(key);
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.AttributeValue#values()
*/
@Override
public Collection<Attribute> values()
{
return fData.values();
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public String toString()
{
@@ -212,9 +130,6 @@ public class MapAttributeValue extends AttributeValue implements MapAttribute
return builder.toString();
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.AttributeValue#size()
*/
@Override
public int size()
{

View File

@@ -57,35 +57,28 @@ public class SerializableAttributeImpl extends AttributeImpl implements
AVMDAOs.Instance().fAttributeDAO.save(this);
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Attribute#getType()
*/
public Type getType()
{
return Type.SERIALIZABLE;
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.AttributeImpl#getSerializableValue()
*/
public Serializable getRawValue()
{
return fValue;
}
@Override
public Serializable getSerializableValue()
{
return fValue;
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.AttributeImpl#setSerializableValue(java.io.Serializable)
*/
@Override
public void setSerializableValue(Serializable value)
{
fValue = value;
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public String toString()
{

View File

@@ -49,35 +49,28 @@ public class SerializableAttributeValue extends AttributeValue implements
fData = attr.getSerializableValue();
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Attribute#getType()
*/
public Type getType()
{
return Type.SERIALIZABLE;
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.AttributeValue#getSerializableValue()
*/
public Serializable getRawValue()
{
return fData;
}
@Override
public Serializable getSerializableValue()
{
return fData;
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.AttributeValue#setSerializableValue(java.io.Serializable)
*/
@Override
public void setSerializableValue(Serializable value)
{
fData = value;
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public String toString()
{

View File

@@ -25,6 +25,8 @@
package org.alfresco.repo.attributes;
import java.io.Serializable;
import org.alfresco.repo.avm.AVMDAOs;
/**
@@ -54,35 +56,28 @@ public class ShortAttributeImpl extends AttributeImpl implements ShortAttribute
AVMDAOs.Instance().fAttributeDAO.save(this);
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.AttributeImpl#getShortValue()
*/
@Override
public short getShortValue()
{
return fValue;
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.AttributeImpl#setShortValue(short)
*/
@Override
public void setShortValue(short value)
{
fValue = value;
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Attribute#getType()
*/
public Type getType()
{
return Type.SHORT;
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
public Serializable getRawValue()
{
return Short.valueOf(fValue);
}
@Override
public String toString()
{

View File

@@ -25,6 +25,8 @@
package org.alfresco.repo.attributes;
import java.io.Serializable;
/**
* Value based implementation of a short attribute.
* @author britt
@@ -47,35 +49,28 @@ public class ShortAttributeValue extends AttributeValue implements
fData = attr.getShortValue();
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Attribute#getType()
*/
public Type getType()
{
return Type.SHORT;
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.AttributeValue#getShortValue()
*/
public Serializable getRawValue()
{
return Short.valueOf(fData);
}
@Override
public short getShortValue()
{
return fData;
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.AttributeValue#setShortValue(short)
*/
@Override
public void setShortValue(short value)
{
fData = value;
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public String toString()
{

View File

@@ -25,6 +25,8 @@
package org.alfresco.repo.attributes;
import java.io.Serializable;
import org.alfresco.repo.avm.AVMDAOs;
/**
@@ -55,35 +57,28 @@ public class StringAttributeImpl extends AttributeImpl implements
AVMDAOs.Instance().fAttributeDAO.save(this);
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Attribute#getType()
*/
public Type getType()
{
return Type.STRING;
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.AttributeImpl#getStringValue()
*/
public Serializable getRawValue()
{
return fValue;
}
@Override
public String getStringValue()
{
return fValue;
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.AttributeImpl#setStringValue(java.lang.String)
*/
@Override
public void setStringValue(String value)
{
fValue = value;
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public String toString()
{

View File

@@ -25,6 +25,8 @@
package org.alfresco.repo.attributes;
import java.io.Serializable;
/**
* Value based implementation of a String attribute.
* @author britt
@@ -47,35 +49,28 @@ public class StringAttributeValue extends AttributeValue implements
fData = attr.getStringValue();
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Attribute#getType()
*/
public Type getType()
{
return Type.STRING;
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.AttributeValue#getStringValue()
*/
public Serializable getRawValue()
{
return fData;
}
@Override
public String getStringValue()
{
return fData;
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.AttributeValue#setStringValue(java.lang.String)
*/
@Override
public void setStringValue(String value)
{
fData = value;
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public String toString()
{