{
int results = 0;
ActivityVOX activityVOX = new ActivityVOX(form);
ActivityVO activityVO = activityVOX.getVO();
ActivityFacadeHome activityFacade = (ActivityFacadeHome)CVUtility.getHomeObject(
"com.centraview.activity.activityfacade.ActivityFacadeHome", "ActivityFacade");
try {
String entityName = form.getLinkCompany();
if (entityName != null && !entityName.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 = syncHome.create();
sfremote.setDataSource(dataSource);
int newEntityID = sfremote.findCompanyNameMatch(entityName, userId);
activityVO.setEntityID(newEntityID);
}
ActivityFacade remote = activityFacade.create();
remote.setDataSource(this.dataSource);
results = remote.addActivity(activityVO, userId);
} catch (Exception e) {
logger.error("[Exception] SyncFacade.addActivity ", e);
return ("FAIL");