congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
ModuleItem.getNode
Code IndexAdd Tabnine to your IDE (free)

How to use
getNode
method
in
org.drools.repository.ModuleItem

Best Java code snippets using org.drools.repository.ModuleItem.getNode (Showing top 7 results out of 315)

origin: org.chtijbug.drools/guvnor-repository

/**
 * Copy a package to the target name.
 */
public String copyModule(String sourceModuleName,
             String destModuleName) {
  ModuleItem source = loadModule(sourceModuleName);
  try {
    String destPath = source.getNode().getParent().getPath() + "/" + destModuleName;
    if (this.getAreaNode(MODULE_AREA).hasNode(destModuleName)) {
      throw new RulesRepositoryException("Destination already exists.");
    }
    this.session.getWorkspace().copy(source.getNode().getPath(),
        destPath);
    ModuleItem newModuleItem = loadModule(destModuleName);
    newModuleItem.updateTitle(destModuleName);
    for (Iterator iter = newModuleItem.getAssets(); iter.hasNext(); ) {
      AssetItem as = (AssetItem) iter.next();
      as.updateStringProperty(destModuleName,
          AssetItem.MODULE_NAME_PROPERTY);
    }
    save();
    return newModuleItem.getUUID();
  } catch (RepositoryException e) {
    log.error(e.getMessage(),
        e);
    throw new RulesRepositoryException(e);
  }
}

origin: org.drools/guvnor-repository

/**
 * Copy a package to the target name.
 */
public String copyModule(String sourceModuleName,
             String destModuleName) {
  ModuleItem source = loadModule(sourceModuleName);
  try {
    String destPath = source.getNode().getParent().getPath() + "/" + destModuleName;
    if (this.getAreaNode(MODULE_AREA).hasNode(destModuleName)) {
      throw new RulesRepositoryException("Destination already exists.");
    }
    this.session.getWorkspace().copy(source.getNode().getPath(),
        destPath);
    ModuleItem newModuleItem = loadModule(destModuleName);
    newModuleItem.updateTitle(destModuleName);
    for (Iterator iter = newModuleItem.getAssets(); iter.hasNext(); ) {
      AssetItem as = (AssetItem) iter.next();
      as.updateStringProperty(destModuleName,
          AssetItem.MODULE_NAME_PROPERTY);
    }
    save();
    return newModuleItem.getUUID();
  } catch (RepositoryException e) {
    log.error(e.getMessage(),
        e);
    throw new RulesRepositoryException(e);
  }
}

origin: org.drools/guvnor-repository

