Elexis API documentation
Version 2.1.6 as of December 11 2011

ch.marlovits.firstnames
Class MarlovitsFirstname

java.lang.Object
  extended by ch.elexis.data.PersistentObject
      extended by ch.marlovits.firstnames.MarlovitsFirstname
All Implemented Interfaces:
IPersistentObject, ISelectable, IGenderService

public class MarlovitsFirstname
extends PersistentObject
implements IGenderService

class for saving data into and getting data from the db table ch_marlovits_firstames. The table contains firstname-gender pairs. The firstnames are all saved lowercase. The gender can be one of 'm' for male, 'w' for female or 'b' 'for both genders possible'.

Author:
Harald Marlovits

Nested Class Summary
 
Nested classes/interfaces inherited from class ch.elexis.data.PersistentObject
PersistentObject.FieldType
 
Field Summary
static int FEMALE
           
static java.lang.String FEMALE_STR
           
static java.lang.String FLD_DELETED
           
static java.lang.String FLD_FIRSTNAME
           
static java.lang.String FLD_ID
           
static java.lang.String FLD_SEX
           
static java.lang.String FLD_TYPE
           
static java.lang.String FLDTYPE_IMPORTED
           
static java.lang.String FLDTYPE_USERRECORD
           
static int GENDERUNDEFINED
           
static java.lang.String GENDERUNDEFINED_STR
           
static int MALE
           
static java.lang.String MALE_STR
           
static java.lang.String MARLOVITS_FIRSTNAME_FEMALE
           
static java.lang.String MARLOVITS_FIRSTNAME_MALE
           
static java.lang.String MARLOVITS_FIRSTNAME_SEXES_STR
           
static int UNISEX
           
static java.lang.String UNISEX_STR
           
static java.lang.String VERSION
           
 
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.util.IGenderService
dbFemaleString, dbMaleString, FIRSTNAME_SEXES_STR
 
Fields inherited from interface ch.elexis.core.data.IPersistentObject
FLD_DATE, FLD_EXTINFO, FLD_LASTUPDATE, STATE_EXISTING, STATE_INEXISTENT, STATE_INVALID_ID
 
Constructor Summary
MarlovitsFirstname()
           
MarlovitsFirstname(java.lang.String id)
          Constructor: creates a new entry in the db, just with the ID. if there is already an entry with this id, then just load this entry
MarlovitsFirstname(java.lang.String firstname, java.lang.String sex)
          The constructor for Firstname.
MarlovitsFirstname(java.lang.String id, java.lang.String firstname, java.lang.String sex, boolean userRecord)
          The constructor for Firstname.
 
Method Summary
static java.lang.Boolean _addFirstname(java.lang.String firstname, java.lang.String sex)
          Adds a first name to the table.
static java.lang.Boolean _addFirstname(java.lang.String firstname, java.lang.String sex, boolean userRecord)
          Adds a first name to the table.
static void _deleteFirstname(java.lang.String firstname, boolean userRecord)
           
static int _getGender(java.lang.String firstname)
          return the gender of the first name for param firstname.
static int _getGender(java.lang.String firstname, boolean userRecord)
          return the gender of the first name for param firstname.
static java.lang.String _getGenderString(java.lang.String firstname)
          Return the gender of the first name for param firstname.
static java.lang.String _getGenderString(java.lang.String firstname, boolean userRecord)
          Return the gender of the first name for param firstname.
 java.lang.Boolean addFirstname(java.lang.String firstname, java.lang.String sex)
          Adds a first name to the table.
 java.lang.Boolean addFirstname(java.lang.String firstname, java.lang.String sex, boolean userRecord)
          Adds a first name to the table.
static void deleteImportedData()
          delete ALL imported data from the table ch_marlovits_firstnames but NOT the modifications/additions added by users.
static void deleteUserData()
          delete ALL user data/modifications data from the table ch_marlovits_firstnames.
static boolean fieldExists(java.lang.String fieldName)
          my way to test if a specific field is already created
 int getCacheTime()
          Return time-to-live in cache for this object
 java.lang.String getFieldData(java.lang.String fieldName)
           
 int getGender(java.lang.String firstName)
          Return the gender of the first name for param firstname.
 int getGender(java.lang.String firstName, boolean userRecord)
          Return the gender of the first name for param firstname. if userRecord is true then we look for the firstname in the user records only.
 java.lang.String getGenderString(java.lang.String firstName)
          Return the gender of the first name for param firstname.
 java.lang.String getGenderString(java.lang.String firstname, boolean userRecord)
          Return the gender of the first name for param firstname. if userRecord is true then we look for the firstname in the user records only.
 java.lang.String getLabel()
          Einen menschenlesbaren Identifikationsstring für dieses Objet liefern
static int getNextImportID()
          Find the starting id to be used for importing new entries for imported entries.
static java.lang.String getTableName2()
          Get the table name from outside the class.
static void initialize()
           
