Elexis API documentation
Version 2.1.6 as of December 11 2011

ch.elexis.core.data
Interface IPersistentObject

All Superinterfaces:
ISelectable
All Known Subinterfaces:
ICreditor, ICustomer, ICustomerRelation, IDebtor, IEncounter, IPartner, IPerson
All Known Implementing Classes:
AccountTransaction, Anwender, Artikel, AUF, BAGMedi, BBSEntry, Bestellung, BezugsKontakt, Bild, Brief, CountryEintrag, DameDokument, DBImage, DBLog, DocHandle, Eigenartikel, Eigendiagnose, Eigenleistung, Encounter, Episode, ESRRecord, Fall, ICD10, IcpcCode, Interaction, Interaction, KantonEintrag, Konsultation, Kontakt, KontaktOrderManagement, LabGroup, LabItem, Labor, Labor2009Tarif, LaborLeistung, LabResult, LandEintrag, Leistung, Leistungsblock, Mandant, MarlovitsFirstname, Medical, Medikament, Medikament, Message, Messung, Messwert, Messwert, MiGelArtikel, Name_GeoNamesEintrag, NamedBlob, NamedBlob2, NameEintrag, Note, Organisation, OutputLog, Patient, PersistentObject, Person, PhysioLeistung, Plz, PlzEintrag, Prescription, Privatnotiz, Rechnung, Rechnungssteller, Reminder, Rezept, RFE, SampleDataType, Script, Sticker, StickyNote, Substance, Substance, TagesNachricht, TarmedLeistung, Termin, Termin.remark, TICode, TransienterKontakt, TransienterPatient, Vaccination, VaccinationType, VerrechenbarAdapter, Verrechnet, Xid, Zahlung

public interface IPersistentObject
extends ISelectable

An IPersistentObject is an abstract representation of an Object with a number of features:

Author:
gerry

Field Summary
static int DELETED
          An object with this ID exists but is marked deleted
static java.lang.String FLD_DATE
          predefined property that holds the date of creation of this object in the form YYYYMMDD
static java.lang.String FLD_DELETED
          predefined property to hande a field that marks the Object as deleted
static java.lang.String FLD_EXTINFO
          predefined property to handle a field that is a compressed HashMap
static java.lang.String FLD_ID
          predefined field name for the GUID
static java.lang.String FLD_LASTUPDATE
          predefined property that holds an automatically updated field containing the last update of this object as long value (milliseconds as in Date())
static int MATCH_AUTO
          Try to find match method.
static int MATCH_CONTAINS
          String must contain test (ignoring case)
static int MATCH_EXACT
          Strings must match exactly (but ignore case)
static int MATCH_REGEXP
          String must match as regular expression
static int MATCH_START
          String must start with test (ignoring case)
static int STATE_EXISTING
          This is an existing object
static int STATE_INEXISTENT
          An object with this ID does not exist
static int STATE_INVALID_ID
          This id is not valid
 
Method Summary
 void addChangeListener(IChangeListener listener, java.lang.String propertyToObserve)
          Add a listener to this object that will be informed, if a given property gets changed.
 void addSticker(ISticker et)
          Add a Sticker to this object
 boolean addXid(java.lang.String domain, java.lang.String domain_id, boolean updateIfExists)
          Assign a Xid to this object.
 boolean exists()
          Check whether an object exists (i.e. lives in the database and is NOT marked as deleted)
 java.lang.String get(java.lang.String field)
          get a named property
 boolean get(java.lang.String[] fields, java.lang.String[] values)
          Mehrere Felder auf einmal auslesen
 java.lang.String getId()
          Return an identifier for this object that is guaranteed to be globally unique.
 int getInt(java.lang.String field)
          read a property that is an Integer
 java.lang.String getLabel()
          return a human readable identifier (not necessarily unique) for this Object
 long getLastUpdate()
          return the time of the last update of this object
 java.util.Map<?,?> getMap(java.lang.String field)
          Read a property that contains a Map
 ISticker getSticker()
          Find the "highest" or the only Sticker of this object
 java.util.List<ISticker> getStickers()
          Return all Stickers attributed to this object
 IXid getXid()
          return the "best" Xid for a given object.
 java.lang.String getXid(java.lang.String domain)
          Return an domain_id of a XID for a specified domain
 java.util.List<IXid> getXids()
          retrieve all Xids of this object
 boolean isAvailable()
          Check wether the object exists in the database.
 boolean isDeleted()
          Deprecated. use state()
 boolean isDragOK()
          check wether this object may dragged and dropped .
 boolean isMatching(IPersistentObject other, int mode, java.lang.String... fields)
          Testet ob zwei Objekte bezüglich definierbarer Felder übereinstimmend sind
 boolean isMatching(java.util.List<Query.Term> terms)
           
 boolean isMatching(java.util.Map<java.lang.String,java.lang.String> fields, int mode, boolean bSkipInexisting)
          Testet ob dieses Objekt den angegebenen Feldern entspricht.
 boolean isMatching(java.lang.String[] fields, int mode, java.lang.String... others)
          testet, ob die angegebenen Felder den angegebenen Werten entsprechen.
 boolean isValid()
          Tell whether this Object is valid (measured by its own implementation dependent means)
 void removeChangeListener(IChangeListener listener, java.lang.String propertyObserved)
          Remove a property change listener.
 void removeSticker(ISticker st)
          Remove a Stickerfrom this object
 boolean set(java.lang.String[] fields, java.lang.String[] values)
          Mehrere Felder auf einmal setzen (Effizienter als einzelnes set)
 boolean set(java.lang.String field, java.lang.String value)
          Store a property
 boolean setInt(java.lang.String field, int value)
          Set a value of type int.
 void setMap(java.lang.String field, java.util.Map<java.lang.Object,java.lang.Object> map)
          store a property that is a map.
 int state()
          Check the state of an object with this ID Note: This method accesses the database and therefore is much more costly than the simple instantaniation of a PersistentObject
 java.lang.String storeToString()
          Serialize this object into a String.
 

