コード例 #1
0
  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);
    }
  }
コード例 #2
0
 protected String[] listImagesInPackage(String packageName) throws SerializationException {
   // load package
   PackageItem item = rulesRepository.loadPackage(packageName);
   List<String> retList = new ArrayList<String>();
   Iterator<AssetItem> iter = item.getAssets();
   while (iter.hasNext()) {
     AssetItem pitem = iter.next();
     if (pitem.getFormat().equalsIgnoreCase("png")
         || pitem.getFormat().equalsIgnoreCase("gif")
         || pitem.getFormat().equalsIgnoreCase("jpg")) {
       retList.add(pitem.getName());
     }
   }
   return (String[]) retList.toArray(new String[] {});
 }
コード例 #3
0
  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);
  }
コード例 #4
0
  protected String[] listRulesInPackage(String packageName) throws SerializationException {
    // load package
    PackageItem item = rulesRepository.loadPackage(packageName);

    PackageDRLAssembler assembler = createPackageDRLAssembler(item);

    List<String> result = new ArrayList<String>();
    try {

      String drl = assembler.getDRL();
      if (drl == null || "".equals(drl)) {
        return new String[0];
      } else {
        parseRulesToPackageList(assembler, result);
      }

      return result.toArray(new String[result.size()]);
    } catch (DroolsParserException e) {
      log.error("Unable to list rules in package", e);
      return new String[0];
    }
  }