public String getSilverObjectId() { if (this.silverObjectId == null) { ContentManager contentManager = ContentManagerFactory.getFactory().getContentManager(); try { int objectId = contentManager.getSilverContentId(getId(), getInstanceId()); if (objectId >= 0) { this.silverObjectId = String.valueOf(objectId); } } catch (ContentManagerException ex) { this.silverObjectId = null; } } return this.silverObjectId; }
/* * 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; }
public String getCurrentQuestionContentId() { String contentId = null; if (currentQuestion != null) { try { ContentManager contentManager = new ContentManager(); contentId = "" + contentManager.getSilverContentId( currentQuestion.getPK().getId(), currentQuestion.getInstanceId()); } catch (ContentManagerException ignored) { SilverTrace.error( "questionReply", "QuestionReplySessionController", "questionReply.EX_UNKNOWN_CONTENT_MANAGER", ignored); contentId = null; } } return contentId; }