From 8760a86ff509b1f477a0a9677e80ac83226cc953 Mon Sep 17 00:00:00 2001 From: Britt Park Date: Tue, 3 Apr 2007 23:22:13 +0000 Subject: [PATCH] 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 --- .../AtrributeMethodNotImplemented.java | 42 +++ .../alfresco/repo/attributes/Attribute.java | 222 ++++++++++++++ .../repo/attributes/AttributeDAO.java | 58 ++++ .../repo/attributes/AttributeImpl.java | 276 ++++++++++++++++++ .../AttributeUnsupportedQueryType.java | 42 +++ .../repo/attributes/BlobAttribute.java | 34 +++ .../repo/attributes/BlobAttributeImpl.java | 68 +++++ .../repo/attributes/BooleanAttribute.java | 34 +++ .../repo/attributes/BooleanAttributeImpl.java | 64 ++++ .../repo/attributes/ByteAttribute.java | 34 +++ .../repo/attributes/ByteAttributeImpl.java | 68 +++++ .../repo/attributes/DoubleAttribute.java | 34 +++ .../repo/attributes/DoubleAttributeImpl.java | 68 +++++ .../repo/attributes/FloatAttribute.java | 34 +++ .../repo/attributes/FloatAttributeImpl.java | 68 +++++ .../repo/attributes/GlobalAttributeEntry.java | 35 +++ .../attributes/GlobalAttributeEntryDAO.java | 33 +++ .../repo/attributes/IntAttribute.java | 34 +++ .../repo/attributes/IntAttributeImpl.java | 68 +++++ .../repo/attributes/LongAttribute.java | 34 +++ .../repo/attributes/LongAttributeImpl.java | 68 +++++ .../repo/attributes/MapAttribute.java | 34 +++ .../repo/attributes/MapAttributeImpl.java | 119 ++++++++ .../alfresco/repo/attributes/MapEntry.java | 35 +++ .../alfresco/repo/attributes/MapEntryDAO.java | 43 +++ .../attributes/SerializableAttribute.java | 34 +++ .../attributes/SerializableAttributeImpl.java | 71 +++++ .../repo/attributes/ShortAttribute.java | 34 +++ .../repo/attributes/ShortAttributeImpl.java | 68 +++++ .../repo/attributes/StringAttribute.java | 34 +++ .../repo/attributes/StringAttributeImpl.java | 69 +++++ .../attributes/hibernate/Attributes.hbm.xml | 76 ++--- .../service/cmr/attributes/AttrQuery.java | 188 ++++++++++++ .../cmr/attributes/AttrQueryEquals.java | 52 ++++ .../service/cmr/attributes/AttrQueryGT.java | 54 ++++ .../service/cmr/attributes/AttrQueryGTE.java | 54 ++++ .../service/cmr/attributes/AttrQueryLT.java | 54 ++++ .../service/cmr/attributes/AttrQueryLTE.java | 54 ++++ .../service/cmr/attributes/AttrQueryLike.java | 59 ++++ .../service/cmr/attributes/AttrQueryNE.java | 54 ++++ .../cmr/attributes/AttributeService.java | 13 +- 41 files changed, 2577 insertions(+), 40 deletions(-) create mode 100644 source/java/org/alfresco/repo/attributes/AtrributeMethodNotImplemented.java create mode 100644 source/java/org/alfresco/repo/attributes/Attribute.java create mode 100644 source/java/org/alfresco/repo/attributes/AttributeDAO.java create mode 100644 source/java/org/alfresco/repo/attributes/AttributeImpl.java create mode 100644 source/java/org/alfresco/repo/attributes/AttributeUnsupportedQueryType.java create mode 100644 source/java/org/alfresco/repo/attributes/BlobAttribute.java create mode 100644 source/java/org/alfresco/repo/attributes/BlobAttributeImpl.java create mode 100644 source/java/org/alfresco/repo/attributes/BooleanAttribute.java create mode 100644 source/java/org/alfresco/repo/attributes/BooleanAttributeImpl.java create mode 100644 source/java/org/alfresco/repo/attributes/ByteAttribute.java create mode 100644 source/java/org/alfresco/repo/attributes/ByteAttributeImpl.java create mode 100644 source/java/org/alfresco/repo/attributes/DoubleAttribute.java create mode 100644 source/java/org/alfresco/repo/attributes/DoubleAttributeImpl.java create mode 100644 source/java/org/alfresco/repo/attributes/FloatAttribute.java create mode 100644 source/java/org/alfresco/repo/attributes/FloatAttributeImpl.java create mode 100644 source/java/org/alfresco/repo/attributes/GlobalAttributeEntry.java create mode 100644 source/java/org/alfresco/repo/attributes/GlobalAttributeEntryDAO.java create mode 100644 source/java/org/alfresco/repo/attributes/IntAttribute.java create mode 100644 source/java/org/alfresco/repo/attributes/IntAttributeImpl.java create mode 100644 source/java/org/alfresco/repo/attributes/LongAttribute.java create mode 100644 source/java/org/alfresco/repo/attributes/LongAttributeImpl.java create mode 100644 source/java/org/alfresco/repo/attributes/MapAttribute.java create mode 100644 source/java/org/alfresco/repo/attributes/MapAttributeImpl.java create mode 100644 source/java/org/alfresco/repo/attributes/MapEntry.java create mode 100644 source/java/org/alfresco/repo/attributes/MapEntryDAO.java create mode 100644 source/java/org/alfresco/repo/attributes/SerializableAttribute.java create mode 100644 source/java/org/alfresco/repo/attributes/SerializableAttributeImpl.java create mode 100644 source/java/org/alfresco/repo/attributes/ShortAttribute.java create mode 100644 source/java/org/alfresco/repo/attributes/ShortAttributeImpl.java create mode 100644 source/java/org/alfresco/repo/attributes/StringAttribute.java create mode 100644 source/java/org/alfresco/repo/attributes/StringAttributeImpl.java create mode 100644 source/java/org/alfresco/service/cmr/attributes/AttrQuery.java create mode 100644 source/java/org/alfresco/service/cmr/attributes/AttrQueryEquals.java create mode 100644 source/java/org/alfresco/service/cmr/attributes/AttrQueryGT.java create mode 100644 source/java/org/alfresco/service/cmr/attributes/AttrQueryGTE.java create mode 100644 source/java/org/alfresco/service/cmr/attributes/AttrQueryLT.java create mode 100644 source/java/org/alfresco/service/cmr/attributes/AttrQueryLTE.java create mode 100644 source/java/org/alfresco/service/cmr/attributes/AttrQueryLike.java create mode 100644 source/java/org/alfresco/service/cmr/attributes/AttrQueryNE.java diff --git a/source/java/org/alfresco/repo/attributes/AtrributeMethodNotImplemented.java b/source/java/org/alfresco/repo/attributes/AtrributeMethodNotImplemented.java new file mode 100644 index 0000000000..93f302a8db --- /dev/null +++ b/source/java/org/alfresco/repo/attributes/AtrributeMethodNotImplemented.java @@ -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); + } +} diff --git a/source/java/org/alfresco/repo/attributes/Attribute.java b/source/java/org/alfresco/repo/attributes/Attribute.java new file mode 100644 index 0000000000..dbd2c05ace --- /dev/null +++ b/source/java/org/alfresco/repo/attributes/Attribute.java @@ -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> entrySet(); + + /** + * Get the key set for a map. + * @return The key set. + */ + public Set keySet(); + + /** + * Get the collection of values of a map. + * @return The values. + */ + public Collection values(); +} diff --git a/source/java/org/alfresco/repo/attributes/AttributeDAO.java b/source/java/org/alfresco/repo/attributes/AttributeDAO.java new file mode 100644 index 0000000000..6f6669a3e8 --- /dev/null +++ b/source/java/org/alfresco/repo/attributes/AttributeDAO.java @@ -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 find(String path, AttrQuery query); +} diff --git a/source/java/org/alfresco/repo/attributes/AttributeImpl.java b/source/java/org/alfresco/repo/attributes/AttributeImpl.java new file mode 100644 index 0000000000..36b5366c49 --- /dev/null +++ b/source/java/org/alfresco/repo/attributes/AttributeImpl.java @@ -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> 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 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 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"); + } +} diff --git a/source/java/org/alfresco/repo/attributes/AttributeUnsupportedQueryType.java b/source/java/org/alfresco/repo/attributes/AttributeUnsupportedQueryType.java new file mode 100644 index 0000000000..23f3b1227a --- /dev/null +++ b/source/java/org/alfresco/repo/attributes/AttributeUnsupportedQueryType.java @@ -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); + } +} diff --git a/source/java/org/alfresco/repo/attributes/BlobAttribute.java b/source/java/org/alfresco/repo/attributes/BlobAttribute.java new file mode 100644 index 0000000000..63c090964e --- /dev/null +++ b/source/java/org/alfresco/repo/attributes/BlobAttribute.java @@ -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 +{ +} diff --git a/source/java/org/alfresco/repo/attributes/BlobAttributeImpl.java b/source/java/org/alfresco/repo/attributes/BlobAttributeImpl.java new file mode 100644 index 0000000000..e929ac5175 --- /dev/null +++ b/source/java/org/alfresco/repo/attributes/BlobAttributeImpl.java @@ -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; + } +} diff --git a/source/java/org/alfresco/repo/attributes/BooleanAttribute.java b/source/java/org/alfresco/repo/attributes/BooleanAttribute.java new file mode 100644 index 0000000000..349afb314c --- /dev/null +++ b/source/java/org/alfresco/repo/attributes/BooleanAttribute.java @@ -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 +{ +} diff --git a/source/java/org/alfresco/repo/attributes/BooleanAttributeImpl.java b/source/java/org/alfresco/repo/attributes/BooleanAttributeImpl.java new file mode 100644 index 0000000000..1f88241e7a --- /dev/null +++ b/source/java/org/alfresco/repo/attributes/BooleanAttributeImpl.java @@ -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; + } +} diff --git a/source/java/org/alfresco/repo/attributes/ByteAttribute.java b/source/java/org/alfresco/repo/attributes/ByteAttribute.java new file mode 100644 index 0000000000..a0ed2feca5 --- /dev/null +++ b/source/java/org/alfresco/repo/attributes/ByteAttribute.java @@ -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 +{ +} diff --git a/source/java/org/alfresco/repo/attributes/ByteAttributeImpl.java b/source/java/org/alfresco/repo/attributes/ByteAttributeImpl.java new file mode 100644 index 0000000000..483aae850e --- /dev/null +++ b/source/java/org/alfresco/repo/attributes/ByteAttributeImpl.java @@ -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; + } +} diff --git a/source/java/org/alfresco/repo/attributes/DoubleAttribute.java b/source/java/org/alfresco/repo/attributes/DoubleAttribute.java new file mode 100644 index 0000000000..fcb410c6d7 --- /dev/null +++ b/source/java/org/alfresco/repo/attributes/DoubleAttribute.java @@ -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 +{ +} diff --git a/source/java/org/alfresco/repo/attributes/DoubleAttributeImpl.java b/source/java/org/alfresco/repo/attributes/DoubleAttributeImpl.java new file mode 100644 index 0000000000..917de389f4 --- /dev/null +++ b/source/java/org/alfresco/repo/attributes/DoubleAttributeImpl.java @@ -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; + } +} diff --git a/source/java/org/alfresco/repo/attributes/FloatAttribute.java b/source/java/org/alfresco/repo/attributes/FloatAttribute.java new file mode 100644 index 0000000000..8bb68f59ce --- /dev/null +++ b/source/java/org/alfresco/repo/attributes/FloatAttribute.java @@ -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 +{ +} diff --git a/source/java/org/alfresco/repo/attributes/FloatAttributeImpl.java b/source/java/org/alfresco/repo/attributes/FloatAttributeImpl.java new file mode 100644 index 0000000000..d8c897f7b2 --- /dev/null +++ b/source/java/org/alfresco/repo/attributes/FloatAttributeImpl.java @@ -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; + } +} diff --git a/source/java/org/alfresco/repo/attributes/GlobalAttributeEntry.java b/source/java/org/alfresco/repo/attributes/GlobalAttributeEntry.java new file mode 100644 index 0000000000..4571e56932 --- /dev/null +++ b/source/java/org/alfresco/repo/attributes/GlobalAttributeEntry.java @@ -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. +} diff --git a/source/java/org/alfresco/repo/attributes/GlobalAttributeEntryDAO.java b/source/java/org/alfresco/repo/attributes/GlobalAttributeEntryDAO.java new file mode 100644 index 0000000000..aac5a440ad --- /dev/null +++ b/source/java/org/alfresco/repo/attributes/GlobalAttributeEntryDAO.java @@ -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); +} diff --git a/source/java/org/alfresco/repo/attributes/IntAttribute.java b/source/java/org/alfresco/repo/attributes/IntAttribute.java new file mode 100644 index 0000000000..294338e389 --- /dev/null +++ b/source/java/org/alfresco/repo/attributes/IntAttribute.java @@ -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 +{ +} diff --git a/source/java/org/alfresco/repo/attributes/IntAttributeImpl.java b/source/java/org/alfresco/repo/attributes/IntAttributeImpl.java new file mode 100644 index 0000000000..f579e5b63d --- /dev/null +++ b/source/java/org/alfresco/repo/attributes/IntAttributeImpl.java @@ -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; + } +} diff --git a/source/java/org/alfresco/repo/attributes/LongAttribute.java b/source/java/org/alfresco/repo/attributes/LongAttribute.java new file mode 100644 index 0000000000..62f1f26585 --- /dev/null +++ b/source/java/org/alfresco/repo/attributes/LongAttribute.java @@ -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 +{ +} diff --git a/source/java/org/alfresco/repo/attributes/LongAttributeImpl.java b/source/java/org/alfresco/repo/attributes/LongAttributeImpl.java new file mode 100644 index 0000000000..c21c72b777 --- /dev/null +++ b/source/java/org/alfresco/repo/attributes/LongAttributeImpl.java @@ -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; + } +} diff --git a/source/java/org/alfresco/repo/attributes/MapAttribute.java b/source/java/org/alfresco/repo/attributes/MapAttribute.java new file mode 100644 index 0000000000..f76c2bb74a --- /dev/null +++ b/source/java/org/alfresco/repo/attributes/MapAttribute.java @@ -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 +{ +} diff --git a/source/java/org/alfresco/repo/attributes/MapAttributeImpl.java b/source/java/org/alfresco/repo/attributes/MapAttributeImpl.java new file mode 100644 index 0000000000..0579fbf8be --- /dev/null +++ b/source/java/org/alfresco/repo/attributes/MapAttributeImpl.java @@ -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> 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 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 values() + { + // TODO Auto-generated method stub + return super.values(); + } +} diff --git a/source/java/org/alfresco/repo/attributes/MapEntry.java b/source/java/org/alfresco/repo/attributes/MapEntry.java new file mode 100644 index 0000000000..6558e16999 --- /dev/null +++ b/source/java/org/alfresco/repo/attributes/MapEntry.java @@ -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. +} diff --git a/source/java/org/alfresco/repo/attributes/MapEntryDAO.java b/source/java/org/alfresco/repo/attributes/MapEntryDAO.java new file mode 100644 index 0000000000..23e6d10636 --- /dev/null +++ b/source/java/org/alfresco/repo/attributes/MapEntryDAO.java @@ -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 get(MapAttribute mapAttr); +} diff --git a/source/java/org/alfresco/repo/attributes/SerializableAttribute.java b/source/java/org/alfresco/repo/attributes/SerializableAttribute.java new file mode 100644 index 0000000000..faf4155b87 --- /dev/null +++ b/source/java/org/alfresco/repo/attributes/SerializableAttribute.java @@ -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 +{ +} diff --git a/source/java/org/alfresco/repo/attributes/SerializableAttributeImpl.java b/source/java/org/alfresco/repo/attributes/SerializableAttributeImpl.java new file mode 100644 index 0000000000..5b0b912d38 --- /dev/null +++ b/source/java/org/alfresco/repo/attributes/SerializableAttributeImpl.java @@ -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; + } +} diff --git a/source/java/org/alfresco/repo/attributes/ShortAttribute.java b/source/java/org/alfresco/repo/attributes/ShortAttribute.java new file mode 100644 index 0000000000..41dc7f4454 --- /dev/null +++ b/source/java/org/alfresco/repo/attributes/ShortAttribute.java @@ -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 +{ +} diff --git a/source/java/org/alfresco/repo/attributes/ShortAttributeImpl.java b/source/java/org/alfresco/repo/attributes/ShortAttributeImpl.java new file mode 100644 index 0000000000..d3e57537fd --- /dev/null +++ b/source/java/org/alfresco/repo/attributes/ShortAttributeImpl.java @@ -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; + } +} diff --git a/source/java/org/alfresco/repo/attributes/StringAttribute.java b/source/java/org/alfresco/repo/attributes/StringAttribute.java new file mode 100644 index 0000000000..61e535dc98 --- /dev/null +++ b/source/java/org/alfresco/repo/attributes/StringAttribute.java @@ -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 +{ +} diff --git a/source/java/org/alfresco/repo/attributes/StringAttributeImpl.java b/source/java/org/alfresco/repo/attributes/StringAttributeImpl.java new file mode 100644 index 0000000000..aaa112c6f6 --- /dev/null +++ b/source/java/org/alfresco/repo/attributes/StringAttributeImpl.java @@ -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; + } +} diff --git a/source/java/org/alfresco/repo/attributes/hibernate/Attributes.hbm.xml b/source/java/org/alfresco/repo/attributes/hibernate/Attributes.hbm.xml index 3b13f496c7..27d0ec821e 100644 --- a/source/java/org/alfresco/repo/attributes/hibernate/Attributes.hbm.xml +++ b/source/java/org/alfresco/repo/attributes/hibernate/Attributes.hbm.xml @@ -3,9 +3,9 @@ - - + @@ -15,77 +15,77 @@ - - + - - + - - + - - + - - + - - + - - + - + length="512" index="attribute_string_index(64)"/> - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + diff --git a/source/java/org/alfresco/service/cmr/attributes/AttrQuery.java b/source/java/org/alfresco/service/cmr/attributes/AttrQuery.java new file mode 100644 index 0000000000..1508d44eef --- /dev/null +++ b/source/java/org/alfresco/service/cmr/attributes/AttrQuery.java @@ -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()); + } + } + } +} diff --git a/source/java/org/alfresco/service/cmr/attributes/AttrQueryEquals.java b/source/java/org/alfresco/service/cmr/attributes/AttrQueryEquals.java new file mode 100644 index 0000000000..c25abc0eec --- /dev/null +++ b/source/java/org/alfresco/service/cmr/attributes/AttrQueryEquals.java @@ -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(); + } +} diff --git a/source/java/org/alfresco/service/cmr/attributes/AttrQueryGT.java b/source/java/org/alfresco/service/cmr/attributes/AttrQueryGT.java new file mode 100644 index 0000000000..6fb4315bbd --- /dev/null +++ b/source/java/org/alfresco/service/cmr/attributes/AttrQueryGT.java @@ -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(); + } +} diff --git a/source/java/org/alfresco/service/cmr/attributes/AttrQueryGTE.java b/source/java/org/alfresco/service/cmr/attributes/AttrQueryGTE.java new file mode 100644 index 0000000000..af536ccf87 --- /dev/null +++ b/source/java/org/alfresco/service/cmr/attributes/AttrQueryGTE.java @@ -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(); + } +} diff --git a/source/java/org/alfresco/service/cmr/attributes/AttrQueryLT.java b/source/java/org/alfresco/service/cmr/attributes/AttrQueryLT.java new file mode 100644 index 0000000000..452be6fe52 --- /dev/null +++ b/source/java/org/alfresco/service/cmr/attributes/AttrQueryLT.java @@ -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(); + } +} diff --git a/source/java/org/alfresco/service/cmr/attributes/AttrQueryLTE.java b/source/java/org/alfresco/service/cmr/attributes/AttrQueryLTE.java new file mode 100644 index 0000000000..9b0a07db92 --- /dev/null +++ b/source/java/org/alfresco/service/cmr/attributes/AttrQueryLTE.java @@ -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(); + } +} diff --git a/source/java/org/alfresco/service/cmr/attributes/AttrQueryLike.java b/source/java/org/alfresco/service/cmr/attributes/AttrQueryLike.java new file mode 100644 index 0000000000..844a632972 --- /dev/null +++ b/source/java/org/alfresco/service/cmr/attributes/AttrQueryLike.java @@ -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(); + } +} diff --git a/source/java/org/alfresco/service/cmr/attributes/AttrQueryNE.java b/source/java/org/alfresco/service/cmr/attributes/AttrQueryNE.java new file mode 100644 index 0000000000..d7f4177599 --- /dev/null +++ b/source/java/org/alfresco/service/cmr/attributes/AttrQueryNE.java @@ -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(); + } +} diff --git a/source/java/org/alfresco/service/cmr/attributes/AttributeService.java b/source/java/org/alfresco/service/cmr/attributes/AttributeService.java index 5125fd0435..17418206c6 100644 --- a/source/java/org/alfresco/service/cmr/attributes/AttributeService.java +++ b/source/java/org/alfresco/service/cmr/attributes/AttributeService.java @@ -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 query(String path, AttrQuery query); }