org.olat.properties
Class PropertyManager

java.lang.Object
  extended by org.olat.properties.PropertyManager
All Implemented Interfaces:
UserDataDeletable

public class PropertyManager
extends java.lang.Object
implements UserDataDeletable

Initial Date: Mar 10, 2004

Author:
Mike Stock Comment:

Method Summary
 Property createProperty()
           
 Property createPropertyInstance(Identity identity, BusinessGroup group, OLATResourceable olatResourceable, java.lang.String category, java.lang.String name, java.lang.Float floatValue, java.lang.Long longValue, java.lang.String stringValue, java.lang.String textValue)
          Creates a new Property
 Property createUserPropertyInstance(Identity identity, java.lang.String category, java.lang.String name, java.lang.Float floatValue, java.lang.Long longValue, java.lang.String stringValue, java.lang.String textValue)
          Create a user proprety.
 void deleteProperties(Identity identity, BusinessGroup grp, OLATResourceable resourceable, java.lang.String category, java.lang.String name)
          deletes properties.
 void deleteProperty(Property p)
          Deletes a property on the database
 void deleteUserData(Identity identity, java.lang.String newDeletedUserName)
          Delete all properties of a certain identity.
 java.util.List findIdentitiesWithProperty(OLATResourceable resourceable, java.lang.String category, java.lang.String name, boolean matchNullValues)
          Get a list of identities that have properties given the restricting values
 java.util.List findIdentitiesWithProperty(java.lang.String resourceTypeName, java.lang.Long resourceTypeId, java.lang.String category, java.lang.String name, boolean matchNullValues)
          Get a list of identities that have properties given the restricting values
 java.util.List findProperties(Identity identity, BusinessGroup grp, OLATResourceable resourceable, java.lang.String category, java.lang.String name)
          Generic find method.
 java.util.List findProperties(Identity identity, BusinessGroup grp, java.lang.String resourceTypeName, java.lang.Long resourceTypeId, java.lang.String category, java.lang.String name)
          Only to use if no OLATResourceable Object is available.
 Property findProperty(Identity identity, BusinessGroup grp, OLATResourceable resourceable, java.lang.String category, java.lang.String name)
          Generic find method.
 Property findUserProperty(Identity identity, java.lang.String category, java.lang.String name)
          Find a user property.
 java.util.List getAllResourceTypeNames()
           
static PropertyManager getInstance()
           
 java.util.List listProperties(Identity identity, BusinessGroup grp, OLATResourceable resourceable, java.lang.String category, java.lang.String name)
          Generic method.
 java.util.List listProperties(Identity identity, BusinessGroup grp, java.lang.String resourceTypeName, java.lang.Long resourceTypeId, java.lang.String category, java.lang.String name)
          Only to use if no OLATResourceable Object is available.
 void saveProperty(Property p)
          Save a property
 void updateProperty(Property p)
          Update a property
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static PropertyManager getInstance()
Returns:
Singleton.

createPropertyInstance

public Property createPropertyInstance(Identity identity,
                                       BusinessGroup group,
                                       OLATResourceable olatResourceable,
                                       java.lang.String category,
                                       java.lang.String name,
                                       java.lang.Float floatValue,
                                       java.lang.Long longValue,
                                       java.lang.String stringValue,
                                       java.lang.String textValue)
Creates a new Property

Parameters:
identity -
group -
olatResourceable -
category -
name -
floatValue -
longValue -
stringValue -
textValue -
Returns:
property instance.

createUserPropertyInstance

public Property createUserPropertyInstance(Identity identity,
                                           java.lang.String category,
                                           java.lang.String name,
                                           java.lang.Float floatValue,
                                           java.lang.Long longValue,
                                           java.lang.String stringValue,
                                           java.lang.String textValue)
Create a user proprety. Grp, course and node a re set to null.

Parameters:
identity -
category -
name -
floatValue -
longValue -
stringValue -
textValue -
Returns:
property instance limited to a specific user.

deleteProperty

public void deleteProperty(Property p)
Deletes a property on the database

Parameters:
p - the property

saveProperty

public void saveProperty(Property p)
Save a property

Parameters:
p -

updateProperty

public void updateProperty(Property p)
Update a property

Parameters:
p -

findUserProperty

