Package com.jalios.rest.client
Class MemberElement
- java.lang.Object
-
- com.jalios.rest.client.DataElement
-
- 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"); MemberElement memberDataElement = MemberElement.getFirstMemberElement(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
Fields Modifier and Type Field Description protected java.lang.String
address
protected java.lang.String
email
protected java.lang.String
firstName
protected java.lang.String
info
protected boolean
isAdmin
protected boolean
isAdminRead
protected boolean
isEmailVisible
protected boolean
isEmailVisibleRead
protected java.lang.String
jobTitle
protected java.lang.String
language
protected java.lang.String
login
protected java.lang.String
mobile
protected java.lang.String
name
protected java.lang.String
organization
protected java.lang.String
phone
protected java.lang.String
salutation
protected int
usage
-
Constructor Summary
Constructors Constructor Description MemberElement(org.jdom.Element element, ClientSession session)
Builds a new MemberElement from the specified xml Element and session
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getAddress()
Retrieve the postal address of this Member.java.lang.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.java.lang.String
getFirstName()
Retrieve the first name of this Member.java.lang.String
getInfo()
Retrieve the information on this Member.java.lang.String
getJobTitle()
Retrieve the Job Title of this Member.java.lang.String
getLanguage()
Retrieve the language on this Member.java.lang.String
getLogin()
Retrieve the login of this Member.java.lang.String
getMobile()
Retrieve the mobile phone number of this Member.java.lang.String
getName()
Retrieve the last name of this Member.java.lang.String
getOrganization()
Retrieve the organization of this Member.java.lang.String
getPhone()
Retrieve the phone number of this Member.java.lang.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
-
-
-
-
Field Detail
-
login
protected java.lang.String login
-
name
protected java.lang.String name
-
firstName
protected java.lang.String firstName
-
email
protected java.lang.String email
-
isEmailVisible
protected boolean isEmailVisible
-
isEmailVisibleRead
protected boolean isEmailVisibleRead
-
salutation
protected java.lang.String salutation
-
organization
protected java.lang.String organization
-
jobTitle
protected java.lang.String jobTitle
-
phone
protected java.lang.String phone
-
mobile
protected java.lang.String mobile
-
address
protected java.lang.String address
-
info
protected java.lang.String info
-
usage
protected int usage
-
language
protected java.lang.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 sessiongetFirstMemberElement(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 java.lang.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 java.lang.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 java.lang.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 java.lang.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 java.lang.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 java.lang.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 java.lang.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 java.lang.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 java.lang.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 java.lang.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 java.lang.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 java.lang.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"); MemberElement memberDataElement = MemberElement.getFirstMemberElement(memberResource, clientSession);
- Parameters:
resource
-session
-- Returns:
- a MemberElement correponding to the data in the entity body of the response.
- Since:
- jcms-6.1.2
-
-