List of usage examples for org.dom4j Node getText
String getText();
Returns the text of this node.
From source file:com.globalsight.everest.webapp.servlet.SnippetLibraryServlet.java
License:Apache License
/** * For the source page editor - retrieve a generic snippet. *//*from w w w. ja v a 2s.c om*/ private String getGenericSnippet(Document p_request) throws Exception, RemoteException, SnippetException { String name = null; Node node; node = p_request.selectSingleNode("/*/arg[1]"); if (node != null) { name = node.getText(); } if (name == null) { CATEGORY.error("Invalid args, expected 1 - " + p_request.asXML()); throw new Exception("getGenericSnippet: invalid arguments"); } Snippet snippet = m_library.getSnippet(name, (GlobalSightLocale) null, 0); if (snippet != null) { return snippetToXml(snippet); } return null; }
From source file:com.globalsight.everest.webapp.servlet.SnippetLibraryServlet.java
License:Apache License
/** * For the Snippet Library Dialog - edit this specific snippet. *///from w ww . j a v a2 s. co m private String getSnippet(Document p_request) throws Exception, RemoteException, SnippetException { String name = null; String locale = null; String version = null; Node node; node = p_request.selectSingleNode("/*/arg[1]"); if (node != null) { name = node.getText(); } node = p_request.selectSingleNode("/*/arg[2]"); if (node != null) { locale = node.getText(); } node = p_request.selectSingleNode("/*/arg[3]"); if (node != null) { version = node.getText(); } if (name == null || locale == null || version == null) { CATEGORY.error("Invalid args, expected 3 - " + p_request.asXML()); throw new Exception("getSnippet: invalid arguments"); } Snippet snippet = m_library.getSnippet(name, locale, Long.parseLong(version)); return snippetToXml(snippet); }
From source file:com.globalsight.everest.webapp.servlet.SnippetLibraryServlet.java
License:Apache License
/** * For the Snippet Select Dialog: creates a snippet in a locale as * a new version and returns a list of all snippets with the * snippet's name and in its locale.//ww w .j a v a 2s .c o m */ private String getSnippets(Document p_request) throws Exception, RemoteException, SnippetException { String name = null; String locale = null; Node node; node = p_request.selectSingleNode("/*/arg[1]"); if (node != null) { name = node.getText(); } node = p_request.selectSingleNode("/*/arg[2]"); if (node != null) { locale = node.getText(); } if (name == null || locale == null) { CATEGORY.error("Invalid args, expected 2 - " + p_request.asXML()); throw new Exception("getSnippets: invalid arguments"); } ArrayList snippets = m_library.getSnippets(name, locale); return snippetsToXml(snippets); }
From source file:com.globalsight.everest.webapp.servlet.SnippetLibraryServlet.java
License:Apache License
/** * For the Snippet Select Dialog: creates a snippet in a locale as * a new version and returns a list of all snippets with the * snippet's name and in its locale.// w w w . jav a 2 s.co m */ private String createSnippet(String p_user, Document p_request) throws Exception, RemoteException, SnippetException { String name = null; String desc = null; String locale = null; String id = null; String value = null; Node node; node = p_request.selectSingleNode("/*/arg[1]"); if (node != null) { name = node.getText(); } node = p_request.selectSingleNode("/*/arg[2]"); if (node != null) { desc = node.getText(); } node = p_request.selectSingleNode("/*/arg[3]"); if (node != null) { locale = node.getText(); } node = p_request.selectSingleNode("/*/arg[4]"); if (node != null) { id = node.getText(); } node = p_request.selectSingleNode("/*/arg[5]"); if (node != null) { value = node.getText(); } if (name == null || desc == null || locale == null || id == null || value == null) { CATEGORY.error("Invalid args, expected 5 - " + p_request.asXML()); throw new Exception("createSnippet: invalid arguments"); } // add the specified snippet and validate its content against // its generic snippet m_library.addSnippet(p_user, name, desc, locale, id, value, true); ArrayList snippets = m_library.getSnippets(name, locale); return snippetsToXml(snippets); }
From source file:com.globalsight.everest.webapp.servlet.SnippetLibraryServlet.java
License:Apache License
private String createSnippetGetSnippet(String p_user, Document p_request) throws Exception, RemoteException, SnippetException { String name = null;/* w w w . ja v a 2s . c o m*/ String desc = null; String locale = null; String id = null; String value = null; Node node; node = p_request.selectSingleNode("/*/arg[1]"); if (node != null) { name = node.getText(); } node = p_request.selectSingleNode("/*/arg[2]"); if (node != null) { desc = node.getText(); } node = p_request.selectSingleNode("/*/arg[3]"); if (node != null) { locale = node.getText(); } node = p_request.selectSingleNode("/*/arg[4]"); if (node != null) { id = node.getText(); } node = p_request.selectSingleNode("/*/arg[5]"); if (node != null) { value = node.getText(); } if (name == null || desc == null || locale == null || id == null || value == null) { CATEGORY.error("Invalid args, expected 5 - " + p_request.asXML()); throw new Exception("createSnippet: invalid arguments"); } // add the specified snippet and validate its content against // its generic snippet Snippet snippet = m_library.addSnippet(p_user, name, desc, locale, id, value, true); return snippetToXml(snippet); }
From source file:com.globalsight.everest.webapp.servlet.SnippetLibraryServlet.java
License:Apache License
/** * For the Snippet Select Dialog: modifies a snippet in a locale * and returns a list of all snippets with the snippet's name and * in its locale.// www. ja va2s. c o m */ private String modifySnippet(String p_user, Document p_request) throws Exception, RemoteException, SnippetException { String name = null; String desc = null; String locale = null; String id = null; String value = null; Node node; node = p_request.selectSingleNode("/*/arg[1]"); if (node != null) { name = node.getText(); } node = p_request.selectSingleNode("/*/arg[2]"); if (node != null) { desc = node.getText(); } node = p_request.selectSingleNode("/*/arg[3]"); if (node != null) { locale = node.getText(); } node = p_request.selectSingleNode("/*/arg[4]"); if (node != null) { id = node.getText(); } node = p_request.selectSingleNode("/*/arg[5]"); if (node != null) { value = node.getText(); } if (name == null || desc == null || locale == null || id == null || value == null) { CATEGORY.error("Invalid args, expected 5 - " + p_request.asXML()); throw new Exception("modifySnippet: invalid argument"); } // modify the snippet and validate its content m_library.modifySnippet(p_user, name, desc, locale, id, value, true); ArrayList snippets = m_library.getSnippets(name, locale); return snippetsToXml(snippets); }
From source file:com.globalsight.everest.webapp.servlet.SnippetLibraryServlet.java
License:Apache License
/** * For source page editing: modifies a snippet and returns it. *//*from w ww . j a va2s . c om*/ private String modifySnippetGetSnippet(String p_user, Document p_request) throws Exception, RemoteException, SnippetException { String name = null; String desc = null; String locale = null; String id = null; String value = null; Node node; node = p_request.selectSingleNode("/*/arg[1]"); if (node != null) { name = node.getText(); } node = p_request.selectSingleNode("/*/arg[2]"); if (node != null) { desc = node.getText(); } node = p_request.selectSingleNode("/*/arg[3]"); if (node != null) { locale = node.getText(); } node = p_request.selectSingleNode("/*/arg[4]"); if (node != null) { id = node.getText(); } node = p_request.selectSingleNode("/*/arg[5]"); if (node != null) { value = node.getText(); } if (name == null || desc == null || locale == null || id == null || value == null) { CATEGORY.error("Invalid args, expected 5 - " + p_request.asXML()); throw new Exception("modifySnippet: invalid argument"); } // modify the snippet and validate its content Snippet snippet = m_library.modifySnippet(p_user, name, desc, locale, id, value, true); return snippetToXml(snippet); }
From source file:com.globalsight.everest.webapp.servlet.SnippetLibraryServlet.java
License:Apache License
/** * For the Snippet Select Dialog: removes a snippet in a locale * and returns a list of all snippets with the snippet's name and * in its locale.//from ww w .j a v a 2 s . co m * * (Need a separate function "removeGenericSnippet" for admin.) */ private String removeSnippet(String p_user, Document p_request) throws Exception, RemoteException, SnippetException { String name = null; String locale = null; String id = null; Node node; node = p_request.selectSingleNode("/*/arg[1]"); if (node != null) { name = node.getText(); } node = p_request.selectSingleNode("/*/arg[2]"); if (node != null) { locale = node.getText(); } node = p_request.selectSingleNode("/*/arg[3]"); if (node != null) { id = node.getText(); } if (name == null || locale == null || id == null) { CATEGORY.error("Invalid args, expected 3 - " + p_request.asXML()); throw new Exception("removeSnippet: invalid arguments"); } m_library.removeSnippet(p_user, name, locale, id); ArrayList snippets = m_library.getSnippets(name, locale); return snippetsToXml(snippets); }
From source file:com.globalsight.everest.webapp.servlet.SnippetLibraryServlet.java
License:Apache License
/** * For the Snippet Select Dialog: modifysnippetgetpage *///from w w w. ja v a2s. c o m private String modifySnippetGetPage(String p_user, Document p_request, EditorState p_state, HttpSession p_session) throws Exception, RemoteException, SnippetException { long pageId = 0L; String locale = null; String role = null; int viewMode = 0; Node node; node = p_request.selectSingleNode("/*/arg[1]"); if (node != null) { pageId = Long.parseLong(node.getText()); } node = p_request.selectSingleNode("/*/arg[2]"); if (node != null) { locale = node.getText(); } node = p_request.selectSingleNode("/*/arg[3]"); if (node != null) { role = node.getText(); } node = p_request.selectSingleNode("/*/arg[4]"); if (node != null) { viewMode = Integer.parseInt(node.getText()); } String name = null; String desc = null; String id = null; String value = null; node = p_request.selectSingleNode("/*/arg[5]"); if (node != null) { name = node.getText(); } node = p_request.selectSingleNode("/*/arg[6]"); if (node != null) { desc = node.getText(); } node = p_request.selectSingleNode("/*/arg[7]"); if (node != null) { id = node.getText(); } node = p_request.selectSingleNode("/*/arg[8]"); if (node != null) { value = node.getText(); } if (pageId == 0L || locale == null || role == null || viewMode == 0 || name == null || desc == null || id == null || value == null) { CATEGORY.error("Invalid args, expected 8 - " + p_request.asXML()); throw new Exception("modifySnippetGetPage: invalid arguments"); } // modify the specified snippet and validate the format m_library.modifySnippet(p_user, name, desc, locale, id, value, true); return getPage(p_session, p_state, viewMode, true); }
From source file:com.globalsight.everest.webapp.servlet.SnippetLibraryServlet.java
License:Apache License
/** * For the Snippet Select Dialog: addsnippetgetpage *//*from w w w. j a va2s . c om*/ private String addSnippetGetPage(String p_user, Document p_request, EditorState p_state, HttpSession p_session) throws RemoteException, SnippetException, TemplateException, Exception { long pageId = 0L; String locale = null; String role = null; int viewMode = 0; Node node; node = p_request.selectSingleNode("/*/arg[1]"); if (node != null) { pageId = Long.parseLong(node.getText()); } node = p_request.selectSingleNode("/*/arg[2]"); if (node != null) { locale = node.getText(); } node = p_request.selectSingleNode("/*/arg[3]"); if (node != null) { role = node.getText(); } node = p_request.selectSingleNode("/*/arg[4]"); if (node != null) { viewMode = Integer.parseInt(node.getText()); } int position = 0; String name = null; String snippetLocale = null; long id = 0L; node = p_request.selectSingleNode("/*/arg[5]"); if (node != null) { position = Integer.parseInt(node.getText()); } node = p_request.selectSingleNode("/*/arg[6]"); if (node != null) { name = node.getText(); } node = p_request.selectSingleNode("/*/arg[7]"); if (node != null) { snippetLocale = node.getText(); } node = p_request.selectSingleNode("/*/arg[8]"); if (node != null) { id = Long.parseLong(node.getText()); } if (pageId == 0L || locale == null || role == null || viewMode == 0 || position == 0 || name == null || snippetLocale == null || id == 0L) { CATEGORY.error("Invalid args, expected 8 - " + p_request.asXML()); throw new Exception("addSnippetGetPage: invalid arguments"); } m_templateManager.addSnippet(p_user, pageId, locale, position, name, snippetLocale, id); return getPage(p_session, p_state, viewMode, true); }