org.opengroupware.jogi.connect.xmlrpc
Class XmlRpcPerson

java.lang.Object
  extended byjava.util.Observable
      extended byorg.opengroupware.jogi.connect.xmlrpc.XmlRpcBaseDocument
          extended byorg.opengroupware.jogi.connect.xmlrpc.XmlRpcPerson
All Implemented Interfaces:
java.util.Observer, Person

public class XmlRpcPerson
extends XmlRpcBaseDocument
implements java.util.Observer, Person

This class provides the implementation for an Person.

Author:
Andreas Rath (teddius)

Field Summary
protected  XmlRpcCaller caller_
           
protected  OpenGroupWare ogo
           
static java.lang.String PERSON_ADDRESSES
           
static java.lang.String PERSON_BIRTHDAY
           
static java.lang.String PERSON_COMMENT
           
static java.lang.String PERSON_CONTACT
           
static java.lang.String PERSON_EXTENDED_ATTRS
           
static java.lang.String PERSON_EXTENDED_KEYS
           
static java.lang.String PERSON_FETCH_ENTERPRISES
           
static java.lang.String PERSON_FETCH_JOB_IDS
           
static java.lang.String PERSON_FETCH_JOBS
           
static java.lang.String PERSON_FIRSTNAME
           
static java.lang.String PERSON_GENDER
           
static java.lang.String PERSON_ID
           
static java.lang.String PERSON_IS_ACCOUNT
           
static java.lang.String PERSON_IS_COMPLETE
           
static java.lang.String PERSON_IS_PRIVATE
           
static java.lang.String PERSON_KEYWORDS
           
static java.lang.String PERSON_LOGIN
           
static java.lang.String PERSON_MIDDLENAME
           
static java.lang.String PERSON_NAME
           
static java.lang.String PERSON_NICKNAME
           
static java.lang.String PERSON_NUMBER
           
static java.lang.String PERSON_OBJECT_VERSION
           
static java.lang.String PERSON_OWNER
           
static java.lang.String PERSON_PHONE_TYPES
           
static java.lang.String PERSON_PHONES
           
static java.lang.String PERSON_SALUTATION
           
static java.lang.String PERSON_URL
           
 
Fields inherited from class org.opengroupware.jogi.connect.xmlrpc.XmlRpcBaseDocument
content_, id_, KEY_ID
 
Constructor Summary
protected XmlRpcPerson(java.util.Map person_map)
           
protected XmlRpcPerson(java.lang.String firstname, java.lang.String lastname, OpenGroupWare ogo)
           
 
Method Summary
protected  boolean checkNewContent(java.util.Map new_content)
          checks that the the minimun required data is in the new_content Map
