org.musicontroller.core
Class LinkableAbs

java.lang.Object
  extended by org.musicontroller.core.LinkableAbs
All Implemented Interfaces:
Linkable
Direct Known Subclasses:
Band, Instrument, Keyword, Playlist, Song

public abstract class LinkableAbs
extends java.lang.Object
implements Linkable

Basic functionality for the Linkable objects. In addition to the Linkable interface, the LinkableAbs has a changed and an inserted-property.

Author:
Varienaja

Constructor Summary
LinkableAbs()
          Constructs a LinkableAbs, with empty Name (zero length, but not null), an Id of -1, Changed to null and Inserted to the current timestamp.
 
Method Summary
 java.util.Date getChanged()
          Returns the date when this object was last-changed.
 long getId()
           
 java.util.Date getInserted()
          Returns the date when this object was inserted (created).
 java.lang.String getName()
           
static java.lang.String normalizeName(java.lang.String name)
          Takes a Name (an ordinary String), and returns the normalized version.
 void setChanged(java.util.Date changed)
          Sets the date where this object was last-changed.
 void setId(long id)
           
 void setInserted(java.util.Date inserted)
          Sets the date when this object was inserted (created).
 void setName(java.lang.String name)
          Setter for the name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.musicontroller.model.Linkable
getType
 

Constructor Detail

LinkableAbs

public LinkableAbs()
Constructs a LinkableAbs, with empty Name (zero length, but not null), an Id of -1, Changed to null and Inserted to the current timestamp.

Method Detail

getId

public long getId()
Specified by:
getId in interface Linkable

setId

public void setId(long id)

getName

public java.lang.String getName()
Specified by:
getName in interface Linkable

normalizeName

public static java.lang.String normalizeName(java.lang.String name)
Takes a Name (an ordinary String), and returns the normalized version. The normalized version contains a maximum of 150 characters, and has all leading and trailing whitespace removed.

Parameters:
name - The Name.
Returns:
The normalized Name.

setName

public void setName(java.lang.String name)
Setter for the name. Null values will be understood as empty strings. All input will be trimmed (trailing and leading whitespace will be removed), when the resulting string is longer than 150 characters, it will be cut-off.

Parameters:
name - The name to set.

getChanged

public java.util.Date getChanged()
Returns the date when this object was last-changed. The changed-property is intended to be used by Hibernate for providing optimistic locking.

Returns:
The timestamp of the last change.

setChanged

public void setChanged(java.util.Date changed)
Sets the date where this object was last-changed. The changed-property is intended to be used by Hibernate for providing optimistic locking.

Parameters:
changed - The timestamp of the last change.

getInserted

public java.util.Date getInserted()
Returns the date when this object was inserted (created).

Returns:
The creation timestamp.

setInserted

public void setInserted(java.util.Date inserted)
Sets the date when this object was inserted (created). The inserted-property is set automatically in the constructor. There is normally no use for setting this property.

Parameters:
inserted - The creation timestamp.


Copyright © 2010 A.J.V.. All Rights Reserved.