Opportunity opportunity = null;
TargetList targetList = null;
Call call = null;
Meeting meeting = null;
Document document = null;
CaseInstance caseInstance = null;
Set<Contact> contacts = null;
if ("Opportunity".equals(this.getRelationKey())) {
opportunity = opportunityService.getEntityById(Opportunity.class,
Integer.valueOf(this.getRelationValue()));
contacts = opportunity.getContacts();
} else if ("TargetList".equals(this.getRelationKey())) {
targetList = targetListService.getEntityById(TargetList.class,
Integer.valueOf(this.getRelationValue()));
contacts = targetList.getContacts();
} else if ("Call".equals(this.getRelationKey())) {
call = callService.getEntityById(Call.class,
Integer.valueOf(this.getRelationValue()));
contacts = call.getContacts();
} else if ("Meeting".equals(this.getRelationKey())) {
meeting = meetingService.getEntityById(Meeting.class,
Integer.valueOf(this.getRelationValue()));
contacts = meeting.getContacts();
} else if ("Document".equals(this.getRelationKey())) {
document = documentService.getEntityById(Document.class,
Integer.valueOf(this.getRelationValue()));
contacts = document.getContacts();
} else if ("CaseInstance".equals(this.getRelationKey())) {
caseInstance = caseService.getEntityById(CaseInstance.class,
Integer.valueOf(this.getRelationValue()));
contacts = caseInstance.getContacts();
}
if (this.getSeleteIDs() != null) {
String[] ids = seleteIDs.split(",");
Collection<Contact> selectedContacts = new ArrayList<Contact>();