/* * Récupère la liste des positions d'une question */ public ContainerPositionInterface getSilverContentIdPosition() throws QuestionReplyException { try { return containerContext.getSilverContentIdSearchContext( Integer.parseInt(getCurrentQuestionContentId()), getComponentId()); } catch (Exception e) { throw new QuestionReplyException( "QuestionReplySessionController.getCurrentQuestionWriters()", SilverpeasException.ERROR, "questionReply.EX_CANT_GET_EXPERTS", "", e); } }
/* * Récupère la liste des experts du domaine de la question */ public Collection<UserDetail> getCurrentQuestionWriters() throws QuestionReplyException { OrganizationController orga = getOrganizationController(); List<UserDetail> arrayUsers = new ArrayList<UserDetail>(); try { ContentManager contentManager = new ContentManager(); // recupere la liste de toutes les instances d'annuaire String[] instances = orga.getCompoId("whitePages"); List<String> listeInstanceId = new ArrayList<String>(); int i = 0; while (i < instances.length) { listeInstanceId.add("whitePages" + instances[i]); i++; } // recupere la liste de tous les experts du domaine de classement de la // question ContainerPositionInterface position = getSilverContentIdPosition(); if (position != null && !position.isEmpty()) { List<Integer> liste = containerContext.getSilverContentIdByPosition(position, listeInstanceId); CardManager cardManager = CardManager.getInstance(); for (Integer integer : liste) { int silverContentId = integer.intValue(); String internalContentId = contentManager.getInternalContentId(silverContentId); long userCardId = Long.parseLong(internalContentId); Card card = cardManager.getCard(userCardId); if (card != null) { String idUser = card.getUserId(); UserDetail user = orga.getUserDetail(idUser); if (!exist(user, arrayUsers)) { arrayUsers.add(user); } } } } } catch (Exception e) { throw new QuestionReplyException( "QuestionReplySessionController.getCurrentQuestionWriters()", SilverpeasException.ERROR, "questionReply.EX_CANT_GET_EXPERTS", "", e); } return arrayUsers; }