@Test public void testSave() throws Exception { List<BBCode> bbcodes = Arrays.asList(createBBCode("foo", "replacement", "description", "example", false, false)); bbcodeService.save(bbcodes); String targetPath = bbcodesPath + "/" + "foo"; assertNodeExists(targetPath); Node n = getNode(targetPath); assertEquals("foo", n.getProperty("exo:tagName").getString()); assertEquals("replacement", n.getProperty("exo:replacement").getString()); assertEquals("description", n.getProperty("exo:description").getString()); assertEquals("example", n.getProperty("exo:example").getString()); assertEquals(false, n.getProperty("exo:isOption").getBoolean()); assertEquals(false, n.getProperty("exo:isActive").getBoolean()); }
public void save(List<BBCode> bbcodes) throws Exception { SessionProvider sProvider = SessionProvider.createSystemProvider(); try { Node bbCodeHome = getBBcodeHome(sProvider); Node bbcNode; for (BBCode bbcode : bbcodes) { bbcNode = createNode(bbCodeHome, bbcode); bbcNode.setProperty("exo:tagName", bbcode.getTagName()); bbcNode.setProperty("exo:replacement", bbcode.getReplacement()); bbcNode.setProperty("exo:example", bbcode.getExample()); bbcNode.setProperty("exo:description", bbcode.getDescription()); bbcNode.setProperty("exo:isActive", bbcode.isActive()); bbcNode.setProperty("exo:isOption", bbcode.isOption()); } if (bbCodeHome.isNew()) { bbCodeHome.getSession().save(); } else { bbCodeHome.save(); } synchronized (activeBBCodesCache) { activeBBCodesCache.clear(); } } catch (Exception e) { log.error("Error saving BBCodes", e); } finally { sProvider.close(); } }
BBCodeServiceImpl implements Startable, BBCodeService, ManagementAware { public void save(List<BBCode> bbcodes) throws Exception { SessionProvider sProvider = SessionProvider.createSystemProvider(); try { Node bbCodeHome = getBBcodeHome(sProvider); Node bbcNode; for (BBCode bbcode : bbcodes) { bbcNode = createNode(bbCodeHome, bbcode); bbcNode.setProperty("exo:tagName", bbcode.getTagName()); bbcNode.setProperty("exo:replacement", bbcode.getReplacement()); bbcNode.setProperty("exo:example", bbcode.getExample()); bbcNode.setProperty("exo:description", bbcode.getDescription()); bbcNode.setProperty("exo:isActive", bbcode.isActive()); bbcNode.setProperty("exo:isOption", bbcode.isOption()); } if (bbCodeHome.isNew()) { bbCodeHome.getSession().save(); } else { bbCodeHome.save(); } synchronized (activeBBCodesCache) { activeBBCodesCache.clear(); } } catch (Exception e) { log.error("Error saving BBCodes", e); } finally { sProvider.close(); } } }
BBCodeServiceImpl implements Startable, BBCodeService, ManagementAware { public void save(List<BBCode> bbcodes) throws Exception { SessionProvider sProvider = SessionProvider.createSystemProvider(); try { Node bbCodeHome = getBBcodeHome(sProvider); Node bbcNode; for (BBCode bbcode : bbcodes) { bbcNode = createNode(bbCodeHome, bbcode); bbcNode.setProperty("exo:tagName", bbcode.getTagName()); bbcNode.setProperty("exo:replacement", bbcode.getReplacement()); bbcNode.setProperty("exo:example", bbcode.getExample()); bbcNode.setProperty("exo:description", bbcode.getDescription()); bbcNode.setProperty("exo:isActive", bbcode.isActive()); bbcNode.setProperty("exo:isOption", bbcode.isOption()); } if (bbCodeHome.isNew()) { bbCodeHome.getSession().save(); } else { bbCodeHome.save(); } synchronized (activeBBCodesCache) { activeBBCodesCache.clear(); } } catch (Exception e) { log.error("Error saving BBCodes", e); } finally { sProvider.close(); } } BBCodeServiceImpl();  BBCodeServiceImpl(KSDataLocation dataLocator); }
BBCodeServiceImpl implements Startable, BBCodeService, ManagementAware { public void save(List<BBCode> bbcodes) throws Exception { SessionProvider sProvider = SessionProvider.createSystemProvider(); try { Node bbCodeHome = getBBcodeHome(sProvider); Node bbcNode; for (BBCode bbcode : bbcodes) { bbcNode = createNode(bbCodeHome, bbcode); bbcNode.setProperty("exo:tagName", bbcode.getTagName()); bbcNode.setProperty("exo:replacement", bbcode.getReplacement()); bbcNode.setProperty("exo:example", bbcode.getExample()); bbcNode.setProperty("exo:description", bbcode.getDescription()); bbcNode.setProperty("exo:isActive", bbcode.isActive()); bbcNode.setProperty("exo:isOption", bbcode.isOption()); } if (bbCodeHome.isNew()) { bbCodeHome.getSession().save(); } else { bbCodeHome.save(); } synchronized (activeBBCodesCache) { activeBBCodesCache.clear(); } } catch (Exception e) { log.error("Error saving BBCodes", e); } finally { sProvider.close(); } } BBCodeServiceImpl();  BBCodeServiceImpl(KSDataLocation dataLocator); void registerBBCodePlugin(BBCodePlugin plugin); void initDefaultBBCodes(); void save(List<BBCode> bbcodes); List<BBCode> getAll(); List<String> getActive(); BBCode findById(String id); void delete(String bbcodeId); void start(); void stop(); void setContext(ManagementContext context); KSDataLocation getDataLocator(); void setDataLocator(KSDataLocation dataLocator); List<BBCodePlugin> getPlugins(); void setPlugins(List<BBCodePlugin> plugins); }
BBCodeServiceImpl implements Startable, BBCodeService, ManagementAware { public void save(List<BBCode> bbcodes) throws Exception { SessionProvider sProvider = SessionProvider.createSystemProvider(); try { Node bbCodeHome = getBBcodeHome(sProvider); Node bbcNode; for (BBCode bbcode : bbcodes) { bbcNode = createNode(bbCodeHome, bbcode); bbcNode.setProperty("exo:tagName", bbcode.getTagName()); bbcNode.setProperty("exo:replacement", bbcode.getReplacement()); bbcNode.setProperty("exo:example", bbcode.getExample()); bbcNode.setProperty("exo:description", bbcode.getDescription()); bbcNode.setProperty("exo:isActive", bbcode.isActive()); bbcNode.setProperty("exo:isOption", bbcode.isOption()); } if (bbCodeHome.isNew()) { bbCodeHome.getSession().save(); } else { bbCodeHome.save(); } synchronized (activeBBCodesCache) { activeBBCodesCache.clear(); } } catch (Exception e) { log.error("Error saving BBCodes", e); } finally { sProvider.close(); } } BBCodeServiceImpl();  BBCodeServiceImpl(KSDataLocation dataLocator); void registerBBCodePlugin(BBCodePlugin plugin); void initDefaultBBCodes(); void save(List<BBCode> bbcodes); List<BBCode> getAll(); List<String> getActive(); BBCode findById(String id); void delete(String bbcodeId); void start(); void stop(); void setContext(ManagementContext context); KSDataLocation getDataLocator(); void setDataLocator(KSDataLocation dataLocator); List<BBCodePlugin> getPlugins(); void setPlugins(List<BBCodePlugin> plugins); final static String BBCODE_NODE_TYPE; final static String BBCODE_HOME_NODE_TYPE; }