/**
 * ParameterReferenceGroup.java
 * Created on May 19, 2008
 * (C) Copyright TANDBERG Television Ltd.
 */
package com.tandbergtv.watchpoint.pmm.job.conf;

import java.util.ArrayList;
import java.util.List;

/**
 * @author spuranik
 *
 * This class represents the group shown in a job parameter or
 * job rule drop down
 */
public class ParameterReferenceGroup extends ParameterReferenceItem {

	// the callback class that will be used by the job if 
	// any of the items from this group are selected
	// NOTE: This will be empty for job parameter groups 
	private String callback;

	// list of items under this group. This will be populated only
	// for the leaf level group
	private List<ParameterReferenceItem> items;

	private ParameterReferenceGroupType type;

	/**
	 * @return the callback
	 */
	public String getCallback() {
		return callback;
	}

	/**
	 * @param callback the callback to set
	 */
	public void setCallback(String callback) {
		this.callback = callback;
	}

	/**
	 * @return the items
	 */
	public List<ParameterReferenceItem> getItems() {
		if (items == null)
			return new ArrayList<ParameterReferenceItem>();
		else
			return items;
	}

	/**
	 * @param items the items to set
	 */
	public void setItems(List<ParameterReferenceItem> items) {
		this.items = items;
	}

	public void addItem(ParameterReferenceItem item) {
		if (items == null) {
			items = new ArrayList<ParameterReferenceItem>();
		}
		items.add(item);
	}

	/**
	 * @return the type
	 */
	public ParameterReferenceGroupType getType() {
		return type;
	}

	/**
	 * @param type the type to set
	 */
	public void setType(ParameterReferenceGroupType type) {
		this.type = type;
	}
}
