teichmann@5863: /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde teichmann@5863: * Software engineering by Intevation GmbH teichmann@5863: * teichmann@5994: * This file is Free Software under the GNU AGPL (>=v3) teichmann@5863: * and comes with ABSOLUTELY NO WARRANTY! Check out the teichmann@5994: * documentation coming with Dive4Elements River for details. teichmann@5863: */ teichmann@5863: teichmann@5831: package org.dive4elements.river.artifacts.states; felix@1026: felix@1026: import java.util.List; felix@1026: felix@1026: import org.apache.log4j.Logger; felix@1026: teichmann@5831: import org.dive4elements.artifacts.CallMeta; felix@1026: teichmann@5831: import org.dive4elements.artifactdatabase.state.Facet; felix@1026: teichmann@5831: import org.dive4elements.river.artifacts.AnnotationArtifact; teichmann@5867: import org.dive4elements.river.artifacts.D4EArtifact; felix@1026: teichmann@5831: import org.dive4elements.river.artifacts.model.AnnotationFacet; teichmann@5831: import org.dive4elements.river.artifacts.model.FacetTypes; teichmann@5831: teichmann@5831: import org.dive4elements.river.artifacts.resources.Resources; felix@1026: felix@1026: felix@1026: /** felix@1026: * The only state for an AnnotationArtifact (River is known). felix@1026: */ felix@1026: public class AnnotationRiverState felix@1026: extends DefaultState felix@1026: implements FacetTypes felix@1026: { felix@1026: /** Developer-centric description of facet. */ felix@1026: public static final String I18N_DESCRIPTION = "facet.longitudinal_section.annotations"; felix@1026: teichmann@8202: /** The log that is used in this state. */ teichmann@8202: private static final Logger log = Logger.getLogger(AnnotationRiverState.class); felix@1026: felix@1026: felix@1026: /** felix@1026: * Add an AnnotationFacet to list of Facets. felix@1026: * felix@1026: * @param artifact Ignored. felix@1026: * @param hash Ignored. felix@1026: * @param context Ignored. felix@1026: * @param meta CallMeta to be used for internationalization. felix@1026: * @param facets List to add AnnotationFacet to. felix@1026: * felix@1026: * @return null. felix@1026: */ felix@1026: @Override felix@1026: public Object computeInit( teichmann@5867: D4EArtifact artifact, felix@1026: String hash, felix@1026: Object context, felix@1026: CallMeta meta, felix@1026: List facets felix@1026: ) { teichmann@8202: log.debug("AnnotationRiverState.computeInit()"); felix@1026: felix@4017: AnnotationArtifact annotationArtifact = (AnnotationArtifact) artifact; felix@4017: felix@4017: String facetName = annotationArtifact.getFilterName(); felix@4017: if (facetName == null) { felix@4017: facetName = Resources.getMsg(meta, I18N_DESCRIPTION, I18N_DESCRIPTION); felix@4017: } felix@4017: felix@1026: AnnotationFacet facet = new AnnotationFacet( felix@1026: 0, felix@1026: LONGITUDINAL_ANNOTATION, felix@4017: facetName); felix@1026: facets.add(facet); felix@1026: felix@1026: return null; felix@1026: } felix@1026: } felix@1026: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :