public void exportCategory( QuestionReplyExport exporter, NodeDetail category, String categoryId, StringBuilder sb) throws QuestionReplyException, ParseException { // titre de la catégorie sb.append("<tr>\n"); sb.append("<td class=\"titreCateg\" width=\"91%\">") .append(category.getName()) .append("</td>\n"); sb.append("</tr>\n"); // contenu de la catégorie sb.append("<tr>\n"); sb.append("<td colspan=\"2\">\n"); Collection<Question> questions = getQuestionsByCategory(categoryId); for (Question question : questions) { exporter.exportQuestion(question, sb, this); } sb.append("</td>\n"); sb.append("</tr>\n"); }
/** Returns the access path of the object. */ private String getPath(String componentId, String nodeId, String language) { String path = ""; // Space > SubSpace if (componentId != null && !"useless".equals(componentId)) { List<SpaceInst> listSpaces = organizationController.getSpacePathToComponent(componentId); for (SpaceInst space : listSpaces) { path += space.getName(language) + " > "; } // Service path += organizationController.getComponentInstLight(componentId).getLabel(language); // Theme > SubTheme String pathString = ""; if (nodeId != null) { NodeBm nodeBm = null; try { NodeBmHome nodeBmHome = EJBUtilitaire.getEJBObjectRef(JNDINames.NODEBM_EJBHOME, NodeBmHome.class); nodeBm = nodeBmHome.create(); } catch (Exception e) { SilverTrace.error( "form", "ExplorerFieldDisplayer.display", "form.EX_CANT_CREATE_NODEBM_HOME", e); } if (nodeBm != null) { NodePK nodePk = new NodePK(nodeId, componentId); Collection<NodeDetail> listPath = null; try { listPath = nodeBm.getPath(nodePk); } catch (RemoteException e) { SilverTrace.error( "form", "ExplorerFieldDisplayer.display", "form.EX_CANT_GET_PATH_NODE", nodeId); } if (listPath != null) { Collections.reverse((List<NodeDetail>) listPath); String nodeName; for (NodeDetail nodeInPath : listPath) { if (!nodeInPath.getNodePK().getId().equals("0")) { if (language != null) { nodeName = nodeInPath.getName(language); } else { nodeName = nodeInPath.getName(); } pathString += nodeName + " > "; } } if (StringUtil.isDefined(pathString)) { pathString = pathString.substring(0, pathString.length() - 3); // remove last '>' } } } } if (pathString.length() > 0) { path += " > " + pathString; } } return path; }