# HG changeset patch # User Ingo Weinzierl # Date 1310113259 0 # Node ID 995fa6994480fe3bf663520a81b2ccb99e183934 # Parent cf2e8cca02b7cd59474bd21bc9912298c94771e7 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 diff -r cf2e8cca02b7 -r 995fa6994480 ChangeLog --- 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 + + * 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 Tagged RELEASE 1.3 diff -r cf2e8cca02b7 -r 995fa6994480 artifact-database/src/main/java/de/intevation/artifactdatabase/ProtocolUtils.java --- 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()); diff -r cf2e8cca02b7 -r 995fa6994480 artifact-database/src/main/java/de/intevation/artifactdatabase/state/AbstractState.java --- 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); } diff -r cf2e8cca02b7 -r 995fa6994480 artifact-database/src/main/java/de/intevation/artifactdatabase/state/DefaultOutput.java --- 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 facets; @@ -30,10 +32,37 @@ this.name = name; this.description = description; this.mimeType = mimeType; + this.type = ""; this.facets = new ArrayList(); } + public DefaultOutput( + String name, + String description, + String mimeType, + String type) + { + this(name, description, mimeType); + + this.facets = new ArrayList(); + this.type = type; + } + + + public DefaultOutput( + String name, + String description, + String mimeType, + List 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 facets) + List 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. * diff -r cf2e8cca02b7 -r 995fa6994480 artifact-database/src/main/java/de/intevation/artifactdatabase/state/Output.java --- 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. *