Search in sources :

Example 16 with ResourceOpenedEvent

use of org.uberfire.workbench.events.ResourceOpenedEvent in project drools-wb by kiegroup.

the class GuidedDecisionTableGraphEditorServiceImpl method constructContent.

@Override
protected GuidedDecisionTableEditorGraphContent constructContent(final Path path, final Overview overview) {
    final GuidedDecisionTableEditorGraphModel model = load(path);
    // Signal opening to interested parties
    resourceOpenedEvent.fire(new ResourceOpenedEvent(path, safeSessionInfo));
    return new GuidedDecisionTableEditorGraphContent(model, overview);
}
Also used : GuidedDecisionTableEditorGraphModel(org.drools.workbench.screens.guided.dtable.model.GuidedDecisionTableEditorGraphModel) GuidedDecisionTableEditorGraphContent(org.drools.workbench.screens.guided.dtable.model.GuidedDecisionTableEditorGraphContent) ResourceOpenedEvent(org.uberfire.workbench.events.ResourceOpenedEvent)

Example 17 with ResourceOpenedEvent

use of org.uberfire.workbench.events.ResourceOpenedEvent in project drools-wb by kiegroup.

the class GuidedRuleTemplateEditorServiceImpl method constructContent.

@Override
protected GuidedTemplateEditorContent constructContent(Path path, Overview overview) {
    final TemplateModel model = load(path);
    final PackageDataModelOracle oracle = dataModelService.getDataModel(path);
    final PackageDataModelOracleBaselinePayload dataModel = new PackageDataModelOracleBaselinePayload();
    // Get FQCN's used by model
    final GuidedRuleModelVisitor visitor = new GuidedRuleModelVisitor(model);
    final Set<String> consumedFQCNs = visitor.getConsumedModelClasses();
    // Get FQCN's used by Globals
    consumedFQCNs.addAll(oracle.getPackageGlobals().values());
    // Get FQCN's of collections defined in project settings
    // they can be used in From Collect expressions
    consumedFQCNs.addAll(oracle.getModuleCollectionTypes().entrySet().stream().filter(entry -> entry.getValue()).map(entry -> entry.getKey()).collect(Collectors.toSet()));
    DataModelOracleUtilities.populateDataModel(oracle, dataModel, consumedFQCNs);
    // Signal opening to interested parties
    resourceOpenedEvent.fire(new ResourceOpenedEvent(path, safeSessionInfo));
    return new GuidedTemplateEditorContent(model, overview, dataModel);
}
Also used : PackageDataModelOracleBaselinePayload(org.kie.workbench.common.services.datamodel.model.PackageDataModelOracleBaselinePayload) Level(org.guvnor.common.services.shared.message.Level) ValidationMessage(org.guvnor.common.services.shared.validation.model.ValidationMessage) PackageDataModelOracle(org.kie.soup.project.datamodel.oracle.PackageDataModelOracle) Metadata(org.guvnor.common.services.shared.metadata.model.Metadata) TemplateModel(org.drools.workbench.models.guided.template.shared.TemplateModel) GuidedRuleTemplateResourceTypeDefinition(org.drools.workbench.screens.guided.template.type.GuidedRuleTemplateResourceTypeDefinition) ArrayList(java.util.ArrayList) Package(org.guvnor.common.services.project.model.Package) Paths(org.uberfire.backend.server.util.Paths) Inject(javax.inject.Inject) ExceptionUtilities(org.guvnor.common.services.backend.exceptions.ExceptionUtilities) CommentedOptionFactory(org.guvnor.common.services.backend.util.CommentedOptionFactory) GuidedRuleTemplateEditorService(org.drools.workbench.screens.guided.template.service.GuidedRuleTemplateEditorService) Overview(org.guvnor.common.services.shared.metadata.model.Overview) Service(org.jboss.errai.bus.server.annotations.Service) SafeSessionInfo(org.guvnor.common.services.backend.config.SafeSessionInfo) SessionInfo(org.uberfire.rpc.SessionInfo) Named(javax.inject.Named) KieService(org.kie.workbench.common.services.backend.service.KieService) RenameService(org.uberfire.ext.editor.commons.service.RenameService) Path(org.uberfire.backend.vfs.Path) DeleteService(org.uberfire.ext.editor.commons.service.DeleteService) Event(javax.enterprise.event.Event) DataModelService(org.kie.workbench.common.services.datamodel.backend.server.service.DataModelService) SaveAndRenameServiceImpl(org.uberfire.ext.editor.commons.backend.service.SaveAndRenameServiceImpl) DataModelOracleUtilities(org.kie.workbench.common.services.datamodel.backend.server.DataModelOracleUtilities) Set(java.util.Set) Collectors(java.util.stream.Collectors) ResourceOpenedEvent(org.uberfire.workbench.events.ResourceOpenedEvent) RuleTemplateModelXMLPersistenceImpl(org.drools.workbench.models.guided.template.backend.RuleTemplateModelXMLPersistenceImpl) GenericValidator(org.guvnor.common.services.backend.validation.GenericValidator) List(java.util.List) GuidedTemplateEditorContent(org.drools.workbench.screens.guided.template.model.GuidedTemplateEditorContent) GuidedRuleModelVisitor(org.drools.workbench.screens.guided.rule.backend.server.GuidedRuleModelVisitor) PostConstruct(javax.annotation.PostConstruct) IOService(org.uberfire.io.IOService) ApplicationScoped(javax.enterprise.context.ApplicationScoped) FileAlreadyExistsException(org.uberfire.java.nio.file.FileAlreadyExistsException) CopyService(org.uberfire.ext.editor.commons.service.CopyService) GuidedTemplateEditorContent(org.drools.workbench.screens.guided.template.model.GuidedTemplateEditorContent) PackageDataModelOracleBaselinePayload(org.kie.workbench.common.services.datamodel.model.PackageDataModelOracleBaselinePayload) GuidedRuleModelVisitor(org.drools.workbench.screens.guided.rule.backend.server.GuidedRuleModelVisitor) PackageDataModelOracle(org.kie.soup.project.datamodel.oracle.PackageDataModelOracle) TemplateModel(org.drools.workbench.models.guided.template.shared.TemplateModel) ResourceOpenedEvent(org.uberfire.workbench.events.ResourceOpenedEvent)