protected  XmlRpcAddress createNewAddress(java.lang.String key_for_map)
           
 void deleteJob(Job job)
           
 void deleteJob(java.lang.String id)
           
 void deleteJobs(java.util.List list)
           
 java.util.List fetch(FetchSpecification spec, int type)
           
 java.util.List fetchEnterprises(FetchSpecification fspec)
           
 java.util.List fetchJobs(FetchSpecification fspec)
           
 java.util.List fetchJobsAsIds(FetchSpecification fspec)
           
 java.util.Map getAddresses()
          Returns a Map with several adresses assigned to this Person.
 java.util.Iterator getAllJobs(java.util.Date startDate, java.util.Date endDate)
           
 java.util.Date getBirthdate()
           
 java.lang.String getComment()
           
 Account getContact()
           
 java.util.List getEnterprises()
           
 java.util.Map getExtendedAttributs()
           
 java.lang.String getFirstName()
           
 java.lang.String getGender()
           
 java.lang.String getId()
           
 java.lang.String getKeywords()
           
 java.lang.String getLastName()
           
 java.lang.String getLogin()
           
 java.lang.String getMiddleName()
           
 java.lang.String getNickName()
           
 java.lang.String getNumber()
           
 int getObjectVersion()
           
 Account getOwner()
           
 java.lang.String getOwnerId()
           
 java.util.Map getPhones()
           
 java.util.List getPhoneTypes()
           
 java.lang.String getSalutation()
           
 java.lang.String getUrl()
           
 java.util.Map insertExtendedAttrs(java.lang.String key, java.lang.String val)
           
 Job insertJob(java.util.Date startDate, java.util.Date endDate, java.lang.String name)
           
 Job insertJob(Job job)
           
 Phone insertPhone(java.lang.String type, java.lang.String number, java.lang.String info)
           
 boolean isAccount()
           
 boolean isComplete()
           
 boolean isPrivate()
           
 boolean removePhone(Phone phone)
           
 void setBirthDate(java.util.Date birthdate)
           
 void setComment(java.lang.String comment)
           
 void setContact(Account account)
           
 void setFirstName(java.lang.String first_name)
           
 void setGender(java.lang.String gender)
           
 void setIsAccount(boolean bool)
           
 void setIsComplete(boolean bool)
           
 void setIsPrivate(boolean bool)
           
 void setKeywords(java.lang.String keywords)
           
 void setLastName(java.lang.String last_name)
           
 void setMiddleName(java.lang.String middle_name)
           
 void setNickName(java.lang.String nick_name)
           
 void setNumber(java.lang.String string)
           
 void setObjectVersion(int objectVersion)
           
 void setOwner(Account account)
           
 void setOwnerId(java.lang.String ownerId)
           
 void setSalutation(java.lang.String salutation)
           
 void setUrl(java.lang.String url)
           
 void update(java.util.Observable o, java.lang.Object arg)
           
protected  boolean updateAddresses(java.util.Map addressesMap)
          This method updates the Address fields associated with this person.
protected  boolean updatePhones(java.util.Map phonesMap)
          This method converts between an XML-RPC result returned by the GroupwareServer and an local XmlRpcPhone object.
 
Methods inherited from class org.opengroupware.jogi.connect.xmlrpc.XmlRpcBaseDocument
fireNotify, getContent, getString, put, setContent
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PERSON_ID

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

PERSON_OBJECT_VERSION

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

PERSON_ADDRESSES

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

PERSON_BIRTHDAY

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

PERSON_COMMENT

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

PERSON_CONTACT

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

PERSON_EXTENDED_ATTRS

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

PERSON_EXTENDED_KEYS

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

PERSON_FIRSTNAME

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

PERSON_GENDER

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

PERSON_KEYWORDS

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

PERSON_LOGIN

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

PERSON_MIDDLENAME

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

PERSON_NAME

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

PERSON_NICKNAME

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

PERSON_NUMBER

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

PERSON_SALUTATION

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

PERSON_IS_ACCOUNT

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

PERSON_IS_COMPLETE

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

PERSON_IS_PRIVATE

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

PERSON_OWNER

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

PERSON_URL

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

PERSON_PHONE_TYPES

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

PERSON_PHONES

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

PERSON_FETCH_ENTERPRISES

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

PERSON_FETCH_JOBS

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

PERSON_FETCH_JOB_IDS

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

caller_

protected XmlRpcCaller caller_

ogo

protected OpenGroupWare ogo
Constructor Detail

XmlRpcPerson

protected XmlRpcPerson(java.lang.String firstname,
                       java.lang.String lastname,
                       OpenGroupWare ogo)
                throws OgoException,
                       ConnectionException

XmlRpcPerson

protected XmlRpcPerson(java.util.Map person_map)
Method Detail

createNewAddress

protected XmlRpcAddress createNewAddress(java.lang.String key_for_map)

updateAddresses

protected boolean updateAddresses(java.util.Map addressesMap)
This method updates the Address fields associated with this person.

Parameters:
addressesMap - the Map returned by OpenGroupware.org, this contains the Addresses as Maps.
Returns:
returns true if the method succeeded, or false if the addresses could not be updated;

updatePhones

protected boolean updatePhones(java.util.Map phonesMap)
This method converts between an XML-RPC result returned by the GroupwareServer and an local XmlRpcPhone object. If there is a local object available its data is updated, if no local object is available it is created and initialized with the results returned by the XML-RPC call.

