Changeset 26270
- Timestamp:
- 2012-09-27T18:37:00+12:00 (12 years ago)
- Location:
- other-projects/gs3-webservices-java-client/trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
other-projects/gs3-webservices-java-client/trunk/build.xml
r26173 r26270 182 182 <mkdir dir="${basedir}/tmp" /> 183 183 <echo>Getting java files GSXML, XMLConverter, GSPath and MyNodeList from Greenstone's SVN repository (${gs3forclient.svn.path}). Compiling and jarring them up into ${gs3.files.jar}...</echo> 184 <!-- No point using timestamp here with the get Task, since the tmp file is newly created and will not already have these java files. Get will therefore always retrieve them --> 184 <!-- No point using timestamp here with the get Task, since the tmp file is newly created and will not already have these java files. Get will therefore always retrieve them. 185 AbstractBasicDocument.java is included for defining constants for the possible NodeStructureInfo param values. --> 185 186 <get src="${gs3forclient.svn.path}/UserContext.java" dest="${basedir}/tmp/UserContext.java" /> 186 187 <get src="${gs3forclient.svn.path}/GSXML.java" dest="${basedir}/tmp/GSXML.java" /> … … 188 189 <get src="${gs3forclient.svn.path}/GSPath.java" dest="${basedir}/tmp/GSPath.java" /> 189 190 <get src="${gs3forclient.svn.path}/MyNodeList.java" dest="${basedir}/tmp/MyNodeList.java" /> 191 <get src="${gs3forclient.svn.path}/AbstractBasicDocument.java" dest="${basedir}/tmp/AbstractBasicDocument.java" /> 190 192 <!-- compile it up: specifying the file to be compiled explicitly --> 191 193 <javac srcdir="${basedir}/tmp" destdir="${basedir}/tmp" debug="on" debuglevel="lines,vars,source"> -
other-projects/gs3-webservices-java-client/trunk/src/GS3Fedora/org/greenstone/fedora/services/FedoraConnection.java
r26259 r26270 20 20 21 21 package org.greenstone.fedora.services; 22 import org.greenstone.gsdl3.util.AbstractBasicDocument; // for constants 22 23 import org.greenstone.gsdl3.util.GSXML; 23 24 … … 1292 1293 * the structure to retrieve. 1293 1294 * @param info can contain any combination of: siblingPosition, numSiblings, 1294 * numChildren, requesting additional information about the structure. */1295 * numChildren, documentType, requesting additional information about the structure. */ 1295 1296 public Element getSectionStructureXML(String docPID, String sectionID, String structure, String info) 1296 1297 throws RemoteException, UnsupportedEncodingException, SAXException, IOException … … 1748 1749 1749 1750 if(!info.equals("")) { 1750 if(info.indexOf("numChildren") != -1) { 1751 if(info.indexOf(AbstractBasicDocument.INFO_NUM_CHILDREN) != -1 1752 || info.indexOf(AbstractBasicDocument.INFO_DOC_TYPE) != -1) { 1751 1753 //int numChildren = e.getElementsByTagName(SECTION_ELEMENT).getLength(); 1752 1754 int numChildren = 0; … … 1760 1762 } 1761 1763 1762 root.setAttribute("numChildren", Integer.toString(numChildren)); 1764 if(info.indexOf(AbstractBasicDocument.INFO_NUM_CHILDREN) != -1) { 1765 root.setAttribute(AbstractBasicDocument.INFO_NUM_CHILDREN, Integer.toString(numChildren)); 1766 } 1767 if(info.indexOf(AbstractBasicDocument.INFO_DOC_TYPE) != -1) { 1768 //String docType = (numChildren > 0) ? "hierarchy" : "simple"; 1769 String docType = "hierarchy"; 1770 root.setAttribute(AbstractBasicDocument.INFO_DOC_TYPE, docType); 1771 } 1763 1772 } 1764 1773 … … 1787 1796 } 1788 1797 1789 if(info.indexOf( "numSiblings") != -1) {1790 root.setAttribute( "numSiblings", Integer.toString(numSiblings));1791 } 1792 1793 if(info.indexOf( "siblingPosition") != -1) {1794 root.setAttribute( "siblingPosition", Integer.toString(siblingPosition));1798 if(info.indexOf(AbstractBasicDocument.INFO_NUM_SIBS) != -1) { 1799 root.setAttribute(AbstractBasicDocument.INFO_NUM_SIBS, Integer.toString(numSiblings)); 1800 } 1801 1802 if(info.indexOf(AbstractBasicDocument.INFO_SIB_POS) != -1) { 1803 root.setAttribute(AbstractBasicDocument.INFO_SIB_POS, Integer.toString(siblingPosition)); 1795 1804 } 1796 1805 } -
other-projects/gs3-webservices-java-client/trunk/src/GS3Fedora/org/greenstone/fedora/services/FedoraGS3Connection.java
r26262 r26270 29 29 import org.greenstone.fedora.services.FedoraGS3Exception.FedoraGS3RunException; 30 30 import org.greenstone.fedora.services.FedoraGS3Exception.NotAFedoraServerException; 31 import org.greenstone.gsdl3.util.AbstractBasicDocument; // for constants 31 32 import org.greenstone.gsdl3.util.GSXML; 32 33 import org.w3c.dom.Document; … … 888 889 // ... 889 890 // </nodeStructureInfo> 890 Element nodeStructureInfo = doc.createElement(GSXML.NODE_STRUCTURE_ELEM+ GSXML.INFO_ATT);891 Element nodeStructureInfo = doc.createElement(GSXML.NODE_STRUCTURE_ELEM+"Info"); 891 892 Element root = srcDocElement.getOwnerDocument().getDocumentElement(); 892 893 893 if(root.hasAttribute( "numSiblings")) {894 String numSiblings = root.getAttribute( "numSiblings");894 if(root.hasAttribute(AbstractBasicDocument.INFO_NUM_SIBS)) { 895 String numSiblings = root.getAttribute(AbstractBasicDocument.INFO_NUM_SIBS); 895 896 Element infoEl = doc.createElement(GSXML.INFO_ATT); 896 infoEl.setAttribute(GSXML.NAME_ATT, "numSiblings");897 infoEl.setAttribute(GSXML.NAME_ATT, AbstractBasicDocument.INFO_NUM_SIBS); 897 898 infoEl.setAttribute(GSXML.VALUE_ATT, numSiblings); 898 899 nodeStructureInfo.appendChild(infoEl); 899 900 } 900 901 901 if(root.hasAttribute( "siblingPosition")) {902 String siblingPosition = root.getAttribute( "siblingPosition");902 if(root.hasAttribute(AbstractBasicDocument.INFO_SIB_POS)) { 903 String siblingPosition = root.getAttribute(AbstractBasicDocument.INFO_SIB_POS); 903 904 Element infoEl = doc.createElement(GSXML.INFO_ATT); 904 infoEl.setAttribute(GSXML.NAME_ATT, "siblingPosition");905 infoEl.setAttribute(GSXML.NAME_ATT, AbstractBasicDocument.INFO_SIB_POS); 905 906 infoEl.setAttribute(GSXML.VALUE_ATT, siblingPosition); 906 907 nodeStructureInfo.appendChild(infoEl); 907 908 } 908 909 909 if(root.hasAttribute( "numChildren")) {910 String numChildren = root.getAttribute( "numChildren");910 if(root.hasAttribute(AbstractBasicDocument.INFO_NUM_CHILDREN)) { 911 String numChildren = root.getAttribute(AbstractBasicDocument.INFO_NUM_CHILDREN); 911 912 Element infoEl = doc.createElement(GSXML.INFO_ATT); 912 infoEl.setAttribute(GSXML.NAME_ATT, "numChildren");913 infoEl.setAttribute(GSXML.NAME_ATT, AbstractBasicDocument.INFO_NUM_CHILDREN); 913 914 infoEl.setAttribute(GSXML.VALUE_ATT, numChildren); 914 915 nodeStructureInfo.appendChild(infoEl); 915 916 } 917 918 if(root.hasAttribute(AbstractBasicDocument.INFO_DOC_TYPE)) { 919 String documentType = root.getAttribute(AbstractBasicDocument.INFO_DOC_TYPE); 920 Element infoEl = doc.createElement(GSXML.INFO_ATT); 921 infoEl.setAttribute(GSXML.NAME_ATT, AbstractBasicDocument.INFO_DOC_TYPE); 922 infoEl.setAttribute(GSXML.VALUE_ATT, documentType); 923 nodeStructureInfo.appendChild(infoEl); 924 } 925 916 926 docNode.appendChild(nodeStructureInfo); 917 927 } … … 2478 2488 for(int i = 0; i < docIDs.length; i++) { 2479 2489 System.out.println("Descendents and numChildren:\n" 2480 + con.getDocumentStructure(docIDs[i], new String[] {"descendants"}, new String[] { "numChildren"}));2490 + con.getDocumentStructure(docIDs[i], new String[] {"descendants"}, new String[] {AbstractBasicDocument.INFO_NUM_CHILDREN})); 2481 2491 System.out.println("Parent and numSiblings:\n" 2482 + con.getDocumentStructure(docIDs[i], new String[] {"parent"}, new String[] { "numSiblings"}));2492 + con.getDocumentStructure(docIDs[i], new String[] {"parent"}, new String[] {AbstractBasicDocument.INFO_NUM_SIBS})); 2483 2493 } 2484 2494 … … 2490 2500 System.out.println(con.getContent(errorCases)); 2491 2501 System.out.println(con.getDocumentMetadata(errorCases, new String[]{"all"})); 2492 System.out.println(con.getDocumentStructure(errorCases, new String[] {"descendants"}, new String[] { "numChildren"}));2502 System.out.println(con.getDocumentStructure(errorCases, new String[] {"descendants"}, new String[] {AbstractBasicDocument.INFO_NUM_CHILDREN})); 2493 2503 2494 2504 System.out.println("\nCLASSIFIER BROWSE");
Note:
See TracChangeset
for help on using the changeset viewer.