/*
 * Copyright 2004-2007 IDCA. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
 * following conditions are met:
 * 
 *    1. Redistributions of source code must retain the above copyright notice, this list of conditions and
 *        the following disclaimer.
 *    2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
 *        and the following disclaimer in the documentation and/or other materials provided with the
 *        distribution.
 * 
 * THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
 * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 * 
 * The views and conclusions contained in the software and documentation are those of the authors and
 * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
 */

package com.idcanet.vasc.impl;

import java.util.ArrayList;
import java.util.List;

import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascEntryField;
import com.idcanet.vasc.core.VascEntryFieldType;
import com.idcanet.vasc.core.entry.VascEntryFieldEventChannel;
import com.idcanet.vasc.core.entry.VascEntryFieldValue;
import com.idcanet.vasc.validators.VascValidator;


/**
 * 
 * @author Willem Cazander
 * @version 1.0 Mar 21, 2007
 */
public class DefaultVascEntryField implements VascEntryField {
	
	private VascEntry vascEntry = null;
	
	/** The vasc id for this field */
	private String id = null; 
	
	/** The vasc Field Type for this field entry. */
	private VascEntryFieldType vascEntryFieldType = null;
	
	/** The backendName, default to the name. **/
	private String backendName = null;

	private VascEntryFieldValue vascEntryFieldValue = null;
	
	private VascEntryFieldEventChannel vascEntryFieldEventChannel = null;
	
	private List<VascValidator> vascValidators = null;
	
	/** Some VascField fields**/
	private String name = null;
	private String description = null;
	private String helpId = null;
	private String image = null;
	private Object defaultValue = null;
	private Integer sizeList = null;
	private Integer sizeEdit = null;
	private String styleList = null;
	private String styleEdit = null;
	
	private String choices = null;
	
	/** Defines if this columns is used in interface list,create,edit **/
	private boolean view = true;
	private boolean optional = false;
	
	/** Defines per view state of this field **/
	private boolean create = true;
	private boolean edit = true;
	private boolean editReadOnly = false;
	private boolean list = true;

	/** Defines the roles stuff if all up is true **/
	private String rolesCreate = null;
	private String rolesEdit = null;
	private String rolesEditReadOnly = null;
	private String rolesList = null;
	
	public DefaultVascEntryField() {
		vascValidators = new ArrayList<VascValidator>(5);
	}
	
	public DefaultVascEntryField(String id) {
		super();
		setId(id);
	}
	
	public VascEntry getVascEntry() {
		return vascEntry;
	}
	
	public void setVascEntry(VascEntry vascEntry) {
		this.vascEntry=vascEntry;
	}
	
	/**
	 * @return the id
	 */
	public String getId() {
		return id;
	}
	
	/**
	 * @param id the id to set
	 */
	public void setId(String id) {
		this.id = id;
	}
	
	/**
	 * @return the vascEntryFieldType
	 */
	public VascEntryFieldType getVascEntryFieldType() {
		return vascEntryFieldType;
	}
	
	/**
	 * @param vascEntryFieldType the vascEntryFieldType to set
	 */
	public void setVascEntryFieldType(VascEntryFieldType vascEntryFieldType) {
		this.vascEntryFieldType = vascEntryFieldType;
	}
	
	/**
	 * @return the backendName
	 */
	public String getBackendName() {
		return backendName;
	}
	
	/**
	 * @param backendName the backendName to set
	 */
	public void setBackendName(String backendName) {
		this.backendName = backendName;
	}
	
	/**
	 * @return the vascEntryFieldValue
	 */
	public VascEntryFieldValue getVascEntryFieldValue() {
		return vascEntryFieldValue;
	}
	
	/**
	 * @param vascEntryFieldValue the vascEntryFieldValue to set
	 */
	public void setVascEntryFieldValue(VascEntryFieldValue vascEntryFieldValue) {
		this.vascEntryFieldValue = vascEntryFieldValue;
	}
	
	/**
	 * @return the vascEntryFieldEventChannel
	 */
	public VascEntryFieldEventChannel getVascEntryFieldEventChannel() {
		return vascEntryFieldEventChannel;
	}
	
	/**
	 * @param vascEntryFieldEventChannel the vascEntryFieldEventChannel to set
	 */
	public void setVascEntryFieldEventChannel(VascEntryFieldEventChannel vascEntryFieldEventChannel) {
		this.vascEntryFieldEventChannel = vascEntryFieldEventChannel;
	}
	
	/**
	 * @return the vascValidators
	 */
	public List<VascValidator> getVascValidators() {
		return vascValidators;
	}
	
	/**
	 * @param vascValidators the vascValidators to add
	 */
	public void addVascValidator(VascValidator vascValidator) {
		this.vascValidators.add(vascValidator);
	}