Parameters:
phonesMap - The phones object returned by an XML-RPC call to the Opengroupware.
Returns:
true if updating the map suceeds and false otherwise.

getFirstName

public java.lang.String getFirstName()
                              throws OgoException,
                                     ConnectionException
Specified by:
getFirstName in interface Person
Throws:
OgoException
ConnectionException

setFirstName

public void setFirstName(java.lang.String first_name)
                  throws OgoException,
                         ConnectionException
Specified by:
setFirstName in interface Person
Throws:
OgoException
ConnectionException

getId

public java.lang.String getId()
                       throws OgoException,
                              ConnectionException
Specified by:
getId in interface Person
Overrides:
getId in class XmlRpcBaseDocument
Throws:
OgoException
ConnectionException

insertExtendedAttrs

public java.util.Map insertExtendedAttrs(java.lang.String key,
                                         java.lang.String val)
                                  throws OgoException,
                                         ConnectionException
Specified by:
insertExtendedAttrs in interface Person
Throws:
OgoException
ConnectionException

fetch

public java.util.List fetch(FetchSpecification spec,
                            int type)
                     throws OgoException,
                            ConnectionException
Specified by:
fetch in interface Person
Throws:
OgoException
ConnectionException

getEnterprises

public java.util.List getEnterprises()
                              throws OgoException,
                                     ConnectionException
Specified by:
getEnterprises in interface Person
Returns:
the Enterprises this Person record is associated with.
Throws:
OgoException
ConnectionException

fetchJobs

public java.util.List fetchJobs(FetchSpecification fspec)
                         throws OgoException,
                                ConnectionException
Specified by:
fetchJobs in interface Person
Throws:
OgoException
ConnectionException

fetchEnterprises

public java.util.List fetchEnterprises(FetchSpecification fspec)
                                throws OgoException,
                                       ConnectionException
Specified by:
fetchEnterprises in interface Person
Returns:
the Enterprises this Person record is associated with.
Throws:
OgoException
ConnectionException

getObjectVersion

public int getObjectVersion()
                     throws OgoException,
                            ConnectionException
Specified by:
getObjectVersion in interface Person
Throws:
OgoException
ConnectionException

setObjectVersion

public void setObjectVersion(int objectVersion)
                      throws OgoException,
                             ConnectionException
Specified by:
setObjectVersion in interface Person
Throws:
OgoException
ConnectionException

getComment

public java.lang.String getComment()
                            throws OgoException,
                                   ConnectionException
Specified by:
getComment in interface Person
Throws:
OgoException
ConnectionException

setComment

public void setComment(java.lang.String comment)
                throws OgoException,
                       ConnectionException
Specified by:
setComment in interface Person
Throws:
OgoException
ConnectionException

getLastName

public java.lang.String getLastName()
                             throws OgoException,
                                    ConnectionException
Specified by:
getLastName in interface Person
Throws:
OgoException
ConnectionException

setLastName

public void setLastName(java.lang.String last_name)
                 throws OgoException,
                        ConnectionException
Specified by:
setLastName in interface Person
Throws:
OgoException
ConnectionException

getMiddleName

public java.lang.String getMiddleName()
                               throws OgoException,
                                      ConnectionException
Specified by:
getMiddleName in interface Person
Throws:
OgoException
ConnectionException

setMiddleName

public void setMiddleName(java.lang.String middle_name)
                   throws OgoException,
                          ConnectionException
Specified by:
setMiddleName in interface Person
Throws:
OgoException
ConnectionException

getNickName

public java.lang.String getNickName()
                             throws OgoException,
                                    ConnectionException
Specified by:
getNickName in interface Person
Throws:
OgoException
ConnectionException

setNickName

public void setNickName(java.lang.String nick_name)
                 throws OgoException,
                        ConnectionException
Specified by:
setNickName in interface Person
Throws:
OgoException
ConnectionException

getUrl

public java.lang.String getUrl()
                        throws OgoException,
                               ConnectionException
