asgaard.skid
Class BeanLink

java.lang.Object
  |
  +--asgaard.skid.BeanLink
Direct Known Subclasses:
BeanLinkFilter

public class BeanLink
extends java.lang.Object
implements java.io.Serializable

This class models one Relationship between one ore two Beans. It is able to maintain it and carrys all nessecary keys. Additionally it can be used to iterate throug the Bean-Ontology.

See Also:
Serialized Form

Field Summary
protected  long Age
           
protected  long Begin
           
protected  int By
           
protected  long Created
           
protected  long End
           
protected  int From
           
protected  long Modified
           
protected  int Order
           
protected  int State
           
protected  int To
           
static byte update_policy
          Update Policy for saving modifications.
 
Constructor Summary
BeanLink()
          Creates an empty new Link-object.
BeanLink(int from, int order, int to, int by, long create, long mod, long begin, long end, int state)
          Creates a new Link-object.
BeanLink(int from, int to, int by, long begin, long end, int state)
          Creates a new Link-object.
BeanLink(RemoteBean from, RemoteBean to, RemoteBean by, long begin, long end, int state)
          Creates a new Link-object.
 
Method Summary
 void flush()
          Does all the saving.
 RemoteBean getBy()
          Returns the Relation-Bean.
 BeanLinkFilter getFilter()
          Returns a Filter-Object corresponding to this Key.
 RemoteBean getFrom()
          Returns the From-Bean in this Relation.
 java.lang.String getKey()
          Returns the primary Key of the Relation.
static java.lang.String getKey(int from, int to, int by)
          Returns a primary Key of the Relation with the given keys.
 RemoteBean getTo()
          Returns the To-Bean in this Relation.
 boolean isChanged()
          Has the Relation been modified?
 void modify()
          Mark the Relation as modified.
 void setAge()
          Set's the Age to the current (modified) timestamp
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

update_policy

public static byte update_policy
Update Policy for saving modifications.
See Also:
asgaard.skid.SkidBean.checkModification

From

protected int From

Order

protected int Order

To

protected int To

By

protected int By

Created

protected long Created

Modified

protected long Modified

Age

protected long Age

Begin

protected long Begin

End

protected long End

State

protected int State
Constructor Detail

BeanLink

public BeanLink()
Creates an empty new Link-object.

BeanLink

public BeanLink(int from,
                int to,
                int by,
                long begin,
                long end,
                int state)
Creates a new Link-object.
Parameters:
from - key of the origin Bean
to - key of the target Bean
by - key of the link-Bean (kind of Link)
begin - timestamp of the start of the relationship
end - timestamp of the end of the relationship
state - access-rights to the target Bean about this relationship

BeanLink

public BeanLink(RemoteBean from,
                RemoteBean to,
                RemoteBean by,
                long begin,
                long end,
                int state)
         throws java.lang.Exception
Creates a new Link-object.
Parameters:
from - key of the origin Bean
to - key of the target Bean
by - key of the link-Bean (kind of Link)
begin - timestamp of the start of the relationship
end - timestamp of the end of the relationship
state - access-rights to the target Bean about this relationship
Throws:
java.lang.Exception - if an Bean is not valid.

BeanLink

public BeanLink(int from,
                int order,
                int to,
                int by,
                long create,
                long mod,
                long begin,
                long end,
                int state)
Creates a new Link-object.
Parameters:
from - key of the origin Bean
order - a local order by an ontology to from
to - key of the target Bean
by - key of the link-Bean (kind of Link)
created - timestamp when the link was created
mod - timestamp when the key was last modified
begin - timestamp of the start of the relationship
end - timestamp of the end of the relationship
state - access-rights to the target Bean about this relationship
Method Detail

isChanged

public boolean isChanged()
Has the Relation been modified?

modify

public void modify()
Mark the Relation as modified.

setAge

public void setAge()
Set's the Age to the current (modified) timestamp

flush

public void flush()
           throws java.lang.Exception
Does all the saving.
Throws:
java.lang.Exception - if the save failed.

getFrom

public RemoteBean getFrom()
Returns the From-Bean in this Relation.
Returns:
the bean if there is any

getTo

public RemoteBean getTo()
Returns the To-Bean in this Relation.
Returns:
the bean if there is any

getBy

public RemoteBean getBy()
Returns the Relation-Bean.
Returns:
the bean if there is any

getKey

public java.lang.String getKey()
Returns the primary Key of the Relation.
Returns:
a String with the tripple "from.to.by"

getKey

public static java.lang.String getKey(int from,
                                      int to,
                                      int by)
Returns a primary Key of the Relation with the given keys.
Parameters:
from - key of the origin Bean
to - key of the target Bean
by - key of the link-Bean (kind of Link)
Returns:
a String with the tripple "from.to.by"

getFilter

public BeanLinkFilter getFilter()
Returns a Filter-Object corresponding to this Key.
Returns:
the filterobject