/**
 * Axelor Business Solutions
 *
 * Copyright (C) 2005-2016 Axelor (<http://axelor.com>).
 *
 * This program is free software: you can redistribute it and/or  modify
 * it under the terms of the GNU Affero General Public License, version 3,
 * as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package com.axelor.meta.schema.views;

import javax.xml.bind.annotation.XmlType;

import com.axelor.meta.db.MetaFieldCustom;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;

@XmlType
@JsonInclude(Include.NON_DEFAULT)
public class JsonField {

	private String name;

	private String type;

	private String title;

	private String defaultValue;

	private String help;

	private String selection;

	private Integer minSize;

	private Integer maxSize;

	private String regex;

	private Boolean required;

	private Boolean hidden;

	private String showIf;

	private String hideIf;

	private String requiredIf;

	public JsonField(MetaFieldCustom field) {
		this.name = field.getName();
		this.type = field.getType();
		this.title = field.getTitle();
		this.defaultValue = field.getDefaultValue();
		this.selection = field.getSelection();
		this.help = field.getHelp();
		this.minSize = field.getMinSize();
		this.maxSize = field.getMaxSize();
		this.required = field.getRequired();
		this.hidden = field.getHidden();
		this.showIf = field.getShowIf();
		this.hideIf = field.getHideIf();
		this.requiredIf = field.getRequiredIf();
	}

	public String getName() {
		return name;
	}

	public String getType() {
		return type;
	}

	public String getTitle() {
		return title;
	}

	public String getDefaultValue() {
		return defaultValue;
	}

	public String getSelection() {
		return selection;
	}

	public String getHelp() {
		return help;
	}

	public Integer getMinSize() {
		return minSize;
	}

	public Integer getMaxSize() {
		return maxSize;
	}

	public String getRegex() {
		return regex;
	}

	public Boolean getRequired() {
		return required;
	}

	public Boolean getHidden() {
		return hidden;
	}

	public String getShowIf() {
		return showIf;
	}

	public String getHideIf() {
		return hideIf;
	}

	public String getRequiredIf() {
		return requiredIf;
	}
}

@@ -737,16 +737,40 @@
 views;%0A%0A
+import java.util.List;%0A%0A
 import j
@@ -804,16 +804,50 @@
 lType;%0A%0A
+import com.axelor.meta.MetaStore;%0A
 import c
@@ -2202,24 +2202,119 @@
 election;%0A%09%7D
+%0A%09%0A%09public List%3C?%3E getSelectionList() %7B%0A%09%09return MetaStore.getSelectionList(getSelection());%0A%09%7D
 %0A%0A%09public St

Implement selection support on json fields