comparison flys-artifacts/src/main/java/de/intevation/flys/collections/FLYSArtifactCollection.java @ 2011:81eaea64c0db

Hide deleted facets from outgenerators. flys-artifacts/trunk@3459 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Mon, 19 Dec 2011 09:04:50 +0000
parents 02ce03329ef5
children 514d26021728
comparison
equal deleted inserted replaced
2010:7f99845e9499 2011:81eaea64c0db
56 public static final String XPATH_ARTIFACT_OUTPUTMODES = 56 public static final String XPATH_ARTIFACT_OUTPUTMODES =
57 "/art:result/art:outputmodes"; 57 "/art:result/art:outputmodes";
58 58
59 public static final String XPATH_ARTIFACT_STATE_DATA = 59 public static final String XPATH_ARTIFACT_STATE_DATA =
60 "/art:result/art:ui/art:static/art:state/art:data"; 60 "/art:result/art:ui/art:static/art:state/art:data";
61
62 public static final String XPATH_ARTIFACT_DYN_DATA =
63 "/art:result/art:ui/art:dynamic/art:select";
61 64
62 public static final String XPATH_COLLECTION_ITEMS = 65 public static final String XPATH_COLLECTION_ITEMS =
63 "/art:result/art:artifact-collection/art:collection-item"; 66 "/art:result/art:artifact-collection/art:collection-item";
64 67
65 public static final String XPATH_OUT_NAME = "/art:action/@art:name"; 68 public static final String XPATH_OUT_NAME = "/art:action/@art:name";
408 log.debug("... artifact: " + art); 411 log.debug("... artifact: " + art);
409 log.debug("... facet: " + facetName); 412 log.debug("... facet: " + facetName);
410 } 413 }
411 414
412 if (outName.equals("export") && !facetName.equals(facet)) { 415 if (outName.equals("export") && !facetName.equals(facet)) {
416 continue;
417 }
418
419 // Skip invisible themes.
420 if (theme.getVisible() == 0) {
413 continue; 421 continue;
414 } 422 }
415 423
416 generator.doOut( 424 generator.doOut(
417 dataProviders.get(i), 425 dataProviders.get(i),
946 return null; 954 return null;
947 } 955 }
948 956
949 957
950 /** 958 /**
959 * Create the Artifacts Node that contains outputmode and statedata.
960 * @param uuid uuid of the artifact.
961 protected Element buildArtifactNode(
962 ArtifactDatabase database,
963 String uuid,
964 CallContext context,
965 XMLUtils.ElementCreator ec)
966 throws ArtifactDatabaseException
967 {
968 log.debug("Append artifact '" + uuid + "' to collection description");
969
970 // TODO
971 String hash = "MYHASH";
972
973 Element ci = ec.create("artifact");
974 ec.addAttr(ci, "uuid", uuid, true);
975 ec.addAttr(ci, "hash", hash, true);
976
977 // XXX I am not sure if it works well every time with an empty document
978 // in the describe operation of an artifact.
979 Document description = database.describe(uuid, null, context.getMeta());
980
981 // Add outputmode element(s).
982 Node outputModes = (Node) XMLUtils.xpath(
983 description,
984 XPATH_ARTIFACT_OUTPUTMODES,
985 XPathConstants.NODE,
986 ArtifactNamespaceContext.INSTANCE);
987
988 if (outputModes != null) {
989 Document doc = ci.getOwnerDocument();
990 ci.appendChild(doc.importNode(outputModes, true));
991 }
992
993 // Add state-data element(s).
994 Node dataNode = ci.appendChild(
995 ci.getOwnerDocument().createElement("art:data-items"));
996
997 // Static data first.
998 NodeList dataNodes = (NodeList) XMLUtils.xpath(
999 description,
1000 XPATH_ARTIFACT_STATE_DATA,
1001 XPathConstants.NODESET,
1002 ArtifactNamespaceContext.INSTANCE);
1003
1004 if (dataNodes != null) {
1005 Document doc = ci.getOwnerDocument();
1006 for (int i = 0; i < dataNodes.getLength(); i++) {
1007 dataNode.appendChild(doc.importNode(dataNodes.item(i), true));
1008 }
1009 }
1010
1011 // Dynamic data second
1012 dataNodes = (NodeList) XMLUtils.xpath(
1013 description,
1014 XPATH_ARTIFACT_DYN_DATA,
1015 XPathConstants.NODESET,
1016 ArtifactNamespaceContext.INSTANCE);
1017
1018 if (dataNodes != null) {
1019 Document doc = ci.getOwnerDocument();
1020 for (int i = 0; i < dataNodes.getLength(); i++) {
1021 dataNode.appendChild(doc.importNode(dataNodes.item(i), true));
1022 }
1023 }
1024
1025 return ci;
1026 }
1027 */
1028
1029
1030 /**
951 * Inner class to structure/order the themes of a chart. 1031 * Inner class to structure/order the themes of a chart.
952 */ 1032 */
953 private static class ThemeList { 1033 private static class ThemeList {
954 private Logger logger = Logger.getLogger(ThemeList.class); 1034 private Logger logger = Logger.getLogger(ThemeList.class);
955 protected Map<Integer, ManagedFacet> themes; 1035 protected Map<Integer, ManagedFacet> themes;

http://dive4elements.wald.intevation.org