	/**
	 * @param vascValidators the vascValidators to remove
	 */
	public void removeVascValidator(VascValidator vascValidator) {
		this.vascValidators.remove(vascValidator);
	}
	
	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}
	
	/**
	 * @param name the name to set
	 */
	public void setName(String name) {
		this.name = name;
	}
	
	/**
	 * @return the description
	 */
	public String getDescription() {
		return description;
	}
	
	/**
	 * @param description the description to set
	 */
	public void setDescription(String description) {
		this.description = description;
	}
	
	/**
	 * @return the helpId
	 */
	public String getHelpId() {
		return helpId;
	}
	
	/**
	 * @param helpId the helpId to set
	 */
	public void setHelpId(String helpId) {
		this.helpId = helpId;
	}
	
	/**
	 * @return the image
	 */
	public String getImage() {
		return image;
	}
	
	/**
	 * @param image the image to set
	 */
	public void setImage(String image) {
		this.image = image;
	}
	
	/**
	 * @return the defaultValue
	 */
	public Object getDefaultValue() {
		return defaultValue;
	}
	
	/**
	 * @param defaultValue the defaultValue to set
	 */
	public void setDefaultValue(Object defaultValue) {
		this.defaultValue = defaultValue;
	}
	
	/**
	 * @return the sizeList
	 */
	public Integer getSizeList() {
		return sizeList;
	}
	
	/**
	 * @param sizeList the sizeList to set
	 */
	public void setSizeList(Integer sizeList) {
		this.sizeList = sizeList;
	}
	
	/**
	 * @return the sizeEdit
	 */
	public Integer getSizeEdit() {
		return sizeEdit;
	}
	
	/**
	 * @param sizeEdit the sizeEdit to set
	 */
	public void setSizeEdit(Integer sizeEdit) {
		this.sizeEdit = sizeEdit;
	}
	
	/**
	 * @return the styleList
	 */
	public String getStyleList() {
		return styleList;
	}
	
	/**
	 * @param styleList the styleList to set
	 */
	public void setStyleList(String styleList) {
		this.styleList = styleList;
	}
	
	/**
	 * @return the styleEdit
	 */
	public String getStyleEdit() {
		return styleEdit;
	}
	
	/**
	 * @param styleEdit the styleEdit to set
	 */
	public void setStyleEdit(String styleEdit) {
		this.styleEdit = styleEdit;
	}
	
	/**
	 * @return the choices
	 */
	public String getChoices() {
		return choices;
	}
	
	/**
	 * @param choices the choices to set
	 */
	public void setChoices(String choices) {
		this.choices = choices;
	}
	
	/**
	 * @return the view
	 */
	public boolean isView() {
		return view;
	}
	
	/**
	 * @param view the view to set
	 */
	public void setView(boolean view) {
		this.view = view;
	}
	
	/**
	 * @return the optional
	 */
	public boolean isOptional() {
		return optional;
	}
	
	/**
	 * @param optional the optional to set
	 */
	public void setOptional(boolean optional) {
		this.optional = optional;
	}
	
	/**
	 * @return the create
	 */
	public boolean isCreate() {
		return create;
	}
	
	/**
	 * @param create the create to set
	 */
	public void setCreate(boolean create) {
		this.create = create;
	}
	
	/**
	 * @return the edit
	 */
	public boolean isEdit() {
		return edit;
	}
	
	/**
	 * @param edit the edit to set
	 */
	public void setEdit(boolean edit) {
		this.edit = edit;
	}
	
	/**
	 * @return the editReadOnly
	 */
	public boolean isEditReadOnly() {
		return editReadOnly;
	}
	
	/**
	 * @param editReadOnly the editReadOnly to set
	 */
	public void setEditReadOnly(boolean editReadOnly) {
		this.editReadOnly = editReadOnly;
	}
	
	/**
	 * @return the list
	 */
	public boolean isList() {
		return list;
	}
	
	/**
	 * @param list the list to set
	 */
	public void setList(boolean list) {
		this.list = list;
	}
	
	/**
	 * @return the rolesCreate
	 */
	public String getRolesCreate() {
		return rolesCreate;
	}
	
	/**
	 * @param rolesCreate the rolesCreate to set
	 */
	public void setRolesCreate(String rolesCreate) {
		this.rolesCreate = rolesCreate;
	}
	
	/**
	 * @return the rolesEdit
	 */
	public String getRolesEdit() {
		return rolesEdit;
	}
	
	/**
	 * @param rolesEdit the rolesEdit to set
	 */
	public void setRolesEdit(String rolesEdit) {
		this.rolesEdit = rolesEdit;
	}
	
	/**
	 * @return the rolesEditReadOnly
	 */
	public String getRolesEditReadOnly() {
		return rolesEditReadOnly;
	}
	
	/**
	 * @param rolesEditReadOnly the rolesEditReadOnly to set
	 */
	public void setRolesEditReadOnly(String rolesEditReadOnly) {
		this.rolesEditReadOnly = rolesEditReadOnly;
	}
	
	/**
	 * @return the rolesList
	 */
	public String getRolesList() {
		return rolesList;
	}
	
	/**
	 * @param rolesList the rolesList to set
	 */
	public void setRolesList(String rolesList) {
		this.rolesList = rolesList;
	}
}