// Path: flyJenkins/src/main/java/com/agun/flyJenkins/model/ProductionMeta.java
// public class ProductionMeta {
// 	
// 	private String jobName;
// 	private Date createDate;
// 	private String productionPath;
// 	private String productionPathOfJob;	
// 	private int serviceGroup;
// 	private int buildNumber;
// 	
// 	public String getJobName() {
// 		return jobName;
// 	}
// 	
// 	public void setJobName(String jobName) {
// 		this.jobName = jobName;
// 	}
// 	
// 	public int getBuildNumber() {
// 		return buildNumber;
// 	}
// 	
// 	public void setBuildNumber(int buildNumber) {
// 		this.buildNumber = buildNumber;
// 	}
// 	
// 	public Date getCreateDate() {
// 		return createDate;
// 	}
// 	
// 	public void setCreateDate(Date createDate) {
// 		this.createDate = createDate;
// 	}
// 	
// 	public int getServiceGroup() {
// 		return serviceGroup;
// 	}
// 	
// 	public void setServiceGroup(int serviceGroup) {
// 		this.serviceGroup = serviceGroup;
// 	}
// 	
// 	public String getProductionPath() {
// 		return productionPath;
// 	}
// 	
// 	public void setProductionPath(String productionPath) {
// 		this.productionPath = productionPath;
// 	}
// 
// 	public String getProductionPathOfJob() {
// 		return productionPathOfJob;
// 	}
// 
// 	public void setProductionPathOfJob(String productionPathOfJob) {
// 		this.productionPathOfJob = productionPathOfJob;
// 	}
// }
// 
// Path: flyJenkins/src/main/java/com/agun/flyJenkins/model/util/ModelSoting.java
// public class ModelSoting {
// 	public static void serviceSortByWeight(List<ServiceMeta> serviceMetaList){
// 
// 		Comparator<ServiceMeta> comparator =  new Comparator<ServiceMeta>() {
// 			public int compare(ServiceMeta o1, ServiceMeta o2) {
// 				return (o1.getWeight() > o2.getWeight())? 1 : -1 ;
// 			}
// 		
// 		};
// 		Collections.sort(serviceMetaList, comparator);
// 	}
// 	
// 	public static void productionSortDate(List<ProductionMeta> productionList){
// 		Comparator<ProductionMeta> comparator =  new Comparator<ProductionMeta>() {
// 			public int compare(ProductionMeta o1, ProductionMeta o2) {
// 				return (o1.getCreateDate().getTime() < o2.getCreateDate().getTime())? 1 : -1 ;
// 			}
// 		};
// 		
// 		Collections.sort(productionList, comparator);
// 
// 	}
// 	
// 	
// 	public static void deployRequestSortDate(List<DeployRequest> deployRequestList){
// 		Comparator<DeployRequest> comparator =  new Comparator<DeployRequest>() {
// 			public int compare(DeployRequest o1, DeployRequest o2) {
// 				return (o1.getDate().getTime() < o2.getDate().getTime())? 1 : -1 ;
// 			}
// 		};
// 		Collections.sort(deployRequestList, comparator);
// 	}
// 	
// 	public static void deployLogSortDate(List<DeployLog> deployLogList){
// 		Comparator<DeployLog> comparator =  new Comparator<DeployLog>() {
// 			public int compare(DeployLog o1, DeployLog o2) {
// 				return (o1.getDate().getTime() < o2.getDate().getTime())? 1 : -1 ;
// 			}
// 		};
// 		Collections.sort(deployLogList, comparator);
// 	}
// 	
// 	public static void deployReportSortId(List<DeployReport> deployReportList){
// 		Comparator<DeployReport> comparator =  new Comparator<DeployReport>() {
// 			public int compare(DeployReport o1, DeployReport o2) {
// 				return o2.getDeployId().compareTo(o1.getDeployId());
// 			}
// 		};
// 		Collections.sort(deployReportList, comparator);
// 	}
// }


