private WorkflowManager getWorkflowManagerChecked() { if (workflowManager == null) { throw new SystemException("Workflow manager not present"); } return workflowManager; }
private CertificationManager getCertificationManagerChecked() { if (certificationManager == null) { throw new SystemException("Certification manager not present"); } return certificationManager; }
private static ChangeTypeType convertChangeType(ChangeType changeType) { if (changeType == ChangeType.ADD) { return ChangeTypeType.ADD; } if (changeType == ChangeType.MODIFY) { return ChangeTypeType.MODIFY; } if (changeType == ChangeType.DELETE) { return ChangeTypeType.DELETE; } throw new SystemException("Unknown changetype "+changeType); }
private void notNull(String value, String message) { if (value == null) { throw new SystemException(message); } }
public static String bytesToString(byte[] clearBytes) { try { // We want fixed charset here, independent of locale. We want consistent and portable encryption/decryption. return new String(clearBytes, CHARSET); } catch (UnsupportedEncodingException e) { throw new SystemException("Unsupported charset '"+CHARSET+"', is this system from 19th century?", e); } }
private void notEmpty(String value, String message) { if (StringUtils.isEmpty(value)) { throw new SystemException(message); } }
public RAExtValue createNewAExtValue(Object value) { try { Constructor<? extends RAExtValue> constr = aExtType.getConstructor(value.getClass()); return constr.newInstance(value); } catch (InstantiationException | IllegalAccessException | NoSuchMethodException | InvocationTargetException ex) { throw new SystemException(ex); } }
public Jsr223ScriptEvaluator(String engineName, PrismContext prismContext, Protector protector, LocalizationService localizationService) { ScriptEngineManager scriptEngineManager = new ScriptEngineManager(); scriptEngine = scriptEngineManager.getEngineByName(engineName); if (scriptEngine == null) { throw new SystemException("The JSR-223 scripting engine for '"+engineName+"' was not found"); } this.prismContext = prismContext; this.protector = protector; this.scriptCache = new ConcurrentHashMap<>(); this.localizationService = localizationService; }
public ROExtValue createNewOExtValue(Object value) { try { Constructor<? extends ROExtValue> constr = oExtType.getConstructor(value.getClass()); return constr.newInstance(value); } catch (InstantiationException | IllegalAccessException | NoSuchMethodException | InvocationTargetException ex) { throw new SystemException(ex); } } }
protected void propagateShadowOperations(PrismObject<ResourceType> resource, PrismObject<ShadowType> shadow, Task workerTask, OperationResult result) { try { shadowCache.propagateOperations(resource, shadow, workerTask, result); } catch (CommonException | GenericFrameworkException | EncryptionException e) { throw new SystemException("Generic provisioning framework error: " + e.getMessage(), e); } }
public <T extends ObjectType> T resolveTargetRef(AssignmentType a, OperationResult result) { try { return resolveTargetRefUnchecked(a, result); } catch (SchemaException|ObjectNotFoundException e) { throw new SystemException(e); } }
public PrismContainerImpl(QName name, Class<C> compileTimeClass, PrismContext prismContext) { this(name, compileTimeClass); this.prismContext = prismContext; if (prismContext != null) { try { prismContext.adopt(this); } catch (SchemaException e) { throw new SystemException("Schema exception when adopting freshly created PrismContainer: " + this); } } }
public <I, O> Mapper<I, O> getMapper(Class<I> inputType, Class<O> outputType) { Key key = buildKey(inputType, outputType); Mapper<I, O> mapper = mappers.get(key); if (mapper == null) { throw new SystemException("Can't map '" + inputType + "' to '" + outputType + "'"); } return mapper; }
private void storeExtensionDeltas(List<ItemDeltaType> result, Collection<ItemDelta<?, ?>> extensionDeltas) { for (ItemDelta itemDelta : extensionDeltas) { Collection<ItemDeltaType> deltaTypes; try { deltaTypes = DeltaConvertor.toItemDeltaTypes(itemDelta); } catch (SchemaException e) { throw new SystemException("Unexpected SchemaException when converting extension ItemDelta to ItemDeltaType", e); } result.addAll(deltaTypes); } }
public static ResourceAttributeContainer getAttributesContainer(PrismContainerValue<?> cval, QName containerName) { PrismContainer attributesContainer = cval.findContainer(containerName); if (attributesContainer == null) { return null; } if (attributesContainer instanceof ResourceAttributeContainer) { return (ResourceAttributeContainer)attributesContainer; } else { throw new SystemException("Expected that <"+containerName.getLocalPart()+"> will be ResourceAttributeContainer but it is "+attributesContainer.getClass()); } }
public void validate(String lexicalRepresentation, OperationResult validationResult, String objectResultOperationName) { try { try (ByteArrayInputStream is = new ByteArrayInputStream(lexicalRepresentation.getBytes(INPUT_STREAM_CHARSET))) { validate(is, validationResult, objectResultOperationName); } } catch (IOException e) { throw new SystemException(e); // shouldn't really occur } }
private String getFactoryClassName(Configuration config) { String className = config.getString(CONF_AUDIT_SERVICE_FACTORY); if (StringUtils.isEmpty(className)) { LOGGER.error("AuditServiceFactory implementation class name ({}) not found in configuration. " + "Provided configuration:\n{}", new Object[]{CONF_AUDIT_SERVICE_FACTORY, config}); throw new SystemException("AuditServiceFactory implementation class name (" + CONF_AUDIT_SERVICE_FACTORY + ") not found in configuration. Provided configuration:\n" + config); } return className; }
@NotNull private LexicalProcessor findProcessor(File file) throws IOException { for (Map.Entry<String,LexicalProcessor> entry: parserMap.entrySet()) { LexicalProcessor aLexicalProcessor = entry.getValue(); if (aLexicalProcessor.canRead(file)) { return aLexicalProcessor; } } throw new SystemException("No lexical processor for file '"+file+"' (autodetect)"); }
public void checkTaskStop() { if (!canRun()) { // TODO do this is a nicer way throw new SystemException("Stopping execution of a script because the task is stopping: " + task); } }
protected void setTaskOwner(Task task) { Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); if (authentication == null) { throw new SystemException("Failed to get authentication object"); } UserType userType = ((MidPointPrincipal)(SecurityContextHolder.getContext().getAuthentication().getPrincipal())).getUser(); if (userType == null) { throw new SystemException("Failed to get user from authentication object"); } task.setOwner(userType.asPrismObject()); }