package org.gcube.application.framework.core.commons.model; import java.io.Serializable; import java.util.HashMap; import java.util.Vector; import org.apache.axis.message.addressing.EndpointReferenceType; /** * Collection's information * @author valia, giotak, UoA * */ //TODO: Done!!! public class CollectionInfo implements Serializable{ /** * */ private static final long serialVersionUID = 1L; protected String id; protected String name; protected String shortName; protected String description; protected String reference; protected Vector schemata; protected Vector metadataIDs; protected Vector languages; protected Vector indices; protected HashMap forward; /** * @return collection's description */ public String getDescription() { return description; } /** * @param description collection's description */ public void setDescription(String description) { this.description = description; } /** * @return collection's ID */ public String getId() { return id; } /** * @param id collection's ID */ public void setId(String id) { this.id = id; } /** * @return collection's name */ public String getName() { return name; } /** * @param name collection's name */ public void setName(String name) { this.name = name; } /** * Constructor of the class */ public CollectionInfo() { id = ""; name = ""; shortName = ""; description = ""; reference = ""; schemata = new Vector(); metadataIDs = new Vector(); languages = new Vector(); indices = new Vector(); forward = new HashMap(); } /** * @param i the position of the metadata schema * @return the schema in the specified position. */ public String getSchema(int i) { return schemata.get(i); } /** * @param i the position of the metadata schema * @return metadata's ID */ public String getMetadataID(int i) { return metadataIDs.get(i); } /** * @param i the position of the metadata schema * @return the language for this schema */ public String getLanguage(int i) { return languages.get(i); } /** * @param i the position of the metadata schema * @return an object that contains info about the existence or not of specific indices */ public IndexInfo getIndexInfo(int i) { return indices.get(i); } /** * @return the collection's short name */ public String getShortName() { return shortName; } /** * @param shortName the collection's short name */ public void setShortName(String shortName) { this.shortName = shortName; } /** * @param schema collection's schema name (e.g. dc, tei) * @param metaID the ID of the metadata collection * @param language metadata collection's language * @param index the indices that collection has */ public void setMetadataCollection(String schema, String metaID, String language, IndexInfo index) { this.schemata.add(schema); this.metadataIDs.add(metaID); this.languages.add(language); this.indices.add(index); } /** * @return the reference to this collection (usually a url) */ public String getReference() { return reference; } /** * @param reference the reference to this collection (usually a url) */ public void setReference(String reference) { this.reference = reference; } /** * @param schema metadata collection's schema * @return true if this collection has a corresponding metadata collection with this schema, otherwise false. */ public boolean hasSchema(String schema) { return this.schemata.contains(schema); } /** * @param schema metadata collection's schema * @return true if this collection has a corresponding metadata collection with this schema, otherwise false. */ public int getIndexOfSchema(String schema) { return this.schemata.indexOf(schema); } /** * @return the number of corrsponding metadata collections */ public int getMetadataSize() { return this.metadataIDs.size(); } /** * @return the forward indices stored in a hasmap. The key to the hasmap is collection together with the field, and the value is an EPR to the index. */ public HashMap getForward() { return forward; } }