pulse - the web application framework Get pulse at SourceForge.net. Fast, secure and Free Open Source software downloads Ohloh project report for pulse-java

org.torweg.pulse.accesscontrol.attributes
Class SelectionAttribute

java.lang.Object
  extended by org.torweg.pulse.util.entity.AbstractBasicEntity
      extended by org.torweg.pulse.util.entity.Node
          extended by org.torweg.pulse.accesscontrol.attributes.AbstractAttribute<Selection>
              extended by org.torweg.pulse.accesscontrol.attributes.SelectionAttribute
All Implemented Interfaces:
java.io.Serializable, JDOMable, INameable, INamed

@Entity
public class SelectionAttribute
extends AbstractAttribute<Selection>
implements INameable

TODO: requires major refactoring to really be multi-select-able.

Version:
$Revision: 1809 $
Author:
Thomas Weber, Daniel Dietz
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.torweg.pulse.accesscontrol.attributes.AbstractAttribute
LOGGER
 
Constructor Summary
SelectionAttribute()
          creates a new SelectionAttribute ( multiselect = false), which is not a system attribute.
SelectionAttribute(boolean isSystem)
          creates a new SelectionAttribute ( multiselect = false).
SelectionAttribute(java.lang.String n)
          creates a new SelectionAttribute ( multiselect, systemAttribute = false) with the given name.
SelectionAttribute(java.lang.String n, boolean isSystem)
          creates a new SelectionAttribute ( multiselect = false) with the given name.
SelectionAttribute(java.lang.String n, boolean isSystem, boolean ms)
          creates a new SelectionAttribute with the given name and selection type.
 
Method Summary
 org.jdom.Element deserializeToJDOM()
          returns a JDOM representation of the attribute.
 org.jdom.Element deserializeToJDOM(java.util.Map<java.lang.Long,AbstractValue<?>> valueMap)
          returns a JDOM representation of the attribute.
 AbstractAttribute<Selection> getAttributeInstance(java.lang.String n, boolean s)
          returns a new SelectionAttribute with the given name.
 AbstractTypedCheck<Selection> getCheck()
          returns the check of the attribute.
 java.lang.String getName()
          returns the attributes name.
 java.util.Set<Option> getOptions()
          returns the options.
protected  java.lang.String getParameterName()
          returns the parameter name.
 boolean isMultiselect()
          returns the multi-select property.
 void setCheck(AbstractTypedCheck<Selection> c)
          sets the check for the attribute.
 void setMultiselect(boolean ms)
          sets the multi-select property.
 void setName(java.lang.String n)
          sets the name of the attribute.
 void setOptions(java.util.Set<Option> o)
          sets the options and updates the reverse mapping.
 AbstractAttribute<Selection> updateSettingsFromCommand(Command command, org.hibernate.Session session)
          updates the attribute's multi-select setting and its options.
 AbstractValue<Selection> valueFromCommand(Command c)
          initialises a value of this attribute from the given command.
 
Methods inherited from class org.torweg.pulse.accesscontrol.attributes.AbstractAttribute
addAdminEditRole, addAdminViewRole, addSelfEditRole, addSelfViewRole, addTriggeredRole, getAdminEditRoles, getAdminViewRoles, getSelfEditRoles, getSelfViewRoles, getTriggeredRoles, getTypedChecks, getValue, isRequired, isSystemAttribute, isValid, removeAdminEditRole, removeAdminViewRole, removeSelfEditRole, removeSelfViewRole, removeTriggeredRole, setAdminEditRoles, setAdminViewRoles, setRequired, setSelfEditRoles, setSelfViewRoles, setTriggeredRoles, setValue, toJSON
 
Methods inherited from class org.torweg.pulse.util.entity.Node
addChild, addChild, getChild, getChildIndex, getChildren, getParent, hasChildren, removeChild, setChildren
 
Methods inherited from class org.torweg.pulse.util.entity.AbstractBasicEntity
compareTo, equals, getFullQualifiedClassNameJAXB, getId, hashCode
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SelectionAttribute

public SelectionAttribute()
creates a new SelectionAttribute ( multiselect = false), which is not a system attribute.


SelectionAttribute

public SelectionAttribute(boolean isSystem)
creates a new SelectionAttribute ( multiselect = false).

Parameters:
isSystem - flag, indicating whether the attribute is a system attribute

SelectionAttribute

