public void service(SourceBean request, SourceBean response) {
String analysisName = null;
String analysisDescritpion = null;
String analysisScope = null;
EngineAnalysisMetadata analysisMetadata = null;
String result = null;
logger.debug("IN");
try {
super.service(request, response);
EMFErrorHandler errorHandler = getErrorHandler();
if (!errorHandler.isOKBySeverity(EMFErrorSeverity.ERROR)) {
Collection errors = errorHandler.getErrors();
Iterator it = errors.iterator();
while (it.hasNext()) {
EMFAbstractError error = (EMFAbstractError) it.next();
if (error.getSeverity().equals(EMFErrorSeverity.ERROR)) {
throw new SpagoBIEngineServiceException(getActionName(), error.getMessage(), null);
}
}
}
analysisName = getAttributeAsString(ANALYSIS_NAME);
logger.debug(ANALYSIS_NAME + ": " + analysisName);
analysisDescritpion = getAttributeAsString(ANALYSIS_DESCRIPTION);
logger.debug(ANALYSIS_DESCRIPTION + ": " + analysisDescritpion);
analysisScope = getAttributeAsString(ANALYSIS_SCOPE);
logger.debug(ANALYSIS_SCOPE + ": " + analysisScope);
Assert.assertNotNull(getEngineInstance(), "It's not possible to execute " + this.getActionName() + " service before having properly created an instance of EngineInstance class");
Assert.assertTrue(!StringUtilities.isEmpty(analysisName), "Input parameter [" + ANALYSIS_NAME + "] cannot be null or empty in oder to execute " + this.getActionName() + " service");
Assert.assertTrue(!StringUtilities.isEmpty(analysisDescritpion), "Input parameter [" + ANALYSIS_DESCRIPTION + "] cannot be null or empty in oder to execute " + this.getActionName() + " service");
Assert.assertTrue(!StringUtilities.isEmpty(analysisScope), "Input parameter [" + ANALYSIS_SCOPE + "] cannot be null or empty in oder to execute " + this.getActionName() + " service");
analysisMetadata = getEngineInstance().getAnalysisMetadata();
analysisMetadata.setName( analysisName );
analysisMetadata.setDescription( analysisDescritpion );
if( EngineAnalysisMetadata.PUBLIC_SCOPE.equalsIgnoreCase( analysisScope ) ) {
analysisMetadata.setScope( EngineAnalysisMetadata.PUBLIC_SCOPE );
} else if( EngineAnalysisMetadata.PRIVATE_SCOPE.equalsIgnoreCase( analysisScope ) ) {
analysisMetadata.setScope( EngineAnalysisMetadata.PRIVATE_SCOPE );
} else {
Assert.assertUnreachable("Value [" + analysisScope + "] is not valid for the input parameter " + ANALYSIS_SCOPE);
}