comparison flys-artifacts/src/main/java/de/intevation/flys/collections/FLYSArtifactCollection.java @ 2012:514d26021728

Roll-back accidentally commited changes. flys-artifacts/trunk@3460 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Mon, 19 Dec 2011 09:08:40 +0000
parents 81eaea64c0db
children 0318fa6f0844
comparison
equal deleted inserted replaced
2011:81eaea64c0db 2012:514d26021728
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";
64 61
65 public static final String XPATH_COLLECTION_ITEMS = 62 public static final String XPATH_COLLECTION_ITEMS =
66 "/art:result/art:artifact-collection/art:collection-item"; 63 "/art:result/art:artifact-collection/art:collection-item";
67 64
68 public static final String XPATH_OUT_NAME = "/art:action/@art:name"; 65 public static final String XPATH_OUT_NAME = "/art:action/@art:name";
954 return null; 951 return null;
955 } 952 }
956 953
957 954
958 /** 955 /**
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 /**
1031 * Inner class to structure/order the themes of a chart. 956 * Inner class to structure/order the themes of a chart.
1032 */ 957 */
1033 private static class ThemeList { 958 private static class ThemeList {
1034 private Logger logger = Logger.getLogger(ThemeList.class); 959 private Logger logger = Logger.getLogger(ThemeList.class);
1035 protected Map<Integer, ManagedFacet> themes; 960 protected Map<Integer, ManagedFacet> themes;

http://dive4elements.wald.intevation.org