try {
  ModuleItem itemOriginal = loadModuleByUUID(uuid);
  log.info("Renaming module: " + itemOriginal.getNode().getPath() + " to " + newModuleName);
  Node node = itemOriginal.getNode();
  String sourcePath = node.getPath();
  String destPath = node.getParent().getPath() + "/" + newModuleName;
origin: org.chtijbug.drools/guvnor-repository

try {
  ModuleItem itemOriginal = loadModuleByUUID(uuid);
  log.info("Renaming module: " + itemOriginal.getNode().getPath() + " to " + newModuleName);
  Node node = itemOriginal.getNode();
  String sourcePath = node.getPath();
  String destPath = node.getParent().getPath() + "/" + newModuleName;
origin: org.chtijbug.drools/guvnor-repository

/**
 * This is showing how to copy a package with standard JCR
 */
@Test
public void testPackageCopy() throws Exception {
  RulesRepository repo = getRepo();
  ModuleItem pkg = repo.createModule( "testPackageCopy", "this is something" );
  AssetItem it1 = pkg.addAsset( "testPackageCopy1", "la" );
  AssetItem it2 = pkg.addAsset( "testPackageCopy2", "la" );
  it1.updateContent( "new content" );
  it2.updateContent( "more content" );
  it1.checkin( "c" );
  it2.checkin( "c" );
  it1 = pkg.loadAsset( "testPackageCopy1" );
  List hist1 = iteratorToList( it1.getHistory() );
  System.out.println(hist1.size());
  repo.getSession().getWorkspace().copy( pkg.getNode().getPath(), pkg.getNode().getPath() + "_");
  ModuleItem pkg2 = repo.loadModule( "testPackageCopy_" );
  assertNotNull(pkg2);
  assertEquals(2, iteratorToList( pkg2.getAssets() ).size() );
  AssetItem it1_ = pkg2.loadAsset( "testPackageCopy1" );
  it1.updateContent( "new content2" );
  it1.checkin( "la" );
  it1_ = pkg2.loadAsset( "testPackageCopy1" );
  assertEquals("new content", it1_.getContent());
}
origin: org.chtijbug.drools/guvnor-repository

@Test
public void testAssetItemCreation() throws Exception {
    Calendar now = Calendar.getInstance();
    Thread.sleep(500); //MN: need this sleep to get the correct date
    AssetItem ruleItem1 = getDefaultPackage().addAsset("testRuleItem", "test content");
    assertNotNull(ruleItem1);
    assertNotNull(ruleItem1.getNode());
    assertEquals("testRuleItem", ruleItem1.getName());
    assertNotNull(ruleItem1.getCreatedDate());
    assertTrue(now.before( ruleItem1.getCreatedDate() ));
    String packName = getDefaultPackage().getName();
    assertEquals(packName, ruleItem1.getModuleName());
    assertNotNull(ruleItem1.getUUID());
  //try constructing with node of wrong type
  try {
    ModuleItem pitem = getRepo().loadDefaultModule();
    new AssetItem(getRepo(), pitem.getNode());
    fail("Exception not thrown for node of wrong type");
  }
  catch(RulesRepositoryException e) {
    assertNotNull(e.getMessage());
  }
  catch(Exception e) {
    fail("Caught unexpected exception: " + e);
  }
}
origin: org.chtijbug.drools/guvnor-repository

@Test
public void testLoadRulePackageItemByUUID() throws Exception {
  ModuleItem rulePackageItem = getRepo().createModule("testLoadRuleRuleItemByUUID", "desc");
  String uuid = null;
    uuid = rulePackageItem.getNode().getUUID();
  rulePackageItem = getRepo().loadModuleByUUID(uuid);
  assertNotNull(rulePackageItem);
  assertEquals("testLoadRuleRuleItemByUUID", rulePackageItem.getName());
  // try loading rule package that was not created
  try {
    rulePackageItem = getRepo().loadModuleByUUID("01010101-0101-0101-0101-010101010101");
    fail("Exception not thrown loading rule package that was not created.");
  } catch (RulesRepositoryException e) {
    // that is OK!
    assertNotNull(e.getMessage());
  }
}
org.drools.repositoryModuleItemgetNode

Popular methods of ModuleItem

  • addAsset
    This adds an asset to the current physical module (you can move it later). With the given category.
  • containsAsset
    Returns true if this module contains an asset of the given name.
  • getName
    Return the name of the module.
  • getStringProperty
  • listAssetsByFormat
    This will load an iterator for assets of the given format type.
  • loadAsset
    Load a specific asset by name.
  • updateStringProperty
  • <init>
    Constructs an object of type ModuleItem corresponding the specified node
  • checkin
  • checkout
  • createSubModule
    Creates a nested package.
  • ensureMixinType
  • createSubModule,
  • ensureMixinType,
  • getAssets,
  • getAssetsWithStatus,
  • getDependencies,
  • getDescription,
  • getFormat,
  • getLastModified,
  • getStringPropertyArray

Popular in Java

  • Start an intent from android
  • scheduleAtFixedRate (ScheduledExecutorService)
  • getExternalFilesDir (Context)
  • getSupportFragmentManager (FragmentActivity)
  • InetAddress (java.net)
    An Internet Protocol (IP) address. This can be either an IPv4 address or an IPv6 address, and in pra
  • Permission (java.security)
    Legacy security code; do not use.
  • Connection (java.sql)
    A connection represents a link from a Java application to a database. All SQL statements and results
  • Deque (java.util)
    A linear collection that supports element insertion and removal at both ends. The name deque is shor
  • Manifest (java.util.jar)
    The Manifest class is used to obtain attribute information for a JarFile and its entries.
  • Cipher (javax.crypto)
    This class provides access to implementations of cryptographic ciphers for encryption and decryption
  • 21 Best Atom Packages for 2021
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