congrats Icon
New! Announcing our next generation AI code completions
Read here
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

  • Reactive rest calls using spring rest template
  • addToBackStack (FragmentTransaction)
  • findViewById (Activity)
  • runOnUiThread (Activity)
  • GridBagLayout (java.awt)
    The GridBagLayout class is a flexible layout manager that aligns components vertically and horizonta
  • FileReader (java.io)
    A specialized Reader that reads from a file in the file system. All read requests made by calling me
  • Socket (java.net)
    Provides a client-side TCP socket.
  • Comparator (java.util)
    A Comparator is used to compare two objects to determine their ordering with respect to each other.
  • Collectors (java.util.stream)
  • JButton (javax.swing)
  • 14 Best Plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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