Specified by:
getUrl in interface Person
Throws:
OgoException
ConnectionException

setUrl

public void setUrl(java.lang.String url)
            throws OgoException,
                   ConnectionException
Specified by:
setUrl in interface Person
Throws:
OgoException
ConnectionException

getSalutation

public java.lang.String getSalutation()
                               throws OgoException,
                                      ConnectionException
Specified by:
getSalutation in interface Person
Throws:
OgoException
ConnectionException

setSalutation

public void setSalutation(java.lang.String salutation)
                   throws OgoException,
                          ConnectionException
Specified by:
setSalutation in interface Person
Throws:
OgoException
ConnectionException

getGender

public java.lang.String getGender()
                           throws OgoException,
                                  ConnectionException
Specified by:
getGender in interface Person
Throws:
OgoException
ConnectionException

setGender

public void setGender(java.lang.String gender)
               throws OgoException,
                      ConnectionException
Specified by:
setGender in interface Person
Throws:
OgoException
ConnectionException

getLogin

public java.lang.String getLogin()
                          throws OgoException,
                                 ConnectionException
Specified by:
getLogin in interface Person
Throws:
OgoException
ConnectionException

getExtendedAttributs

public java.util.Map getExtendedAttributs()
                                   throws OgoException,
                                          ConnectionException
Specified by:
getExtendedAttributs in interface Person
Throws:
OgoException
ConnectionException

getKeywords

public java.lang.String getKeywords()
                             throws OgoException,
                                    ConnectionException
Specified by:
getKeywords in interface Person
Throws:
OgoException
ConnectionException

setKeywords

public void setKeywords(java.lang.String keywords)
                 throws OgoException,
                        ConnectionException
Specified by:
setKeywords in interface Person
Throws:
OgoException
ConnectionException

getNumber

public java.lang.String getNumber()
                           throws OgoException,
                                  ConnectionException
Specified by:
getNumber in interface Person
Throws:
OgoException
ConnectionException

setNumber

public void setNumber(java.lang.String string)
               throws OgoException,
                      ConnectionException
Specified by:
setNumber in interface Person
Throws:
OgoException
ConnectionException

setContact

public void setContact(Account account)
                throws OgoException,
                       ConnectionException
Specified by:
setContact in interface Person
Parameters:
account -
Throws:
OgoException
ConnectionException

getContact

public Account getContact()
                   throws OgoException,
                          ConnectionException
Specified by:
getContact in interface Person
Throws:
OgoException
ConnectionException

setOwner

public void setOwner(Account account)
              throws OgoException,
                     ConnectionException
Specified by:
setOwner in interface Person
Throws:
OgoException
ConnectionException

getOwner

public Account getOwner()
                 throws OgoException,
                        ConnectionException
Specified by:
getOwner in interface Person
Throws:
OgoException
ConnectionException

getOwnerId

public java.lang.String getOwnerId()
                            throws OgoException,
                                   ConnectionException
Specified by:
getOwnerId in interface Person
Throws:
OgoException
ConnectionException

setOwnerId

public void setOwnerId(java.lang.String ownerId)
                throws OgoException,
                       ConnectionException
Specified by:
setOwnerId in interface Person
Throws:
OgoException
ConnectionException

getBirthdate

public java.util.Date getBirthdate()
                            throws OgoException,
                                   ConnectionException
Specified by:
getBirthdate in interface Person
Throws:
OgoException
ConnectionException

setBirthDate

public void setBirthDate(java.util.Date birthdate)
                  throws OgoException,
                         ConnectionException
Specified by:
setBirthDate in interface Person
Throws:
OgoException
ConnectionException

isAccount

public boolean isAccount()
                  throws OgoException,
                         ConnectionException
Specified by:
isAccount in interface Person
Throws:
OgoException
ConnectionException

isComplete

public boolean isComplete()
                   throws OgoException,
                          ConnectionException
Specified by:
isComplete in interface Person
Throws:
OgoException
ConnectionException

isPrivate

