Tabnine Logo
RulesRepository.addNodeIfNew
Code IndexAdd Tabnine to your IDE (free)

How to use
addNodeIfNew
method
in
org.drools.repository.RulesRepository

Best Java code snippets using org.drools.repository.RulesRepository.addNodeIfNew (Showing top 16 results out of 315)

origin: org.chtijbug.drools/guvnor-repository

private Node getMetaDataTypeNode(String metadataType)
    throws RepositoryException {
  Node schemaNode = getAreaNode(SCHEMA_AREA);
  return addNodeIfNew(
      addNodeIfNew(schemaNode,
          METADATA_TYPE_AREA,
          "nt:folder"),
      metadataType,
      "nt:file");
}
origin: org.drools/guvnor-repository

private Node getMetaDataTypeNode(String metadataType)
    throws RepositoryException {
  Node schemaNode = getAreaNode(SCHEMA_AREA);
  return addNodeIfNew(
      addNodeIfNew(schemaNode,
          METADATA_TYPE_AREA,
          "nt:folder"),
      metadataType,
      "nt:file");
}
origin: org.drools/guvnor-repository

private NodeIterator getMetaDataTypeNodes() throws RepositoryException {
  Node schemaNode = getAreaNode(SCHEMA_AREA);
  return addNodeIfNew(schemaNode,
      METADATA_TYPE_AREA,
      "nt:folder").getNodes();
}
origin: org.chtijbug.drools/guvnor-repository

private NodeIterator getMetaDataTypeNodes() throws RepositoryException {
  Node schemaNode = getAreaNode(SCHEMA_AREA);
  return addNodeIfNew(schemaNode,
      METADATA_TYPE_AREA,
      "nt:folder").getNodes();
}
origin: org.drools/guvnor-repository

private Node getPerspectivesConfigurationArea() throws RepositoryException {
  Node areaNode;
  try {
    areaNode = this.getAreaNode(String.format("%s/%s",
        CONFIGURATION_AREA,
        PERSPECTIVES_CONFIGURATION_AREA));
  } catch (RulesRepositoryException e) {
    Node repositoryNode = this.session.getRootNode().getNode(RULES_REPOSITORY_NAME);
    Node configurationArea = RulesRepository.addNodeIfNew(repositoryNode,
        RulesRepository.CONFIGURATION_AREA,
        "nt:folder");
    areaNode = RulesRepository.addNodeIfNew(configurationArea,
        RulesRepository.PERSPECTIVES_CONFIGURATION_AREA,
        "nt:folder");
  }
  return areaNode;
}
origin: org.chtijbug.drools/guvnor-repository

private Node getPerspectivesConfigurationArea() throws RepositoryException {
  Node areaNode;
  try {
    areaNode = this.getAreaNode(String.format("%s/%s",
        CONFIGURATION_AREA,
        PERSPECTIVES_CONFIGURATION_AREA));
  } catch (RulesRepositoryException e) {
    Node repositoryNode = this.session.getRootNode().getNode(RULES_REPOSITORY_NAME);
    Node configurationArea = RulesRepository.addNodeIfNew(repositoryNode,
        RulesRepository.CONFIGURATION_AREA,
        "nt:folder");
    areaNode = RulesRepository.addNodeIfNew(configurationArea,
        RulesRepository.PERSPECTIVES_CONFIGURATION_AREA,
        "nt:folder");
  }
  return areaNode;
}
origin: org.drools/guvnor-repository

public String[] listWorkspaces() throws RulesRepositoryException {
  List<String> result = new ArrayList<String>();
  try {
    //SCHEMA_AREA and WORKSPACE_AREA may not exist if the repository is imported from an old version.
    Node schemaNode = addNodeIfNew(this.session.getRootNode().getNode(RULES_REPOSITORY_NAME),
        SCHEMA_AREA,
        "nt:folder");
    NodeIterator workspaceNodes = addNodeIfNew(schemaNode,
        WORKSPACE_AREA,
        "nt:folder").getNodes();
    while (workspaceNodes.hasNext()) {
      Node workspaceNode = workspaceNodes.nextNode();
      result.add(workspaceNode.getName());
    }
  } catch (Exception e) {
    log.error(e.getMessage(),
        e);
    throw new RulesRepositoryException(e);
  }
  return result.toArray(new String[result.size()]);
}
origin: org.chtijbug.drools/guvnor-repository

