Codota Logo
NodeUtils.makeJSR170ComplaintName
Code IndexAdd Codota to your IDE (free)

How to use
makeJSR170ComplaintName
method
in
org.drools.repository.utils.NodeUtils

Best Java code snippets using org.drools.repository.utils.NodeUtils.makeJSR170ComplaintName (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
ScheduledThreadPoolExecutor s =
  • Codota Iconnew ScheduledThreadPoolExecutor(corePoolSize)
  • Codota IconThreadFactory threadFactory;new ScheduledThreadPoolExecutor(corePoolSize, threadFactory)
  • Codota IconString str;new ScheduledThreadPoolExecutor(1, new ThreadFactoryBuilder().setNameFormat(str).build())
  • Smart code suggestions by Codota
}
origin: org.drools/guvnor-repository

/**
 * This will create a child category under this one
 */
public CategoryItem addCategory(String name,
                String description) {
  try {
    String nodePath = NodeUtils.makeJSR170ComplaintName(name);
    Node child = this.node.addNode(nodePath, CategoryItem.TAG_NODE_TYPE_NAME);
    this.rulesRepository.getSession().save();
    return new CategoryItem(this.rulesRepository, child);
  } catch (Exception e) {
    if (e instanceof RuntimeException) {
      throw (RuntimeException) e;
    } else {
      throw new RulesRepositoryException(e);
    }
  }
}
origin: org.drools/guvnor-repository

/**
 * This will copy the module to the snapshot area. Creating a copy for
 * deployment, etc.
 */
public void createModuleSnapshot(String moduleName,
                 String snapshotName) {
  log.debug("Creating snapshot for [" + moduleName + "] called [" + snapshotName + "]");
  try {
    Node snaps = this.getAreaNode(MODULE_SNAPSHOT_AREA);
    String nodePath = NodeUtils.makeJSR170ComplaintName(moduleName);
    if (!snaps.hasNode(nodePath)) {
      snaps.addNode(nodePath,
          "nt:folder");
      save();
    }
    String newName = snaps.getNode(nodePath).getPath() + "/" + snapshotName;
    Node moduleNode = this.getAreaNode(MODULE_AREA).getNode(moduleName);
    long start = System.currentTimeMillis();
    this.session.getWorkspace().copy(moduleNode.getPath(),
        newName);
    log.debug("Time taken for snap: " + (System.currentTimeMillis() - start));
  } catch (RepositoryException e) {
    log.error("Unable to create snapshot",
        e);
    throw new RulesRepositoryException(e);
  }
}
origin: org.chtijbug.drools/guvnor-repository

/**
 * This will copy the module to the snapshot area. Creating a copy for
 * deployment, etc.
 */
public void createModuleSnapshot(String moduleName,
                 String snapshotName) {
  log.debug("Creating snapshot for [" + moduleName + "] called [" + snapshotName + "]");
  try {
    Node snaps = this.getAreaNode(MODULE_SNAPSHOT_AREA);
    String nodePath = NodeUtils.makeJSR170ComplaintName(moduleName);
    if (!snaps.hasNode(nodePath)) {
      snaps.addNode(nodePath,
          "nt:folder");
      save();
    }
    String newName = snaps.getNode(nodePath).getPath() + "/" + snapshotName;
    Node moduleNode = this.getAreaNode(MODULE_AREA).getNode(moduleName);
    long start = System.currentTimeMillis();
    this.session.getWorkspace().copy(moduleNode.getPath(),
        newName);
    log.debug("Time taken for snap: " + (System.currentTimeMillis() - start));
  } catch (RepositoryException e) {
    log.error("Unable to create snapshot",
        e);
    throw new RulesRepositoryException(e);
  }
}
origin: org.chtijbug.drools/guvnor-repository

/**
 * This will create a child category under this one
 */
public CategoryItem addCategory(String name,
                String description) {
  try {
    String nodePath = NodeUtils.makeJSR170ComplaintName(name);
    Node child = this.node.addNode(nodePath, CategoryItem.TAG_NODE_TYPE_NAME);
    this.rulesRepository.getSession().save();
    return new CategoryItem(this.rulesRepository, child);
  } catch (Exception e) {
    if (e instanceof RuntimeException) {
      throw (RuntimeException) e;
    } else {
      throw new RulesRepositoryException(e);
    }
  }
}
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.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);
  }
}
origin: org.drools/guvnor-repository

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

String assetPath = NodeUtils.makeJSR170ComplaintName(subModuleName);
Node ruleSubPackageNode = subModulesNode.addNode(assetPath,
    ModuleItem.MODULE_TYPE_NAME);
origin: org.chtijbug.drools/guvnor-repository

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

@Test
public void testNodePathConversion5() {
  final String assetName = "one]two";
  final String pathName = NodeUtils.makeJSR170ComplaintName( assetName );
  assertEquals( "one_two",
         pathName );
}
origin: org.chtijbug.drools/guvnor-repository

@Test
public void testNodePathConversion7() {
  final String assetName = "one\"two";
  final String pathName = NodeUtils.makeJSR170ComplaintName( assetName );
  assertEquals( "one_two",
         pathName );
}
origin: org.chtijbug.drools/guvnor-repository

@Test
public void testNodePathConversion3() {
  final String assetName = "one*two";
  final String pathName = NodeUtils.makeJSR170ComplaintName( assetName );
  assertEquals( "one_two",
         pathName );
}
origin: org.chtijbug.drools/guvnor-repository

@Test
public void testNodePathConversion6() {
  final String assetName = "one'two";
  final String pathName = NodeUtils.makeJSR170ComplaintName( assetName );
  assertEquals( "one_two",
         pathName );
}
origin: org.chtijbug.drools/guvnor-repository

@Test
public void testNodePathConversion2() {
  final String assetName = "one:two";
  final String pathName = NodeUtils.makeJSR170ComplaintName( assetName );
  assertEquals( "one_two",
         pathName );
}
origin: org.chtijbug.drools/guvnor-repository

@Test
public void testNodePathConversion8() {
  final String assetName = "one|two";
  final String pathName = NodeUtils.makeJSR170ComplaintName( assetName );
  assertEquals( "one_two",
         pathName );
}
origin: org.chtijbug.drools/guvnor-repository

@Test
public void testNodePathConversion1() {
  final String assetName = "one/two";
  final String pathName = NodeUtils.makeJSR170ComplaintName( assetName );
  assertEquals( "one_two",
         pathName );
}
origin: org.chtijbug.drools/guvnor-repository

@Test
public void testNodePathConversion9() {
  final String assetName = "one two";
  final String pathName = NodeUtils.makeJSR170ComplaintName( assetName );
  assertEquals( "one two",
         pathName );
}
origin: org.chtijbug.drools/guvnor-repository

@Test
public void testNodePathConversion4() {
  final String assetName = "one[two";
  final String pathName = NodeUtils.makeJSR170ComplaintName( assetName );
  assertEquals( "one_two",
         pathName );
}
origin: org.drools/guvnor-repository

AssetItem source = loadAssetByUUID(uuidSource);
String sourcePath = source.getNode().getPath();
String safeDestinationName = NodeUtils.makeJSR170ComplaintName(destinationName);
String destPath = this.getAreaNode(MODULE_AREA).getPath() + "/" + destinationModule + "/" + ModuleItem.ASSET_FOLDER_NAME + "/" + safeDestinationName;
this.session.getWorkspace().copy(sourcePath,
origin: org.chtijbug.drools/guvnor-repository

AssetItem source = loadAssetByUUID(uuidSource);
String sourcePath = source.getNode().getPath();
String safeDestinationName = NodeUtils.makeJSR170ComplaintName(destinationName);
String destPath = this.getAreaNode(MODULE_AREA).getPath() + "/" + destinationModule + "/" + ModuleItem.ASSET_FOLDER_NAME + "/" + safeDestinationName;
this.session.getWorkspace().copy(sourcePath,
org.drools.repository.utilsNodeUtilsmakeJSR170ComplaintName

Javadoc

Construct a validate JCR Node path name per JSR-170 from an asset name. Only the following characters are valid: char ::= nonspace | ' ' nonspace ::= (* Any Unicode character except: '/', ':', '[', ']', '*', ''', '"', '|' or any whitespace character *). Invalid characters are replaced with an underscore ("_").

Popular methods of NodeUtils

    Popular in Java

    • Creating JSON documents from java classes using gson
    • scheduleAtFixedRate (Timer)
    • getExternalFilesDir (Context)
    • compareTo (BigDecimal)
      Compares this BigDecimal with the specified BigDecimal. Two BigDecimal objects that are equal in val
    • Component (java.awt)
      A component is an object having a graphical representation that can be displayed on the screen and t
    • GridLayout (java.awt)
      The GridLayout class is a layout manager that lays out a container's components in a rectangular gri
    • HttpURLConnection (java.net)
      An URLConnection for HTTP (RFC 2616 [http://tools.ietf.org/html/rfc2616]) used to send and receive d
    • StringTokenizer (java.util)
      The string tokenizer class allows an application to break a string into tokens. The tokenization met
    • Annotation (javassist.bytecode.annotation)
      The annotation structure.An instance of this class is returned bygetAnnotations() in AnnotationsAttr
    • SAXParseException (org.xml.sax)
      Encapsulate an XML parse error or warning.This exception may include information for locating the er
    Codota Logo
    • Products

      Search for Java codeSearch for JavaScript codeEnterprise
    • IDE Plugins

      IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
    • Company

      About UsContact UsCareers
    • Resources

      FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
    Get Codota for your IDE now