Search in sources :

Example 91 with SystemException

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);
    }
}
Also used : SystemException(com.evolveum.midpoint.util.exception.SystemException) ObjectAlreadyExistsException(com.evolveum.midpoint.util.exception.ObjectAlreadyExistsException)

Example 92 with SystemException

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;
}
Also used : SystemException(com.evolveum.midpoint.util.exception.SystemException) RepositoryServiceFactoryException(com.evolveum.midpoint.repo.api.RepositoryServiceFactoryException)

Example 93 with SystemException

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);
    }
}
Also used : MidpointConfiguration(com.evolveum.midpoint.common.configuration.api.MidpointConfiguration) Configuration(org.apache.commons.configuration.Configuration) RuntimeConfiguration(com.evolveum.midpoint.common.configuration.api.RuntimeConfiguration) SystemException(com.evolveum.midpoint.util.exception.SystemException) RepositoryServiceFactory(com.evolveum.midpoint.repo.api.RepositoryServiceFactory) BeansException(org.springframework.beans.BeansException) SystemException(com.evolveum.midpoint.util.exception.SystemException) RepositoryServiceFactoryException(com.evolveum.midpoint.repo.api.RepositoryServiceFactoryException)

Example 94 with SystemException

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);
    }
}
Also used : SchemaException(com.evolveum.midpoint.util.exception.SchemaException) ExpressionEvaluationException(com.evolveum.midpoint.util.exception.ExpressionEvaluationException) SystemException(com.evolveum.midpoint.util.exception.SystemException) ObjectNotFoundException(com.evolveum.midpoint.util.exception.ObjectNotFoundException)

Example 95 with SystemException

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;
}
Also used : SystemException(com.evolveum.midpoint.util.exception.SystemException) HashMap(java.util.HashMap) ByteArrayInputStream(java.io.ByteArrayInputStream) ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream) JRTemplate(net.sf.jasperreports.engine.JRTemplate) PrismObject(com.evolveum.midpoint.prism.PrismObject) SchemaException(com.evolveum.midpoint.util.exception.SchemaException) ObjectNotFoundException(com.evolveum.midpoint.util.exception.ObjectNotFoundException) SystemException(com.evolveum.midpoint.util.exception.SystemException) JRException(net.sf.jasperreports.engine.JRException)

Aggregations

SystemException (com.evolveum.midpoint.util.exception.SystemException)201 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)113 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)76 ObjectNotFoundException (com.evolveum.midpoint.util.exception.ObjectNotFoundException)65 ObjectAlreadyExistsException (com.evolveum.midpoint.util.exception.ObjectAlreadyExistsException)35 PrismObject (com.evolveum.midpoint.prism.PrismObject)32 CommunicationException (com.evolveum.midpoint.util.exception.CommunicationException)32 ExpressionEvaluationException (com.evolveum.midpoint.util.exception.ExpressionEvaluationException)31 QName (javax.xml.namespace.QName)28 ConfigurationException (com.evolveum.midpoint.util.exception.ConfigurationException)26 SecurityViolationException (com.evolveum.midpoint.util.exception.SecurityViolationException)26 Task (com.evolveum.midpoint.task.api.Task)23 ArrayList (java.util.ArrayList)21 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)16 GenericFrameworkException (com.evolveum.midpoint.provisioning.ucf.api.GenericFrameworkException)16 ShadowType (com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)14 Test (org.testng.annotations.Test)14 PolyString (com.evolveum.midpoint.prism.polystring.PolyString)12 ObjectQuery (com.evolveum.midpoint.prism.query.ObjectQuery)12 ResultHandler (com.evolveum.midpoint.schema.ResultHandler)12