org.davesag.generica.core
Class Link

java.lang.Object
  extended byorg.davesag.generica.core.AbstractDateStamped
      extended byorg.davesag.generica.core.AbstractContent
          extended byorg.davesag.generica.core.Link
All Implemented Interfaces:
Content, DateStamped, Localisable, Persistable, Serializable

public class Link
extends AbstractContent

The Link bean represents a titled url linking to an external site.

Since:
Generica 1.0
Version:
CVS Revision $Id: Link.java,v 1.13 2004/04/08 13:19:08 davesag Exp $
Author:
Dave Sag http://www.davesag.com
See Also:
Serialized Form

Field Summary
protected  boolean itsValid
          is the url of the link a valid url?
protected  String theDescription
          a Description of this link
protected  String theTitle
          the title for this link
protected  String theUrl
          The Url of this Link
 
Fields inherited from class org.davesag.generica.core.AbstractContent
theCountryCode, theLanguageCode
 
Fields inherited from class org.davesag.generica.core.AbstractDateStamped
theCreated, theId, theLastModified
 
Constructor Summary
Link()
          null constructor required by hibernate.
Link(String title, String url, String desc, Locale loc)
          Constructor that takes a title, url, description and Locale.
Link(String title, String url, String desc, String lang)
          Constructor that takes a title, url, description and language code.
 
Method Summary
 boolean equals(Object o)
          Tests if the supplied object is equal to this Link.
 String getDescription()
          Returns a short description.
 String getTitle()
          get the title of this link.
 String getUrl()
          get the url of this link.
 Boolean getValid()
          Checks that the url of this Link has been marked as a valid url.
 int hashcode()
          the hashcode.
 void invalidate()
          The URL of this Link has been checked and you wish to assert that it is not valid.
 boolean isValid()
          Checks that the url of this Link has been marked as a valid url.
 void setDescription(String desc)
          Set a short description of this Link.
 void setTitle(String title)
          Set the Title for this Link.
 void setUrl(String url)
          Set an associated url for this Link.
 void setValid(Boolean v)
          Set the validity of this url.
 String toString()
          get a simple string representation of this link.
 void validate()
          The URL of this Link has been checked and you wish to assert that it is valid.
 
Methods inherited from class org.davesag.generica.core.AbstractContent
getCountryCode, getLanguageCode, getLocale, setCountryCode, setLanguageCode, setLocale
 
Methods inherited from class org.davesag.generica.core.AbstractDateStamped
getCreated, getId, getLastModified, setCreated, setId, setLastModified, setTemplateId
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.davesag.generica.core.DateStamped
getCreated, getLastModified, setCreated, setLastModified
 

Field Detail

theUrl

protected String theUrl
The Url of this Link


theDescription

protected String theDescription
a Description of this link


theTitle

protected String theTitle
the title for this link


itsValid

protected boolean itsValid
is the url of the link a valid url?

Constructor Detail

Link

public Link()
null constructor required by hibernate.


Link

public Link(String title,
            String url,
            String desc,
            String lang)
Constructor that takes a title, url, description and language code.

Parameters:
title - The title of the Link.
url - The Url of the Link.
desc - A verbal deswcription of the Link.
lang - The ISO Language code.

Link

public Link(String title,
            String url,
            String desc,
            Locale loc)
Constructor that takes a title, url, description and Locale.

Parameters:
title - The title of the Link.
url - The Url of the Link.
desc - A verbal deswcription of the Link.
loc - The Locale.
Method Detail

getUrl

public String getUrl()
get the url of this link.

Returns:
An associated url for this Link. Can be null.
Hibernate Property:
length = "255"

setUrl

public void setUrl(String url)
Set an associated url for this Link.

Parameters:
url - A url for this Link.

getDescription

public String getDescription()
Returns a short description.

Returns:
A short description of this Link. Can be null.
Hibernate Property:
length = "1024"

setDescription

public void setDescription(String desc)
Set a short description of this Link.

Parameters:
desc - A description of this Link.

getTitle

public String getTitle()
get the title of this link.

Returns:
This Link's Title. Can not be null.
Hibernate Property:
length = "255" not-null="true"

setTitle

public void setTitle(String title)
Set the Title for this Link.

Parameters:
title - The Title of this Link.

isValid

public boolean isValid()
Checks that the url of this Link has been marked as a valid url.

Returns:
true if the url has been tested and shown to be valid.
See Also:
LinkPeer.validate(net.sf.hibernate.Session, org.davesag.generica.core.Link)

getValid

public Boolean getValid()
Checks that the url of this Link has been marked as a valid url. This is a helper method for struts whose logic tags can not deal with is * methods. It's also used by hibernate.

Returns:
True if the url has been tested and shown to be valid.
Hibernate Property:

setValid

public void setValid(Boolean v)
Set the validity of this url. Only really used by hibernate.

Parameters:
v - The Boolean value to set.

validate

public void validate()
The URL of this Link has been checked and you wish to assert that it is valid.

See Also:
LinkPeer.validate(net.sf.hibernate.Session, org.davesag.generica.core.Link)

invalidate

public void invalidate()
The URL of this Link has been checked and you wish to assert that it is not valid.

See Also:
LinkPeer.validate(net.sf.hibernate.Session, org.davesag.generica.core.Link)

toString

public String toString()
get a simple string representation of this link.

Specified by:
toString in class AbstractContent
Returns:
the story title. useful for debugging.

equals

public boolean equals(Object o)
Tests if the supplied object is equal to this Link.

Overrides:
equals in class AbstractContent
Parameters:
o - The object to test against this Link. Must also be a Link to make sense.
Returns:
true if the two users have the same id.

hashcode

public int hashcode()
the hashcode.

Specified by:
hashcode in class AbstractContent
Returns:
a valid hashcode for this story.


Dave Sag Generica API version 0.5.9 - (prerelease) Copyright 2003 - 2004 Dave Sag.