ingo@67: package de.intevation.flys.client.shared.model;
ingo@67:
ingo@67: import java.util.List;
felix@1435: import java.util.Map;
ingo@67:
ingo@67:
ingo@67: /**
felix@1435: * The default implementation of a CollectionItem (artifact).
ingo@67: *
ingo@67: * @author Ingo Weinzierl
ingo@67: */
ingo@67: public class DefaultCollectionItem implements CollectionItem {
ingo@67:
felix@1435: /** The identifier that specifies the artifact related to this item. */
ingo@67: protected String identifier;
ingo@67:
felix@1435: /** The hash that specifies the artifact related to this item. */
ingo@87: protected String hash;
ingo@87:
felix@1435: /** The list of output modes supported by the artifact of this item. */
ingo@67: protected List outputModes;
ingo@67:
felix@1435: /** The map of datanames to data values. */
felix@1435: protected Map data;
felix@1435:
ingo@67:
ingo@67: /**
ingo@67: * An empty constructor.
ingo@67: */
ingo@67: public DefaultCollectionItem() {
ingo@67: }
ingo@67:
ingo@67:
ingo@67: /**
ingo@67: * The default constructor to create a new CollectionItem related to an
ingo@67: * artifact with output modes.
ingo@67: *
ingo@67: * @param identifier The identifier of an artifact.
ingo@67: * @param outputModes The output modes supported by this item.
ingo@67: */
ingo@87: public DefaultCollectionItem(
ingo@87: String identifier,
ingo@87: String hash,
felix@1435: List modes,
felix@1435: Map data
felix@1435: ) {
ingo@67: this.identifier = identifier;
ingo@87: this.hash = hash;
ingo@67: this.outputModes = modes;
felix@1435: this.data = data;
ingo@67: }
ingo@67:
ingo@67:
felix@1435:
ingo@67: public String identifier() {
ingo@67: return identifier;
ingo@67: }
ingo@67:
ingo@67:
ingo@87: public String hash() {
ingo@87: return hash;
ingo@87: }
ingo@87:
ingo@87:
ingo@67: public List getOutputModes() {
ingo@67: return outputModes;
ingo@67: }
ingo@67:
ingo@67:
ingo@67: public List getFacets(String outputmode) {
ingo@67: for (OutputMode mode: outputModes) {
ingo@67: if (outputmode.equals(mode.getName())) {
ingo@67: // TODO Return facets, but facets are not implemented for
ingo@67: // OutputModes yet!
ingo@67: }
ingo@67: }
ingo@67:
ingo@67: return null;
ingo@67: }
felix@1435:
felix@1435:
felix@1435: /**
felix@1435: * Returns artifact data.
felix@1435: * @return key/value data map
felix@1435: */
felix@1435: public Map getData() {
felix@1435: return this.data;
felix@1435: }
ingo@67: }
ingo@67: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :