Elexis API documentation
Version 2.1.6 as of December 11 2011

ch.elexis.data
Class Xid

java.lang.Object
  extended by ch.elexis.data.PersistentObject
      extended by ch.elexis.data.Xid
All Implemented Interfaces:
IPersistentObject, ISelectable, IXid

public class Xid
extends PersistentObject
implements IXid

A XID is an external identifier, that is an ID from en external identifyer system. Examples are entities such as Social Security Number, Passport Number, OID, and others. XID's are not limites to Persons but can be attributed to all kinds of entities. They are usable like OID's but are more general and can integrate other systems. A XID consists of a domain that denotes the identifying system and an ID within this domain. The Domain name is globally unique, while the ID can be globally unique, but might also be unique within its domain only. To differentiate between such "qualities" there is a flag that indicates, that a XID is in fact a GUID. There is also a flag to indicate the range within a xid is valid (e.g. a social security number ist only an identifier within the country where it was created) The Flag ASSIGNMENT_LOCAL means that this XID is used only between different instances of this program, ASSIGNMENT_REGIONAL means a XID used within a country while ASSIGNMENT_GLOBAL a globally used identifier is (e.g. an EAN or an OID) To simplify working with XIDs for the user, a XID Domain can also have a short "nickname" that is valid and unique within the running instance of the program only and that is mapped to a full xid-domain. The Domain "www.xid.ch/id/ean" can be called "EAN". The two namings ar exchangeable within the defining instance, but a XID that leaves this instance of the program must always be named with its full name.

Author:
Gerry

Nested Class Summary
static class Xid.XIDDomain
           
static class Xid.XIDException
           
 
Nested classes/interfaces inherited from class ch.elexis.data.PersistentObject
PersistentObject.FieldType
 
Field Summary
static int ASSIGNMENT_GLOBAL
          Quality value for an ID that can be used as global identifier
static int ASSIGNMENT_LOCAL
          Quality value for an ID that is valid only in the context of the issuing program
static int ASSIGNMENT_REGIONAL
          Quality value for an ID that is valid within a geographic or politic context (e.g. a nationally assigned ID)
static java.lang.String DOMAIN_AHV
           
static java.lang.String DOMAIN_AUSTRIAN_PASSPORT
           
static java.lang.String DOMAIN_EAN
           
static java.lang.String DOMAIN_ELEXIS
           
static java.lang.String DOMAIN_GERMAN_PASSPORT
           
static java.lang.String DOMAIN_OID
           
static java.lang.String DOMAIN_SWISS_PASSPORT
           
static java.lang.String FLD_DOMAIN
           
static java.lang.String FLD_DOMAIN_ID
           
static java.lang.String FLD_OBJECT
           
static java.lang.String ID_IN_DOMAIN
           
static java.lang.String QUALITY
           
static int QUALITY_GUID
          Marker that the ID is a GUID (that is, guaranteed to exist only once through time and space)
static java.lang.String TYPE
           
 
Fields inherited from class ch.elexis.data.PersistentObject
CACHE_DEFAULT_LIFETIME, CACHE_MIN_LIFETIME, CFG_CONNECTSTRING, CFG_DRIVER, CFG_PWD, CFG_TYPE, CFG_USER, DELETED, EXISTS, INEXISTENT, INVALID_ID, MATCH_AUTO, MATCH_CONTAINS, MATCH_EXACT, MATCH_REGEXP, MATCH_START
 
Fields inherited from interface ch.elexis.core.data.IPersistentObject
FLD_DATE, FLD_DELETED, FLD_EXTINFO, FLD_ID, FLD_LASTUPDATE, STATE_EXISTING, STATE_INEXISTENT, STATE_INVALID_ID
 
Constructor Summary
Xid(PersistentObject o, java.lang.String domain, java.lang.String domain_id)
          create a new XID.
 
Method Summary
static PersistentObject findObject(java.lang.String domain, java.lang.String id)
          Find a PersistentObject from a domain and a domain_id
static Xid findXID(PersistentObject o, java.lang.String domain)
          Find the Xid of a given domain for the given Object
static Xid findXID(java.lang.String domain, java.lang.String id)
          Find a XID from a domain and a domain_id
 java.lang.String getDomain()
          get the Domain this Xid is from
