Search in sources :

Example 1 with InvalidateDMOPackageCacheEvent

use of org.guvnor.common.services.project.builder.events.InvalidateDMOPackageCacheEvent in project drools-wb by kiegroup.

the class GlobalsEditorServiceImpl method save.

@Override
public Path save(final Path resource, final GlobalsModel content, final Metadata metadata, final String comment) {
    try {
        final Package pkg = moduleService.resolvePackage(resource);
        final String packageName = (pkg == null ? null : pkg.getPackageName());
        content.setPackageName(packageName);
        Metadata currentMetadata = metadataService.getMetadata(resource);
        ioService.write(Paths.convert(resource), GlobalsPersistence.getInstance().marshal(content), metadataService.setUpAttributes(resource, metadata), commentedOptionFactory.makeCommentedOption(comment));
        // Invalidate Package-level DMO cache as Globals have changed.
        invalidatePackageDMOEvent.fire(new InvalidateDMOPackageCacheEvent(resource));
        fireMetadataSocialEvents(resource, currentMetadata, metadata);
        return resource;
    } catch (Exception e) {
        throw ExceptionUtilities.handleException(e);
    }
}
Also used : Metadata(org.guvnor.common.services.shared.metadata.model.Metadata) InvalidateDMOPackageCacheEvent(org.guvnor.common.services.project.builder.events.InvalidateDMOPackageCacheEvent) Package(org.guvnor.common.services.project.model.Package) FileAlreadyExistsException(org.uberfire.java.nio.file.FileAlreadyExistsException)

Example 2 with InvalidateDMOPackageCacheEvent

use of org.guvnor.common.services.project.builder.events.InvalidateDMOPackageCacheEvent in project drools-wb by kiegroup.

the class DSLTextEditorServiceImpl method save.

@Override
public Path save(final Path resource, final String content, final Metadata metadata, final String comment) {
    try {
        Metadata currentMetadata = metadataService.getMetadata(resource);
        ioService.write(Paths.convert(resource), content, metadataService.setUpAttributes(resource, metadata), commentedOptionFactory.makeCommentedOption(comment));
        // Invalidate Package-level DMO cache as a DSL has been altered
        invalidateDMOPackageCache.fire(new InvalidateDMOPackageCacheEvent(resource));
        fireMetadataSocialEvents(resource, currentMetadata, metadata);
        return resource;
    } catch (Exception e) {
        throw ExceptionUtilities.handleException(e);
    }
}
Also used : Metadata(org.guvnor.common.services.shared.metadata.model.Metadata) InvalidateDMOPackageCacheEvent(org.guvnor.common.services.project.builder.events.InvalidateDMOPackageCacheEvent) DSLMappingParseException(org.drools.compiler.lang.dsl.DSLMappingParseException) IOException(java.io.IOException) FileAlreadyExistsException(org.uberfire.java.nio.file.FileAlreadyExistsException)

Example 3 with InvalidateDMOPackageCacheEvent

use of org.guvnor.common.services.project.builder.events.InvalidateDMOPackageCacheEvent in project drools-wb by kiegroup.

the class EnumServiceImpl method save.

@Override
public Path save(final Path resource, final String content, final Metadata metadata, final String comment) {
    try {
        Metadata currentMetadata = metadataService.getMetadata(resource);
        ioService.write(Paths.convert(resource), content, metadataService.setUpAttributes(resource, metadata), commentedOptionFactory.makeCommentedOption(comment));
        // Invalidate Package-level DMO cache as Enums have changed.
        invalidateDMOPackageCache.fire(new InvalidateDMOPackageCacheEvent(resource));
        fireMetadataSocialEvents(resource, currentMetadata, metadata);
        return resource;
    } catch (Exception e) {
        throw ExceptionUtilities.handleException(e);
    }
}
Also used : Metadata(org.guvnor.common.services.shared.metadata.model.Metadata) InvalidateDMOPackageCacheEvent(org.guvnor.common.services.project.builder.events.InvalidateDMOPackageCacheEvent) FileAlreadyExistsException(org.uberfire.java.nio.file.FileAlreadyExistsException)

Aggregations

InvalidateDMOPackageCacheEvent (org.guvnor.common.services.project.builder.events.InvalidateDMOPackageCacheEvent)3 Metadata (org.guvnor.common.services.shared.metadata.model.Metadata)3 FileAlreadyExistsException (org.uberfire.java.nio.file.FileAlreadyExistsException)3 IOException (java.io.IOException)1 DSLMappingParseException (org.drools.compiler.lang.dsl.DSLMappingParseException)1 Package (org.guvnor.common.services.project.model.Package)1