use of org.kie.workbench.common.services.shared.source.SourceGenerationFailedException in project drools-wb by kiegroup.
the class DecisionTableXLSServiceImpl method getSource.
@Override
public String getSource(final Path path) {
InputStream inputStream = null;
try {
final SpreadsheetCompiler compiler = new SpreadsheetCompiler();
inputStream = ioService.newInputStream(Paths.convert(path), StandardOpenOption.READ);
final String drl = compiler.compile(inputStream, InputType.XLS);
return drl;
} catch (Exception e) {
throw new SourceGenerationFailedException(e.getMessage());
} finally {
if (inputStream != null) {
try {
inputStream.close();
} catch (IOException ioe) {
throw ExceptionUtilities.handleException(ioe);
}
}
}
}
use of org.kie.workbench.common.services.shared.source.SourceGenerationFailedException in project drools-wb by kiegroup.
the class GuidedRuleDSLRSourceService method getSource.
@Override
public String getSource(final Path path, final RuleModel model) throws SourceGenerationFailedException {
try {
final String dslr = RuleModelDRLPersistenceImpl.getInstance().marshal(model);
final Expander expander = getDSLExpander(path);
final String drl = expander.expand(dslr);
return drl;
} catch (Exception e) {
throw new SourceGenerationFailedException(e.getMessage());
}
}
use of org.kie.workbench.common.services.shared.source.SourceGenerationFailedException in project drools-wb by kiegroup.
the class GuidedDecisionTableSourceService method getSource.
@Override
public String getSource(final Path path, final GuidedDecisionTable52 model) throws SourceGenerationFailedException {
try {
final String dslr = GuidedDTDRLPersistence.getInstance().marshal(model);
final Expander expander = getDSLExpander(path);
final String drl = expander.expand(dslr);
return drl;
} catch (Exception e) {
throw new SourceGenerationFailedException(e.getMessage());
}
}
use of org.kie.workbench.common.services.shared.source.SourceGenerationFailedException in project drools-wb by kiegroup.
the class GuidedRuleTemplateSourceService method getSource.
@Override
public String getSource(final Path path, final TemplateModel model) throws SourceGenerationFailedException {
try {
if (model == null) {
return "";
} else {
final String dslr = RuleTemplateModelDRLPersistenceImpl.getInstance().marshal(model);
final Expander expander = getDSLExpander(path);
final String drl = expander.expand(dslr);
return drl;
}
} catch (Exception e) {
throw new SourceGenerationFailedException(e.getMessage());
}
}
Aggregations