cancel
Showing results for 
Search instead for 
Did you mean: 

Récupérer NodeRef d'un espace de travail Via NavigationBean

arkantos
Champ in-the-making
Champ in-the-making
Bonjour,

   Comment faire pour récupérer le nodeRef d'un espace de travail bien précis via NavigationBean: par exemple : company home/PME/industrie

  j'ai déja le code suivant pour récupérer le nodeRef du l'espace courant

                FacesContext fc = FacesContext.getCurrentInstance();               NavigationBean navBean = (NavigationBean)fc.getExternalContext().getSessionMap().get(NavigationBean.BEAN_NAME);      containerNodeRef = navBean.getCurrentNode().getNodeRef();                  return containerNodeRef;‍‍‍‍‍‍‍‍‍‍

Comment faire pour adapter ce code à mon besoin???

Merci
5 REPLIES 5

jayjayecl
Confirmed Champ
Confirmed Champ
recherche Lucene / XPath

arkantos
Champ in-the-making
Champ in-the-making
Pouvez vous me donner un bout de code à titre d'exemple ?

Merci Rodel

jayjayecl
Confirmed Champ
Confirmed Champ
Très rapidement, un code qui permet de chercher un fichier précis dans Dictionnaire des données / Dashlets templates, à partir du nom du fichier

public NodeRef getDashletTemplateNodeRef(String templateName)   {         NodeRef templateNodeRef = null;         SearchParameters sp = new SearchParameters();         sp.addStore(new StoreRef("workspace://SpacesStore"));         sp.setLanguage(SearchService.LANGUAGE_LUCENE);                   // encode space chars         String cnNameNoWhiteSpaces = templateName.replace(" ", "_x0020_");         String query = "";         // search in 'Dashlets templates' space to increase research speed         query = " +PATH:\"/app:company_home/app:dictionary/cm:Dashlets_x0020_Templates//.\"";         query += " AND +QNAME:\"cm:" + cnNameNoWhiteSpaces + "\"";         sp.setQuery(query);         ResultSet results = null;         try {            results = searchService.query(sp);         } finally {            if (results != null) {               if (results.length() > 0) {                  templateNodeRef = results.getNodeRef(0);               } else   {                  logger.warn("aucun résultat trouvé pour recherche de " + templateName);               }               // close the result set               results.close();            }         }         return templateNodeRef;      }‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

arkantos
Champ in-the-making
Champ in-the-making
Merci Rodel,

  C'est exactement ce que je cherche.

Bonne continuation

jayjayecl
Confirmed Champ
Confirmed Champ
pas de problèmes, bonne chance ! Smiley Happy