comparison flys-artifacts/src/main/java/de/intevation/flys/collections/OutputParser.java @ 1770:e8a98eee816d

Cosmetics, documentation. flys-artifacts/trunk@3091 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Wed, 26 Oct 2011 12:55:32 +0000
parents a70e0cbc5e02
children 2fe270661b20
comparison
equal deleted inserted replaced
1769:bbe12d77710d 1770:e8a98eee816d
20 import de.intevation.flys.artifacts.model.ManagedFacetAdapter; 20 import de.intevation.flys.artifacts.model.ManagedFacetAdapter;
21 21
22 22
23 public class OutputParser { 23 public class OutputParser {
24 24
25 /** Constant XPath that points to the outputmodes of an artifact.*/ 25 /** Constant XPath that points to the outputmodes of an artifact. */
26 public static final String XPATH_ARTIFACT_OUTPUTMODES = 26 public static final String XPATH_ARTIFACT_OUTPUTMODES =
27 "/art:result/art:outputmodes/art:output"; 27 "/art:result/art:outputmodes/art:output";
28
29 28
30 private static Logger logger = Logger.getLogger(OutputParser.class); 29 private static Logger logger = Logger.getLogger(OutputParser.class);
31 30
32 protected ArtifactDatabase db; 31 protected ArtifactDatabase db;
33 protected CallMeta meta; 32 protected CallMeta meta;
34 protected CallContext context; 33 protected CallContext context;
35 34
36 protected Map<String, Output> outs; 35 protected Map<String, Output> outs;
37 36
38 37
38 /**
39 * @param db Database used to fetch artifacts, outputs and facets.
40 */
39 public OutputParser(ArtifactDatabase db, CallContext context) { 41 public OutputParser(ArtifactDatabase db, CallContext context) {
40 this.db = db; 42 this.db = db;
41 this.meta = context.getMeta(); 43 this.meta = context.getMeta();
42 this.context = context; 44 this.context = context;
43 this.outs = new HashMap<String, Output>(); 45 this.outs = new HashMap<String, Output>();
44 } 46 }
45 47
46 48
49 /**
50 * Gets raw facet with given id and sorts outputs in mapping.
51 * Converts Facets to ManagedFacets on the way.
52 * @param uuid uuid of artifact to load from database.
53 */
47 public void parse(String uuid) 54 public void parse(String uuid)
48 throws ArtifactDatabaseException 55 throws ArtifactDatabaseException
49 { 56 {
50 logger.debug("OutputParser.parse: " + uuid); 57 logger.debug("OutputParser.parse: " + uuid);
51 58
64 out.getName(), 71 out.getName(),
65 out.getDescription(), 72 out.getDescription(),
66 out.getMimeType(), 73 out.getMimeType(),
67 new ArrayList<Facet>(), 74 new ArrayList<Facet>(),
68 out.getType()); 75 out.getType());
69
70 outs.put(name, o); 76 outs.put(name, o);
71 } 77 }
72 else { 78 else {
79 logger.debug("OutputParser.parse: Use 'old' Output");
73 pos = o.getFacets().size() + 1; 80 pos = o.getFacets().size() + 1;
74 } 81 }
75 82
76 List<Facet> facets = facet2ManagedFacet(uuid, out.getFacets(), pos); 83 List<Facet> facets = facet2ManagedFacet(uuid, out.getFacets(), pos);
77 o.addFacets(facets); 84 o.addFacets(facets);
78 } 85 }
79 } 86 }
80 87
81 88
89 /**
90 * Access mapping of Outputname to Output.
91 */
82 public Map<String, Output> getOuts() { 92 public Map<String, Output> getOuts() {
83 return outs; 93 return outs;
84 } 94 }
85 95
86 96

http://dive4elements.wald.intevation.org