package be.shoktan.BeeBreedingManager.model;

import java.util.Collection;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Model class to represent a modpack
 * @author Wisthy
 *
 */
public class Modpack extends ANamedEntity {
	private static final Logger LOG = LoggerFactory.getLogger(Modpack.class);
	private Collection<PluginVersion> plugins;
	
	
	
	// ********** getters & setters ********** //

	/**
	 * @return the plugins
	 */
	public Collection<PluginVersion> getPlugins() {
		return plugins;
	}

	/**
	 * @param plugins the plugins to set
	 */
	public void setPlugins(Collection<PluginVersion> plugins) {
		this.plugins = plugins;
	}
	
	
	
	// ********** others ********** //
	
	/**
	 * run validations check on the plugins list to ensure it is correct.
	 */
	public boolean validatePluginList(){
		if(LOG.isTraceEnabled())LOG.trace("starting validation of the plugin list");
		boolean isValid = true;
		for(PluginVersion pluginVersion : plugins){
			if(pluginVersion == null){
				LOG.error("there is a null plugin in the list");
				isValid = false;
				continue;
			}
			pluginVersion.validate();
		}
		if(LOG.isTraceEnabled())LOG.trace("end of the validation of the plugin list");
		return isValid;
	}
}

@@ -67,16 +67,144 @@
 lection;
+%0Aimport java.util.SortedSet;%0Aimport java.util.TreeSet;%0A%0Aimport javax.persistence.ManyToMany;%0Aimport javax.persistence.OneToMany;
 %0A%0Aimport
@@ -441,16 +441,53 @@
 class);%0A
+%09%0A%09@ManyToMany(mappedBy = %22modpack%22)%0A
 %09private
@@ -524,16 +524,100 @@
 gins;%0A%09%0A
+%09@OneToMany(mappedBy = %22modpack%22)%0A%09private Collection%3CBeeCollection%3E collections;%0A%09%0A
 %09%0A%09%0A%09// 
@@ -905,16 +905,297 @@
 s;%0A%09%7D%0A%09%0A
+%09/**%0A%09 * @return the collections%0A%09 */%0A%09public Collection%3CBeeCollection%3E getCollections() %7B%0A%09%09return collections;%0A%09%7D%0A%0A%09/**%0A%09 * @param collections the collections to set%0A%09 */%0A%09public void setCollections(Collection%3CBeeCollection%3E collections) %7B%0A%09%09this.collections = collections;%0A%09%7D%0A%09%0A
 %09%0A%09%0A%09// 
@@ -1228,16 +1228,18 @@
 ** //%0A%09%0A
+%0A%0A
 %09/**%0A%09 *
@@ -1454,16 +1454,73 @@
 = true;%0A
+%09%09%0A%09%09SortedSet%3CEPlugin%3E pluginSet = new TreeSet%3C%3E(); %0A%09%09%0A
 %09%09for(Pl
@@ -1683,16 +1683,243 @@
 %09%09%09%7D%0A%09%09%09
+EPlugin plugin = pluginVersion.getPlugin();%0A%09%09%09if(pluginSet.contains(plugin))%7B%0A%09%09%09%09LOG.error(%22the plugin %3C%22+plugin+%22%3E is present more than one time%22);%0A%09%09%09%09isValid = false;%0A%09%09%09%7Delse%7B%0A%09%09%09%09pluginSet.add(plugin);%0A%09%09%09%7D%0A%09%09%09isValid = 
 pluginVe
@@ -1934,16 +1934,27 @@
 lidate()
+ && isValid
 ;%0A%09%09%7D%0A%09%09
@@ -2024,25 +2024,46 @@
  plugin list
-%22
+ with result %22+isValid
 );%0A%09%09return 

Update Modpack.java