public SelectionAttribute(java.lang.String n)
creates a new SelectionAttribute ( multiselect, systemAttribute = false) with the given name.

Parameters:
n - the name

SelectionAttribute

public SelectionAttribute(java.lang.String n,
                          boolean isSystem)
creates a new SelectionAttribute ( multiselect = false) with the given name.

Parameters:
n - the name
isSystem - flag, indicating whether the attribute is a system attribute

SelectionAttribute

public SelectionAttribute(java.lang.String n,
                          boolean isSystem,
                          boolean ms)
creates a new SelectionAttribute with the given name and selection type.

Parameters:
n - the name
isSystem - flag, indicating whether the attribute is a system attribute
ms - flag, indicating whether the selection is a multi-select selection or not
Method Detail

setName

public final void setName(java.lang.String n)
sets the name of the attribute.

Specified by:
setName in interface INameable
Parameters:
n - the name to set
See Also:
INameable.setName(String)

getName

public final java.lang.String getName()
returns the attributes name.

Specified by:
getName in interface INamed
Specified by:
getName in class AbstractAttribute<Selection>
Returns:
the name

getOptions

public final java.util.Set<Option> getOptions()
returns the options.

Returns:
the options

setOptions

public final void setOptions(java.util.Set<Option> o)
sets the options and updates the reverse mapping.

Parameters:
o - the options to set

isMultiselect

public final boolean isMultiselect()
returns the multi-select property.

Returns:
the multi-select property

setMultiselect

public final void setMultiselect(boolean ms)
sets the multi-select property.

Parameters:
ms - the multi-select flag to set

getCheck

public final AbstractTypedCheck<Selection> getCheck()
returns the check of the attribute.

Specified by:
getCheck in class AbstractAttribute<Selection>
Returns:
the check
See Also:
AbstractAttribute.getCheck()

setCheck

public final void setCheck(AbstractTypedCheck<Selection> c)
sets the check for the attribute.

Specified by:
setCheck in class AbstractAttribute<Selection>
Parameters:
c - the check to set
See Also:
AbstractAttribute.setCheck(org.torweg.pulse.accesscontrol.attributes.AbstractTypedCheck)

getParameterName

protected final java.lang.String getParameterName()
returns the parameter name.

Returns:
the parameter name

valueFromCommand

public final AbstractValue<Selection> valueFromCommand(Command c)
Description copied from class: AbstractAttribute
initialises a value of this attribute from the given command.

Specified by:
valueFromCommand in class AbstractAttribute<Selection>
Parameters:
c - the current command
Returns:
an AbstractValue&lt;Selection&gt;
See Also:
AbstractAttribute.valueFromCommand(org.torweg.pulse.service.request.Command)

updateSettingsFromCommand

public final AbstractAttribute<Selection> updateSettingsFromCommand(Command command,
                                                                    org.hibernate.Session session)
updates the attribute's multi-select setting and its options.

Specified by:
updateSettingsFromCommand in class AbstractAttribute<Selection>
Parameters:
command - reporting the changes to make
session - to persist the changes
Returns:
the updated instance
See Also:
AbstractAttribute.updateSettingsFromCommand(Command, Session)

getAttributeInstance

public final AbstractAttribute<Selection> getAttributeInstance(java.lang.String n,
                                                               boolean s)
returns a new SelectionAttribute with the given name.

Specified by:
getAttributeInstance in class AbstractAttribute<Selection>
Parameters:
n - the name
s - flag, indicating whether the attribute will be a system attribute
Returns:
a new SelectionAttribute
See Also:
AbstractAttribute.getAttributeInstance(java.lang.String, boolean)

deserializeToJDOM

public org.jdom.Element deserializeToJDOM()
returns a JDOM representation of the attribute.

Specified by:
deserializeToJDOM in interface JDOMable
Overrides:
deserializeToJDOM in class AbstractAttribute<Selection>
Returns:
a JDOM representation
See Also:
AbstractAttribute.deserializeToJDOM()

deserializeToJDOM

public final org.jdom.Element deserializeToJDOM(java.util.Map<java.lang.Long,AbstractValue<?>> valueMap)
returns a JDOM representation of the attribute.

used during deserialization of a User

Overrides:
deserializeToJDOM in class AbstractAttribute<Selection>
Parameters:
valueMap - maps attribute-ids a Users attribute-values
Returns:
a JDOM representation of the attribute
See Also:
AbstractAttribute.deserializeToJDOM()