This is a checkpoint of metadata work. Nothing works, but it compiles.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5458 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Britt Park
2007-04-03 23:22:13 +00:00
parent 3eb95fac69
commit 8760a86ff5
41 changed files with 2577 additions and 40 deletions

View File

@@ -0,0 +1,42 @@
/*
* 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 org.alfresco.error.AlfrescoRuntimeException;
/**
* For unimplemented attribute methods.
* @author britt
*/
public class AtrributeMethodNotImplemented extends AlfrescoRuntimeException
{
private static final long serialVersionUID = -7167699355451456957L;
public AtrributeMethodNotImplemented(String message)
{
super(message);
}
}

View File

@@ -0,0 +1,222 @@
/*
* 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.Serializable;
import java.util.Collection;
import java.util.Map;
import java.util.Set;
/**
* Interface for polymorphic attributes.
* @author britt
*/
public interface Attribute extends Serializable
{
public static enum Type implements Serializable
{
BOOLEAN,
BYTE,
SHORT,
INT,
LONG,
FLOAT,
DOUBLE,
STRING,
BLOB,
SERIALIZABLE,
MAP
};
/**
* Get the value type for this node.
* @return
*/
public Type getType();
/**
* Set a boolean value.
* @param value The value.
*/
public void setBooleanValue(boolean value);
/**
* Get the value of a BooleanValue.
* @return The value.
*/
public boolean getBooleanValue();
/**
* Set a byte value.
* @param value The value to set.
*/
public void setByteValue(byte value);
/**
* Get the value of a ByteValue.
* @return The value.
*/
public byte getByteValue();
/**
* Set a short value.
* @param value The value to set.
*/
public void setShortValue(short value);
/**
* Get the value of a ShortValue.
* @return The value.
*/
public short getShortValue();
/**
* Set an integer value.
* @param value The value to set.
*/
public void setIntValue(int value);
/**
* Get the integer value of an IntValue.
* @return The value.
*/
public int getIntValue();
/**
* Set a long value.
* @param value The value to set.
*/
public void setLongValue(long value);
/**
* Get the long value of a LongValue.
* @return The value.
*/
public long getLongValue();
/**
* Set a float value.
* @param value The value to set.
*/
public void setFloatValue(float value);
/**
* Get the value of a FloatValue.
* @return The value.
*/
public float getFloatValue();
/**
* Set a double value.
* @param value The value to set.
*/
public void setDoubleValue(double value);
/**
* Get a double value from a DoubleValue.
* @return The value.
*/
public double getDoubleValue();
/**
* Set a String value.
* @param value The value to set.
*/
public void setStringValue(String value);
/**
* Get a String value from a StringValue.
* @return The value.
*/
public String getStringValue();
/**
* Set a Blob value.
* @param value The value to set.
*/
public void setBlobValue(byte[] value);
/**
* Get a Blob value from a BlobValue
* @return The value.
*/
public byte[] getBlobValue();
/**
* Set a Serializable value.
* @param value
*/
public void setSerializableValue(Serializable value);
/**
* Get a Seriailizable value from a SerializableValue
* @return The value.
*/
public Serializable getSerializableValue();
/**
* Clear a map.
*/
public void clear();
/**
* Add an entry to a map.
* @param key The key to the entry.
* @param value The Value of the entry.
*/
public void put(String key, Attribute value);
/**
* Get the Value for a key in a map.
* @param key The key.
* @return The value.
*/
public Attribute get(String key);
/**
* Remove an entry by key from a map.
* @param key The key of the entry to remove.
*/
public void remove(String key);
/**
* Get the entry set for a map.
* @return The entry set.
*/
public Set<Map.Entry<String, Attribute>> entrySet();
/**
* Get the key set for a map.
* @return The key set.
*/
public Set<String> keySet();
/**
* Get the collection of values of a map.
* @return The values.
*/
public Collection<Attribute> values();
}

View File

@@ -0,0 +1,58 @@
/*
* 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.util.List;
import org.alfresco.service.cmr.attributes.AttrQuery;
/**
* Interface for persistence operations on attributes.
* @author britt
*/
public interface AttributeDAO
{
/**
* Save an attribute (recursively).
* @param attr The attribute to save.
*/
public void save(Attribute attr);
/**
* Delete an attribute (recursively).
* @param attr The attribute to delete.
*/
public void delete(Attribute attr);
/**
* Find all attributes that match a given path and AttrQuery.
* @param path The path, starting from the top to the map in which to
* search for matching attributes.
* @param query The AttrQuery.
* @return A List of Attributes.
*/
List<Attribute> find(String path, AttrQuery query);
}

