Changeset 22308
- Timestamp:
- 2010-06-26T19:11:44+12:00 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
other-projects/gs3-webservices-java-client/trunk/src/GS3Fedora/org/greenstone/fedora/services/FedoraGS3Connection.java
r22302 r22308 1783 1783 * @param classifierID - the ID of the (sub)classifier. Can be CL1, CL1.x, where x is 1784 1784 * a letter. 1785 * @param structure - the requested browse substructure. Can be any combination 1786 * of ancestors, parent, siblings, children, descendants. siblingsnot yet implemented.1785 * @param structure - the requested browse substructure. Can be any combination of 1786 * ancestors, parent, siblings, children, descendants. 'siblings' not yet implemented. 1787 1787 * @param info - the requested structural info. Can be numSiblings, siblingPosition, 1788 1788 * numChildren. … … 1795 1795 FedoraGS3RunException ex = null; //any RemoteException or UnsupportedEncodingException 1796 1796 1797 // TODO1798 if(structure.indexOf("siblings") != -1) {1799 LOG.error("Structure: siblings. Not yet implemented\n");1800 }1801 1802 1797 if(structure.indexOf("entire") != -1) { 1803 1798 structure = structure + "ancestors|descendants"; … … 1825 1820 nodeStructure.appendChild(root); 1826 1821 if(structure.indexOf("descendants") != -1) { 1827 getTitlesByLetterStructure(collectionName, root, classifierID, true );1822 getTitlesByLetterStructure(collectionName, root, classifierID, true, null); 1828 1823 } else if(structure.indexOf("children") != -1) { 1829 getTitlesByLetterStructure(collectionName, root, classifierID, false );1824 getTitlesByLetterStructure(collectionName, root, classifierID, false, null); 1830 1825 } 1826 // nothing to be done for siblings 1831 1827 } 1832 1828 else if(firstLevel == secondLevel) { // CL1.x, where x is a number 1833 1829 1834 if(structure.indexOf("parent") != -1 || structure.indexOf("ancestors") != -1) { 1830 if(structure.indexOf("parent") != -1 1831 || structure.indexOf("ancestors") != -1 1832 || structure.indexOf("siblings") != -1) { 1835 1833 String toplevelID = classifierID.substring(0, firstLevel); 1836 1834 Element toplevelNode = doc.createElement(GSXML.CLASS_NODE_ELEM); … … 1842 1840 classifierNodeList.appendChild(toplevelNode); 1843 1841 toplevelNode.appendChild(nodeStructure); 1844 1845 1842 nodeStructure.appendChild(node); 1846 node.appendChild(classNode); 1843 1844 if(structure.indexOf("siblings") != -1) { // get the children of the parents too 1845 getTitlesByLetterStructure(collectionName, node, toplevelID, false, classNode); 1846 // pass the requested node (classNode) so that it is attached in the correct 1847 // location among its siblings, and to ensure that it is not recreated. 1848 // getTitlesByLetterStructure() will append classNode to node 1849 } else { 1850 node.appendChild(classNode); 1851 } 1847 1852 } else { 1848 1853 Element node = (Element)classNode.cloneNode(true); … … 1926 1931 * @param getDescendants - if true, get descendants of any documents found, otherwise 1927 1932 * get just the children. 1933 * @param wantedSibling - the node (already created) whose siblings are requested. We 1934 * need to make sure not to recreate this node when creating its sibling nodes. 1928 1935 * @return the given classifierNode, with the CL.x subclassifiers for the letters of 1929 1936 * the alphabet that are represented in the document titles. 1930 1937 */ 1931 1938 public Element getTitlesByLetterStructure(String collectionName, Element classifierNode, 1932 String classifierID, boolean getDescendants) 1933 { 1939 String classifierID, boolean getDescendants, 1940 Element wantedSibling) 1941 { 1942 String ID = ""; 1943 if(wantedSibling != null) { // the pre-created classifier node whose siblings were requested 1944 ID = wantedSibling.getAttribute(GSXML.NODE_ID_ATT); 1945 } 1946 1934 1947 Document doc = classifierNode.getOwnerDocument(); 1935 1948 FedoraGS3RunException ex = null; // any RemoteException or UnsupportedEncodingException … … 1946 1959 continue; // skip letters that don't have any kids 1947 1960 } 1948 1949 // <classifierNode nodeID="CL1.x"> 1950 Element subClassifier = doc.createElement(GSXML.CLASS_NODE_ELEM); 1951 Attr attribute = doc.createAttribute(GSXML.NODE_ID_ATT); 1952 attribute.setValue(classifierID+"."+count); 1953 subClassifier.setAttributeNode(attribute); 1954 classifierNode.appendChild(subClassifier); 1961 Element subClassifier = null; 1962 if(wantedSibling != null && ID.equals(classifierID+"."+count)) { 1963 // already have the requested node, don't recreate it 1964 subClassifier = wantedSibling; 1965 } else { 1966 // <classifierNode nodeID="CL1.x"> 1967 subClassifier = doc.createElement(GSXML.CLASS_NODE_ELEM); 1968 Attr attribute = doc.createAttribute(GSXML.NODE_ID_ATT); 1969 attribute.setValue(classifierID+"."+count); 1970 subClassifier.setAttributeNode(attribute); 1971 } 1972 classifierNode.appendChild(subClassifier); // either way, append the subClassifier node 1955 1973 1956 1974 if(getDescendants) { // get the documents
Note:
See TracChangeset
for help on using the changeset viewer.