Field Detail

FLD_ID

static final java.lang.String FLD_ID
predefined field name for the GUID

See Also:
Constant Field Values

FLD_EXTINFO

static final java.lang.String FLD_EXTINFO
predefined property to handle a field that is a compressed HashMap

See Also:
Constant Field Values

FLD_DELETED

static final java.lang.String FLD_DELETED
predefined property to hande a field that marks the Object as deleted

See Also:
Constant Field Values

FLD_LASTUPDATE

static final java.lang.String FLD_LASTUPDATE
predefined property that holds an automatically updated field containing the last update of this object as long value (milliseconds as in Date())

See Also:
Constant Field Values

FLD_DATE

static final java.lang.String FLD_DATE
predefined property that holds the date of creation of this object in the form YYYYMMDD

See Also:
Constant Field Values

STATE_INEXISTENT

static final int STATE_INEXISTENT
An object with this ID does not exist

See Also:
Constant Field Values

STATE_INVALID_ID

static final int STATE_INVALID_ID
This id is not valid

See Also:
Constant Field Values

DELETED

static final int DELETED
An object with this ID exists but is marked deleted

See Also:
Constant Field Values

STATE_EXISTING

static final int STATE_EXISTING
This is an existing object

See Also:
Constant Field Values

MATCH_EXACT

static final int MATCH_EXACT
Strings must match exactly (but ignore case)

See Also:
Constant Field Values

MATCH_START

static final int MATCH_START
String must start with test (ignoring case)

See Also:
Constant Field Values

MATCH_REGEXP

static final int MATCH_REGEXP
String must match as regular expression

See Also:
Constant Field Values

MATCH_CONTAINS

static final int MATCH_CONTAINS
String must contain test (ignoring case)

See Also:
Constant Field Values

MATCH_AUTO

static final int MATCH_AUTO
Try to find match method.

See Also:
Constant Field Values
Method Detail

getLabel

java.lang.String getLabel()
return a human readable identifier (not necessarily unique) for this Object


isValid

boolean isValid()
Tell whether this Object is valid (measured by its own implementation dependent means)

Returns:
true if this Object is valid (which is not the same as "correct")

getId

java.lang.String getId()
Return an identifier for this object that is guaranteed to be globally unique.

Returns:
the ID.

storeToString

java.lang.String storeToString()
Serialize this object into a String. The String must onbly be valid within the same database i.e. it is not guaranteed, that the creation of an object with this String on a different installation will yield the same object (ar a valid object at all)


state

int state()
Check the state of an object with this ID Note: This method accesses the database and therefore is much more costly than the simple instantaniation of a PersistentObject

Returns:
a value between INEXISTENT and EXISTING

exists

boolean exists()
Check whether an object exists (i.e. lives in the database and is NOT marked as deleted)

Returns:
false if it does not exist at all, OR if it is marked as deleted

isAvailable

boolean isAvailable()
Check wether the object exists in the database. This is the case for all objects in the database for which state() returns neither INVALID_ID nor INEXISTENT. Note: objects marked as deleted will also return true!

Returns:
true, if the object is available in the database, false otherwise. The object might be marked as deleted. Therfore, exists() and isValid() could return false while isAvailable() returns true.

getXid

java.lang.String getXid(java.lang.String domain)
Return an domain_id of a XID for a specified domain

Parameters:
domain -
Returns:
an identifier that might be null

getXid

IXid getXid()
return the "best" Xid for a given object. This is the Xid with the highest quality. If no Xid is given for this object, a newly created Xid of local quality will be returned


getXids

java.util.List<IXid> getXids()
retrieve all Xids of this object

Returns:
a List that might be empty but is never null

addXid

boolean addXid(java.lang.String domain,
               java.lang.String domain_id,
               boolean updateIfExists)
Assign a Xid to this object.

Parameters:
domain - the domain whose ID will be assigned
domain_id - the id out of the given domain fot this object
updateIfExists - if true update values if Xid with same domain and domain_id exists. Otherwise the method will fail if a collision occurs.
Returns:
true on success, false on failure