static Xid.XIDDomain getDomain(java.lang.String name)
           
 java.lang.String getDomainId()
          get the id of this Xid in its domain
 java.lang.String getLabel()
          Einen menschenlesbaren Identifikationsstring für dieses Objet liefern
 PersistentObject getObject()
          Get the object that is identified with this XID
 int getQuality()
          Get the quality of this xid
static java.lang.String getSimpleNameForXIDDomain(java.lang.String domain)
           
static java.lang.Integer getXIDDomainQuality(java.lang.String xidDomain)
          Get the ID quality of an Object of a given domain
static java.util.Set<java.lang.String> getXIDDomains()
          return a list of all known domains
 boolean isGUID()
          Tell whether this XID is a GUID
static Xid load(java.lang.String id)
           
static boolean localRegisterXIDDomain(java.lang.String domain, java.lang.String simpleName, int quality)
          Register a new domain for use with our XID System locally (this will not affect the central XID registry at www.xid.ch)
static boolean localRegisterXIDDomainIfNotExists(java.lang.String domain, java.lang.String simpleName, int quality)
          Register a local xid domain if it does not exist.
 
Methods inherited from class ch.elexis.data.PersistentObject
addChangeListener, addSticker, addToList, addXid, begin, checkNull, checkZero, checkZeroDouble, clearCache, connect, connect, delete, deleteList, disconnect, equals, executeSQLScript, exists, exportData, fireChangeEvent, flatten, fold, get, get, getCacheTime, getConnection, getDefaultCacheLifetime, getFieldType, getId, getInt, getLastUpdate, getList, getList, getMap, getSticker, getStickers, getWrappedId, getXid, getXid, getXids, hashCode, isAvailable, isDeleted, isDragOK, isMatching, isMatching, isMatching, isMatching, isShowDeleted, isValid, lock, map, relock, removeChangeListener, removeFromList, removeFromList, removeSticker, resetCache, set, set, setDefaultCacheLifetime, setInt, setMap, setShowDeleted, setTrace, state, storeToString, tableExists, ts, undelete, unlock
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface ch.elexis.core.data.IXid
getId
 

Field Detail

QUALITY

public static final java.lang.String QUALITY
See Also:
Constant Field Values

ID_IN_DOMAIN

public static final java.lang.String ID_IN_DOMAIN
See Also:
Constant Field Values

TYPE

public static final java.lang.String TYPE
See Also:
Constant Field Values

ASSIGNMENT_LOCAL

public static final int ASSIGNMENT_LOCAL
Quality value for an ID that is valid only in the context of the issuing program

See Also:
Constant Field Values

ASSIGNMENT_REGIONAL

public static final int ASSIGNMENT_REGIONAL
Quality value for an ID that is valid within a geographic or politic context (e.g. a nationally assigned ID)

See Also:
Constant Field Values

ASSIGNMENT_GLOBAL

public static final int ASSIGNMENT_GLOBAL
Quality value for an ID that can be used as global identifier

See Also:
Constant Field Values

QUALITY_GUID

public static final int QUALITY_GUID
Marker that the ID is a GUID (that is, guaranteed to exist only once through time and space)

See Also:
Constant Field Values

DOMAIN_ELEXIS

public static final java.lang.String DOMAIN_ELEXIS
See Also:
Constant Field Values

DOMAIN_AHV

public static final java.lang.String DOMAIN_AHV
See Also:
Constant Field Values

DOMAIN_SWISS_PASSPORT

public static final java.lang.String DOMAIN_SWISS_PASSPORT
See Also:
Constant Field Values

DOMAIN_AUSTRIAN_PASSPORT

public static final java.lang.String DOMAIN_AUSTRIAN_PASSPORT
See Also:
Constant Field Values

DOMAIN_GERMAN_PASSPORT

public static final java.lang.String DOMAIN_GERMAN_PASSPORT
See Also:
Constant Field Values

DOMAIN_EAN

public static final java.lang.String DOMAIN_EAN
See Also:
Constant Field Values

DOMAIN_OID

public static final java.lang.String DOMAIN_OID
See Also:
Constant Field Values

FLD_OBJECT

public static final java.lang.String FLD_OBJECT
See Also:
Constant Field Values

FLD_DOMAIN_ID

