public LocationLevel createLocationLevel(String locationName, String locationLevelName) {
    LocationLevel locationLevel = null;
    if (StringUtils.isNotEmpty(locationName) && StringUtils.isNotEmpty(locationLevelName)) {
      String[] locations = locationName.split("/");
      String[] locationLevels = locationLevelName.split("/");
      String locName = "";
      String levelName = "";
      if (locations.length > 0) {
        locName = locations[0];
        levelName = locationLevels[0];
        if (locationName.contains("/")) {
          locationName = locationName.replaceFirst(locations[0] + "/", "");
        } else {
          locationName = locationName.replace(locations[0], "");
        }

        if (locationLevelName.contains("/")) {
          locationLevelName = locationLevelName.replaceFirst(locationLevels[0] + "/", "");
        } else {
          locationLevelName = locationLevelName.replace(locationLevels[0], "");
        }
        if (locName != null && locations.length != 0) {
          locationLevel = new LocationLevel();
          locationLevel.setLevel(levelName);
          locationLevel.setName(locName);
          locationLevel.setLocationLevel(createLocationLevel(locationName, locationLevelName));
        }
      }
    }
    return locationLevel;
  }
 private void buildLocation(
     LocationLevel locationLevel,
     SolrInputDocument solrInputDocument,
     StringBuffer loactionLevelStr) {
   if (locationLevel != null) {
     String locationName = locationLevel.getName();
     if (LOCATION_LEVEL_INSTITUTION.equalsIgnoreCase(locationLevel.getLevel())) {
       solrInputDocument.addField(LEVEL1LOCATION_DISPLAY, locationName);
       solrInputDocument.addField(LEVEL1LOCATION_SEARCH, locationName);
       appendData(loactionLevelStr, locationName.replace("-", ""));
     } else if (LOCATION_LEVEL_CAMPUS.equalsIgnoreCase(locationLevel.getLevel())) {
       solrInputDocument.addField(LEVEL2LOCATION_DISPLAY, locationName);
       solrInputDocument.addField(LEVEL2LOCATION_SEARCH, locationName);
       appendData(loactionLevelStr, locationName.replace("-", ""));
     } else if (LOCATION_LEVEL_LIBRARY.equalsIgnoreCase(locationLevel.getLevel())) {
       solrInputDocument.addField(LEVEL3LOCATION_DISPLAY, locationName);
       solrInputDocument.addField(LEVEL3LOCATION_SEARCH, locationName);
       appendData(loactionLevelStr, locationName.replace("-", ""));
     } else if (LOCATION_LEVEL_COLLECTION.equalsIgnoreCase(locationLevel.getLevel())) {
       solrInputDocument.addField(LEVEL4LOCATION_DISPLAY, locationName);
       solrInputDocument.addField(LEVEL4LOCATION_SEARCH, locationName);
       appendData(loactionLevelStr, locationName.replace("-", ""));
     } else if (LOCATION_LEVEL_SHELVING.equalsIgnoreCase(locationLevel.getLevel())
         || LOCATION_LEVEL_SHELVING_1.equalsIgnoreCase(locationLevel.getLevel())) {
       solrInputDocument.addField(LEVEL5LOCATION_DISPLAY, locationName);
       solrInputDocument.addField(LEVEL5LOCATION_SEARCH, locationName);
       appendData(loactionLevelStr, locationName.replace("-", ""));
     }
     buildLocation(locationLevel.getLocationLevel(), solrInputDocument, loactionLevelStr);
   }
 }