# HG changeset patch # User Felix Wolfsteller # Date 1314268943 0 # Node ID ef756e16615410edc3aa0de6c5b4d66a4cc2dd5e # Parent 048517d67215ab842b141955c1651b895ea9c8b1 Improved implementation of MainValueArtifact#MainValueFacet . flys-artifacts/trunk@2576 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r 048517d67215 -r ef756e166154 flys-artifacts/ChangeLog --- a/flys-artifacts/ChangeLog Thu Aug 25 10:38:45 2011 +0000 +++ b/flys-artifacts/ChangeLog Thu Aug 25 10:42:23 2011 +0000 @@ -1,3 +1,9 @@ +2011-08-25 Felix Wolfsteller + + * src/main/java/de/intevation/flys/artifacts/MainValuesArtifact.java + (MainValueFacet): + Improved and straightened implementation, added code-Annotations and Todos. + 2011-08-25 Felix Wolfsteller * src/main/java/de/intevation/flys/artifacts/MainValuesArtifact.java diff -r 048517d67215 -r ef756e166154 flys-artifacts/src/main/java/de/intevation/flys/artifacts/MainValuesArtifact.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/MainValuesArtifact.java Thu Aug 25 10:38:45 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/MainValuesArtifact.java Thu Aug 25 10:42:23 2011 +0000 @@ -140,44 +140,26 @@ } - /* FACET IMPLEMENTATION */ - class MainValuesFacet extends DefaultFacet { + /* FACET IMPLEMENTATION */ + // TODO evaluate whether DefaultFacet can do. + static class MainValuesFacet + extends DefaultFacet + implements FacetTypes { - public MainValuesFacet() - { - description = "facet.mainvalues"; - name = "facet.mainvalues"; - index = 0; + public MainValuesFacet() { + description = "facet.discharge_curves.mainvalues.description"; + name = COMPUTED_DISCHARGE_MAINVALUES; + //Resources.getMsg(meta, I18N_DESCRIPTION, I18N_DESCRIPTION)); + index = 0; } - // TODO implement; what is index used for? - /** - * Returns the index of this facet. - * - * @return the index of this facet. - */ - public int getIndex() { - return 0; - } - - - /** - * Returns the name of this facet. - * - * @return the name of this facet. - */ - public String getName() { - // TODO define, static - // TODO remove, is part of DefaultFacet. - return "facet.mainvalue"; - } - - + /** * Returns the description of this facet. * * @return the description of this facet. */ + @Override public String getDescription() { // TODO remove, is part of DefaultFacet. return "facet.mainvalues"; @@ -187,20 +169,23 @@ /** * Returns the data this facet requires. * - * @param artifact The owner artifact. - * @param context The CallContext. + * @param artifact the owner artifact. + * @param context the CallContext (ignored). * * @return the data. */ + @Override public Object getData(Artifact artifact, CallContext context) { - return null; + MainValuesArtifact mvArtifact = (MainValuesArtifact) artifact; + return mvArtifact.getMainValues(); } /** * Create a deep copy of this Facet. * @return a deep copy. - */ + */ + @Override public MainValuesFacet deepCopy() { MainValuesFacet copy = new MainValuesFacet(); copy.set(this);