/**
 * 
 */
package gov.nih.nci.cananolab.dto.common;

import gov.nih.nci.cananolab.domain.common.Organization;
import gov.nih.nci.cananolab.domain.common.PointOfContact;


/**
 * PointOfContact view bean
 * 
 * @author tanq, cais
 * 
 */

//TODO: need to revise PointOfContactBean, copy from OrganizationBean

public class PointOfContactBean{
	private PointOfContact domain;
	private String POCName;
	private Organization organization;
	private String[] orgVisibilityGroups = new String[0];
	private String[] pocVisibilityGroups = new String[0];
	private String[] emailVisibilityGroups = new String[0];
	private String[] phoneVisibilityGroups = new String[0];
	private boolean hidden = false;
	private String address;
	//TODO: need info for nanoparticleSample??
	
	
	public PointOfContactBean() {
		super();
		domain = new PointOfContact();
		organization = new Organization();
		POCName = "";
	}

	public PointOfContactBean(PointOfContact pointOfContact) {
		domain = pointOfContact;
		organization =
			pointOfContact.getOrganization();
		String firstName = domain.getFirstName();
		POCName = "";
		if (firstName!=null) {
			POCName = firstName +" ";
		}
		String lastName = domain.getLastName();
		if (lastName!=null) {
			POCName+=lastName;
		}
	}
	
	/**
	 * @return the domain
	 */
	public PointOfContact getDomain() {
		return domain;
	}

	/**
	 * @param domain the domain to set
	 */
	public void setDomain(PointOfContact domain) {
		this.domain = domain;
	}

	/**
	 * @return the pocs
	 */
	public Organization getOrganization() {
		return organization;
	}

	/**
	 * @param pocs the pocs to set
	 */
	public void setOrganization(Organization organization) {
		this.organization = organization;
	}

	/**
	 * @return the orgVisibilityGroups
	 */
	public String[] getOrgVisibilityGroups() {
		return orgVisibilityGroups;
	}

	/**
	 * @param orgVisibilityGroups the orgVisibilityGroups to set
	 */
	public void setOrgVisibilityGroups(String[] orgVisibilityGroups) {
		this.orgVisibilityGroups = orgVisibilityGroups;
	}

	/**
	 * @return the pocVisibilityGroups
	 */
	public String[] getPocVisibilityGroups() {
		return pocVisibilityGroups;
	}

	/**
	 * @param pocVisibilityGroups the pocVisibilityGroups to set
	 */
	public void setPocVisibilityGroups(String[] pocVisibilityGroups) {
		this.pocVisibilityGroups = pocVisibilityGroups;
	}

	/**
	 * @return the emailVisibilityGroups
	 */
	public String[] getEmailVisibilityGroups() {
		return emailVisibilityGroups;
	}

	/**
	 * @param emailVisibilityGroups the emailVisibilityGroups to set
	 */
	public void setEmailVisibilityGroups(String[] emailVisibilityGroups) {
		this.emailVisibilityGroups = emailVisibilityGroups;
	}

	/**
	 * @return the phoneVisibilityGroups
	 */
	public String[] getPhoneVisibilityGroups() {
		return phoneVisibilityGroups;
	}

	/**
	 * @param phoneVisibilityGroups the phoneVisibilityGroups to set
	 */
	public void setPhoneVisibilityGroups(String[] phoneVisibilityGroups) {
		this.phoneVisibilityGroups = phoneVisibilityGroups;
	}

	/**
	 * @return the hidden
	 */
	public boolean isHidden() {
		return hidden;
	}

	/**
	 * @param hidden the hidden to set
	 */
	public void setHidden(boolean hidden) {
		this.hidden = hidden;
	}

	/**
	 * @return the pOCName
	 */
	public String getPOCName() {
		String firstName = domain.getFirstName();
		POCName = "";
		if (firstName!=null) {
			POCName = firstName +" ";
		}
		String lastName = domain.getLastName();
		if (lastName!=null) {
			POCName+=lastName;
		}
		return POCName;
	}

	/**
	 * @param name the pOCName to set
	 */
	public void setPOCName(String name) {
		POCName = name;
	}	
	
	
	
}

@@ -868,24 +868,64 @@
 nization();%0A
+%09%09domain.setOrganization(organization);%0A
 %09%09POCName = 
@@ -928,16 +928,16 @@
 e = %22%22;%0A
-
 %09%7D%0A%0A%09pub
@@ -1073,16 +1073,54 @@
 tion();%0A
+%09%09//TODO:: the following not needed??%0A
 %09%09String
@@ -1287,32 +1287,32 @@
 stName!=null) %7B%0A
-
 %09%09%09POCName+=last
@@ -1321,16 +1321,175 @@
 me;%0A%09%09%7D%0A
+%09%09if (domain.getOrganization()!=null) %7B%0A%09%09%09String orgName = domain.getOrganization().getName();%0A%09%09%09if (orgName!=null) %7B%0A%09%09%09%09POCName+=%22(%22+orgName+%22)%22;%0A%09%09%09%7D%0A%09%09%7D%0A
 %09%7D%0A%09%0A%09/*
@@ -3717,16 +3717,175 @@
 me;%0A%09%09%7D%0A
+%09%09if (domain.getOrganization()!=null) %7B%0A%09%09%09String orgName = domain.getOrganization().getName();%0A%09%09%09if (orgName!=null) %7B%0A%09%09%09%09POCName+=%22(%22+orgName+%22)%22;%0A%09%09%09%7D%0A%09%09%7D%0A
 %09%09return
@@ -4010,10 +4010,14 @@
 %09%0A%09%0A%09%0A%09%0A
+%09%0A%09%0A
 %7D%0A

add poc and organization association