org.alfresco.repo.props
Class PropertyValueComponentImpl

java.lang.Object
  extended by org.alfresco.repo.props.PropertyValueComponentImpl
All Implemented Interfaces:
PropertyValueComponent

public class PropertyValueComponentImpl
extends java.lang.Object
implements PropertyValueComponent

This component provides a clearer distinction between shared and unshared properties and avoids the need to access the DAO, which is much more obscure and potentially harmful.

Since:
3.2

Constructor Summary
PropertyValueComponentImpl()
           
 
Method Summary
 java.lang.Long createPropertyUniqueContext(java.io.Serializable value1, java.io.Serializable value2, java.io.Serializable value3)
          Create a new combination of three unique properties.
 java.lang.Long createUnsharedProperty(java.io.Serializable value)
          
 void deletePropertyUniqueContext(java.lang.Long id)
          Delete a unique property context.
 int deletePropertyUniqueContexts(java.io.Serializable[] values)
          Delete a combination of three unique properties.
 void deleteUnsharedProperty(java.lang.Long id)
          
 java.lang.Long getOrCreateSharedValue(java.io.Serializable value)
          
 java.lang.Long getPropertyUniqueContext(java.io.Serializable value1, java.io.Serializable value2, java.io.Serializable value3)
          Get the ID of a unique property context.
 java.io.Serializable getSharedValueById(java.lang.Long id)
          
 java.lang.Long getSharedValueId(java.io.Serializable value)
          
 java.io.Serializable getUnsharedPropertyById(java.lang.Long id)
          
 void init()
          Ensures that all necessary properties have been set
 void setPropertyValueDAO(PropertyValueDAO propertyValueDAO)
          Set the underlying DAO that manipulates the database data
 void updatePropertyUniqueContext(java.lang.Long id, java.io.Serializable value1, java.io.Serializable value2, java.io.Serializable value3)
          Update a unique property context.
 java.lang.Long updatePropertyUniqueContext(java.io.Serializable value1Before, java.io.Serializable value2Before, java.io.Serializable value3Before, java.io.Serializable value1, java.io.Serializable value2, java.io.Serializable value3)
          Update a combination of three unique properties.
 void updateUnsharedProperty(java.lang.Long id, java.io.Serializable value)
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertyValueComponentImpl

public PropertyValueComponentImpl()
Method Detail

setPropertyValueDAO

public void setPropertyValueDAO(PropertyValueDAO propertyValueDAO)
Set the underlying DAO that manipulates the database data


init

public void init()
Ensures that all necessary properties have been set


getSharedValueById

public java.io.Serializable getSharedValueById(java.lang.Long id)

Specified by:
getSharedValueById in interface PropertyValueComponent
Parameters:
id - the ID (may not be null)

getSharedValueId

public java.lang.Long getSharedValueId(java.io.Serializable value)

Specified by:
getSharedValueId in interface PropertyValueComponent
Parameters:
value - the value to find the ID for (may be null)
Returns:
Returns the ID of the shared value or null if it doesn't exist

getOrCreateSharedValue

public java.lang.Long getOrCreateSharedValue(java.io.Serializable value)

Specified by:
getOrCreateSharedValue in interface PropertyValueComponent
Parameters:
value - the value to find the ID for (may be null)
Returns:
Returns the ID of the shared value (created or not)

getUnsharedPropertyById

public java.io.Serializable getUnsharedPropertyById(java.lang.Long id)

Specified by:
getUnsharedPropertyById in interface PropertyValueComponent
Parameters:
id - the ID (may not be null)
Returns:
Returns the value of the property (never null)

createUnsharedProperty

public java.lang.Long createUnsharedProperty(java.io.Serializable value)

Specified by:
createUnsharedProperty in interface PropertyValueComponent
Parameters:
value - the value to create (may be null)
Returns:
Returns the new property's ID

updateUnsharedProperty

public void updateUnsharedProperty(java.lang.Long id,
                                   java.io.Serializable value)

Specified by:
updateUnsharedProperty in interface PropertyValueComponent
Parameters:
id - the ID of the root property to change (may not be null)
value - the new property value

deleteUnsharedProperty

public void deleteUnsharedProperty(java.lang.Long id)

Specified by:
deleteUnsharedProperty in interface PropertyValueComponent
Parameters:
id - the ID of the root property to delete (may be null)

createPropertyUniqueContext

public java.lang.Long createPropertyUniqueContext(java.io.Serializable value1,
                                                  java.io.Serializable value2,
                                                  java.io.Serializable value3)
Create a new combination of three unique properties.

Specified by:
createPropertyUniqueContext in interface PropertyValueComponent
Parameters:
value1 - the first property, which should denote application name or use-case ID (null allowed)
value2 - the second property, which should denote the context or container value (null allowed)
value3 - the third property, which should denote the unique value within the context of the previous two properties (null allowed)
Returns:
Returns the ID of the unique property combination for later updates

getPropertyUniqueContext

public java.lang.Long getPropertyUniqueContext(java.io.Serializable value1,
                                               java.io.Serializable value2,
                                               java.io.Serializable value3)
Get the ID of a unique property context.

Specified by:
getPropertyUniqueContext in interface PropertyValueComponent
See Also:
PropertyValueComponent.createPropertyUniqueContext(Serializable, Serializable, Serializable)

updatePropertyUniqueContext

public void updatePropertyUniqueContext(java.lang.Long id,
                                        java.io.Serializable value1,
                                        java.io.Serializable value2,
                                        java.io.Serializable value3)
Update a unique property context.

Specified by:
updatePropertyUniqueContext in interface PropertyValueComponent
See Also:
PropertyValueComponent.createPropertyUniqueContext(Serializable, Serializable, Serializable)

updatePropertyUniqueContext

public java.lang.Long updatePropertyUniqueContext(java.io.Serializable value1Before,
                                                  java.io.Serializable value2Before,
                                                  java.io.Serializable value3Before,
                                                  java.io.Serializable value1,
                                                  java.io.Serializable value2,
                                                  java.io.Serializable value3)
Update a combination of three unique properties. If the before values exist, then they are updated to the new values. If the before values don't exist, then the new values are created assuming no pre-existence - using create is better if there is no pre-existing set of values.

Specified by:
updatePropertyUniqueContext in interface PropertyValueComponent
Parameters:
value1Before - the first property before (null allowed)
value2Before - the second property before (null allowed)
value3Before - the third property before (null allowed)
value1 - the first property (null allowed)
value2 - the second property (null allowed)
value3 - the third property (null allowed)
Returns:
Returns the ID of the unique property combination for later updates

deletePropertyUniqueContext

public void deletePropertyUniqueContext(java.lang.Long id)
Delete a unique property context.

Specified by:
deletePropertyUniqueContext in interface PropertyValueComponent
See Also:
PropertyValueComponent.createPropertyUniqueContext(Serializable, Serializable, Serializable)

deletePropertyUniqueContexts

public int deletePropertyUniqueContexts(java.io.Serializable[] values)
Delete a combination of three unique properties. It doesn't matter if the unique combination already existed or not.

Specified by:
deletePropertyUniqueContexts in interface PropertyValueComponent
Parameters:
values - an array of one, two or three values, any of which may be null
Returns:
Returns the number of unique combinations deleted


Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.