Ignore:
Timestamp:
2016-12-01T01:22:35+13:00 (7 years ago)
Author:
Georgiy Litvinov
Message:

Java code for groups breadcrumbs

Location:
main/trunk/greenstone3/src/java/org/greenstone/gsdl3
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/action/PageAction.java

    r30836 r31166  
    160160                info_response.appendChild(doc.importNode(group_list, true));
    161161            }
     162            Element path_list = (Element) GSXML.getChildByTagName(group_info_response,
     163                    GSXML.PATH_ELEM + GSXML.LIST_MODIFIER);
     164            if (path_list != null) {
     165                info_response.appendChild(doc.importNode(path_list, true));
     166            }
    162167            // Send message to groupInfoType Services
    163168        } else {
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/CollectionGroups.java

    r31109 r31166  
    173173                }
    174174               
    175             }
    176            
    177            
    178 
     175            } else {
     176                Element groupDescription = getPathInfo(groupPath);
     177                if (groupContent != null){
     178                    result.appendChild(doc.importNode(groupDescription, true));
     179                }
     180            }
    179181        }
    180182
     
    298300
    299301    }
     302    private Element getPathInfo(String path) {
     303
     304        if (hierarchy == null || groupDesc == null) {
     305            return null;
     306        }
     307       
     308        Document doc = XMLConverter.newDOM();
     309       
     310        if (path == null) {
     311             path = "";
     312        }
     313        String[] pathSteps = path.split("/");
     314
     315        Element pathInfo = doc.createElement(GSXML.PATH_ELEM + GSXML.LIST_MODIFIER);
     316       
     317        String currentPath = "";
     318        for (int i = 0; i < pathSteps.length; i++) {
     319            if (!pathSteps[i].isEmpty()) {
     320                currentPath += "/" + pathSteps[i];
     321                Element pathStepDescription = getGroupDescription(pathSteps[i]);
     322                if (pathStepDescription != null){
     323                    pathStepDescription.setAttribute(GSXML.POSITION_ATT, String.valueOf(i));
     324                    pathStepDescription.setAttribute(GSXML.PATH_ATT, currentPath);
     325                    pathInfo.appendChild(doc.importNode(pathStepDescription, true));
     326                }
     327            }
     328        }
     329       
     330        return pathInfo;
     331    }
    300332
    301333}
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/GSXML.java

    r30831 r31166  
    8282    public static final String FORMAT_STRING_ELEM = "formatString";
    8383    public static final String EXTRA_METADATA = "extraMetadata";
     84    public static final String PATH_ELEM = "path";
    8485
    8586    //config file elems
     
    162163    public static final String HIDDEN_ATT = "hidden";
    163164    public static final String FACET_ATT = "facet";
     165    public static final String PATH_ATT = "path";
    164166
    165167    // document stuff
Note: See TracChangeset for help on using the changeset viewer.