protected void copyOrRemoveSnapshot( String packageName, String snapshotName, boolean delete, String newSnapshotName) throws SerializationException { if (delete) { log.info( "USER:"******" REMOVING SNAPSHOT for package: [" + packageName + "] snapshot: [" + snapshotName + "]"); rulesRepository.removePackageSnapshot(packageName, snapshotName); } else { if (newSnapshotName.equals("")) { throw new SerializationException("Need to have a new snapshot name."); } log.info( "USER:"******" COPYING SNAPSHOT for package: [" + packageName + "] snapshot: [" + snapshotName + "] to [" + newSnapshotName + "]"); rulesRepository.copyPackageSnapshot(packageName, snapshotName, newSnapshotName); } }
public void savePackage(PackageConfigData data) throws SerializationException { log.info("USER:"******" SAVING package [" + data.getName() + "]"); PackageItem item = rulesRepository.loadPackage(data.getName()); // If package is being unarchived. boolean unarchived = (!data.isArchived() && item.isArchived()); Calendar packageLastModified = item.getLastModified(); DroolsHeader.updateDroolsHeader(data.getHeader(), item); updateCategoryRules(data, item); item.updateExternalURI(data.getExternalURI()); item.updateDescription(data.getDescription()); item.archiveItem(data.isArchived()); item.updateBinaryUpToDate(false); if (!data.getFormat().equals("")) { item.updateFormat(data.getFormat()); } RuleBaseCache.getInstance().remove(data.getUuid()); item.checkin(data.getDescription()); // If package is archived, archive all the assets under it if (data.isArchived()) { handleArchivedForSavePackage(data, item); } else if (unarchived) { handleUnarchivedForSavePackage(data, item, packageLastModified); } }
protected String createPackage(String name, String description, String format, String[] workspace) throws RulesRepositoryException { log.info("USER: "******" CREATING package [" + name + "]"); PackageItem item = rulesRepository.createPackage(name, description, format, workspace); return item.getUUID(); }
protected String renamePackage(String uuid, String newName) { log.info( "USER:"******" RENAMING package [UUID: " + uuid + "] to package [" + newName + "]"); return rulesRepository.renamePackage(uuid, newName); }
protected void removePackage(String uuid) { try { PackageItem item = rulesRepository.loadPackageByUUID(uuid); log.info("USER:"******" REMOVEING package [" + item.getName() + "]"); item.remove(); rulesRepository.save(); } catch (RulesRepositoryException e) { log.error("Unable to remove package.", e); throw e; } }
protected String createSubPackage(String name, String description, String parentNode) throws SerializationException { log.info( "USER: "******" CREATING subPackage [" + name + "], parent [" + parentNode + "]"); PackageItem item = rulesRepository.createSubPackage(name, description, parentNode); return item.getUUID(); }
protected byte[] exportPackages(String packageName) { log.info("USER:"******" export package [name: " + packageName + "] "); try { return rulesRepository.dumpPackageFromRepositoryXml(packageName); } catch (PathNotFoundException e) { throw new RulesRepositoryException(e); } catch (IOException e) { throw new RulesRepositoryException(e); } catch (RepositoryException e) { throw new RulesRepositoryException(e); } }
public ValidatedResponse validatePackageConfiguration(PackageConfigData data) throws SerializationException { log.info( "USER:"******" validatePackageConfiguration package [" + data.getName() + "]"); RuleBaseCache.getInstance().remove(data.getUuid()); BRMSSuggestionCompletionLoader loader = createBRMSSuggestionCompletionLoader(); loader.getSuggestionEngine(rulesRepository.loadPackage(data.getName()), data.getHeader()); return validateBRMSSuggestionCompletionLoaderResponse(loader); }
protected String copyPackage(String sourcePackageName, String destPackageName) throws SerializationException { try { log.info( "USER:"******" COPYING package [" + sourcePackageName + "] to package [" + destPackageName + "]"); return rulesRepository.copyPackage(sourcePackageName, destPackageName); } catch (RulesRepositoryException e) { log.error("Unable to copy package.", e); throw e; } }
protected void createPackageSnapshot( String packageName, String snapshotName, boolean replaceExisting, String comment) { log.info( "USER:"******" CREATING PACKAGE SNAPSHOT for package: [" + packageName + "] snapshot name: [" + snapshotName); if (replaceExisting) { rulesRepository.removePackageSnapshot(packageName, snapshotName); } rulesRepository.createPackageSnapshot(packageName, snapshotName); PackageItem item = rulesRepository.loadPackageSnapshot(packageName, snapshotName); item.updateCheckinComment(comment); rulesRepository.save(); }