static MarlovitsFirstname load(java.lang.String id)
           
 void setGenderForPatients()
          set/correct gender for all patients - not yet functional
 void setInitializationData(IConfigurationElement config, java.lang.String propertyName, java.lang.Object data)
           
static boolean tableExists()
          my way to test if the table is already created - I don't like the VERSION entries...
static void testThis(boolean asdf)
           
 java.lang.String toString()
           
 
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, 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, wait, wait, wait
 

Field Detail

VERSION

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

FLD_ID

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

FLD_FIRSTNAME

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

FLD_SEX

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

FLD_DELETED

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

FLD_TYPE

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

FLDTYPE_IMPORTED

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

FLDTYPE_USERRECORD

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

MARLOVITS_FIRSTNAME_MALE

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

MARLOVITS_FIRSTNAME_FEMALE

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

MALE

public static final int MALE
See Also:
Constant Field Values

FEMALE

public static final int FEMALE
See Also:
Constant Field Values

UNISEX

public static final int UNISEX
See Also:
Constant Field Values

GENDERUNDEFINED

public static final int GENDERUNDEFINED
See Also:
Constant Field Values

MALE_STR

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

FEMALE_STR

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

UNISEX_STR

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

GENDERUNDEFINED_STR

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

MARLOVITS_FIRSTNAME_SEXES_STR

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

MarlovitsFirstname

public MarlovitsFirstname(java.lang.String firstname,
                          java.lang.String sex)
The constructor for Firstname. This function accepts empty Strings. The names are all saved as lowercase in the table. This creates a user entry.

Parameters:
firstname - : the firstname...
sex - : the gender for this name: w, m, b (both genders) or empty

MarlovitsFirstname

public MarlovitsFirstname(java.lang.String id,
                          java.lang.String firstname,
                          java.lang.String sex,
                          boolean userRecord)
The constructor for Firstname. This function accepts empty Strings. The names are all saved as lowercase in the table

Parameters:
id - the id. must be a valid id and not yet used - your responsibility! Numeric id's will be treated as user entries, alphanumeric entries are treated as imported entries +++++ modify
firstname - the firstname...
sex - the gender for this name: w, m, b (both genders) or empty

MarlovitsFirstname

public MarlovitsFirstname(java.lang.String id)
Constructor: creates a new entry in the db, just with the ID. if there is already an entry with this id, then just load this entry

Parameters:
id - String

MarlovitsFirstname

public MarlovitsFirstname()
Method Detail

tableExists

public static boolean tableExists()
my way to test if the table is already created - I don't like the VERSION entries...

Returns:

fieldExists

public static boolean fieldExists(java.lang.String fieldName)
my way to test if a specific field is already created

Returns:

testThis

public static void testThis(boolean asdf)

_deleteFirstname

public static void _deleteFirstname(java.lang.String firstname,
                                    boolean userRecord)

load

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

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

initialize

public static void initialize()

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 class PersistentObject

getTableName2

public static java.lang.String getTableName2()
Get the table name from outside the class.


getCacheTime

public int getCacheTime()
Description copied from class: PersistentObject
Return time-to-live in cache for this object

Overrides:
getCacheTime in class PersistentObject
Returns:
the time in seconds

getFieldData

public java.lang.String getFieldData(java.lang.String fieldName)

_addFirstname

public static java.lang.Boolean _addFirstname(java.lang.String firstname,
                                              java.lang.String sex,
                                              boolean userRecord)
Adds a first name to the table. Only "m", "w", "b" are allowed, all others are ignored/not added. the names are all saved in lowercase. No duplicates are created. If you add a firstname with a gender in opposite to one that is already saved in the db, then the gender is set to "b" for "both genders".

Parameters:
firstname - first name
sex - gender, String, "m", "w", "b" (both male AND female), all others are not added to the db
userRecord - true if add as user record else add as imported record
---userRecord - true if add to user records (alphanumeric id's), false if add to imported records (numeric id's)
Returns:
true if the name is added or changed, false if not

_addFirstname

public static java.lang.Boolean _addFirstname(java.lang.String firstname,
                                              java.lang.String sex)
Adds a first name to the table. Only "m", "w", "b" are allowed, all others are ignored/not added. the names are all saved in lowercase. No duplicates are created. If you add a firstname with a gender in opposite to one that is already saved in the db, then the gender is set to "b" for "both genders".

Parameters:
firstname - = first name
sex - = gender, String, "m", "w", "b" (both male AND female), all others are not added to the db
Returns:
true if the name is added or changed, false if not

_getGender

public static int _getGender(java.lang.String firstname)
return the gender of the first name for param firstname. First we look for the firstname in the user records. If there are no user records for firstname then we try to find the fitting record inside the imported records.

Parameters:
firstname - = first name
Returns:
int: 1=male, 2=female, 3=both genders, 0=not filled in or not found

_getGender

public static int _getGender(java.lang.String firstname,
                             boolean userRecord)
return the gender of the first name for param firstname. First we look for the firstname in the user records. If there are no user records for firstname then we try to find the fitting record inside the imported records.