public boolean isPrivate()
                  throws OgoException,
                         ConnectionException
Specified by:
isPrivate in interface Person
Throws:
OgoException
ConnectionException

setIsAccount

public void setIsAccount(boolean bool)
                  throws OgoException,
                         ConnectionException
Specified by:
setIsAccount in interface Person
Throws:
OgoException
ConnectionException

setIsComplete

public void setIsComplete(boolean bool)
                   throws OgoException,
                          ConnectionException
Specified by:
setIsComplete in interface Person
Throws:
OgoException
ConnectionException

setIsPrivate

public void setIsPrivate(boolean bool)
                  throws OgoException,
                         ConnectionException
Specified by:
setIsPrivate in interface Person
Throws:
OgoException
ConnectionException

getAddresses

public java.util.Map getAddresses()
                           throws OgoException,
                                  ConnectionException
Description copied from interface: Person
Returns a Map with several adresses assigned to this Person. The OpenGroupware.org XML-RPC documentation defines 3 default types of adresses: "location", "mailing", "private". If they are available they can be fetched from the Map with their names as key. There might be less or more different address objects in the Map.

Specified by:
getAddresses in interface Person
Returns:
a Map containing Address objects for this Person object.
Throws:
OgoException
ConnectionException

getPhones

public java.util.Map getPhones()
                        throws OgoException,
                               ConnectionException
Specified by:
getPhones in interface Person
Throws:
OgoException
ConnectionException

getPhoneTypes

public java.util.List getPhoneTypes()
                             throws OgoException,
                                    ConnectionException
Specified by:
getPhoneTypes in interface Person
Throws:
OgoException
ConnectionException

insertPhone

public Phone insertPhone(java.lang.String type,
                         java.lang.String number,
                         java.lang.String info)
                  throws OgoException,
                         ConnectionException
Specified by:
insertPhone in interface Person
Throws:
OgoException
ConnectionException

removePhone

public boolean removePhone(Phone phone)
                    throws OgoException,
                           ConnectionException
Specified by:
removePhone in interface Person
Throws:
OgoException
ConnectionException

update

public void update(java.util.Observable o,
                   java.lang.Object arg)
Specified by:
update in interface java.util.Observer

checkNewContent

protected boolean checkNewContent(java.util.Map new_content)
checks that the the minimun required data is in the new_content Map

Specified by:
checkNewContent in class XmlRpcBaseDocument
Parameters:
new_content - The new content for the document.
Returns:
true if the content meets all requirements, otherwise false.

insertJob

public Job insertJob(Job job)
              throws OgoException,
                     ConnectionException
Specified by:
insertJob in interface Person
Throws:
OgoException
ConnectionException

fetchJobsAsIds

public java.util.List fetchJobsAsIds(FetchSpecification fspec)
                              throws OgoException,
                                     ConnectionException
Specified by:
fetchJobsAsIds in interface Person
Throws:
OgoException
ConnectionException

getAllJobs

public java.util.Iterator getAllJobs(java.util.Date startDate,
                                     java.util.Date endDate)
                              throws OgoException,
                                     ConnectionException
Throws:
OgoException
ConnectionException

insertJob

public Job insertJob(java.util.Date startDate,
                     java.util.Date endDate,
                     java.lang.String name)
              throws OgoException,
                     ConnectionException
Specified by:
insertJob in interface Person
Throws:
OgoException
ConnectionException

deleteJob

public void deleteJob(Job job)
               throws OgoException,
                      ConnectionException
Specified by:
deleteJob in interface Person
Throws:
OgoException
ConnectionException

deleteJob

public void deleteJob(java.lang.String id)
               throws OgoException,
                      ConnectionException
Specified by:
deleteJob in interface Person
Throws:
OgoException
ConnectionException

deleteJobs

public void deleteJobs(java.util.List list)
                throws OgoException,
                       ConnectionException
Specified by:
deleteJobs in interface Person
Throws:
OgoException
ConnectionException


Copyright © 2003 ogojogi Project, All Rights Reserved.