public StateItem loadState(String name) throws RulesRepositoryException { try { Node ruleStateNode = this.getAreaNode(STATE_AREA).getNode(name); return new StateItem(this, ruleStateNode); } catch (RepositoryException e) { log.error("Unable to load a status. ", e); throw new RulesRepositoryException("Unable to load a status. ", e); } }
public StateItem loadState(String name) throws RulesRepositoryException { try { Node ruleStateNode = this.getAreaNode(STATE_AREA).getNode(name); return new StateItem(this, ruleStateNode); } catch (RepositoryException e) { log.error("Unable to load a status. ", e); throw new RulesRepositoryException("Unable to load a status. ", e); } }
/** * @return A list of statii in the system. */ public StateItem[] listStates() { List<StateItem> states = new ArrayList<StateItem>(); try { NodeIterator it = this.getAreaNode(STATE_AREA).getNodes(); while (it.hasNext()) { states.add(new StateItem(this, it.nextNode())); } } catch (RepositoryException e) { log.error(e.getMessage(), e); throw new RulesRepositoryException(e); } return states.toArray(new StateItem[states.size()]); }
/** * @return A list of statii in the system. */ public StateItem[] listStates() { List<StateItem> states = new ArrayList<StateItem>(); try { NodeIterator it = this.getAreaNode(STATE_AREA).getNodes(); while (it.hasNext()) { states.add(new StateItem(this, it.nextNode())); } } catch (RepositoryException e) { log.error(e.getMessage(), e); throw new RulesRepositoryException(e); } return states.toArray(new StateItem[states.size()]); }
/** * Create a status node of the given name. */ public StateItem createState(String name) { try { Node folderNode = this.getAreaNode(STATE_AREA); String nodePath = NodeUtils.makeJSR170ComplaintName(name); Node stateNode = RulesRepository.addNodeIfNew(folderNode, nodePath, StateItem.STATE_NODE_TYPE_NAME); log.debug("Created the status [" + name + "] at [" + nodePath + "]"); return new StateItem(this, stateNode); } catch (Exception e) { log.error(e.getMessage(), e); throw new RulesRepositoryException(e); } }
/** * Gets a StateItem for the specified state name. If a node for the * specified state does not yet exist, one is first created. * * @param name the name of the state to get * @return a StateItem object encapsulating the retrieved node * @throws RulesRepositoryException */ public StateItem getState(String name) throws RulesRepositoryException { try { Node folderNode = this.getAreaNode(STATE_AREA); String nodePath = NodeUtils.makeJSR170ComplaintName(name); if (!folderNode.hasNode(nodePath)) { throw new RulesRepositoryException("The state called [" + name + "] does not exist."); } Node stateNode = folderNode.getNode(nodePath); // RulesRepository.addNodeIfNew(folderNode, name, StateItem.STATE_NODE_TYPE_NAME); return new StateItem(this, stateNode); } catch (Exception e) { log.error(e.getMessage(), e); throw new RulesRepositoryException(e); } }
/** * Gets a StateItem for the specified state name. If a node for the * specified state does not yet exist, one is first created. * * @param name the name of the state to get * @return a StateItem object encapsulating the retrieved node * @throws RulesRepositoryException */ public StateItem getState(String name) throws RulesRepositoryException { try { Node folderNode = this.getAreaNode(STATE_AREA); String nodePath = NodeUtils.makeJSR170ComplaintName(name); if (!folderNode.hasNode(nodePath)) { throw new RulesRepositoryException("The state called [" + name + "] does not exist."); } Node stateNode = folderNode.getNode(nodePath); // RulesRepository.addNodeIfNew(folderNode, name, StateItem.STATE_NODE_TYPE_NAME); return new StateItem(this, stateNode); } catch (Exception e) { log.error(e.getMessage(), e); throw new RulesRepositoryException(e); } }
/** * Create a status node of the given name. */ public StateItem createState(String name) { try { Node folderNode = this.getAreaNode(STATE_AREA); String nodePath = NodeUtils.makeJSR170ComplaintName(name); Node stateNode = RulesRepository.addNodeIfNew(folderNode, nodePath, StateItem.STATE_NODE_TYPE_NAME); log.debug("Created the status [" + name + "] at [" + nodePath + "]"); return new StateItem(this, stateNode); } catch (Exception e) { log.error(e.getMessage(), e); throw new RulesRepositoryException(e); } }
/** * Gets StateItem object corresponding to the state property of this object's node * * @return a StateItem object corresponding to the state property of this object's node, or null * if the state property is not set * @throws RulesRepositoryException */ public StateItem getState() throws RulesRepositoryException { try { Node content = getVersionContentNode(); Property stateProperty = content.getProperty( STATE_PROPERTY_NAME ); Node stateNode = this.rulesRepository.getSession().getNodeByIdentifier( stateProperty.getString() ); return new StateItem( this.rulesRepository, stateNode ); } catch ( PathNotFoundException e ) { //not set return null; } catch ( Exception e ) { log.error( "Caught exception", e ); throw new RulesRepositoryException( e ); } }
/** * Gets StateItem object corresponding to the state property of this object's node * * @return a StateItem object corresponding to the state property of this object's node, or null * if the state property is not set * @throws RulesRepositoryException */ public StateItem getState() throws RulesRepositoryException { try { Node content = getVersionContentNode(); Property stateProperty = content.getProperty( STATE_PROPERTY_NAME ); Node stateNode = this.rulesRepository.getSession().getNodeByIdentifier( stateProperty.getString() ); return new StateItem( this.rulesRepository, stateNode ); } catch ( PathNotFoundException e ) { //not set return null; } catch ( Exception e ) { log.error( "Caught exception", e ); throw new RulesRepositoryException( e ); } }