public Property findUserProperty(Identity identity,
                                 java.lang.String category,
                                 java.lang.String name)
Find a user property.

Parameters:
identity -
category -
name -
Returns:
Found property or null if no match.

listProperties

public java.util.List listProperties(Identity identity,
                                     BusinessGroup grp,
                                     OLATResourceable resourceable,
                                     java.lang.String category,
                                     java.lang.String name)
Generic method. Returns a list of Property objects. This is an inexact match i.e. parameters with null values will not be included in the query.

Parameters:
identity -
grp -
resourceable -
category -
name -
Returns:
a list of Property objects

listProperties

public java.util.List listProperties(Identity identity,
                                     BusinessGroup grp,
                                     java.lang.String resourceTypeName,
                                     java.lang.Long resourceTypeId,
                                     java.lang.String category,
                                     java.lang.String name)
Only to use if no OLATResourceable Object is available.

Parameters:
identity -
grp -
resourceTypeName -
resourceTypeId -
category -
name -
Returns:
a list of Property objects

deleteProperties

public void deleteProperties(Identity identity,
                             BusinessGroup grp,
                             OLATResourceable resourceable,
                             java.lang.String category,
                             java.lang.String name)
deletes properties. IMPORTANT: if an argument is null, then it will be not considered in the delete statement, which means not only the record having a "null" value will be deleted, but all.

Parameters:
identity -
grp -
resourceable -
category -
name -

findProperties

public java.util.List findProperties(Identity identity,
                                     BusinessGroup grp,
                                     OLATResourceable resourceable,
                                     java.lang.String category,
                                     java.lang.String name)
Generic find method. Returns a list of Property objects. This is an exact match i.e. if you pass-on null values, null values will be included in the query.

Parameters:
identity -
grp -
resourceable -
category -
name -
Returns:
a list of Property objects.

findProperties

public java.util.List findProperties(Identity identity,
                                     BusinessGroup grp,
                                     java.lang.String resourceTypeName,
                                     java.lang.Long resourceTypeId,
                                     java.lang.String category,
                                     java.lang.String name)
Only to use if no OLATResourceable Object is available.

Parameters:
identity -
grp -
resourceTypeName -
resourceTypeId -
category -
name -
Returns:
List of properties

findIdentitiesWithProperty

public java.util.List findIdentitiesWithProperty(OLATResourceable resourceable,
                                                 java.lang.String category,
                                                 java.lang.String name,
                                                 boolean matchNullValues)
Get a list of identities that have properties given the restricting values

Parameters:
resourceable - Search restricted to this resourcable
category - Search restricted to this property category
name - Search restricted to this property name
matchNullValues - true: null values in the above restricting values will be added as null values to the query; false: null values in the restricting values will be ignored in the query
Returns:
List of identities

findIdentitiesWithProperty

public java.util.List findIdentitiesWithProperty(java.lang.String resourceTypeName,
                                                 java.lang.Long resourceTypeId,
                                                 java.lang.String category,
                                                 java.lang.String name,
                                                 boolean matchNullValues)
Get a list of identities that have properties given the restricting values

Parameters:
resourceTypeName - Search restricted to this resource type name
resourceTypeId - Search restricted to this resource type id
category - Search restricted to this property category
name - Search restricted to this property name
matchNullValues - true: null values in the above restricting values will be added as null values to the query; false: null values in the restricting values will be ignored in the query
Returns:
List of identities

findProperty

public Property findProperty(Identity identity,
                             BusinessGroup grp,
                             OLATResourceable resourceable,
                             java.lang.String category,
                             java.lang.String name)
Generic find method.

Parameters:
identity -
grp -
resourceable -
category -
name -
Returns:
Property if found or null
Throws:
AssertException - if more than one match found

getAllResourceTypeNames

public java.util.List getAllResourceTypeNames()
Returns:
a list of all available resource type names

deleteUserData

public void deleteUserData(Identity identity,
                           java.lang.String newDeletedUserName)
Delete all properties of a certain identity.

Specified by:
deleteUserData in interface UserDataDeletable
Parameters:
identity - Data for this identity will be deleted
See Also:
org.olat.user.UserDataDeletable#deleteUserData(org.olat.core.id.Identity)

createProperty

public Property createProperty()