getSticker

ISticker getSticker()
Find the "highest" or the only Sticker of this object

Returns:
a Sticker or Null of no Sticker was assigned to this object

getStickers

java.util.List<ISticker> getStickers()
Return all Stickers attributed to this object

Returns:
A possibly empty list of Stickers but never null

removeSticker

void removeSticker(ISticker st)
Remove a Stickerfrom this object

Parameters:
st - the Sticker to remove

addSticker

void addSticker(ISticker et)
Add a Sticker to this object

Parameters:
et - the Sticker to add

isDeleted

boolean isDeleted()
Deprecated. use state()

check wether this object is marked as deleted

Returns:
true if this object is present in the database and is marked as deleted

isDragOK

boolean isDragOK()
check wether this object may dragged and dropped .

Returns:
true if d&d is ok for this object

get

java.lang.String get(java.lang.String field)
get a named property

Parameters:
field - name of the Property
Returns:
the value of the property or null if no such property exists

getMap

java.util.Map<?,?> getMap(java.lang.String field)
Read a property that contains a Map

Parameters:
field - Name of the map
Returns:
a map that might be empty but is never null

getInt

int getInt(java.lang.String field)
read a property that is an Integer

Parameters:
field - name of the Property
Returns:
The value of the property. If the property does not exist or can not be expressed as integer: return 0

set

boolean set(java.lang.String field,
            java.lang.String value)
Store a property

Parameters:
field - name of the Property to write
value - value of the property. Any preexistent value will be overwritten.
Returns:
true on success

setMap

void setMap(java.lang.String field,
            java.util.Map<java.lang.Object,java.lang.Object> map)
            throws PersistenceException
store a property that is a map.

Parameters:
field - Name of the map
map - the map to store. The map will be serialized in an implementation dependent way.
Throws:
PersistenceException - on storage failure

setInt

boolean setInt(java.lang.String field,
               int value)
Set a value of type int.

Parameters:
field - a table field of numeric type
value - the value to be set
Returns:
true on success, false else

set

boolean set(java.lang.String[] fields,
            java.lang.String[] values)
Mehrere Felder auf einmal setzen (Effizienter als einzelnes set)

Parameters:
fields - die Feldnamen
values - die Werte
Returns:
false bei Fehler

get

boolean get(java.lang.String[] fields,
            java.lang.String[] values)
Mehrere Felder auf einmal auslesen

Parameters:
fields - die Felder
values - String Array für die gelesenen Werte
Returns:
true ok, values wurden gesetzt

isMatching

boolean isMatching(IPersistentObject other,
                   int mode,
                   java.lang.String... fields)
Testet ob zwei Objekte bezüglich definierbarer Felder übereinstimmend sind

Parameters:
other - anderes Objekt
mode - gleich, LIKE oder Regexp
fields - die interessierenden Felder
Returns:
true wenn this und other vom selben typ sind und alle interessierenden Felder genäss mode übereinstimmen.

isMatching

boolean isMatching(java.lang.String[] fields,
                   int mode,
                   java.lang.String... others)
testet, ob die angegebenen Felder den angegebenen Werten entsprechen.

Parameters:
fields - die zu testenden Felde
mode - Testmodus (MATCH_EXACT, MATCH_LIKE oder MATCH_REGEXP)
others - die Vergleichswerte
Returns:
true bei übereinsteimmung

isMatching

boolean isMatching(java.util.Map<java.lang.String,java.lang.String> fields,
                   int mode,
                   boolean bSkipInexisting)
Testet ob dieses Objekt den angegebenen Feldern entspricht.

Parameters:
fields - HashMap mit name,wert paaren für die Felder
mode - Testmodus (MATCH_EXACT, MATCH_BEGIN, MATCH_REGEXP, MATCH_CONTAIN oder MATCH_AUTO)
bSkipInexisting - don't return false if a fieldname is not found but skip this field instead
Returns:
true wenn dieses Objekt die entsprechenden Felder hat

isMatching

boolean isMatching(java.util.List<Query.Term> terms)

getLastUpdate

long getLastUpdate()
return the time of the last update of this object

Returns:
the time (as given in System.currentTimeMillis()) of the last write operation on this object or 0 if there was no valid lastupdate time

addChangeListener

void addChangeListener(IChangeListener listener,
                       java.lang.String propertyToObserve)
Add a listener to this object that will be informed, if a given property gets changed. This is more efficient than attaching an ElexisEventListener. If more Properties of the same object should be observed, the ElexisEventListener might be more appropriate

Parameters:
listener - The Listener to attach
propertyToObserve - the name of the property to observe

removeChangeListener

void removeChangeListener(IChangeListener listener,
                          java.lang.String propertyObserved)
Remove a property change listener. If no such Listener was registered, nothing happens. If the same listener was attached several times for different properties, only the one with the given property will be removed.

Parameters:
listener - the listener to remove
propertyObserved - the property that was observed by this listener.

Elexis API documentation
Version 2.1.6 as of December 11 2011

Copyright 2005-2011 by Gerry Weirich, Elexis