package com.libreecm.db.jpa;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.apache.chemistry.opencmis.commons.data.CmisExtensionElement;
import org.hibernate.annotations.GenericGenerator;

@Entity
@Table(name="new_type_settable_attributes")
public class NewTypeSettableAttributesImpl extends LibreECMObject implements org.apache.chemistry.opencmis.commons.data.NewTypeSettableAttributes {
	@Id
	@GeneratedValue(generator="hilo-gen")
	@GenericGenerator(name="hilo-gen", strategy="hilo")
	private Integer id;
	
	public String getId() {
		if (id==null){
			return null;
		}
		return id.toString();
	}
	
	public void setId(String id){
		this.id=Integer.parseInt(id);
	}
	
	@Transient
	private static final long serialVersionUID = 1L;

    private Boolean canSetId;
    private Boolean localName;
    private Boolean localNamespace;
    private Boolean displayName;
    private Boolean queryName;
    private Boolean description;
    private Boolean creatable;
    private Boolean fileable;
    private Boolean queryable;
    private Boolean fulltextIndexed;
    private Boolean includedInSupertypeQuery;
    private Boolean controllablePolicy;
    private Boolean controllableACL;

    
	@OneToMany
	/**
	* A collection of additional Cmis extensions elements supported by this repository
	*/
    private List<CmisExtensionElementImpl> extensions= new ArrayList<CmisExtensionElementImpl>();

    public Boolean canSetId() {
        return canSetId;
    }

    public void setCanSetId(Boolean id) {
        this.canSetId = id;
    }

    public Boolean canSetLocalName() {
        return localName;
    }

    public void setCanSetLocalName(Boolean localName) {
        this.localName = localName;
    }

    public Boolean canSetLocalNamespace() {
        return localNamespace;
    }

    public void setCanSetLocalNamespace(Boolean localNamespace) {
        this.localNamespace = localNamespace;
    }

    public Boolean canSetDisplayName() {
        return displayName;
    }

    public void setCanSetDisplayName(Boolean displayName) {
        this.displayName = displayName;
    }

    public Boolean canSetQueryName() {
        return queryName;
    }

    public void setCanSetQueryName(Boolean queryName) {
        this.queryName = queryName;
    }

    public Boolean canSetDescription() {
        return description;
    }

    public void setCanSetDescription(Boolean description) {
        this.description = description;
    }

    public Boolean canSetCreatable() {
        return creatable;
    }

    public void setCanSetCreatable(Boolean creatable) {
        this.creatable = creatable;
    }

    public Boolean canSetFileable() {
        return fileable;
    }

    public void setCanSetFileable(Boolean fileable) {
        this.fileable = fileable;
    }

    public Boolean canSetQueryable() {
        return queryable;
    }

    public void setCanSetQueryable(Boolean queryable) {
        this.queryable = queryable;
    }

    public Boolean canSetFulltextIndexed() {
        return fulltextIndexed;
    }

    public void setCanSetFulltextIndexed(Boolean fulltextIndexed) {
        this.fulltextIndexed = fulltextIndexed;
    }

    public Boolean canSetIncludedInSupertypeQuery() {
        return includedInSupertypeQuery;
    }

    public void setCanSetIncludedInSupertypeQuery(Boolean includedInSupertypeQuery) {
        this.includedInSupertypeQuery = includedInSupertypeQuery;
    }

    public Boolean canSetControllablePolicy() {
        return controllablePolicy;
    }

    public void setCanSetControllablePolicy(Boolean controllablePolicy) {
        this.controllablePolicy = controllablePolicy;
    }

    public Boolean canSetControllableAcl() {
        return controllableACL;
    }

    public void setCanSetControllableAcl(Boolean controllableACL) {
        this.controllableACL = controllableACL;
    }

    /**
     * 
     * @param canSetId
     * @param localName
     * @param localNamespace
     * @param displayName
     * @param queryName
     * @param description
     * @param creatable
     * @param fileable
     * @param queryable
     * @param fulltextIndexed
     * @param includedInSupertypeQuery
     * @param controllablePolicy
     * @param controllableACL
     */
	public NewTypeSettableAttributesImpl(//Integer id, 
			Boolean canSetId, Boolean localName, Boolean localNamespace,
			Boolean displayName, Boolean queryName, Boolean description, Boolean creatable, Boolean fileable,
			Boolean queryable, Boolean fulltextIndexed, Boolean includedInSupertypeQuery, Boolean controllablePolicy,
			Boolean controllableACL) {
		super();
		//this.id = id;
		this.canSetId = canSetId;
		this.localName = localName;
		this.localNamespace = localNamespace;
		this.displayName = displayName;
		this.queryName = queryName;
		this.description = description;
		this.creatable = creatable;
		this.fileable = fileable;
		this.queryable = queryable;
		this.fulltextIndexed = fulltextIndexed;
		this.includedInSupertypeQuery = includedInSupertypeQuery;
		this.controllablePolicy = controllablePolicy;
		this.controllableACL = controllableACL;
	}

	public NewTypeSettableAttributesImpl(){}
	
	@Override
	public List<CmisExtensionElement> getExtensions() {
		ArrayList<CmisExtensionElement> array= new ArrayList<CmisExtensionElement>();
		array.addAll(this.extensions);
		return array;
	} 

	public void setExtensions(List<CmisExtensionElement> arg0) {
	this.extensions=new ArrayList<CmisExtensionElementImpl>();
	Iterator<CmisExtensionElement> it = arg0.iterator();
		while (it.hasNext()){
			this.extensions.add((CmisExtensionElementImpl) it.next());
		}		
	}

}
