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

Java code for groups breadcrumbs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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}
Note: See TracChangeset for help on using the changeset viewer.