Example 18 with ResourceOpenedEvent

use of org.uberfire.workbench.events.ResourceOpenedEvent in project drools-wb by kiegroup.

the class ScoreCardXLSServiceImpl method load.

@Override
public InputStream load(final Path path, final String sessionId) {
    try {
        final InputStream inputStream = ioService.newInputStream(Paths.convert(path), StandardOpenOption.READ);
        // Signal opening to interested parties
        resourceOpenedEvent.fire(new ResourceOpenedEvent(path, getSessionInfo(sessionId)));
        return inputStream;
    } catch (Exception e) {
        throw ExceptionUtilities.handleException(e);
    }
}
Also used : InputStream(java.io.InputStream) ResourceOpenedEvent(org.uberfire.workbench.events.ResourceOpenedEvent) IOException(java.io.IOException)

Example 19 with ResourceOpenedEvent

use of org.uberfire.workbench.events.ResourceOpenedEvent in project drools-wb by kiegroup.

the class DecisionTableXLSServiceImpl method load.

@Override
public InputStream load(final Path path, final String sessionId) {
    try {
        final InputStream inputStream = ioService.newInputStream(Paths.convert(path), StandardOpenOption.READ);
        // Signal opening to interested parties
        resourceOpenedEvent.fire(new ResourceOpenedEvent(path, getSessionInfo(sessionId)));
        return inputStream;
    } catch (Exception e) {
        throw ExceptionUtilities.handleException(e);
    }
}
Also used : FileInputStream(java.io.FileInputStream) InputStream(java.io.InputStream) ResourceOpenedEvent(org.uberfire.workbench.events.ResourceOpenedEvent) SourceGenerationFailedException(org.kie.workbench.common.services.shared.source.SourceGenerationFailedException) InvalidFormatException(org.apache.poi.openxml4j.exceptions.InvalidFormatException) IOException(java.io.IOException) DecisionTableParseException(org.drools.template.parser.DecisionTableParseException)

Aggregations

ResourceOpenedEvent (org.uberfire.workbench.events.ResourceOpenedEvent)19 PackageDataModelOracle (org.kie.soup.project.datamodel.oracle.PackageDataModelOracle)9 PackageDataModelOracleBaselinePayload (org.kie.workbench.common.services.datamodel.model.PackageDataModelOracleBaselinePayload)7 Overview (org.guvnor.common.services.shared.metadata.model.Overview)6 Path (org.uberfire.backend.vfs.Path)5 FileAlreadyExistsException (org.uberfire.java.nio.file.FileAlreadyExistsException)5 IOException (java.io.IOException)3 HashSet (java.util.HashSet)3 List (java.util.List)3 Set (java.util.Set)3 Collectors (java.util.stream.Collectors)3 PostConstruct (javax.annotation.PostConstruct)3 ApplicationScoped (javax.enterprise.context.ApplicationScoped)3 Event (javax.enterprise.event.Event)3 Inject (javax.inject.Inject)3 Named (javax.inject.Named)3 SafeSessionInfo (org.guvnor.common.services.backend.config.SafeSessionInfo)3 ExceptionUtilities (org.guvnor.common.services.backend.exceptions.ExceptionUtilities)3 CommentedOptionFactory (org.guvnor.common.services.backend.util.CommentedOptionFactory)3 GenericValidator (org.guvnor.common.services.backend.validation.GenericValidator)3