import java.io.File;
import java.io.IOException;
import java.util.List;
import com.agun.flyJenkins.model.ProductionMeta;
import com.agun.flyJenkins.model.util.ModelSoting;
import jenkins.model.Jenkins;
import hudson.BulkChange;
import hudson.XmlFile;
import hudson.model.Saveable;
import hudson.model.listeners.SaveableListener;

        } catch (IOException e) {
           	e.printStackTrace();
        }
		
	}
	protected XmlFile getConfigFile() {
		
	    return new XmlFile(new File(Jenkins.getInstance().getRootDir(), this.getClass().getSimpleName()+".xml"));
    }

	
	/**
	 * open file and load data
	 */
	 public synchronized void load() {
		 XmlFile file = getConfigFile();
		 if(!file.exists())
			 return;
		 try {
			 file.unmarshal(this);
		 } catch (IOException e) {
			 e.printStackTrace();
		 }
	 }
	 
	public List<ProductionMeta> getProductionMetaList() {
		return productionMetaList;
	}
	
	public void setProductionMetaList(List<ProductionMeta> productionMetaList) {

// Path: flyJenkins/src/main/java/com/agun/flyJenkins/model/ProductionMeta.java
// public class ProductionMeta {
// 	
// 	private String jobName;
// 	private Date createDate;
// 	private String productionPath;
// 	private String productionPathOfJob;	
// 	private int serviceGroup;
// 	private int buildNumber;
// 	
// 	public String getJobName() {
// 		return jobName;
// 	}
// 	
// 	public void setJobName(String jobName) {
// 		this.jobName = jobName;
// 	}
// 	
// 	public int getBuildNumber() {
// 		return buildNumber;
// 	}
// 	
// 	public void setBuildNumber(int buildNumber) {
// 		this.buildNumber = buildNumber;
// 	}
// 	
// 	public Date getCreateDate() {
// 		return createDate;
// 	}
// 	
// 	public void setCreateDate(Date createDate) {
// 		this.createDate = createDate;
// 	}
// 	
// 	public int getServiceGroup() {
// 		return serviceGroup;
// 	}
// 	
// 	public void setServiceGroup(int serviceGroup) {
// 		this.serviceGroup = serviceGroup;
// 	}
// 	
// 	public String getProductionPath() {
// 		return productionPath;
// 	}
// 	
// 	public void setProductionPath(String productionPath) {
// 		this.productionPath = productionPath;
// 	}
// 
// 	public String getProductionPathOfJob() {
// 		return productionPathOfJob;
// 	}
// 
// 	public void setProductionPathOfJob(String productionPathOfJob) {
// 		this.productionPathOfJob = productionPathOfJob;
// 	}
// }
// 
// Path: flyJenkins/src/main/java/com/agun/flyJenkins/model/util/ModelSoting.java
// public class ModelSoting {
// 	public static void serviceSortByWeight(List<ServiceMeta> serviceMetaList){
// 
// 		Comparator<ServiceMeta> comparator =  new Comparator<ServiceMeta>() {
// 			public int compare(ServiceMeta o1, ServiceMeta o2) {
// 				return (o1.getWeight() > o2.getWeight())? 1 : -1 ;
// 			}
// 		
// 		};
// 		Collections.sort(serviceMetaList, comparator);
// 	}
// 	
// 	public static void productionSortDate(List<ProductionMeta> productionList){
// 		Comparator<ProductionMeta> comparator =  new Comparator<ProductionMeta>() {
// 			public int compare(ProductionMeta o1, ProductionMeta o2) {
// 				return (o1.getCreateDate().getTime() < o2.getCreateDate().getTime())? 1 : -1 ;
// 			}
// 		};
// 		
// 		Collections.sort(productionList, comparator);
// 
// 	}
// 	
// 	
// 	public static void deployRequestSortDate(List<DeployRequest> deployRequestList){
// 		Comparator<DeployRequest> comparator =  new Comparator<DeployRequest>() {
// 			public int compare(DeployRequest o1, DeployRequest o2) {
// 				return (o1.getDate().getTime() < o2.getDate().getTime())? 1 : -1 ;
// 			}
// 		};
// 		Collections.sort(deployRequestList, comparator);
// 	}
// 	
// 	public static void deployLogSortDate(List<DeployLog> deployLogList){
// 		Comparator<DeployLog> comparator =  new Comparator<DeployLog>() {
// 			public int compare(DeployLog o1, DeployLog o2) {
// 				return (o1.getDate().getTime() < o2.getDate().getTime())? 1 : -1 ;
// 			}
// 		};
// 		Collections.sort(deployLogList, comparator);
// 	}
// 	
// 	public static void deployReportSortId(List<DeployReport> deployReportList){
// 		Comparator<DeployReport> comparator =  new Comparator<DeployReport>() {
// 			public int compare(DeployReport o1, DeployReport o2) {
// 				return o2.getDeployId().compareTo(o1.getDeployId());
// 			}
// 		};
// 		Collections.sort(deployReportList, comparator);
// 	}
// }


// Path: flyJenkins/src/main/java/com/agun/flyJenkins/persistence/ProductionSaveable.java
import java.io.File;
import java.io.IOException;
import java.util.List;
import com.agun.flyJenkins.model.ProductionMeta;
import com.agun.flyJenkins.model.util.ModelSoting;
import jenkins.model.Jenkins;
import hudson.BulkChange;
import hudson.XmlFile;
import hudson.model.Saveable;
import hudson.model.listeners.SaveableListener;

        } catch (IOException e) {
           	e.printStackTrace();
        }
		
	}
	protected XmlFile getConfigFile() {
		
	    return new XmlFile(new File(Jenkins.getInstance().getRootDir(), this.getClass().getSimpleName()+".xml"));
    }

	
	/**
	 * open file and load data
	 */
	 public synchronized void load() {
		 XmlFile file = getConfigFile();
		 if(!file.exists())
			 return;
		 try {
			 file.unmarshal(this);
		 } catch (IOException e) {
			 e.printStackTrace();
		 }
	 }
	 
	public List<ProductionMeta> getProductionMetaList() {
		return productionMetaList;
	}
	
	public void setProductionMetaList(List<ProductionMeta> productionMetaList) {

		this.productionMetaList = productionMetaList;
