felix@1026: package de.intevation.flys.artifacts.states;
felix@1026: 
felix@1026: import java.util.List;
felix@1026: 
felix@1026: import org.apache.log4j.Logger;
felix@1026: 
felix@1026: import de.intevation.artifacts.CallMeta;
felix@1026: 
felix@1026: import de.intevation.artifactdatabase.state.Facet;
felix@1026: 
felix@4017: import de.intevation.flys.artifacts.AnnotationArtifact;
felix@1026: import de.intevation.flys.artifacts.FLYSArtifact;
felix@1026: 
felix@1026: import de.intevation.flys.artifacts.model.AnnotationFacet;
felix@1026: import de.intevation.flys.artifacts.model.FacetTypes;
felix@1026: 
felix@1026: import de.intevation.flys.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: 
felix@1026:     /** The logger that is used in this state. */
felix@1026:     private static final Logger logger = 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(
felix@1026:         FLYSArtifact artifact,
felix@1026:         String       hash,
felix@1026:         Object       context,
felix@1026:         CallMeta     meta,
felix@1026:         List<Facet>  facets
felix@1026:     ) {
felix@1026:         logger.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 :