com.jalios.jcms
Class MemberImport

java.lang.Object
  extended by com.jalios.jcms.MemberImport

public class MemberImport
extends Object

Represents a Member during CSV Member import.

Since:
jcms-8
Version:
$Revision: 44328 $
Author:
Sylvain Devaux

Field Summary
protected  String department
           
protected  String email
           
protected  String firstName
           
protected  Collection<String> groupIds
          A collection of Group's id.
protected  boolean hasToSendEmail
          If an email has to be sent for created Member, it may impact the way to compute the password field.
protected  boolean isBlockingError
          True if any blocking error.
protected  boolean isCreate
          True if the member does not yet exist.
protected  boolean isError
          True if any error.
protected  boolean isSimulation
           
protected  String jobTitle
           
protected  String login
           
protected  Member member
          The related Member.
protected  String message
          The information message.
protected  String mobile
           
protected  String name
           
protected  String organization
           
protected  String phone
           
static String REVISION
          The class revision.
protected  String sourceLine
          The source line.
protected  ControllerStatus status
          A custom integrity error message, or a JCMS integrity message.
protected  String userLang
           
 
Constructor Summary
MemberImport(com.csvreader.CsvReader csvReader)
          Constructor used to feed a MemberImport instance from a CsvReader.
MemberImport(int line, String sourceLine, boolean hasToSendEmail, String separator, String userLang)
          Constructor used to keep trace of the source informations.
 
Method Summary
protected  String computeLoginFromEmail(String email)
          Computes login from email : remove right part after '@'.
 void copy(MemberImport mbrImport)
          Copy fiels from given mbrImport param to this instance.
 String getDepartment()
           
 String getEmail()
           
 String getFirstName()
           
 Collection<String> getGroupIds()
           
 String getJobTitle()
           
 int getLine()
           
 String getLogin()
           
 Member getMember()
           
 String getMessage()
           
 String getMobile()
           
 String getName()
           
 String getOrganization()
           
 String getPhone()
           
 String getSourceLine()
           
 ControllerStatus getStatus()
           
 void initMember()
          Retrieves member from email if exists.
 boolean isBlockingError()
           
 boolean isCreate()
           
 boolean isError()
           
 boolean isLoginAvailable()
          Tests if the login is already used.
 boolean isSimulation()
           
 boolean isUpdate()
           
 boolean performSave(Member opAuthor)
          Calls Data.performCreate(Member, java.util.Map), or Data.performUpdate(Member, java.util.Map), depending on the Member already exist.
 void setBlockingError(boolean isBlockingError)
           
 void setCreate(boolean isCreate)
           
 void setDepartment(String department)
           
 void setEmail(String email)
           
 void setError(boolean isError)
           
 void setFirstName(String firstName)
           
 void setGroupIds(Collection<String> groupIds)
           
 void setJobTitle(String jobTitle)
           
 void setLine(int line)
           
 void setLogin(String login)
           
 void setMember(Member member)
           
 void setMessage(String message)
           
 void setMobile(String mobile)
           
 void setName(String name)
           
 void setOrganization(String organization)
           
 void setPhone(String phone)
           
 void setSimulation(boolean isSimulation)
           
 void setSourceLine(String sourceLine)
           
 void setStatus(ControllerStatus status)
           
 void setUpdate(boolean isUpdate)
           
 String toString()
          Used for debug purpose.
 void updateMember()
          Updates the related Member's fields if values are not empty.
protected  void updateMemberGroups()
          Add the Member to the optional Groups.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

REVISION

public static final String REVISION
The class revision.

Since:
jcms-8
See Also:
Constant Field Values

isSimulation

protected boolean isSimulation

isCreate

protected boolean isCreate
True if the member does not yet exist.


isError

protected boolean isError
True if any error.


isBlockingError

protected boolean isBlockingError
True if any blocking error.


member

protected Member member
The related Member.


status

protected ControllerStatus status
A custom integrity error message, or a JCMS integrity message.


message

protected String message
The information message.


sourceLine

protected String sourceLine
The source line.


name

protected String name

firstName

protected String firstName

email

protected String email

login

protected String login

organization

protected String organization

department

protected String department

jobTitle

protected String jobTitle

phone

protected String phone

mobile

protected String mobile

userLang

protected String userLang

groupIds

protected Collection<String> groupIds
A collection of Group's id.

Since:
jcms-8

hasToSendEmail

protected boolean hasToSendEmail
If an email has to be sent for created Member, it may impact the way to compute the password field.

Since:
jcms-8
Constructor Detail

MemberImport

public MemberImport(int line,
                    String sourceLine,
                    boolean hasToSendEmail,
                    String separator,
                    String userLang)
Constructor used to keep trace of the source informations.

Parameters:
line - : the corresponding line number in the .csv file.
sourceLine - : the corresponding line as source in the .csv file.
hasToSendEmail - : if an email has to be sent for created Member.
separator - The separator used to split CSV.
userLang - the user lang to use.
Since:
jcms-8

MemberImport

public MemberImport(com.csvreader.CsvReader csvReader)
             throws IOException
Constructor used to feed a MemberImport instance from a CsvReader.

Parameters:
csvReader - the csv reader to use.
Throws:
IOException
Since:
jcms-8
Method Detail

isSimulation

public boolean isSimulation()
Returns:
the isSimulation
Since:
jcms-8

setSimulation

public void setSimulation(boolean isSimulation)
Parameters:
isSimulation - the isSimulation to set
Since:
jcms-8

isCreate

public boolean isCreate()
Returns:
the isCreate
Since:
jcms-8

setCreate

public void setCreate(boolean isCreate)
Parameters:
isCreate - the isCreate to set
Since:
jcms-8

isUpdate

public boolean isUpdate()
Returns:
the isUpdate
Since:
jcms-8

setUpdate

public void setUpdate(boolean isUpdate)
Parameters:
isUpdate - the isUpdate to set
Since:
jcms-8

isError

public boolean isError()
Returns:
the isError
Since:
jcms-8

setError

public void setError(boolean isError)
Parameters:
isError - the isError to set
Since:
jcms-8

isBlockingError

public boolean isBlockingError()
Returns:
the isBlockingError
Since:
jcms-8

setBlockingError

public void setBlockingError(boolean isBlockingError)
Parameters:
isBlockingError - the isBlockingError to set
Since:
jcms-8

getStatus

public ControllerStatus getStatus()
Returns:
the status
Since:
jcms-8

setStatus

public void setStatus(ControllerStatus status)
Parameters:
status - the status to set
Since:
jcms-8

getLine

public int getLine()
Returns:
the line
Since:
jcms-8

setLine

public void setLine(int line)
Parameters:
line - the line to set
Since:
jcms-8

getSourceLine

public String getSourceLine()
Returns:
the sourceLine
Since:
jcms-8

setSourceLine

public void setSourceLine(String sourceLine)
Parameters:
sourceLine - the sourceLine to set
Since:
jcms-8

getName

public String getName()
Returns:
the name
Since:
jcms-8

setName

public void setName(String name)
Parameters:
name - the name to set
Since:
jcms-8

getFirstName

public String getFirstName()
Returns:
the firstName
Since:
jcms-8

setFirstName

public void setFirstName(String firstName)
Parameters:
firstName - the firstName to set
Since:
jcms-8

getEmail

public String getEmail()
Returns:
the email
Since:
jcms-8

setEmail

public void setEmail(String email)
Parameters:
email - the email to set
Since:
jcms-8

getLogin

public String getLogin()
Returns:
the login
Since:
jcms-8

setLogin

public void setLogin(String login)
Parameters:
login - the login to set
Since:
jcms-8

getOrganization

public String getOrganization()
Returns:
the organization
Since:
jcms-8

setOrganization

public void setOrganization(String organization)
Parameters:
organization - the organization to set
Since:
jcms-8

getDepartment

public String getDepartment()
Returns:
the department
Since:
jcms-8

setDepartment

public void setDepartment(String department)
Parameters:
department - the department to set
Since:
jcms-8

getJobTitle

public String getJobTitle()
Returns:
the jobTitle
Since:
jcms-8

setJobTitle

public void setJobTitle(String jobTitle)
Parameters:
jobTitle - the jobTitle to set
Since:
jcms-8

getPhone

public String getPhone()
Returns:
the phone
Since:
jcms-8

setPhone

public void setPhone(String phone)
Parameters:
phone - the phone to set
Since:
jcms-8

getMobile

public String getMobile()
Returns:
the mobile
Since:
jcms-8

setMobile

public void setMobile(String mobile)
Parameters:
mobile - the mobile to set
Since:
jcms-8

getMessage

public String getMessage()
Returns:
the message
Since:
jcms-8

setMessage

public void setMessage(String message)
Parameters:
message - the message to set
Since:
jcms-8

getMember

public Member getMember()
Returns:
the member
Since:
jcms-8

setMember

public void setMember(Member member)
Parameters:
member - the member to set
Since:
jcms-8

getGroupIds

public Collection<String> getGroupIds()
Returns:
the groupIds
Since:
jcms-8

setGroupIds

public void setGroupIds(Collection<String> groupIds)
Parameters:
groupIds - the groupIds to set
Since:
jcms-8

initMember

public void initMember()
Retrieves member from email if exists.
If it does exist, sets an update instance to member, else created a new empty Member.

Since:
jcms-8

updateMember

public void updateMember()
Updates the related Member's fields if values are not empty.

If creation case :

Since:
jcms-8

computeLoginFromEmail

protected String computeLoginFromEmail(String email)
Computes login from email : remove right part after '@'.

Parameters:
email -
Returns:
the login given the email
Since:
jcms-8

updateMemberGroups

protected void updateMemberGroups()
Add the Member to the optional Groups.

Since:
jcms-8

copy

public void copy(MemberImport mbrImport)
Copy fiels from given mbrImport param to this instance.

Parameters:
mbrImport - the MemberImport to use to feed 'this' instance.
Since:
jcms-8

performSave

public boolean performSave(Member opAuthor)
Calls Data.performCreate(Member, java.util.Map), or Data.performUpdate(Member, java.util.Map), depending on the Member already exist.

Parameters:
opAuthor - the Member performing the operation.
Returns:
true if operation was successfull.
Since:
jcms-8

isLoginAvailable

public boolean isLoginAvailable()
Tests if the login is already used. Returns true if :

Returns:
true if the given login is not used by anyone else by the Member of the given Email.
Since:
jcms-8

toString

public String toString()
Used for debug purpose.

Overrides:
toString in class Object
Since:
jcms-8


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