|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--asgaard.skid.SkidBean
Implementation of an Data-Bean.
Important: Once in use, a Class HAS NOT TO BE CHANGED ANY MORE! If a class is changes after use, there will be a serialisation-error getting the bean out of the database.
Important: Key values which are accessible via the
RemoteBroker
have to be defined following the
Java-Beans-Convention using the getXXXX
methods for key-generation.
Important: public static RemoteBroker THIS
has to be defined
within each VM to guarantie regular behavior within Skid!
Remark: All attribues used by the Object which
are not intended to be persitent have to be declared transient
and restored by default or the parameterless constructor. Within implementing
new setXXXX
methods call the modify()
method to set
the new timestamps.
Minimal Usage: (The RemoteBroker should be instanciated at this time)
SkidBean b = new SkidBean();
b.setName()
(optional)
b.flush();
Remark: A System-Object cannot be modified and carries the created-Timestamp 0
RemoteBroker
, Serialized FormField Summary | |
protected static RemoteBroker |
broker
Link to the RemoteBroker (one per VM). |
protected static boolean |
debug
|
static int |
history_policy
The History - Policy for saving UNDO-information. |
static java.lang.String |
LAST_METHOD
Last method of the Interface - Implementation |
Constructor Summary | |
SkidBean()
Instanciates a Bean and does all the initialisation work for transient attributes. |
Method Summary | |
void |
addEvent(RemoteBean event)
Adding an Event and replicating it to all suscribed Objects. |
java.lang.Object |
cloneBean()
Clones the Object and does all the settings neccesary to be assigned as a new SkidBean. |
void |
flush()
Save all modifications (if any) and checks if the update is possible (timestamp of the RemoteBroker). |
long |
getAge()
Timestamp "Age" of the Bean (= current version by the Modified-Timestamp). |
byte |
getBeanType()
Returns the type of the Bean, used for the loading-signature. |
RemoteBroker |
getBroker()
Get Link to the RemoteBroker (one per VM). |
java.lang.String[] |
getChangeHistory()
Produces a discription of the last changes which can be undone. |
int |
getClassKey()
Returns the type of the Bean's class, used for the loading-signature. |
long |
getCreated()
Timestamp "Created" of the Bean. |
SkidEvent[] |
getEvent(long newer)
Returns the Events for this bean which are newer than the given time |
SkidBeanFilter |
getFilter()
Returns a Filter for this (and all parent) class. |
java.lang.String |
getIdentifier()
Get the Identifier of the Bean which shall be unique worldwide for different Objects (like different Plans with luckily the same Name) and common for identical Objects (like a Person reentered), do not use manually. |
int |
getKey()
(Unique) Primary Key of the Bean. |
BeanLink[] |
getLink(BeanLinkFilter filter)
Returns a set of Links defined by an filterobject. |
java.lang.reflect.Method[] |
getMethods()
Returns an array containing Method objects reflecting all the public member methods of the class or interface represented by this Class object, including those declared by the class or interface and and those inherited from superclasses and superinterfaces. |
long |
getModified()
Timestamp "Modified" of the Bean. |
java.lang.String |
getName()
Returns the name of the Bean which shold be human readable and may be unique in some cases, but this is not strictly required. |
java.lang.Object |
getObject()
Returns the wrapped Object, in this case it's the SkidBean itselfe. |
byte |
getUpdatePolicy()
Get's the update policy defined by the UPDATE_* constants. |
boolean |
init(int pKey,
int cKey,
RemoteBroker broker)
All Keys of the Bean which are established at the first insert to the RemoteBroker, do not use manually. |
java.lang.Object |
invoke(java.lang.String name,
java.lang.Object[] args,
boolean modify)
Invokes the underlying method represented by this Method object, on the specified object with the specified parameters. |
boolean |
isChanged()
Has the Bean been changed? |
boolean |
isNew()
Ist das Bean neu? |
boolean |
isReadOnly()
Ist the Bean read only? |
protected void |
modify(java.lang.Object oldValue,
java.lang.String fieldName)
Set the modified flag and savin the old Value for the undo-mechanism (if the history_policy allowes this). |
boolean |
putLink(BeanLink link)
Adds a Relaition between Beans |
void |
setAge()
Sets the Age to the Modified timestamp, therefor IsChanged = false, do not use manually! |
void |
setObject(java.lang.Object contain)
Sets (replaces if any before) the given objects. |
void |
suscribeEvent(RemoteBean producer,
RemoteBean event)
Adding an Event-Pattern and suscribing this type of event. |
boolean |
undo(int steps)
Undo the last steps changes (0 = all,
-1 no undo but ask if any undos possible) HAS TO BE THE
LAST METHOD OF A REMOTEBEAN ROOT-IMPLEMENTATION.
|
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
public static final java.lang.String LAST_METHOD
protected static transient RemoteBroker broker
public static int history_policy
HISTORY_ALL, HISTORY_NONE
and any number >
0
defining the depth of the history.asgaard.skid.RemoteBean.HISTORY_ALL
,
asgaard.skid.RemoteBean.HISTORY_NONE
,
modify
,
undo
protected static final transient boolean debug
Constructor Detail |
public SkidBean()
Method Detail |
public RemoteBroker getBroker()
public byte getUpdatePolicy()
UPDATE_*
constants.asgaard.skid.RemoteBean.UPDATE_STRONG
public java.lang.String getIdentifier()
asgaard.skid.SkidBean.enforceUniqueness
,
asgaard.skid.SkidBean.getName
public java.lang.String getName()
public int getKey() throws SkidException
public int getClassKey() throws SkidException
public byte getBeanType()
public long getCreated() throws SkidException
System#currentTimeMillis
public long getModified() throws SkidException
System#currentTimeMillis
public long getAge() throws SkidException
System#currentTimeMillis
public void setAge()
asgaard.skid.RemoteBroker#put
public BeanLink[] getLink(BeanLinkFilter filter) throws java.lang.Exception
null
) all Links of this Bean are searched.filter
- the filterobjectBeanLinkFilter
public boolean putLink(BeanLink link) throws java.lang.Exception
link
- one relationpublic void addEvent(RemoteBean event)
event
- the kond of the event (not null
)public void suscribeEvent(RemoteBean producer, RemoteBean event)
producer
- of the event (not null
)event
- the kond of the event (not null
)public SkidEvent[] getEvent(long newer)
newer
- than the given timepublic boolean init(int pKey, int cKey, RemoteBroker broker)
insertBean
pKey
- the generated unique primary keycKey
- the key of the classbroker
- defines the owning brokerasgaard.skid.RemoteBroker.insertBean
protected void modify(java.lang.Object oldValue, java.lang.String fieldName)
history_policy
or use null, null
as parameter
values.oldVlaue
- the old value (if any)fieldName
- the name of the field which was changed (see
getClass.getDeclaredField()
)public boolean isChanged()
public boolean isNew()
public boolean isReadOnly()
public void setObject(java.lang.Object contain) throws SkidException
contain
- the wrapped objectpublic java.lang.Object getObject()
public SkidBeanFilter getFilter()
public java.lang.reflect.Method[] getMethods() throws java.lang.SecurityException
public java.lang.Object invoke(java.lang.String name, java.lang.Object[] args, boolean modify) throws java.lang.IllegalAccessException, java.lang.IllegalArgumentException, java.lang.reflect.InvocationTargetException, java.lang.NullPointerException, java.lang.NoSuchMethodException
name
- the name of the Methodargs
- the Argumentsmodify
- call the modify-method too? (not including undo)Method.invoke(java.lang.Object, java.lang.Object[])
public void flush() throws java.lang.Exception
public java.lang.Object cloneBean() throws java.lang.CloneNotSupportedException
RemoteBean.flush()
,
asgaard.skid.RemoteBroker#put
public java.lang.String[] getChangeHistory()
public boolean undo(int steps)
steps
changes (0
= all,
-1
no undo but ask if any undos possible) HAS TO BE THE
LAST METHOD OF A REMOTEBEAN ROOT-IMPLEMENTATION.
The call of the flush()
methods resets the UNDO-mechanism and
clear all relied information.
Remark: Undo only works if the modify()
method was
called by the setXXXX
method before change.
steps
- cont of changes to undoasgaard.skid.RemoteBean.HISTORY_ALL
,
asgaard.skid.RemoteBean.HISTORY_NONE
,
modify
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |