teichmann@5861: /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
teichmann@5861: * Software engineering by Intevation GmbH
teichmann@5861: *
teichmann@5993: * This file is Free Software under the GNU AGPL (>=v3)
teichmann@5861: * and comes with ABSOLUTELY NO WARRANTY! Check out the
teichmann@5993: * documentation coming with Dive4Elements River for details.
teichmann@5861: */
teichmann@5861:
teichmann@5835: package org.dive4elements.river.client.shared.model;
ingo@67:
ingo@67: import java.util.List;
felix@1435: import java.util.Map;
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:
gernotbelger@9499: private static final long serialVersionUID = 1L;
gernotbelger@9499:
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: * An empty constructor.
ingo@67: */
ingo@67: public DefaultCollectionItem() {
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: *
gernotbelger@9499: * @param identifier
gernotbelger@9499: * The identifier of an artifact.
gernotbelger@9499: * @param outputModes
gernotbelger@9499: * The output modes supported by this item.
ingo@67: */
gernotbelger@9499: public DefaultCollectionItem(final String identifier, final String hash, final List modes, final Map data) {
gernotbelger@9499: this.identifier = identifier;
gernotbelger@9499: this.hash = hash;
ingo@67: this.outputModes = modes;
gernotbelger@9499: this.data = data;
ingo@67: }
ingo@67:
gernotbelger@9499: @Override
ingo@67: public String identifier() {
gernotbelger@9499: return this.identifier;
ingo@67: }
ingo@67:
gernotbelger@9499: @Override
ingo@87: public String hash() {
gernotbelger@9499: return this.hash;
ingo@87: }
ingo@87:
gernotbelger@9499: @Override
ingo@67: public List getOutputModes() {
gernotbelger@9499: return this.outputModes;
ingo@67: }
ingo@67:
gernotbelger@9499: @Override
gernotbelger@9499: public List getFacets(final String outputmode) {
gernotbelger@9499: for (final OutputMode mode : this.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: * Returns artifact data.
gernotbelger@9499: *
felix@1435: * @return key/value data map
felix@1435: */
gernotbelger@9499: @Override
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 :