ModuleFieldRightMatrix rightsMatrix = userObject.getUserPref().getModuleAuthorizationMatrix();
HashMap indivFieldRights = rightsMatrix.getFieldRights("Individual");
HashMap entityFieldRights = rightsMatrix.getFieldRights("Entity");
IndividualVO individualVO = new IndividualVO();
IndividualVO individualCurrent = remote.getIndividual(contactID);
individualVO.setContactID(contactID);
String companyName = (String)contactForm.get("companyName");
if (companyName != null) {
if (! companyName.equals("")) {
// first, check to see if a entity with a matching name exists
// if yes, then associate this invidivual with that entity
// if no, then create a new entity, and associate this individual with that entity
SyncFacadeHome syncHome = (SyncFacadeHome)CVUtility.getHomeObject("com.centraview.syncfacade.SyncFacadeHome", "SyncFacade");
com.centraview.syncfacade.SyncFacade sfremote = (com.centraview.syncfacade.SyncFacade)syncHome.create();
sfremote.setDataSource(dataSource);
int newEntityID = sfremote.findCompanyNameMatch(companyName, individualID);
individualVO.setEntityID(newEntityID);
}else{
individualVO.setEntityID(individualCurrent.getEntityID());
}
}
String firstName = (String)contactForm.get("firstName");
if (firstName != null && ! firstName.equals("") && ((Integer)indivFieldRights.get("firstname")).intValue() < ModuleFieldRightMatrix.VIEW_RIGHT) {
individualVO.setFirstName(firstName);
}else{
individualVO.setFirstName(individualCurrent.getFirstName());
}
String MI = (String)contactForm.get("MI");
if (MI != null && ! MI.equals("") && ((Integer)indivFieldRights.get("middlename")).intValue() < ModuleFieldRightMatrix.VIEW_RIGHT) {
individualVO.setMiddleName(MI);
}else{
individualVO.setMiddleName(individualCurrent.getMiddleName());
}
String lastName = (String)contactForm.get("lastName");
if (lastName != null && ! lastName.equals("") && ((Integer)indivFieldRights.get("lastname")).intValue() < ModuleFieldRightMatrix.VIEW_RIGHT) {
individualVO.setLastName(lastName);
}else{
individualVO.setLastName(individualCurrent.getLastName());
}
String title = (String)contactForm.get("title");
if (title != null && ! title.equals("") && ((Integer)indivFieldRights.get("title")).intValue() < ModuleFieldRightMatrix.VIEW_RIGHT) {
individualVO.setTitle(title);
}else{
individualVO.setTitle(individualCurrent.getTitle());
}
String primaryContact = (String)contactForm.get("primaryContact");
if (primaryContact != null) { // && ((Integer)indivFieldRights.get("primarycontact")).intValue() < ModuleFieldRightMatrix.VIEW_RIGHT)
if (primaryContact.equals("YES") || primaryContact.equals("NO")) {
individualVO.setIsPrimaryContact(primaryContact);
}
}else{
individualVO.setIsPrimaryContact(individualCurrent.getIsPrimaryContact());
}
AddressVO primaryAddress = individualCurrent.getPrimaryAddress();
if (primaryAddress == null) {
primaryAddress = new AddressVO();
}
primaryAddress.setIsPrimary("YES");
if (((Integer)indivFieldRights.get("address")).intValue() < ModuleFieldRightMatrix.VIEW_RIGHT) {
String street1 = (String)contactForm.get("street1");
if ((street1 != null) && (! street1.equals(""))) {
primaryAddress.setStreet1(street1);
}
String street2 = (String)contactForm.get("street2");
if ((street2 != null) && (! street2.equals(""))) {
primaryAddress.setStreet2(street2);
}
String city = (String)contactForm.get("city");
if ((city != null) && (! city.equals(""))) {
primaryAddress.setCity(city);
}
String state = (String)contactForm.get("state");
if ((state != null) && (!state.equals(""))) {
primaryAddress.setStateName(state);
}
String zipCode = (String)contactForm.get("zipCode");
if ((zipCode != null) && (! zipCode.equals(""))) {
primaryAddress.setZip(zipCode);
}
String country = (String)contactForm.get("country");
if ((country != null) && (!country.equals(""))) {
primaryAddress.setCountryName(country);
}
individualVO.setPrimaryAddress(primaryAddress);
} // end if (((Integer)indivFieldRights.get("address")).intValue() < ModuleFieldRightMatrix.VIEW_RIGHT)
if (((Integer)indivFieldRights.get("contactmethod")).intValue() < ModuleFieldRightMatrix.VIEW_RIGHT) {
// get the current MOC values from the individualCurrent MOC
// save them in String variables for use below
String currentWorkPhone = new String("");
String currentHomePhone = new String("");
String currentFaxPhone = new String("");
String currentOtherPhone = new String("");
String currentMainPhone = new String("");
String currentPagerPhone = new String("");
String currentMobilePhone = new String("");
String currentEmail = new String("");
MethodOfContactVO currentWorkVO = null;
MethodOfContactVO currentHomeVO = null;
MethodOfContactVO currentFaxVO = null;
MethodOfContactVO currentOtherVO = null;
MethodOfContactVO currentMainVO = null;
MethodOfContactVO currentPagerVO = null;
MethodOfContactVO currentMobileVO = null;
MethodOfContactVO currentEmailVO = null;
Vector currentMOCs = individualCurrent.getMOC();
if (currentMOCs != null) {
Enumeration e = currentMOCs.elements();
while (e.hasMoreElements()) {
MethodOfContactVO mocVO = (MethodOfContactVO)e.nextElement();
String syncAs = mocVO.getSyncAs();