public String[] listWorkspaces() throws RulesRepositoryException {
  List<String> result = new ArrayList<String>();
  try {
    //SCHEMA_AREA and WORKSPACE_AREA may not exist if the repository is imported from an old version.
    Node schemaNode = addNodeIfNew(this.session.getRootNode().getNode(RULES_REPOSITORY_NAME),
        SCHEMA_AREA,
        "nt:folder");
    NodeIterator workspaceNodes = addNodeIfNew(schemaNode,
        WORKSPACE_AREA,
        "nt:folder").getNodes();
    while (workspaceNodes.hasNext()) {
      Node workspaceNode = workspaceNodes.nextNode();
      result.add(workspaceNode.getName());
    }
  } catch (Exception e) {
    log.error(e.getMessage(),
        e);
    throw new RulesRepositoryException(e);
  }
  return result.toArray(new String[result.size()]);
}
origin: org.chtijbug.drools/guvnor-repository

/**
 * Create a status node of the given name.
 */
public Node createWorkspace(String workspace) {
  try {
    //SCHEMA_AREA and WORKSPACE_AREA may not exist if the repository is imported from an old version.
    Node schemaNode = addNodeIfNew(this.session.getRootNode().getNode(RULES_REPOSITORY_NAME),
        SCHEMA_AREA,
        "nt:folder");
    Node workspaceNode = addNodeIfNew(schemaNode,
        WORKSPACE_AREA,
        "nt:folder");
    Node node = addNodeIfNew(workspaceNode,
        workspace,
        "nt:file");
    //TODO: use cnd instead
    node.addNode("jcr:content",
        "nt:unstructured");
    this.getSession().save();
    log.debug("Created workspace [" + workspace + "]");
    return node;
  } catch (Exception e) {
    log.error(e.getMessage(),
        e);
    throw new RulesRepositoryException(e);
  }
}
origin: org.drools/guvnor-repository

public void removeWorkspace(String workspace) {
  try {
    Node schemaNode = addNodeIfNew(this.session.getRootNode().getNode(RULES_REPOSITORY_NAME),
        SCHEMA_AREA,
        "nt:folder");
    Node workspaceAreaNode = addNodeIfNew(schemaNode,
        WORKSPACE_AREA,
        "nt:folder");
    Node workspaceNode = workspaceAreaNode.getNode(workspace);
    workspaceNode.remove();
    this.getSession().save();
  } catch (Exception e) {
    log.error(e.getMessage(),
        e);
    throw new RulesRepositoryException(e);
  }
}
origin: org.drools/guvnor-repository

/**
 * Create a status node of the given name.
 */
public Node createWorkspace(String workspace) {
  try {
    //SCHEMA_AREA and WORKSPACE_AREA may not exist if the repository is imported from an old version.
    Node schemaNode = addNodeIfNew(this.session.getRootNode().getNode(RULES_REPOSITORY_NAME),
        SCHEMA_AREA,
        "nt:folder");
    Node workspaceNode = addNodeIfNew(schemaNode,
        WORKSPACE_AREA,
        "nt:folder");
    Node node = addNodeIfNew(workspaceNode,
        workspace,
        "nt:file");
    //TODO: use cnd instead
    node.addNode("jcr:content",
        "nt:unstructured");
    this.getSession().save();
    log.debug("Created workspace [" + workspace + "]");
    return node;
  } catch (Exception e) {
    log.error(e.getMessage(),
        e);
    throw new RulesRepositoryException(e);
  }
}
origin: org.chtijbug.drools/guvnor-repository

public void removeWorkspace(String workspace) {
  try {
    Node schemaNode = addNodeIfNew(this.session.getRootNode().getNode(RULES_REPOSITORY_NAME),
        SCHEMA_AREA,
        "nt:folder");
    Node workspaceAreaNode = addNodeIfNew(schemaNode,
        WORKSPACE_AREA,
        "nt:folder");
    Node workspaceNode = workspaceAreaNode.getNode(workspace);
    workspaceNode.remove();
    this.getSession().save();
  } catch (Exception e) {
    log.error(e.getMessage(),
        e);
    throw new RulesRepositoryException(e);
  }
}
origin: org.chtijbug.drools/guvnor-repository

Node repositoryNode = RulesRepository.addNodeIfNew(root, RulesRepository.RULES_REPOSITORY_NAME, "nt:folder");
Node packageAreaNode = RulesRepository.addNodeIfNew(repositoryNode, RulesRepository.MODULE_AREA, "nt:folder");
  Node globalAreaNode = RulesRepository.addNodeIfNew(packageAreaNode, RulesRepository.GLOBAL_AREA, ModuleItem.MODULE_TYPE_NAME);
  globalAreaNode.addNode(ModuleItem.ASSET_FOLDER_NAME, "drools:versionableAssetFolder");
  globalAreaNode.setProperty(ModuleItem.TITLE_PROPERTY_NAME, RulesRepository.GLOBAL_AREA);
