/** * Optionally set the filename to be associated with the binary content. */ public void updateBinaryContentAttachmentFileName(String name) { updateStringProperty( name, CONTENT_PROPERTY_ATTACHMENT_FILENAME ); }
/** * Optionally set the filename to be associated with the binary content. */ public void updateBinaryContentAttachmentFileName(String name) { updateStringProperty( name, CONTENT_PROPERTY_ATTACHMENT_FILENAME ); }
/** * This updates a user defined property (not one of the intrinsic ones). */ public void updateUserProperty(String propertyName, String value) { if ( propertyName.startsWith( "drools:" ) ) { throw new IllegalArgumentException( "Can only set the pre defined fields using the appropriate methods." ); } updateStringProperty( value, propertyName ); }
/** * This updates a user defined property (not one of the intrinsic ones). */ public void updateUserProperty(String propertyName, String value) { if ( propertyName.startsWith( "drools:" ) ) { throw new IllegalArgumentException( "Can only set the pre defined fields using the appropriate methods." ); } updateStringProperty( value, propertyName ); }
as.updateStringProperty(newModuleName, AssetItem.MODULE_NAME_PROPERTY);
/** * 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); } }
as.updateStringProperty(newModuleName, AssetItem.MODULE_NAME_PROPERTY);
/** * 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); } }
dest.updateStringProperty(destinationModule, AssetItem.MODULE_NAME_PROPERTY); dest.node.setProperty(AssetItem.VERSION_NUMBER_PROPERTY_NAME,
dest.updateStringProperty(destinationModule, AssetItem.MODULE_NAME_PROPERTY); dest.node.setProperty(AssetItem.VERSION_NUMBER_PROPERTY_NAME,
@Test public void testUpdateStringProperty() throws Exception { RulesRepository repo = getRepo(); ModuleItem def = repo.loadDefaultModule(); AssetItem asset = repo.loadDefaultModule().addAsset("testUpdateStringProperty", "test content"); asset.updateContent("new content"); asset.checkin(""); Calendar lm = asset.getLastModified(); Thread.sleep(100); asset.updateStringProperty("Anything", "AField"); assertEquals("Anything", asset.getStringProperty("AField")); Calendar lm_ = asset.getLastModified(); assertTrue(lm_.getTimeInMillis() > lm.getTimeInMillis()); Thread.sleep(100); asset.updateStringProperty("More", "AField", false); assertEquals(lm_.getTimeInMillis(), asset.getLastModified().getTimeInMillis()); asset.updateContent("more content"); asset.checkin(""); asset = repo.loadAssetByUUID(asset.getUUID()); assertEquals("More", asset.getStringProperty("AField")); }
@Test public void testUpdateStringPropertyForShareableAsset() throws Exception { AssetItem asset = loadGlobalArea().addAsset("testUpdateStringPropertyForShareableAsset", "desc"); asset.checkin("initial"); AssetItem linkedAsset = getDefaultPackage().addAssetImportedFromGlobalArea(asset.getName()); linkedAsset.updateContent("new content"); linkedAsset.checkin(""); linkedAsset.updateStringProperty("Anything", "AField"); assertEquals("Anything", linkedAsset.getStringProperty("AField")); assertEquals("Anything", asset.getStringProperty("AField")); asset.updateStringProperty("More", "AField", false); asset.updateContent("more content"); asset.checkin(""); asset = getRepo().loadAssetByUUID(asset.getUUID()); assertEquals("More", asset.getStringProperty("AField")); assertEquals("more content", asset.getContent()); linkedAsset = getRepo().loadAssetByUUID(linkedAsset.getUUID()); assertEquals("More", linkedAsset.getStringProperty("AField")); assertEquals("more content", asset.getContent()); } /*