コード例 #1
0
  @Override
  public void save(
      final Path resource,
      final GuidedDecisionTable52 model,
      final ResourceConfig config,
      final Metadata metadata,
      final String comment) {

    final org.kie.commons.java.nio.file.Path path = paths.convert(resource);

    Map<String, Object> attrs;

    try {
      attrs = ioService.readAttributes(path);
    } catch (final NoSuchFileException ex) {
      attrs = new HashMap<String, Object>();
    }

    if (config != null) {
      attrs = resourceConfigService.configAttrs(attrs, config);
    }
    if (metadata != null) {
      attrs = metadataService.configAttrs(attrs, metadata);
    }

    ioService.write(
        path,
        GuidedDTXMLPersistence.getInstance().marshal(model),
        attrs,
        makeCommentedOption(comment));
  }
コード例 #2
0
  @Override
  public void save(
      final Path resource, final String content, final Metadata metadata, final String comment) {

    ioService.write(
        paths.convert(resource),
        content,
        metadataService.setUpAttributes(resource, metadata),
        makeCommentedOption(comment));

    // Invalidate Package-level DMO cache in case user added a Declarative Type to their DRL. Tssk,
    // Tssk.
    invalidateDMOPackageCache.fire(new InvalidateDMOPackageCacheEvent(resource));
  }
コード例 #3
0
 @Override
 public void saveKModule(
     String commitMessage, final Path path, final KModuleModel model, Metadata metadata) {
   if (metadata == null) {
     ioService.write(
         paths.convert(path),
         moduleContentHandler.toString(model),
         makeCommentedOption(commitMessage));
   } else {
     ioService.write(
         paths.convert(path),
         moduleContentHandler.toString(model),
         metadataService.setUpAttributes(path, metadata),
         makeCommentedOption(commitMessage));
   }
 }
コード例 #4
0
  @Override
  public Path save(
      final Path resource,
      final GlobalsModel content,
      final Metadata metadata,
      final String comment) {
    ioService.write(
        paths.convert(resource),
        GlobalsPersistence.getInstance().marshal(content),
        metadataService.setUpAttributes(resource, metadata),
        makeCommentedOption(comment));

    // Invalidate Package-level DMO cache as Globals have changed.
    invalidatePackageDMOEvent.fire(new InvalidateDMOPackageCacheEvent(resource));

    // Signal update to interested parties
    resourceUpdatedEvent.fire(new ResourceUpdatedEvent(resource));

    return resource;
  }