// Path: app/models/DomainModel.java
// @MappedSuperclass
// public abstract class DomainModel extends GenericModel {
// 
// 	@Id
// 	public long pk;
// 
// }
// 
// Path: app/models/Series.java
// @Entity
// public class Series extends DomainModel {
// 
// 	public String series_no;
// 	public String series_iuid;
// 	public String station_name;
// 	public String series_desc;
// 	public String modality;
// 	@ManyToOne
// 	@JoinColumn(name="study_fk")
// 	public Study study;
// 	@OneToMany(mappedBy = "series")
// 	public Set<Instance> instances;
// 
// 	public String toDownloadString() {
// 		return String.format("%s_%s_%s", study.toDownloadString(), series_no, series_desc).replaceAll("\\W+", "");
// 	}
// 
// }
// 
// Path: app/models/Study.java
// @Entity
// //@NamedNativeQuery(name = "nativeSQL", query = "select * from study", resultClass = Study.class)
// public class Study extends DomainModel {
// 
// 	public String study_id;
// 	public String study_desc;
// 	public Date study_datetime;
// 	public String study_custom1;
// 	public Date created_time;
// 	@ManyToOne
// 	@JoinColumn(name="patient_fk")
// 	public Patient patient;
// 	@OneToMany(mappedBy = "study")
// 	public Set<Series> series;
// 	@OneToMany(mappedBy = "study")
// 	public Set<ProjectAssociation> projectAssociations;
// 
// 	public List<ProjectAssociation> getProjectAssociations() {
// 		return ProjectAssociation.find("select projectAssociation from Project project, in(project.projectAssociations) projectAssociation where projectAssociation.study = ?", this).fetch();
// 	}
// 
// 	public String toDownloadString() {
// 		List<String> parts = new ArrayList<String>();
// 		List<ProjectAssociation> projectAssociations = getProjectAssociations();
// 		if (projectAssociations.size() > 0) {
// 			ProjectAssociation projectAssociation = projectAssociations.iterator().next();
// 			if (projectAssociation.participationID != null && !projectAssociation.participationID.isEmpty()) {
// 				parts.add(projectAssociation.participationID);
// 			}
// 			parts.add(projectAssociation.project.name);
// 		}
// 		parts.add(new SimpleDateFormat("yyyyMMddHHmm").format(study_datetime));
// 		String station_name = getStation_name();
// 		if (station_name != null) {
// 			parts.add(station_name);
// 		}
// 		return StringUtils.join(parts, "_").replaceAll("\\W+", "");
// 	}
// 
// 	public String getStation_name() {
// 		Series scannedSeries = (Series) CollectionUtils.find(series, new Predicate() {
// 			@Override
// 			public boolean evaluate(Object arg0) {
// 				return ((Series) arg0).station_name != null;
// 			}
// 		});
// 		return scannedSeries == null ? null : scannedSeries.station_name;
// 	}
// 
// }


import java.lang.reflect.InvocationTargetException;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import models.DomainModel;
import models.Series;
import models.Study;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import play.db.jpa.GenericModel;
	}

	@Override
	public String toString() {
		return StringUtils.join(items, SEPARATOR);
	}

	public static class Item {

		private static final String DELIMITER = ":";
		private static final List types = Arrays.asList(Study.class, Series.class);

		public Class type;
		public long pk;

		public Item(String item) {
			String[] parts = item.split(DELIMITER);
			type = (Class) types.get(Integer.parseInt(parts[0]));
			pk = Long.parseLong(parts[1]);
		}

		private Item(Class type, long pk) {
			this.type = type;
			this.pk = pk;
		}

		public Item(String type, long pk) throws ClassNotFoundException {
			this(Class.forName(String.format("models.%s", type)), pk);
		}

// Path: app/models/DomainModel.java
// @MappedSuperclass
// public abstract class DomainModel extends GenericModel {
// 
// 	@Id
// 	public long pk;
// 
// }
// 
// Path: app/models/Series.java
// @Entity
// public class Series extends DomainModel {
// 
// 	public String series_no;
// 	public String series_iuid;
// 	public String station_name;
// 	public String series_desc;
// 	public String modality;
// 	@ManyToOne
// 	@JoinColumn(name="study_fk")
// 	public Study study;
// 	@OneToMany(mappedBy = "series")
// 	public Set<Instance> instances;
// 
// 	public String toDownloadString() {
// 		return String.format("%s_%s_%s", study.toDownloadString(), series_no, series_desc).replaceAll("\\W+", "");
// 	}
// 
// }
// 
// Path: app/models/Study.java
// @Entity
// //@NamedNativeQuery(name = "nativeSQL", query = "select * from study", resultClass = Study.class)
// public class Study extends DomainModel {
// 
// 	public String study_id;
// 	public String study_desc;
// 	public Date study_datetime;
// 	public String study_custom1;
// 	public Date created_time;
// 	@ManyToOne
// 	@JoinColumn(name="patient_fk")
// 	public Patient patient;
// 	@OneToMany(mappedBy = "study")
// 	public Set<Series> series;
// 	@OneToMany(mappedBy = "study")
// 	public Set<ProjectAssociation> projectAssociations;
// 
// 	public List<ProjectAssociation> getProjectAssociations() {
// 		return ProjectAssociation.find("select projectAssociation from Project project, in(project.projectAssociations) projectAssociation where projectAssociation.study = ?", this).fetch();
// 	}
// 
// 	public String toDownloadString() {
// 		List<String> parts = new ArrayList<String>();
// 		List<ProjectAssociation> projectAssociations = getProjectAssociations();
// 		if (projectAssociations.size() > 0) {
// 			ProjectAssociation projectAssociation = projectAssociations.iterator().next();
// 			if (projectAssociation.participationID != null && !projectAssociation.participationID.isEmpty()) {
// 				parts.add(projectAssociation.participationID);
// 			}
// 			parts.add(projectAssociation.project.name);
// 		}
// 		parts.add(new SimpleDateFormat("yyyyMMddHHmm").format(study_datetime));
// 		String station_name = getStation_name();
// 		if (station_name != null) {
// 			parts.add(station_name);
// 		}
// 		return StringUtils.join(parts, "_").replaceAll("\\W+", "");
// 	}
// 
// 	public String getStation_name() {
// 		Series scannedSeries = (Series) CollectionUtils.find(series, new Predicate() {
// 			@Override
// 			public boolean evaluate(Object arg0) {
// 				return ((Series) arg0).station_name != null;
// 			}
// 		});
// 		return scannedSeries == null ? null : scannedSeries.station_name;
// 	}
// 
// }


// Path: app/util/Clipboard.java
import java.lang.reflect.InvocationTargetException;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import models.DomainModel;
import models.Series;
import models.Study;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import play.db.jpa.GenericModel;

	}

	@Override
	public String toString() {
		return StringUtils.join(items, SEPARATOR);
	}

	public static class Item {

		private static final String DELIMITER = ":";
		private static final List types = Arrays.asList(Study.class, Series.class);

		public Class type;
		public long pk;

		public Item(String item) {
			String[] parts = item.split(DELIMITER);
			type = (Class) types.get(Integer.parseInt(parts[0]));
			pk = Long.parseLong(parts[1]);
		}

		private Item(Class type, long pk) {
			this.type = type;
			this.pk = pk;
		}

		public Item(String type, long pk) throws ClassNotFoundException {
			this(Class.forName(String.format("models.%s", type)), pk);
		}

		public Item(DomainModel object) {