package jp.ac.nii.prl.mape.monitoring.model;

import java.util.List;

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

import com.fasterxml.jackson.annotation.JsonIgnore;

@Entity
public class Model {

	@GeneratedValue
	@Id
	@JsonIgnore
	private Long id;
	
	@OneToMany(mappedBy="model")
	private List<Instance> instances;
	
	@OneToMany(mappedBy="model")
	private List<SecurityGroup> securityGroups;

	@OneToMany(mappedBy="model")
	private List<InstanceType> instanceTypes;
	
	public void addInstance(Instance instance) {
		instances.add(instance);
	}

	public Long getId() {
		return id;
	}

	public List<Instance> getInstances() {
		return instances;
	}

	public List<InstanceType> getInstanceTypes() {
		return instanceTypes;
	}

	public List<SecurityGroup> getSecurityGroups() {
		return securityGroups;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public void setInstances(List<Instance> instances) {
		this.instances = instances;
	}

	public void setInstanceTypes(List<InstanceType> instanceTypes) {
		this.instanceTypes = instanceTypes;
	}
	
	public void setSecurityGroups(List<SecurityGroup> securityGroups) {
		this.securityGroups = securityGroups;
	}
}

@@ -39,16 +39,44 @@
 model;%0A%0A
+import java.util.ArrayList;%0A
 import j
@@ -432,16 +432,36 @@
 nstances
+ = new ArrayList%3C%3E()
 ;%0A%09%0A%09@On
@@ -529,16 +529,36 @@
 tyGroups
+ = new ArrayList%3C%3E()
 ;%0A%0A%09@One
@@ -623,16 +623,36 @@
 nceTypes
+ = new ArrayList%3C%3E()
 ;%0A%09%0A%09pub
@@ -718,24 +718,226 @@
 nstance);%0A%09%7D
+%0A%09%0A%09public void addInstanceType(InstanceType instanceType) %7B%0A%09%09instanceTypes.add(instanceType);%0A%09%7D%0A%09%0A%09public void addSecurityGroups(SecurityGroup securityGroup) %7B%0A%09%09securityGroups.add(securityGroup);%0A%09%7D
 %0A%0A%09public Lo

Add InstanceTypes and SecurityGroups to Model model. Fix bug