com.jalios.rest.client
Class MemberElement

java.lang.Object
  extended by com.jalios.rest.client.DataElement
      extended by com.jalios.rest.client.MemberElement

public class MemberElement
extends DataElement

This class provides a wrapper to get the informations in the JCMS data XML element of a Member resource.

    ClientSession clientSession = new ClientSession("http://www.example.com/");
    JcmsApp jcmsApp = new JcmsApp(clientSession);
    JcmsResource memberResource = jcmsApp.getData("j_2");
    DataElement memberDataElement = MemberElement.getFirstDataElement(memberResource, clientSession);
    String login = memberDataElement.getLogin();
    String firstname = memberDataElement.getFirstName();
    String lastname = memberDataElement.getName();
    String email = memberDataElement.getEmail();

    System.out.printf("Hello {0} {1}! Your login is '{2}' and your email is '{3}'.", firstname, lastname, login, email);
 

Since:
jcms-6.1.2

Field Summary
protected  String address
           
protected  String email
           
protected  String firstName
           
protected  String info
           
protected  boolean isAdmin
           
protected  boolean isAdminRead
           
protected  boolean isEmailVisible
           
protected  boolean isEmailVisibleRead
           
protected  String jobTitle
           
protected  String language
           
protected  String login
           
protected  String mobile
           
protected  String name
           
protected  String organization
           
protected  String phone
           
protected  String salutation
           
protected  int usage
           
 
Constructor Summary
MemberElement(org.jdom.Element element, ClientSession session)
          Builds a new MemberElement from the specified xml Element and session Use the simpler method getFirstMemberElement(JcmsResource, ClientSession) instead of invoking this constructor.
 
Method Summary
 String getAddress()
          Retrieve the postal address of this Member.
 String getEmail()
          Retrieve the email address of this Member.
static MemberElement getFirstMemberElement(JcmsResource resource, ClientSession session)
          Retrieve the MemberElement corresponding to the single data in the specified resource.
 String getFirstName()
          Retrieve the first name of this Member.
 String getInfo()
          Retrieve the information on this Member.
 String getJobTitle()
          Retrieve the Job Title of this Member.
 String getLanguage()
          Retrieve the language on this Member.
 String getLogin()
          Retrieve the login of this Member.
 String getMobile()
          Retrieve the mobile phone number of this Member.
 String getName()
          Retrieve the last name of this Member.
 String getOrganization()
          Retrieve the organization of this Member.
 String getPhone()
          Retrieve the phone number of this Member.
 String getSalutation()
          Retrieve the salutation of this Member.
 int getUsage()
          Retrieve the usage of this Member (0 is an account, 1 is a contact).
 boolean isAdmin()
          Check if this Member is an admin.
 boolean isEmailVisible()
          Retrieve the email address visibility status of this Member.
 
Methods inherited from class com.jalios.rest.client.DataElement
getAbstractField, getAbstractMLName, getCdate, getDataElementList, getDataElementList, getDataType, getElement, getField, getFieldText, getFirstDataElement, getId, getMainLanguage, getMdate, getMLField, getPdate, getRelateds, getTitle, getUrl
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

login

protected String login

name

protected String name

firstName

protected String firstName

email

protected String email

isEmailVisible

protected boolean isEmailVisible

isEmailVisibleRead

protected boolean isEmailVisibleRead

salutation

protected String salutation

organization

protected String organization

jobTitle

protected String jobTitle

phone

protected String phone

mobile

protected String mobile

address

protected String address

info

protected String info

usage

protected int usage

language

protected String language

isAdmin

protected boolean isAdmin

isAdminRead

protected boolean isAdminRead
Constructor Detail

MemberElement

public MemberElement(org.jdom.Element element,
                     ClientSession session)
Builds a new MemberElement from the specified xml Element and session

Use the simpler method getFirstMemberElement(JcmsResource, ClientSession) instead of invoking this constructor.

Parameters:
element - the xml Element corresponding to the Member (data)
session - the ClientSession in which element was retrieved
Method Detail

getLogin

public String getLogin()
Retrieve the login of this Member.

Returns:
the login or an empty string if it could not be retrieved
Since:
jcms-6.1.2

getName

public String getName()
Retrieve the last name of this Member.

Returns:
the name or an empty string if it could not be retrieved
Since:
jcms-6.1.2

getFirstName

public String getFirstName()
Retrieve the first name of this Member.

Returns:
the first name or an empty string if it could not be retrieved
Since:
jcms-6.1.2

getEmail

public String getEmail()
Retrieve the email address of this Member.

Returns:
the email or an empty string if it could not be retrieved
Since:
jcms-6.1.2

isEmailVisible

public boolean isEmailVisible()
Retrieve the email address visibility status of this Member.

Returns:
the email visibility status or false if it could not be retrieved
Since:
jcms-6.1.2

getSalutation

public String getSalutation()
Retrieve the salutation of this Member.

Returns:
the salutation or an empty string if it could not be retrieved
Since:
jcms-6.1.2

getOrganization

public String getOrganization()
Retrieve the organization of this Member.

Returns:
the organization or an empty string if it could not be retrieved
Since:
jcms-6.1.2

getJobTitle

public String getJobTitle()
Retrieve the Job Title of this Member.

Returns:
the Job Title or an empty string if it could not be retrieved
Since:
jcms-6.1.2

getPhone

public String getPhone()
Retrieve the phone number of this Member.

Returns:
the phone or an empty string if it could not be retrieved
Since:
jcms-6.1.2

getMobile

public String getMobile()
Retrieve the mobile phone number of this Member.

Returns:
the mobile phone or an empty string if it could not be retrieved
Since:
jcms-6.1.2

getAddress

public String getAddress()
Retrieve the postal address of this Member.

Returns:
the postal address or an empty string if it could not be retrieved
Since:
jcms-6.1.2

getInfo

public String getInfo()
Retrieve the information on this Member.

Returns:
the information or an empty string if it could not be retrieved
Since:
jcms-6.1.2

getUsage

public int getUsage()
Retrieve the usage of this Member (0 is an account, 1 is a contact).

Returns:
the usage of this Member (default to 0 if it could not be read)
Since:
jcms-6.1.2

getLanguage

public String getLanguage()
Retrieve the language on this Member.

Returns:
the language or an empty string if it could not be retrieved
Since:
jcms-6.1.2

isAdmin

public boolean isAdmin()
Check if this Member is an admin.

Returns:
true if this user is an admin false otherwise (false if it could not be retrieved)
Since:
jcms-6.1.2

getFirstMemberElement

public static MemberElement getFirstMemberElement(JcmsResource resource,
                                                  ClientSession session)
Retrieve the MemberElement corresponding to the single data in the specified resource.

    JcmsResource memberResource = jcmsApp.getData("j_2");
    DataElement memberDataElement = MemberElement.getFirstDataElement(memberResource, clientSession);
 

Parameters:
resource -
session -
Returns:
a MemberElement correponding to the data in the entity body of the response.
Since:
jcms-6.1.2


Copyright © 2001-2010 Jalios SA. All Rights Reserved.