Mercurial > dive4elements > framework
changeset 290:995fa6994480
Outputs can have a member variable 'type' that should make it easier to distinguish the type of an Output.
artifacts/trunk@2310 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Fri, 08 Jul 2011 08:20:59 +0000 |
parents | cf2e8cca02b7 |
children | f8c4fa292c9c |
files | ChangeLog artifact-database/src/main/java/de/intevation/artifactdatabase/ProtocolUtils.java artifact-database/src/main/java/de/intevation/artifactdatabase/state/AbstractState.java artifact-database/src/main/java/de/intevation/artifactdatabase/state/DefaultOutput.java artifact-database/src/main/java/de/intevation/artifactdatabase/state/Output.java |
diffstat | 5 files changed, 70 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Tue Jun 28 07:51:17 2011 +0000 +++ b/ChangeLog Fri Jul 08 08:20:59 2011 +0000 @@ -1,3 +1,16 @@ +2011-07-08 Ingo Weinzierl <ingo@intevation.de> + + * artifact-database/src/main/java/de/intevation/artifactdatabase/state/Output.java, + artifact-database/src/main/java/de/intevation/artifactdatabase/state/DefaultOutput.java: + An Output can have a type (string) declaration now that should make it + easier to distinguish different Output types. + + * artifact-database/src/main/java/de/intevation/artifactdatabase/state/AbstractState.java: + Read the attribute "type" from OutputMode's configuration section. + + * artifact-database/src/main/java/de/intevation/artifactdatabase/ProtocolUtils.java: + Write the member variable "type" to an OutputMode. + 2011-06-28 Ingo Weinzierl <ingo@intevation.de> Tagged RELEASE 1.3
--- a/artifact-database/src/main/java/de/intevation/artifactdatabase/ProtocolUtils.java Tue Jun 28 07:51:17 2011 +0000 +++ b/artifact-database/src/main/java/de/intevation/artifactdatabase/ProtocolUtils.java Fri Jul 08 08:20:59 2011 +0000 @@ -165,8 +165,12 @@ Element newOut = createArtNode( creator, "output", - new String[] {"name", "description", "mime-type"}, - new String[] {o.getName(),o.getDescription(),o.getMimeType()}); + new String[] {"name", "description", "mime-type", "type"}, + new String[] { + o.getName(), + o.getDescription(), + o.getMimeType(), + o.getType() }); Element facets = createArtNode(creator, "facets", null, null); appendFacets(creator, facets, o.getFacets());
--- a/artifact-database/src/main/java/de/intevation/artifactdatabase/state/AbstractState.java Tue Jun 28 07:51:17 2011 +0000 +++ b/artifact-database/src/main/java/de/intevation/artifactdatabase/state/AbstractState.java Fri Jul 08 08:20:59 2011 +0000 @@ -240,6 +240,9 @@ String mimetype = XMLUtils.xpathString( out, "@mime-type", ArtifactNamespaceContext.INSTANCE); + String type = XMLUtils.xpathString( + out, "@type", ArtifactNamespaceContext.INSTANCE); + if (name == null) { return null; } @@ -251,7 +254,7 @@ ArtifactNamespaceContext.INSTANCE); if (facets == null || facets.getLength() == 0) { - return new DefaultOutput(name, desc, mimetype); + return new DefaultOutput(name, desc, mimetype, type); } int num = facets.getLength(); @@ -266,7 +269,7 @@ } } - return new DefaultOutput(name, desc, mimetype, facetList); + return new DefaultOutput(name, desc, mimetype, facetList, type); }
--- a/artifact-database/src/main/java/de/intevation/artifactdatabase/state/DefaultOutput.java Tue Jun 28 07:51:17 2011 +0000 +++ b/artifact-database/src/main/java/de/intevation/artifactdatabase/state/DefaultOutput.java Fri Jul 08 08:20:59 2011 +0000 @@ -16,6 +16,8 @@ protected String mimeType; + protected String type; + protected List<Facet> facets; @@ -30,10 +32,37 @@ this.name = name; this.description = description; this.mimeType = mimeType; + this.type = ""; this.facets = new ArrayList<Facet>(); } + public DefaultOutput( + String name, + String description, + String mimeType, + String type) + { + this(name, description, mimeType); + + this.facets = new ArrayList<Facet>(); + this.type = type; + } + + + public DefaultOutput( + String name, + String description, + String mimeType, + List<Facet> facets) + { + this(name, description, mimeType); + + this.type = ""; + this.facets = facets; + } + + /** * This constructor builds a new Output object that contains facets as well. * @@ -46,11 +75,12 @@ String name, String description, String mimeType, - List<Facet> facets) + List<Facet> facets, + String type) { - this(name, description, mimeType); + this(name, description, mimeType, facets); - this.facets = facets; + this.type = type; } @@ -84,6 +114,11 @@ } + public String getType() { + return type; + } + + /** * Returns the list of facets supported by this output. *
--- a/artifact-database/src/main/java/de/intevation/artifactdatabase/state/Output.java Tue Jun 28 07:51:17 2011 +0000 +++ b/artifact-database/src/main/java/de/intevation/artifactdatabase/state/Output.java Fri Jul 08 08:20:59 2011 +0000 @@ -29,6 +29,14 @@ */ public String getMimeType(); + + /** + * Returns the type of this output. + * + * @return the type. + */ + public String getType(); + /** * Retrieve the facets of this output. *