spcp7.imagegallery.abstractionlayer.util
Class PropertyDTO

java.lang.Object
  extended by spcp7.imagegallery.abstractionlayer.util.PropertyDTO
All Implemented Interfaces:
java.io.Serializable, PropertyModelFace

public class PropertyDTO
extends java.lang.Object
implements PropertyModelFace, java.io.Serializable

This class was created to provide a more convenient way to handle properties than the persistent jpa class. All boolean properties will be validated before setting them to always get a valid state. Furthermore we do not want to expose the persistent class to users of the api. Instead of "key" and "value" the German equivalents "schluessel" and "wert" are used, because key and value are often keywords in databases.

Author:
Phillip Merensky
See Also:
Serialized Form

Constructor Summary
PropertyDTO()
          Deafult constructor.
PropertyDTO(java.lang.String schluessel, java.lang.String wert)
           
 
Method Summary
 java.lang.Boolean getBool()
          If your property value is a boolean value and you only want boolean values in the "wert" field to be valid this should be true.
 java.lang.Boolean getBrowseable()
          If the property resembles a path which can be browsed as a hierarchical structure, set this to true.
 java.lang.Boolean getDeletable()
          Should the property be deletable?
 java.lang.Boolean getFolderSelection()
          If this is set to true the field "wert" contains a value which must be a folder.
 java.lang.Long getId()
          The id of the property
 java.lang.Boolean getImageSelection()
          If this is set to true only images can be selected when using a browseable view.
 java.lang.Boolean getNumber()
          If the "wert" field of this property contains a number and only numbers should be valid, this will be set to true.
 java.lang.String getSchluessel()
          This method gets the key of the property.
 java.lang.Boolean getUrlSelection()
          If the "wert" field should be a http retrievable url and the wert field is set to a ContentFace.getUrl(), set this to true.
 java.lang.Boolean getVisible()
           
 java.lang.String getWert()
          This method gets the value of the property.
 void setBool(java.lang.Boolean bool)
          This field and PropertyModelFace.getNumber() PropertyModelFace.getBrowseable() PropertyModelFace.getFolderSelection() PropertyModelFace.getImageSelection() PropertyModelFace.getUrlSelection() must not be set to true at the same time.
 void setBrowseable(java.lang.Boolean browseable)
           
 void setDeletable(java.lang.Boolean deletable)
          Set if property should be deletable, or not.
 void setFolderSelection(java.lang.Boolean folderSelection)
          This field and PropertyModelFace.getNumber() PropertyModelFace.getBool() PropertyModelFace.getImageSelection() PropertyModelFace.getUrlSelection() must not be set to true at the same time whereas PropertyModelFace.getBrowseable() should be.
 void setId(java.lang.Long id)
          Normally this should not be set manually but by the persistence provider.
 void setImageSelection(java.lang.Boolean imageSelection)
          This field and PropertyModelFace.getNumber() PropertyModelFace.getBool() PropertyModelFace.getFolderSelection() PropertyModelFace.getUrlSelection() must not be set to true at the same time whereas PropertyModelFace.getBrowseable() should be.
 void setNumber(java.lang.Boolean number)
          This field and PropertyModelFace.getBool() PropertyModelFace.getBrowseable() PropertyModelFace.getFolderSelection() PropertyModelFace.getImageSelection() PropertyModelFace.getUrlSelection() must not be set to true at the same time.
 void setSchluessel(java.lang.String schluessel)
           
 void setUrlSelection(java.lang.Boolean urlSelection)
           
 void setVisible(java.lang.Boolean visible)
           
 void setWert(java.lang.String wert)
           
 boolean validate()
          Attention!
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertyDTO

public PropertyDTO(java.lang.String schluessel,
                   java.lang.String wert)
Parameters:
schluessel -
wert -

PropertyDTO

public PropertyDTO()
Deafult constructor.

Method Detail

validate

public boolean validate()
Attention!
Unlike the described in the interface this method only checks if wert and schluessel are not null. The boolean properties are validated within the setter methods.

Specified by:
validate in interface PropertyModelFace
Returns:
true if all constraints have been met and false otherwise.

getId

public java.lang.Long getId()
Description copied from interface: PropertyModelFace
The id of the property

Specified by:
getId in interface PropertyModelFace
Returns:
Long the id.
See Also:
PropertyModelFace.getId()

setId

public void setId(java.lang.Long id)
Description copied from interface: PropertyModelFace
Normally this should not be set manually but by the persistence provider.

Specified by:
setId in interface PropertyModelFace
Parameters:
id - the id to set.
See Also:
PropertyModelFace.setId(java.lang.Long)

getBool

public java.lang.Boolean getBool()
Description copied from interface: PropertyModelFace
If your property value is a boolean value and you only want boolean values in the "wert" field to be valid this should be true.

Specified by:
getBool in interface PropertyModelFace
Returns:
Boolean True if the "wert"(value) should be validated as boolean value, false otherwise.
See Also:
PropertyModelFace.getBool()

setBool

public void setBool(java.lang.Boolean bool)
Description copied from interface: PropertyModelFace
This field and must not be set to true at the same time.

Specified by:
setBool in interface PropertyModelFace
Parameters:
bool - True if the value(wert) of this property should only contain Boolean values, false otherwise.
See Also:
PropertyModelFace.setBool(java.lang.Boolean)

getBrowseable

public java.lang.Boolean getBrowseable()
Description copied from interface: PropertyModelFace
If the property resembles a path which can be browsed as a hierarchical structure, set this to true. This field and cannot be set to true at the same time.

Specified by:
getBrowseable in interface PropertyModelFace
Returns:
Boolean True if the property resembles a full, browseable, absolute path, false otherwise.
See Also:
PropertyModelFace.getBrowseable()

setBrowseable

