public class ContactItemObjectHandler extends java.lang.Object implements ObjectItemAdapterInterface
Notes:
In a wide range we're using ORM which has (currently) some problems to handle
firebird BLOBs. So some proprietary methods are coded here to store/receive
BLOBs
ContactItems are stored by convention as an object in the table USR_CONTACT
but they can be stored/exported/imported as XML files, vCards or local
streams also.
Constructor and Description |
---|
ContactItemObjectHandler() |
ContactItemObjectHandler(javax.persistence.EntityManager em,
boolean isJTA) |
ContactItemObjectHandler(SEHRDataSource ds) |
Modifier and Type | Method and Description |
---|---|
boolean |
addXMLContactElement(ContactItem item,
org.jdom.Document xmldoc)
Add the item as formatted XML element to given XML document object
|
void |
close()
Used to close (terminate) the object in the current context
|
ContactItem |
convertAdrMain(org.ifeth.sehr.intrasec.entities.AdrMain entity) |
boolean |
createVCard(ContactItem item,
java.io.OutputStream out)
Creates a VCARD from given ContactItem object to given output stream.
|
void |
createVCard(java.io.OutputStream out)
Creates a VCARD from current ContactItem object to given output stream.
|
void |
delete()
Used to delete the current object
|
void |
display()
Used to display the content
|
boolean |
forward(java.lang.Object receiver)
In this context to send a
ContactItem as VCard by mail |
ContactItem |
getItem()
Get the currently handled item based on the db record object.
|
java.util.List<org.ifeth.sehr.intrasec.entities.AdrMain> |
listContactsByUsrID(int usrid)
This method returns a list of UsrContact entities assigned to a given user
(a patient, an administrator or resposible person of a module).
|
boolean |
loadfrom(int type,
java.lang.Object obj,
java.lang.Object source)
Used to import an object to an from input stream
|
void |
move(java.lang.Object from,
java.lang.Object to)
Move content of object to another parent or leaf.
|
void |
print()
Print content of object...
|
void |
read(int itemid)
Used to read/load the object of given unique itemid from a storage
|
ContactItem |
readContactItemByAdrID(int adrid) |
void |
reply(boolean object)
Reply a received object or send receive notification.
|
boolean |
save()
Used to save the object using the context of the model how to save...
|
boolean |
save(ContactItem contact)
Save / Create given ContactItem as DB record at USR_CONTACT.
|
boolean |
saveas(int type,
java.lang.Object obj1,
java.lang.Object out)
Save given contact item object as type to given output stream.
|
void |
send(java.lang.Object receiver)
Send current object to given receiver.
|
void |
setItem(ContactItem item)
This setter is also a helper method for handling ContactItem objects as
entity objects of the ORM/DAO.
|
void |
setSEHRConfiguration(SEHRConfiguration cfg) |
boolean |
update()
Internal method to update current item object.
|
boolean |
update(ContactItem item)
Update given ContactItem.
|
public ContactItemObjectHandler()
public ContactItemObjectHandler(SEHRDataSource ds)
public ContactItemObjectHandler(javax.persistence.EntityManager em, boolean isJTA)
public boolean createVCard(ContactItem item, java.io.OutputStream out)
No DB connection required.
item
- out
- public void createVCard(java.io.OutputStream out) throws ObjectHandlerException
out
- ObjectHandlerException
public java.util.List<org.ifeth.sehr.intrasec.entities.AdrMain> listContactsByUsrID(int usrid)
The BLOB with the contact item is not read to improve the performance.
After selection use readContactItemByAdrID(int)
to get item object
for editing or handling.
N.B.: A DB connection is required. Use a suitable constructor.
usrid
- or '-1' list all recordspublic ContactItem convertAdrMain(org.ifeth.sehr.intrasec.entities.AdrMain entity)
public ContactItem readContactItemByAdrID(int adrid)
public boolean save(ContactItem contact)
Note: This method modifies the item by storing the ID of the database inside the object before it writes the object to the DB as BLOB
contact
- public boolean update(ContactItem item)
Remember that on updates the ContactItem object is identified by the EntryID.
item
- public boolean update()
update
in interface ObjectItemAdapterInterface
public ContactItem getItem()
public void setItem(ContactItem item)
This method sets the fields of the USR_CONTACT entity of the given ContactItem object.
item
- public boolean addXMLContactElement(ContactItem item, org.jdom.Document xmldoc)
item
- output stream to be writed to (the user profile)xmldoc
- Ref. SEHRContatctItem specification and DTD for structurepublic boolean save()
ObjectItemAdapterInterface
save
in interface ObjectItemAdapterInterface
public boolean saveas(int type, java.lang.Object obj1, java.lang.Object out)
saveas
in interface ObjectItemAdapterInterface
type
- e.g. XMLobj1
- e.g. ContactItemout
- e.g. File, String or JDOM Documentpublic void print()
ObjectItemAdapterInterface
print
in interface ObjectItemAdapterInterface
public void send(java.lang.Object receiver)
ObjectItemAdapterInterface
Receiver may be a single String, a StringArray or List
send
in interface ObjectItemAdapterInterface
public void move(java.lang.Object from, java.lang.Object to)
ObjectItemAdapterInterface
move
in interface ObjectItemAdapterInterface
public boolean forward(java.lang.Object receiver)
ContactItem
as VCard by mailforward
in interface ObjectItemAdapterInterface
public void reply(boolean object)
ObjectItemAdapterInterface
The address to reply to will be exctracted from the object header. A reply will be send to the originator or sender of the object only due to security aspects.
reply
in interface ObjectItemAdapterInterface
object
- - If 'true' reply object; otherwise a note onlypublic void read(int itemid)
ObjectItemAdapterInterface
read
in interface ObjectItemAdapterInterface
itemid
- Use the unique id for each item to load itpublic void close()
ObjectItemAdapterInterface
close
in interface ObjectItemAdapterInterface
public void delete()
ObjectItemAdapterInterface
delete
in interface ObjectItemAdapterInterface
public void display()
ObjectItemAdapterInterface
display
in interface ObjectItemAdapterInterface
public boolean loadfrom(int type, java.lang.Object obj, java.lang.Object source)
ObjectItemAdapterInterface
loadfrom
in interface ObjectItemAdapterInterface
type
- to use a specific converterobj
- the object to store data in, e.g. ContactItemsource
- the source as an input stream objectpublic void setSEHRConfiguration(SEHRConfiguration cfg)