Parameters:
firstname - first name
userRecord - boolean, true if we should look for a user record, else we look for an imported record
Returns:
int: 1=male, 2=female, 3=both genders, 0=not filled in or not found

_getGenderString

public static java.lang.String _getGenderString(java.lang.String firstname)
Return the gender of the first name for param firstname. First we look for the firstname in the user records. If there are no user records for firstname then we try to find the fitting record inside the imported records.

Parameters:
firstname - = first name
Returns:
String: "m"=male, "w"=female, "b"=both genders, ""=not filled in or not found

_getGenderString

public static java.lang.String _getGenderString(java.lang.String firstname,
                                                boolean userRecord)
Return the gender of the first name for param firstname. If userRecord is true we look for the firstname in the user records else we look inside the imported records.

Parameters:
firstname - = first name
userRecord - boolean, true if we should look for a user record, else we look for an imported record
Returns:
String: "m"=male, "w"=female, "b"=both genders, ""=not filled in or not found

deleteImportedData

public static void deleteImportedData()
delete ALL imported data from the table ch_marlovits_firstnames but NOT the modifications/additions added by users.


deleteUserData

public static void deleteUserData()
delete ALL user data/modifications data from the table ch_marlovits_firstnames. The imported entries remain in the table.


getNextImportID

public static int getNextImportID()
Find the starting id to be used for importing new entries for imported entries. Imported entries are numeric whereas user entries are alphanumeric. //+++++ this is true for the moment, but this may actually change some time

Returns:
the next free ID

setGenderForPatients

public void setGenderForPatients()
set/correct gender for all patients - not yet functional


setInitializationData

public void setInitializationData(IConfigurationElement config,
                                  java.lang.String propertyName,
                                  java.lang.Object data)
                           throws CoreException
Throws:
CoreException

getGender

public int getGender(java.lang.String firstName)
Description copied from interface: IGenderService
Return the gender of the first name for param firstname. First we look for the firstname in the user records. If there are no user records for firstname then we try to find the fitting record inside the imported records.

Specified by:
getGender in interface IGenderService
Returns:
int: 1=male, 2=female, 3=both genders, 0=not filled in or not found

getGender

public int getGender(java.lang.String firstName,
                     boolean userRecord)
Description copied from interface: IGenderService
Return the gender of the first name for param firstname. if userRecord is true then we look for the firstname in the user records only. If userRecord is false, then we try to find the fitting record inside the imported records.

Specified by:
getGender in interface IGenderService
Parameters:
firstName - first name
userRecord - boolean, true if we should look for a user record, else we look for an imported record
Returns:
int: 1=male, 2=female, 3=both genders, 0=not filled in or not found

getGenderString

public java.lang.String getGenderString(java.lang.String firstName)
Description copied from interface: IGenderService
Return the gender of the first name for param firstname. First we look for the firstname in the user records. If there are no user records for firstname then we try to find the fitting record inside the imported records.

Specified by:
getGenderString in interface IGenderService
Returns:
String: "m"=male, "w"=female, "b"=both genders, ""=not filled in or not found

addFirstname

public java.lang.Boolean addFirstname(java.lang.String firstname,
                                      java.lang.String sex,
                                      boolean userRecord)
Description copied from interface: IGenderService
Adds a first name to the table. Only "m", "w", "b" are allowed, all others are ignored/not added. the names are all saved in lowercase. No duplicates are created. If you add a firstname with a gender in opposite to one that is already saved in the db, then the gender is set to "b" for "both genders".

Specified by:
addFirstname in interface IGenderService
Parameters:
firstname - first name
sex - gender, String, "m", "w", "b" (both male AND female), all others are not added to the db
userRecord - true if add to user records (alphanumeric id's), false if add to imported records (numeric id's)
Returns:
true if the name is added or changed, false if not

addFirstname

public java.lang.Boolean addFirstname(java.lang.String firstname,
                                      java.lang.String sex)
Description copied from interface: IGenderService
Adds a first name to the table. Only "m", "w", "b" are allowed, all others are ignored/not added. the names are all saved in lowercase. No duplicates are created. If you add a firstname with a gender in opposite to one that is already saved in the db, then the gender is set to "b" for "both genders".

Specified by:
addFirstname in interface IGenderService
Parameters:
firstname - = first name
sex - = gender, String, "m", "w", "b" (both male AND female), all others are not added to the db
Returns:
true if the name is added or changed, false if not

getGenderString

public java.lang.String getGenderString(java.lang.String firstname,
                                        boolean userRecord)
Description copied from interface: IGenderService
Return the gender of the first name for param firstname. if userRecord is true then we look for the firstname in the user records only. If userRecord is false, then we try to find the fitting record inside the imported records.

Specified by:
getGenderString in interface IGenderService
Parameters:
firstname - = first name
userRecord - boolean, true if we should look for a user record, else we look for an imported record
Returns:
String: "m"=male, "w"=female, "b"=both genders, ""=not filled in or not found

Elexis API documentation
Version 2.1.6 as of December 11 2011

Copyright 2005-2011 by Gerry Weirich, Elexis