public void setBrowseable(java.lang.Boolean browseable)
Specified by:
setBrowseable in interface PropertyModelFace
Parameters:
browseable - True if the property resembles a full, browseable, absolute path, false otherwise.
See Also:
PropertyModelFace.setBrowseable(java.lang.Boolean)

getDeletable

public java.lang.Boolean getDeletable()
Description copied from interface: PropertyModelFace
Should the property be deletable? Default is false

Specified by:
getDeletable in interface PropertyModelFace
Returns:
Boolean true if property is deletable, false otherwise.
See Also:
PropertyModelFace.getDeletable()

setDeletable

public void setDeletable(java.lang.Boolean deletable)
Description copied from interface: PropertyModelFace
Set if property should be deletable, or not.

Specified by:
setDeletable in interface PropertyModelFace
Parameters:
deletable - true if property should be deletable, false otherwise.
See Also:
PropertyModelFace.setDeletable(java.lang.Boolean)

getSchluessel

public java.lang.String getSchluessel()
Description copied from interface: PropertyModelFace
This method gets the key of the property. The German translation of key "schluessel" is used because key is a keyword in several databases. This "schluessel" must also be used as key in maps like ContentProviderRegistryFace.getDefaultProperties()

Specified by:
getSchluessel in interface PropertyModelFace
Returns:
String the key of this property
See Also:
PropertyModelFace.getSchluessel()

setSchluessel

public void setSchluessel(java.lang.String schluessel)
Specified by:
setSchluessel in interface PropertyModelFace
Parameters:
schluessel - The key of this property
See Also:
PropertyModelFace.setSchluessel(java.lang.String)

getWert

public java.lang.String getWert()
Description copied from interface: PropertyModelFace
This method gets the value of the property. The German translation of value "wert" is used because value is a keyword in several databases.

Specified by:
getWert in interface PropertyModelFace
Returns:
String the value of this property
See Also:
PropertyModelFace.getWert()

setWert

public void setWert(java.lang.String wert)
Specified by:
setWert in interface PropertyModelFace
Parameters:
wert - The value of this property.
See Also:
PropertyModelFace.setWert(java.lang.String)

getFolderSelection

public java.lang.Boolean getFolderSelection()
Description copied from interface: PropertyModelFace
If this is set to true the field "wert" contains a value which must be a folder. For this to work "wert" must contain an absolute path to this folder. Within the browsing perspective of the gui this option allows only folders to be selected.

Specified by:
getFolderSelection in interface PropertyModelFace
Returns:
True if the "wert" field of this property must contain an absolute path to a folder.
See Also:
PropertyModelFace.getFolderSelection()

setFolderSelection

public void setFolderSelection(java.lang.Boolean folderSelection)
Description copied from interface: PropertyModelFace
This field and must not be set to true at the same time whereas PropertyModelFace.getBrowseable() should be.

Specified by:
setFolderSelection in interface PropertyModelFace
See Also:
PropertyModelFace.setFolderSelection(java.lang.Boolean)

getUrlSelection

public java.lang.Boolean getUrlSelection()
Description copied from interface: PropertyModelFace
If the "wert" field should be a http retrievable url and the wert field is set to a ContentFace.getUrl(), set this to true.

Specified by:
getUrlSelection in interface PropertyModelFace
Returns:
True if this is a url, false otherwise.
See Also:
PropertyModelFace.getUrlSelection()

setUrlSelection

public void setUrlSelection(java.lang.Boolean urlSelection)
Specified by:
setUrlSelection in interface PropertyModelFace
Parameters:
urlSelection - True if the "wert" field of this property should be a selectable url.
See Also:
PropertyModelFace.setUrlSelection(java.lang.Boolean)

getImageSelection

public java.lang.Boolean getImageSelection()
Description copied from interface: PropertyModelFace
If this is set to true only images can be selected when using a browseable view. Within the "wert" field an absolute path to an image is valid when this field is set to true.

Specified by:
getImageSelection in interface PropertyModelFace
Returns:
true if only images have to be selected, false otherwise.
See Also:
PropertyModelFace.getImageSelection()

setImageSelection

public void setImageSelection(java.lang.Boolean imageSelection)
Description copied from interface: PropertyModelFace
This field and must not be set to true at the same time whereas PropertyModelFace.getBrowseable() should be.

Specified by:
setImageSelection in interface PropertyModelFace
Parameters:
imageSelection - true if only images should be selectable, false otherwise.
See Also:
PropertyModelFace.setImageSelection(java.lang.Boolean)

getNumber

public java.lang.Boolean getNumber()
Description copied from interface: PropertyModelFace
If the "wert" field of this property contains a number and only numbers should be valid, this will be set to true.

Specified by:
getNumber in interface PropertyModelFace
Returns:
true if the "wert" field contains a number, false otherwise.
See Also:
PropertyModelFace.getNumber()

setNumber

public void setNumber(java.lang.Boolean number)
Description copied from interface: PropertyModelFace
This field and must not be set to true at the same time.

Specified by:
setNumber in interface PropertyModelFace
Parameters:
number - True if the value(wert) of this property should only contain Boolean numbers, false otherwise.
See Also:
PropertyModelFace.setNumber(java.lang.Boolean)

getVisible

public java.lang.Boolean getVisible()
Specified by:
getVisible in interface PropertyModelFace
Returns:
True if the value should be visible in the gui, false if it is only used internally.
See Also:
PropertyModelFace.getVisible()

setVisible

public void setVisible(java.lang.Boolean visible)
Specified by:
setVisible in interface PropertyModelFace
Parameters:
visible - True if the value should be visible in the gui, false if it is only used internally.
See Also:
PropertyModelFace.setVisible(java.lang.Boolean)


Copyright © 2008. All Rights Reserved.