public static final java.lang.String FLD_DOMAIN_ID
See Also:
Constant Field Values

FLD_DOMAIN

public static final java.lang.String FLD_DOMAIN
See Also:
Constant Field Values
Constructor Detail

Xid

public Xid(PersistentObject o,
           java.lang.String domain,
           java.lang.String domain_id)
    throws Xid.XIDException
create a new XID. Does nothing if identical XID already exists.

Parameters:
o - the object to identify with the new XID
domain - the domain from wich the identifier is (e.g. DOMAIN_COVERCARD). Must be a registered domain
domain_id - the id from that domain that identifies the object
quality - the quality of this identifier
Throws:
Xid.XIDException - if a XID with same domain and domain_id but different object or quality already exists. if the domain was not rgeistered
Method Detail

getQuality

public int getQuality()
Get the quality of this xid

Specified by:
getQuality in interface IXid
Returns:
the quality

isGUID

public boolean isGUID()
Tell whether this XID is a GUID

Specified by:
isGUID in interface IXid
Returns:
true if so.

getDomain

public java.lang.String getDomain()
get the Domain this Xid is from

Specified by:
getDomain in interface IXid
Returns:

getDomainId

public java.lang.String getDomainId()
get the id of this Xid in its domain

Specified by:
getDomainId in interface IXid
Returns:

getObject

public PersistentObject getObject()
Get the object that is identified with this XID

Specified by:
getObject in interface IXid
Returns:
the object or null if it could not be restored.

getLabel

public java.lang.String getLabel()
Description copied from class: PersistentObject
Einen menschenlesbaren Identifikationsstring für dieses Objet liefern

Specified by:
getLabel in interface IPersistentObject
Specified by:
getLabel in interface IXid
Specified by:
getLabel in class PersistentObject

load

public static Xid load(java.lang.String id)

findXID

public static Xid findXID(java.lang.String domain,
                          java.lang.String id)
Find a XID from a domain and a domain_id

Parameters:
domain - the domain to search an id from, Can be full name or local short name of the domain
id - the id out of domain to retrieve
Returns:
the xid holding that id from that domain or null if no such xid was found

findObject

public static PersistentObject findObject(java.lang.String domain,
                                          java.lang.String id)
Find a PersistentObject from a domain and a domain_id

Parameters:
domain - the domain to search an id from (e.g. www.ahv.ch)
id - the id out of domain to retrieve
Returns:
the PersistentObject identified by that id from that domain or null if no such Object was found

findXID

public static Xid findXID(PersistentObject o,
                          java.lang.String domain)
Find the Xid of a given domain for the given Object

Parameters:
o - the object whose Xid should be find
domain - the domain the Xid should be from
Returns:
the Xid or null if no xid for the given domain was found on the given object

localRegisterXIDDomain

public static boolean localRegisterXIDDomain(java.lang.String domain,
                                             java.lang.String simpleName,
                                             int quality)
Register a new domain for use with our XID System locally (this will not affect the central XID registry at www.xid.ch)

Parameters:
domain - the domain to register
quality - the quality an ID of that domain will have
Returns:
true on success, false if that domain could not be registered

localRegisterXIDDomainIfNotExists

public static boolean localRegisterXIDDomainIfNotExists(java.lang.String domain,
                                                        java.lang.String simpleName,
                                                        int quality)
Register a local xid domain if it does not exist. Does nothing if a domain with the given domain name exists already

Parameters:
domain - name of the domain
simpleName - short name for the domain
quality - the wuality of an ID of that domain will have
Returns:
true on success

getXIDDomainQuality

public static java.lang.Integer getXIDDomainQuality(java.lang.String xidDomain)
Get the ID quality of an Object of a given domain

Parameters:
xidDomain - the domain to query
Returns:
obne of the Quality-ID constants or null if no such domain ist registered

getSimpleNameForXIDDomain

public static java.lang.String getSimpleNameForXIDDomain(java.lang.String domain)

getDomain

public static Xid.XIDDomain getDomain(java.lang.String name)

getXIDDomains

public static java.util.Set<java.lang.String> getXIDDomains()
return a list of all known domains

Returns:

Elexis API documentation
Version 2.1.6 as of December 11 2011

Copyright 2005-2011 by Gerry Weirich, Elexis