Пример #1
0
  /** This will create a new asset which refers to an existing asset */
  public String createNewImportedRule(String sharedAssetName, String initialPackage)
      throws SerializationException {
    log.info(
        "USER:"******" CREATING shared asset imported from global area named ["
            + sharedAssetName
            + "] in package ["
            + initialPackage
            + "]");

    try {
      ModuleItem packageItem = rulesRepository.loadModule(initialPackage);
      AssetItem asset = packageItem.addAssetImportedFromGlobalArea(sharedAssetName);
      rulesRepository.save();

      return asset.getUUID();
    } catch (RulesRepositoryException e) {
      // If we want to display an explicit error message of "duplicate asset", we can achieve this
      // in client error handler.
      /*            if ( e.getCause() instanceof ItemExistsException ) {
          return "DUPLICATE";
      }*/
      log.error(
          "An error occurred creating shared asset"
              + sharedAssetName
              + "] in package ["
              + initialPackage
              + "]: ",
          e);
      throw new SerializationException(e.getMessage());
    }
  }
 private String getCurrentUserName() {
   return rulesRepository.getSession().getUserID();
 }
Пример #3
0
 @Roles({"ADMIN"})
 public void clearRulesRepository() {
   RulesRepositoryAdministrator admin =
       new RulesRepositoryAdministrator(rulesRepository.getSession());
   admin.clearRulesRepository();
 }