View File

@@ -0,0 +1,276 @@
/*
* 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.Serializable;
import java.util.Collection;
import java.util.Set;
import java.util.Map.Entry;
/**
* The base class of the implementation of Values.
* @author britt
*/
public abstract class AttributeImpl implements Attribute
{
/**
* The primary key.
*/
private long fID;
/**
* Base constructor.
*/
protected AttributeImpl()
{
}
public void setId(long id)
{
fID = id;
}
public long getId()
{
return fID;
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Value#clear()
*/
public void clear()
{
throw new AtrributeMethodNotImplemented("Not ListValue or MapValue");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Value#entrySet()
*/
public Set<Entry<String, Attribute>> entrySet()
{
throw new AtrributeMethodNotImplemented("Not MapValue");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Value#get(java.lang.String)
*/
public Attribute get(String key)
{
throw new AtrributeMethodNotImplemented("Not MapValue");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Value#getBlobValue()
*/
public byte[] getBlobValue()
{
throw new AtrributeMethodNotImplemented("Not BlobValue");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Value#getDoubleValue()
*/
public double getDoubleValue()
{
throw new AtrributeMethodNotImplemented("Not DoubleValue");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Value#getIntValue()
*/
public int getIntValue()
{
throw new AtrributeMethodNotImplemented("Not IntValue");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Value#getLongValue()
*/
public long getLongValue()
{
throw new AtrributeMethodNotImplemented("Not LongValue");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Value#getSerializableValue()
*/
public Serializable getSerializableValue()
{
throw new AtrributeMethodNotImplemented("Not SerializableValue");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Value#getStringValue()
*/
public String getStringValue()
{
throw new AtrributeMethodNotImplemented("Not StringValue");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Value#keySet()
*/
public Set<String> keySet()
{
throw new AtrributeMethodNotImplemented("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 AtrributeMethodNotImplemented("Not MapValue");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Value#remove(java.lang.String)
*/
public void remove(String key)
{
throw new AtrributeMethodNotImplemented("Not MapValue");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Value#setBlobValue(byte[])
*/
public void setBlobValue(byte[] value)
{
throw new AtrributeMethodNotImplemented("Not BlobValue");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Value#setDoubleValue(double)
*/
public void setDoubleValue(double value)
{
throw new AtrributeMethodNotImplemented("Not DoubleValue");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Value#setIntValue(int)
*/
public void setIntValue(int value)
{
throw new AtrributeMethodNotImplemented("Not IntValue");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Value#setLongValue(long)
*/
public void setLongValue(long value)
{
throw new AtrributeMethodNotImplemented("Not LongValue");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Value#setSerializableValue(java.io.Serializable)
*/
public void setSerializableValue(Serializable value)
{
throw new AtrributeMethodNotImplemented("Not SerializableValue");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Value#setStringValue(java.lang.String)
*/
public void setStringValue(String value)
{
throw new AtrributeMethodNotImplemented("Not StringValue");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Value#values()
*/
public Collection<Attribute> values()
{
throw new AtrributeMethodNotImplemented("Not MapValue");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Value#getBooleanValue()
*/
public boolean getBooleanValue()
{
throw new AtrributeMethodNotImplemented("Not BooleanValue");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Value#getByteValue()
*/
public byte getByteValue()
{
throw new AtrributeMethodNotImplemented("Not ByteValue");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Value#getFloatValue()
*/
public float getFloatValue()
{
throw new AtrributeMethodNotImplemented("Not FloatValue");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Value#getShortValue()
*/
public short getShortValue()
{
throw new AtrributeMethodNotImplemented("Not ShortValue");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Value#setBooleanValue(boolean)
*/
public void setBooleanValue(boolean value)
{
throw new AtrributeMethodNotImplemented("Not BooleanValue");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Value#setByteValue(byte)
*/
public void setByteValue(byte value)
{
throw new AtrributeMethodNotImplemented("Not ByteValue");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Value#setFloatValue(float)
*/
public void setFloatValue(float value)
{
throw new AtrributeMethodNotImplemented("Not FloatValue");
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Value#setShortValue(short)
*/
public void setShortValue(short value)
{
throw new AtrributeMethodNotImplemented("Not ShortValue");
}
}

View File

@@ -0,0 +1,42 @@
/*
* 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 org.alfresco.error.AlfrescoRuntimeException;
/**
* Thrown when a query node is created with an unsupported type.
* @author britt
*/
public class AttributeUnsupportedQueryType extends AlfrescoRuntimeException
{
private static final long serialVersionUID = 7736211710764082022L;
public AttributeUnsupportedQueryType(String message)
{
super(message);
}
}

View File

@@ -0,0 +1,34 @@
/*
* 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;
/**
* Placeholder interface for Blob attributes.
* @author britt
*/
public interface BlobAttribute extends Attribute
{
}

View File

@@ -0,0 +1,68 @@
/*
* 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;
/**
* Persistent implementation of Blob attribute.
* @author britt
*/
public class BlobAttributeImpl extends AttributeImpl implements BlobAttribute
{
private static final long serialVersionUID = 53323685626921588L;
private byte[] fValue;
public BlobAttributeImpl(byte[] value)
{
fValue = value;
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Attribute#getType()
*/
public Type getType()
{
return Type.BLOB;
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.AttributeImpl#getBlobValue()
*/
@Override
public byte[] getBlobValue()
{
return fValue;
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.AttributeImpl#setBlobValue(byte[])
*/
@Override
public void setBlobValue(byte[] value)
{
fValue = value;
}
}

View File

@@ -0,0 +1,34 @@
/*
* 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;
/**
* Stub interface for Booleans.
* @author britt
*/
public interface BooleanAttribute extends Attribute
{
}

View File

@@ -0,0 +1,64 @@
/*
* 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;
/**
* @author britt
*
*/
public class BooleanAttributeImpl extends AttributeImpl implements
BooleanAttribute
{
private static final long serialVersionUID = 8483440613101900682L;
private boolean fValue;
/* (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;
}
}

View File

@@ -0,0 +1,34 @@
/*
* 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;
/**
* Stub interface for byte Attributes.
* @author britt
*/
public interface ByteAttribute extends Attribute
{
}

View File

@@ -0,0 +1,68 @@
/*
* 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;
/**
* A Byte Attribute.
* @author britt
*/
public class ByteAttributeImpl extends AttributeImpl implements ByteAttribute
{
private static final long serialVersionUID = -8308587890270623903L;
private byte fValue;
public ByteAttributeImpl(byte value)
{
fValue = value;
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Attribute#getType()
*/
public Type getType()
{
return Type.BYTE;
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.AttributeImpl#getByteValue()
*/
@Override
public byte getByteValue()
{
return fValue;
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.AttributeImpl#setByteValue(byte)
*/
@Override
public void setByteValue(byte value)
{
fValue = value;
}
}

View File

@@ -0,0 +1,34 @@
/*
* 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;
/**
* Placeholder interface or double attributes.
* @author britt
*/
public interface DoubleAttribute extends Attribute
{
}

View File

@@ -0,0 +1,68 @@
/*
* 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;
/**
* @author britt
*
*/
public class DoubleAttributeImpl extends AttributeImpl implements Attribute
{
private static final long serialVersionUID = 6615023606094278263L;
private double fValue;
public DoubleAttributeImpl(double value)
{
fValue = value;
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Attribute#getType()
*/
public Type getType()
{
return Type.DOUBLE;
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.AttributeImpl#getDoubleValue()
*/
@Override
public double getDoubleValue()
{
return fValue;
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.AttributeImpl#setDoubleValue(double)
*/
@Override
public void setDoubleValue(double value)
{
fValue = value;
}
}

View File

@@ -0,0 +1,34 @@
/*
* 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;
/**
* Stub interface for float attribute.
* @author britt
*/
public interface FloatAttribute extends Attribute
{
}

View File

@@ -0,0 +1,68 @@
/*
* 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;
/**
* @author britt
*
*/
public class FloatAttributeImpl extends AttributeImpl implements FloatAttribute
{
private static final long serialVersionUID = 8173803953645298153L;
private float fValue;
public FloatAttributeImpl(float value)
{
fValue = value;
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Attribute#getType()
*/
public Type getType()
{
return Type.FLOAT;
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.AttributeImpl#getFloatValue()
*/
@Override
public float getFloatValue()
{
return fValue;
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.AttributeImpl#setFloatValue(float)
*/
@Override
public void setFloatValue(float value)
{
fValue = value;
}
}

View File

@@ -0,0 +1,35 @@
/*
* 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;
/**
* Interface for the entries in the global attribute table.
* @author britt
*/
public interface GlobalAttributeEntry
{
// TODO This is a stub and needs to be completed.
}

View File

@@ -0,0 +1,33 @@
package org.alfresco.repo.attributes;
/**
* Interface for persistence of the top level attribute map.
* @author britt
*/
public interface GlobalAttributeEntryDAO
{
/**
* Save an entry.
* @param entry To save.
*/
public void save(GlobalAttributeEntry entry);
/**
* Delete an entry.
* @param entry To delete.
*/
public void delete(GlobalAttributeEntry entry);
/**
* Delete an entry by name.
* @param name The name of the entry.
*/
public void delete(String name);
/**
* Get an attribute by name.
* @param name The name of the attribute.
* @return The attribute or null.
*/
public Attribute get(String name);
}

View File

@@ -0,0 +1,34 @@
/*
* 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;
/**
* A stub interface for int attributes.
* @author britt
*/
public interface IntAttribute extends Attribute
{
}

View File

@@ -0,0 +1,68 @@
/*
* 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;
/**
* An integer attribute.
* @author britt
*/
public class IntAttributeImpl extends AttributeImpl implements IntAttribute
{
private static final long serialVersionUID = -7721943599145354015L;
private int fValue;
public IntAttributeImpl(int value)
{
fValue = value;
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Attribute#getType()
*/
public Type getType()
{
return Type.INT;
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.AttributeImpl#getIntValue()
*/
@Override
public int getIntValue()
{
return fValue;
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.AttributeImpl#setIntValue(int)
*/
@Override
public void setIntValue(int value)
{
fValue = value;
}
}

View File

@@ -0,0 +1,34 @@
/*
* 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;
/**
* Stub interface for long attributes.
* @author britt
*/
public interface LongAttribute extends Attribute
{
}

View File

@@ -0,0 +1,68 @@
/*
* 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;
/**
* Long valued attribute.
* @author britt
*/
public class LongAttributeImpl extends AttributeImpl implements LongAttribute
{
private static final long serialVersionUID = 1625735137563940631L;
private long fValue;
public LongAttributeImpl(long value)
{
fValue = value;
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Attribute#getType()
*/
public Type getType()
{
return Type.LONG;
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.AttributeImpl#getLongValue()
*/
@Override
public long getLongValue()
{
return fValue;
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.AttributeImpl#setLongValue(long)
*/
@Override
public void setLongValue(long value)
{
fValue = value;
}
}

View File

@@ -0,0 +1,34 @@
/*
* 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;
/**
* Placeholder interface for Map attributes.
* @author britt
*/
public interface MapAttribute extends Attribute
{
}

View File

@@ -0,0 +1,119 @@
/*
* 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.util.Collection;
import java.util.Set;
import java.util.Map.Entry;
/**
* @author britt
*
*/
public class MapAttributeImpl extends AttributeImpl implements MapAttribute
{
public MapAttributeImpl()
{
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Attribute#getType()
*/
public Type getType()
{
return Type.MAP;
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.AttributeImpl#clear()
*/
@Override
public void clear()
{
// TODO Auto-generated method stub
super.clear();
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.AttributeImpl#entrySet()
*/
@Override
public Set<Entry<String, Attribute>> entrySet()
{
// TODO Auto-generated method stub
return super.entrySet();
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.AttributeImpl#get(java.lang.String)
*/
@Override
public Attribute get(String key)
{
// TODO Auto-generated method stub
return super.get(key);
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.AttributeImpl#keySet()
*/
@Override
public Set<String> keySet()
{
// TODO Auto-generated method stub
return super.keySet();
}
/* (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)
{
// TODO Auto-generated method stub
super.put(key, value);
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.AttributeImpl#remove(java.lang.String)
*/
@Override
public void remove(String key)
{
// TODO Auto-generated method stub
super.remove(key);
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.AttributeImpl#values()
*/
@Override
public Collection<Attribute> values()
{
// TODO Auto-generated method stub
return super.values();
}
}

View File

@@ -0,0 +1,35 @@
/*
* 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;
/**
* Interface for map entries.
* @author britt
*/
public interface MapEntry
{
// TODO This is a stub. Fix it.
}

View File

@@ -0,0 +1,43 @@
package org.alfresco.repo.attributes;
import java.util.List;
/**
* Interface for MapEntry persistence.
* @author britt
*/
public interface MapEntryDAO
{
/**
* Save a MapEntry.
* @param entry To save.
*/
public void save(MapEntry entry);
/**
* Delete a MapEntry.
* @param entry
*/
public void delete(MapEntry entry);
/**
* Delete all entries for a map.
* @param mapAttr The map to purge.
*/
public void delete(MapAttribute mapAttr);
/**
* Get an entry by name.
* @param mapAttr The map to get the entry from.
* @param key The key of the entry.
* @return A MapEntry or null.
*/
public MapEntry get(MapAttribute mapAttr, String key);
/**
* Retrieve all the entries in a map.
* @param mapAttr
* @return A List of all entries in the given map.
*/
public List<MapEntry> get(MapAttribute mapAttr);
}

View File

@@ -0,0 +1,34 @@
/*
* 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;
/**
* Placeholder interface for a Serializable attribute.
* @author britt
*/
public interface SerializableAttribute extends Attribute
{
}

View File

@@ -0,0 +1,71 @@
/*
* 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.Serializable;
/**
* Persistent implemantation of a Serializable attribute.
* @author britt
*/
public class SerializableAttributeImpl extends AttributeImpl implements
SerializableAttribute
{
private static final long serialVersionUID = -4499585229435904817L;
private Serializable fValue;
public SerializableAttributeImpl(Serializable value)
{
fValue = value;
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Attribute#getType()
*/
public Type getType()
{
return Type.SERIALIZABLE;
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.AttributeImpl#getSerializableValue()
*/
@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;
}
}

View File

@@ -0,0 +1,34 @@
/*
* 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;
/**
* Stub interface for shorts.
* @author britt
*/
public interface ShortAttribute extends Attribute
{
}

View File

@@ -0,0 +1,68 @@
/*
* 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;
/**
* A short attribute.
* @author britt
*/
public class ShortAttributeImpl extends AttributeImpl implements ShortAttribute
{
private static final long serialVersionUID = 583269625932011762L;
private short fValue;
public ShortAttributeImpl(short value)
{
fValue = value;
}
/* (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;
}
}

View File

@@ -0,0 +1,34 @@
/*
* 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;
/**
* Place holder interface for String valued attributes.
* @author britt
*/
public interface StringAttribute extends Attribute
{
}

View File

@@ -0,0 +1,69 @@
/*
* 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;
/**
* Persistent implementation of String valued attribute.
* @author britt
*/
public class StringAttributeImpl extends AttributeImpl implements
StringAttribute
{
private static final long serialVersionUID = -2877268541212029648L;
private String fValue;
public StringAttributeImpl(String value)
{
fValue = value;
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.Attribute#getType()
*/
public Type getType()
{
return Type.STRING;
}
/* (non-Javadoc)
* @see org.alfresco.repo.attributes.AttributeImpl#getStringValue()
*/
@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;
}
}

View File

@@ -3,9 +3,9 @@
<!-- Polymorphic, nestable attributes. -->
<hibernate-mapping package="org.alfresco.repo.attributes">
<!-- Value is the base class for metadata values. -->
<class table="alf_values" abstract="true"
name="ValueImpl" proxy="Value"
<!-- Attribute is the base class for metadata Attributes. -->
<class table="alf_attributes" abstract="true"
name="AttributeImpl" proxy="Attribute"
optimistic-lock="version"
lazy="true">
<cache usage="read-write"/>
@@ -15,77 +15,77 @@
<discriminator column="type" type="string" length="1"/>
<version column="version" name="version" type="long"/>
<!-- A boolean valued attribute -->
<subclass name="BooleanValueImpl" proxy="BooleanValue" lazy="true"
<subclass name="BooleanAttributeImpl" proxy="BooleanAttribute" lazy="true"
discriminator-value="O">
<property name="booleanValue" column="bool_value" type="boolean" index="value_bool_index"/>
<property name="booleanValue" column="bool_value" type="boolean" index="attribute_bool_index"/>
</subclass>
<!-- A byte valued attribute -->
<subclass name="ByteValueImpl" proxy="ByteValue" lazy="true"
<subclass name="ByteAttributeImpl" proxy="ByteAttribute" lazy="true"
discriminator-value="Y">
<property name="byteValue" column="byte_value" type="byte" index="value_byte_index"/>
<property name="byteValue" column="byte_value" type="byte" index="attribute_byte_index"/>
</subclass>
<!-- A short valued attribute -->
<subclass name="ShortValueImpl" proxy="ShortValue" lazy="true"
<subclass name="ShortAttributeImpl" proxy="ShortAttribute" lazy="true"
discriminator-value="H">
<property name="shortValue" column="short_value" type="short" index="value_short_index"/>
<property name="shortValue" column="short_value" type="short" index="attribute_short_index"/>
</subclass>
<!-- An integer valued attribute. -->
<subclass name="IntValueImpl" proxy="IntValue" lazy="true"
<subclass name="IntAttributeImpl" proxy="IntAttribute" lazy="true"
discriminator-value="I">
<property name="intValue" column="int_value" type="int" index="value_int_index"/>
<property name="intValue" column="int_value" type="int" index="attribute_int_index"/>
</subclass>
<!-- A long valued attribute -->
<subclass name="LongValueImpl" proxy="LongValue" lazy="true"
<subclass name="LongAttributeImpl" proxy="LongAttribute" lazy="true"
discriminator-value="L">
<property name="longValue" column="long_value" type="long" index="value_long_index"/>
<property name="longValue" column="long_value" type="long" index="attribute_long_index"/>
</subclass>
<!-- A float valued attribute -->
<subclass name="FloatValueImpl" proxy="FloatValue" lazy="true"
<subclass name="FloatAttributeImpl" proxy="FloatAttribute" lazy="true"
discriminator-value="F">
<property name="floatValue" column="float_value" type="float" index="value_float_index"/>
<property name="floatValue" column="float_value" type="float" index="attribute_float_index"/>
</subclass>
<!-- A double valued attribute -->
<subclass name="DoubleValueImpl" proxy="DoubleValue" lazy="true"
<subclass name="DoubleAttributeImpl" proxy="DoubleAttribute" lazy="true"
discriminator-value="D">
<property name="doubleValue" column="double_value" type="double" index="value_double_index"/>
<property name="doubleValue" column="double_value" type="double" index="attribute_double_index"/>
</subclass>
<!-- A string valued attribute -->
<subclass name="StringValueImpl" proxy="StringValue" lazy="true"
<subclass name="StringAttributeImpl" proxy="StringAttribute" lazy="true"
discriminator-value="S">
<property name="stringValue" column="string_value" type="string"
length="512" index="value_string_index(64)"/>
length="512" index="attribute_string_index(64)"/>
</subclass>
<!-- A blob valued attribute -->
<subclass name="BlobValueImpl" proxy="BlobValue" lazy="true"
<subclass name="BlobAttributeImpl" proxy="BlobAttribute" lazy="true"
discriminator-value="B">
<property name="blobValue" column="blob_value" type="blob"
length="8192"/>
</subclass>
<!-- A serializable attribute -->
<subclass name="SerializableValueImpl" proxy="SerializableValue" lazy="true"
<subclass name="SerializableAttributeImpl" proxy="SerializableAttribute" lazy="true"
discriminator-value="E">
<property name="serializableValue" column="serializable_value" lazy="true"
length="8192"/>
</subclass>
<!-- A list attribute -->
<subclass name="ListValueImpl" proxy="ListValue" lazy="true"
discriminator-value="T">
<list name="data" table="alf_list_data" lazy="true" cascade="all">
<cache usage="read-write"/>
<key column="value_id"/>
<index type="int" column="offset"/>
<many-to-many class="ValueImpl" column="list_value" lazy="true"/>
</list>
</subclass>
<!-- A map attribute -->
<subclass name="MapValueImpl" proxy="MapValue" lazy="true"
<subclass name="MapAttributeImpl" proxy="MapAttribute" lazy="true"
discriminator-value="M">
<map name="data" table="alf_map_data" lazy="true" cascade="all">
<cache usage="read-write"/>
<key column="value_id"/>
<map-key column="map_key" type="string" length="160"/>
<many-to-many class="AttributeImpl" column="map_attr" lazy="true"/>
</map>
</subclass>
</class>
<class name="GlobalAttributeEntryImpl" proxy="GlobalAttributeEntry">
<cache usage="read-write"/>
<id name="name" type="string" length="160"/>
<many-to-one class="AttributeImpl" name="attribute" unique="true"/>
</class>
<class name="MapEntryImpl" proxy="MapEntry" lazy="false">
<cache usage="read-write"/>
<id name="id" column="id" type="long">
<generator class="native"/>
</id>
<natural-id>
<many-to-one class="MapAttributeImpl" name="map" column="map_id"/>
<property name="key" type="string" length="160" column="key" index="map_key_index"/>
</natural-id>
<many-to-one class="AttributeImpl" name="attribute" columne="attribute_id"/>
</class>
</hibernate-mapping>

View File

@@ -0,0 +1,188 @@
/*
* 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.service.cmr.attributes;
import java.io.Serializable;
import org.alfresco.repo.attributes.Attribute;
import org.alfresco.repo.attributes.AttributeUnsupportedQueryType;
/**
* Abstract base class for Attribute Query nodes.
* @author britt
*/
public abstract class AttrQuery implements Serializable
{
protected Attribute fValue;
protected String fAttrName;
protected String fEntityName;
protected AttrQuery(Attribute value)
{
fValue = value;
switch (fValue.getType())
{
case BOOLEAN :
{
fAttrName = "booleanValue";
fEntityName = "BooleanAttributeImpl";
break;
}
case BYTE :
{
fAttrName = "byteValue";
fEntityName = "ByteAttributeImpl";
break;
}
case SHORT :
{
fAttrName = "shortValue";
fEntityName = "ShortAttributeImpl";
break;
}
case INT :
{
fAttrName = "intValue";
fEntityName = "IntAttributeImpl";
break;
}
case LONG :
{
fAttrName = "longValue";
fEntityName = "LongAttributeImpl";
break;
}
case FLOAT :
{
fAttrName = "floatValue";
fEntityName = "FloatAttributeImpl";
break;
}
case DOUBLE :
{
fAttrName = "doubleValue";
fEntityName = "DoubleAttributeImpl";
break;
}
case STRING :
{
fAttrName = "stringValue";
fEntityName = "StringAttributeImpl";
break;
}
case BLOB :
{
fAttrName = "blobValue";
fEntityName = "BlobValueImpl";
break;
}
case SERIALIZABLE :
{
fAttrName = "serializableValue";
fEntityName = "SerializableValueImpl";
break;
}
case MAP :
{
fAttrName = "mapValue"; // This doesn't need to make sense.
fEntityName = "MapValueImpl"; // Nor does this.
}
}
}
/**
* Get the predicate that goes into a Hibernate query.
* @return The predicate.
*/
public abstract String getPredicate();
/**
* Get the entity that this predicate applies to.
* @return The entity name.
*/
public String getEntity()
{
return fEntityName;
}
protected String getValue()
{
switch (fValue.getType())
{
case BOOLEAN :
{
return fValue.getBooleanValue() ? "1" : "0";
}
case BYTE :
{
return Byte.toString(fValue.getByteValue());
}
case SHORT :
{
return Short.toString(fValue.getShortValue());
}
case INT :
{
return Integer.toString(fValue.getIntValue());
}
case LONG :
{
return Long.toString(fValue.getLongValue());
}
case FLOAT :
{
return Float.toString(fValue.getFloatValue());
}
case DOUBLE :
{
return Double.toString(fValue.getDoubleValue());
}
case STRING :
{
StringBuilder builder = new StringBuilder();
char[] chars = fValue.getStringValue().toCharArray();
builder.append('\'');
for (char c : chars)
{
if (c == '\'')
{
builder.append("\\'");
continue;
}
builder.append(c);
}
builder.append('\'');
return builder.toString();
}
default :
{
throw new AttributeUnsupportedQueryType(fValue.getType().name());
}
}
}
}

View File

@@ -0,0 +1,52 @@
/*
* 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.service.cmr.attributes;
import org.alfresco.repo.attributes.Attribute;
import org.alfresco.repo.attributes.AttributeUnsupportedQueryType;
/**
* The equals predicate.
* @author britt
*/
public class AttrQueryEquals extends AttrQuery
{
private static final long serialVersionUID = 2180915053803244460L;
public AttrQueryEquals(Attribute value)
{
super(value);
}
/* (non-Javadoc)
* @see org.alfresco.service.cmr.attributes.AttrQuery#getPredicate()
*/
@Override
public String getPredicate()
{
return "ent." + fAttrName + " = " + getValue();
}
}

View File

@@ -0,0 +1,54 @@
/*
* 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.service.cmr.attributes;
import org.alfresco.repo.attributes.Attribute;
/**
* Greater than query.
* @author britt
*/
public class AttrQueryGT extends AttrQuery
{
private static final long serialVersionUID = 3171792743187950462L;
/**
* @param value
*/
public AttrQueryGT(Attribute value)
{
super(value);
}
/* (non-Javadoc)
* @see org.alfresco.service.cmr.attributes.AttrQuery#getPredicate()
*/
@Override
public String getPredicate()
{
return "ent." + fAttrName + " > " + getValue();
}
}

View File

@@ -0,0 +1,54 @@
/*
* 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.service.cmr.attributes;
import org.alfresco.repo.attributes.Attribute;
/**
* Greater than or equals predicate.
* @author britt
*/
public class AttrQueryGTE extends AttrQuery
{
private static final long serialVersionUID = -7957078449719425057L;
/**
* @param value
*/
public AttrQueryGTE(Attribute value)
{
super(value);
}
/* (non-Javadoc)
* @see org.alfresco.service.cmr.attributes.AttrQuery#getPredicate()
*/
@Override
public String getPredicate()
{
return "ent." + fAttrName + " >= " + getValue();
}
}

View File

@@ -0,0 +1,54 @@
/*
* 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.service.cmr.attributes;
import org.alfresco.repo.attributes.Attribute;
/**
* Query a less than condition.
* @author britt
*/
public class AttrQueryLT extends AttrQuery
{
private static final long serialVersionUID = -2385160490778425115L;
/**
* @param value
*/
public AttrQueryLT(Attribute value)
{
super(value);
}
/* (non-Javadoc)
* @see org.alfresco.service.cmr.attributes.AttrQuery#getPredicate()
*/
@Override
public String getPredicate()
{
return "ent." + fAttrName + " < " + getValue();
}
}

View File

@@ -0,0 +1,54 @@
/*
* 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.service.cmr.attributes;
import org.alfresco.repo.attributes.Attribute;
/**
* Less than or equal query
* @author britt
*/
public class AttrQueryLTE extends AttrQuery
{
private static final long serialVersionUID = -7735611069499505767L;
/**
* @param value
*/
public AttrQueryLTE(Attribute value)
{
super(value);
}
/* (non-Javadoc)
* @see org.alfresco.service.cmr.attributes.AttrQuery#getPredicate()
*/
@Override
public String getPredicate()
{
return "ent." + fAttrName + " <= " + getValue();
}
}

View File

@@ -0,0 +1,59 @@
/*
* 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.service.cmr.attributes;
import org.alfresco.repo.attributes.Attribute;
import org.alfresco.repo.attributes.AttributeUnsupportedQueryType;
/**
* A "like" query.
* @author britt
*/
public class AttrQueryLike extends AttrQuery
{
private static final long serialVersionUID = -984397014171296687L;
/**
* @param value
*/
public AttrQueryLike(Attribute value)
{
super(value);
}
/* (non-Javadoc)
* @see org.alfresco.service.cmr.attributes.AttrQuery#getPredicate()
*/
@Override
public String getPredicate()
{
if (fValue.getType() != Attribute.Type.STRING)
{
throw new AttributeUnsupportedQueryType(fValue.getType().name());
}
return "ent." + fAttrName + " like " + getValue();
}
}

View File

@@ -0,0 +1,54 @@
/*
* 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.service.cmr.attributes;
import org.alfresco.repo.attributes.Attribute;
/**
* Not equals query.
* @author britt
*/
public class AttrQueryNE extends AttrQuery
{
private static final long serialVersionUID = 103038173214972590L;
/**
* @param value
*/
public AttrQueryNE(Attribute value)
{
super(value);
}
/* (non-Javadoc)
* @see org.alfresco.service.cmr.attributes.AttrQuery#getPredicate()
*/
@Override
public String getPredicate()
{
return "ent." + fAttrName + " <> " + getValue();
}
}

View File

@@ -25,6 +25,8 @@
package org.alfresco.service.cmr.attributes;
import java.util.List;
/**
* This provides services for reading, writing, and querying global attributes.
* @author britt
@@ -51,6 +53,13 @@ public interface AttributeService
* @param name The name of the Attribute.
*/
public void removeValue(String path);
// TODO A query interface.
/**
* Query for a list of attributes which are contained in the container
* defined by the given path and meet the query criteria.
* @param path
* @param query
* @return A List of matching attributes.
*/
public List<Object> query(String path, AttrQuery query);
}