RulesRepository.addNodeIfNew(repositoryNode, RulesRepository.MODULE_SNAPSHOT_AREA, "nt:folder");
RulesRepository.addNodeIfNew(repositoryNode, RulesRepository.TAG_AREA, "nt:folder");
RulesRepository.addNodeIfNew(repositoryNode, RulesRepository.STATE_AREA, "nt:folder");
RulesRepository.addNodeIfNew(repositoryNode.getNode(RulesRepository.STATE_AREA), StateItem.DRAFT_STATE_NAME, StateItem.STATE_NODE_TYPE_NAME);
RulesRepository.addNodeIfNew(repositoryNode, RulesRepository.SCHEMA_AREA, "nt:folder");
RulesRepository.addNodeIfNew(repositoryNode.getNode(RulesRepository.SCHEMA_AREA), RulesRepository.WORKSPACE_AREA, "nt:folder");
origin: org.drools/guvnor-repository

/**
 * 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);
  }
}
origin: org.drools/guvnor-repository

Node repositoryNode = RulesRepository.addNodeIfNew(root, RulesRepository.RULES_REPOSITORY_NAME, "nt:folder");
Node packageAreaNode = RulesRepository.addNodeIfNew(repositoryNode, RulesRepository.MODULE_AREA, "nt:folder");
  Node globalAreaNode = RulesRepository.addNodeIfNew(packageAreaNode, RulesRepository.GLOBAL_AREA, ModuleItem.MODULE_TYPE_NAME);
  globalAreaNode.addNode(ModuleItem.ASSET_FOLDER_NAME, "drools:versionableAssetFolder");
  globalAreaNode.setProperty(ModuleItem.TITLE_PROPERTY_NAME, RulesRepository.GLOBAL_AREA);
RulesRepository.addNodeIfNew(repositoryNode, RulesRepository.MODULE_SNAPSHOT_AREA, "nt:folder");
RulesRepository.addNodeIfNew(repositoryNode, RulesRepository.TAG_AREA, "nt:folder");
RulesRepository.addNodeIfNew(repositoryNode, RulesRepository.STATE_AREA, "nt:folder");
RulesRepository.addNodeIfNew(repositoryNode.getNode(RulesRepository.STATE_AREA), StateItem.DRAFT_STATE_NAME, StateItem.STATE_NODE_TYPE_NAME);
RulesRepository.addNodeIfNew(repositoryNode, RulesRepository.SCHEMA_AREA, "nt:folder");
RulesRepository.addNodeIfNew(repositoryNode.getNode(RulesRepository.SCHEMA_AREA), RulesRepository.WORKSPACE_AREA, "nt:folder");
origin: org.chtijbug.drools/guvnor-repository

/**
 * 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);
  }
}
org.drools.repositoryRulesRepositoryaddNodeIfNew

Javadoc

Will add a node named 'nodeName' of type 'type' to 'parent' if such a node does not already exist.

Popular methods of RulesRepository

  • createModule
    Adds a module to the repository.
  • loadModule
    Loads a Module for the specified module name and version. Will throw an exception if the specified m
  • save
    Save any pending changes.
  • <init>
    This requires a JCR session be setup, and the repository be configured.
  • findAssetsByCategory
    This will retrieve a list of RuleItem objects - that are allocated to the provided category. Only th
  • findAssetsByName
    This will search assets, looking for matches against the name.
  • findAssetsByState
    Finds the AssetItem's linked to the requested state. Similar to finding by category.
  • getAreaNode
  • getSession
  • getState
    Gets a StateItem for the specified state name. If a node for the specified state does not yet exist,
  • listModuleSnapshots
    Return a list of the snapshots available for the given module name.
  • listModules
  • listModuleSnapshots,
  • listModules,
  • loadAssetByUUID,
  • loadCategory,
  • loadGlobalArea,
  • loadModuleByUUID,
  • loadModuleSnapshot,
  • loadState,
  • checkForDataMigration

Popular in Java

  • Reading from database using SQL prepared statement
  • startActivity (Activity)
  • getResourceAsStream (ClassLoader)
  • getApplicationContext (Context)
  • VirtualMachine (com.sun.tools.attach)
    A Java virtual machine. A VirtualMachine represents a Java virtual machine to which this Java vir
  • URLEncoder (java.net)
    This class is used to encode a string using the format required by application/x-www-form-urlencoded
  • TimerTask (java.util)
    The TimerTask class represents a task to run at a specified time. The task may be run once or repeat
  • BlockingQueue (java.util.concurrent)
    A java.util.Queue that additionally supports operations that wait for the queue to become non-empty
  • HttpServlet (javax.servlet.http)
    Provides an abstract class to be subclassed to create an HTTP servlet suitable for a Web site. A sub
  • JTable (javax.swing)
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now