use of com.evolveum.midpoint.util.exception.SystemException in project midpoint by Evolveum.
the class TaskQuartzImpl method setOtherHandlersUriStackImmediate.
public void setOtherHandlersUriStackImmediate(UriStack value, OperationResult parentResult) throws ObjectNotFoundException, SchemaException {
try {
processModificationNow(setOtherHandlersUriStackAndPrepareDelta(value), parentResult);
checkHandlerUriConsistency();
} catch (ObjectAlreadyExistsException ex) {
throw new SystemException(ex);
}
}
use of com.evolveum.midpoint.util.exception.SystemException in project midpoint by Evolveum.
the class RepositoryFactory method getRepositoryService.
public synchronized RepositoryService getRepositoryService() {
if (repositoryService == null) {
try {
LOGGER.debug("Creating repository service using factory {}", factory);
repositoryService = factory.getRepositoryService();
} catch (RepositoryServiceFactoryException | RuntimeException ex) {
LoggingUtils.logUnexpectedException(LOGGER, "Failed to get repository service from factory " + factory, ex);
throw new SystemException("Failed to get repository service from factory " + factory, ex);
} catch (Error ex) {
LoggingUtils.logUnexpectedException(LOGGER, "Failed to get repository service from factory " + factory, ex);
throw ex;
}
}
return repositoryService;
}
use of com.evolveum.midpoint.util.exception.SystemException in project midpoint by Evolveum.
the class RepositoryFactory method init.
public void init() {
Configuration config = midpointConfiguration.getConfiguration(REPOSITORY_CONFIGURATION);
try {
String className = getFactoryClassName(config);
LOGGER.info("Repository factory class name from configuration '{}'.", new Object[] { className });
Class<RepositoryServiceFactory> clazz = (Class<RepositoryServiceFactory>) Class.forName(className);
factory = getFactoryBean(clazz);
factory.init(config);
} catch (Exception ex) {
LoggingUtils.logException(LOGGER, "RepositoryServiceFactory implementation class {} failed to " + "initialize.", ex, config.getString(REPOSITORY_FACTORY_CLASS));
throw new SystemException("RepositoryServiceFactory implementation class " + config.getString(REPOSITORY_FACTORY_CLASS) + " failed to initialize: " + ex.getMessage(), ex);
}
}
use of com.evolveum.midpoint.util.exception.SystemException in project midpoint by Evolveum.
the class MidPointQueryExecutor method parseQuery.
@Override
protected void parseQuery() {
try {
String s = dataset.getQuery().getText();
LOGGER.trace("query: " + s);
if (StringUtils.isEmpty(s)) {
query = null;
} else {
if (s.startsWith("<filter")) {
query = getParsedQuery(s, getParameters());
// getParsedQuery(s, expressionParameters);
} else if (s.startsWith("<code")) {
script = getParsedScript(s);
}
}
} catch (SchemaException | ObjectNotFoundException | ExpressionEvaluationException e) {
// TODO Auto-generated catch block
throw new SystemException(e.getMessage(), e);
}
}
use of com.evolveum.midpoint.util.exception.SystemException in project midpoint by Evolveum.
the class ReportCreateTaskHandler method prepareReportParameters.
// private JasperReport loadJasperReport(ReportType reportType) throws SchemaException{
//
// if (reportType.getTemplate() == null) {
// throw new IllegalStateException("Could not create report. No jasper template defined.");
// }
// try {
// byte[] reportTemplate = Base64.decodeBase64(reportType.getTemplate());
//
// InputStream inputStreamJRXML = new ByteArrayInputStream(reportTemplate);
// JasperDesign jasperDesign = JRXmlLoader.load(inputStreamJRXML);
// LOGGER.trace("load jasper design : {}", jasperDesign);
//
// if (reportType.getTemplateStyle() != null){
// JRDesignReportTemplate templateStyle = new JRDesignReportTemplate(new JRDesignExpression("$P{" + PARAMETER_TEMPLATE_STYLES + "}"));
// jasperDesign.addTemplate(templateStyle);
// JRDesignParameter parameter = new JRDesignParameter();
// parameter.setName(PARAMETER_TEMPLATE_STYLES);
// parameter.setValueClass(JRTemplate.class);
// parameter.setForPrompting(false);
// jasperDesign.addParameter(parameter);
// }
// JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign);
// return jasperReport;
// } catch (JRException ex){
// LOGGER.error("Couldn't create jasper report design {}", ex.getMessage());
// throw new SchemaException(ex.getMessage(), ex.getCause());
// }
//
//
// }
private Map<String, Object> prepareReportParameters(ReportType reportType, OperationResult parentResult) {
Map<String, Object> params = new HashMap<String, Object>();
if (reportType.getTemplateStyle() != null) {
byte[] reportTemplateStyleBase64 = reportType.getTemplateStyle();
byte[] reportTemplateStyle = Base64.decodeBase64(reportTemplateStyleBase64);
try {
LOGGER.trace("Style template string {}", new String(reportTemplateStyle));
InputStream inputStreamJRTX = new ByteArrayInputStream(reportTemplateStyle);
JRTemplate templateStyle = JRXmlTemplateLoader.load(inputStreamJRTX);
params.put(PARAMETER_TEMPLATE_STYLES, templateStyle);
LOGGER.trace("Style template parameter {}", templateStyle);
} catch (Exception ex) {
LOGGER.error("Error create style template parameter {}", ex.getMessage());
throw new SystemException(ex);
}
}
// for our special datasource
params.put(PARAMETER_REPORT_OID, reportType.getOid());
params.put(PARAMETER_OPERATION_RESULT, parentResult);
params.put(ReportService.PARAMETER_REPORT_SERVICE, reportService);
return params;
}
Aggregations