private WorkflowManager getWorkflowManagerChecked() { if (workflowManager == null) { throw new SystemException("Workflow manager not present"); } return workflowManager; }
@SuppressWarnings("WeakerAccess") public static <T> T unwrapTunnelledException(TunnelException te) throws CommonException { Throwable cause = te.getCause(); if (cause instanceof CommonException) { throw (CommonException) cause; } else if (cause instanceof RuntimeException) { throw (RuntimeException) cause; } else { throw te; } }
private static AbstractAuthenticationPolicyType checkAndGetAuthPolicyConsistence( MailAuthenticationPolicyType mailPolicy, SmsAuthenticationPolicyType smsPolicy) throws SchemaException { if (mailPolicy != null && smsPolicy != null) { throw new SchemaException( "Found both, mail and sms authentication method for registration. Only one of them can be present at the moment"); } if (mailPolicy != null) { return mailPolicy; } return smsPolicy; }
@Override public <IV extends PrismValue,ID extends ItemDefinition,I extends Item<IV,ID>> I findItem(ItemPath path, Class<I> type) { try { return findCreateItem(path, type, null, false); } catch (SchemaException e) { // This should not happen throw new SystemException("Internal Error:(path="+path+",type="+type+"): "+e.getMessage(),e); } }
@Override public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { try { return getPrincipal(username); } catch (ObjectNotFoundException e) { throw new UsernameNotFoundException(e.getMessage(), e); } catch (SchemaException | CommunicationException | ConfigurationException | SecurityViolationException | ExpressionEvaluationException e) { throw new SystemException(e.getMessage(), e); } }
@Override public OrgType getOrgByOid(String oid, boolean preAuthorized) throws SchemaException { try { return getObject(OrgType.class, oid, preAuthorized); } catch (ObjectNotFoundException|SecurityViolationException e) { return null; } catch (CommunicationException|ConfigurationException|ExpressionEvaluationException e) { throw new SystemException("Couldn't get org: " + e.getMessage(), e); // really shouldn't occur } }
@Override public String getLocalizedMessage() { return localizedUserFriendlyMessage != null ? localizedUserFriendlyMessage : getMessage(); }
public String getLocalizedUserFriendlyMessage() { return getLocalizedMessage(); }
@Override public ObjectDelta<O> getSecondaryDelta() { try { return secondaryDeltas.getMergedDeltas(); } catch (SchemaException e) { // This should not happen throw new SystemException("Unexpected delta merging problem: "+e.getMessage(), e); } }
public static <O extends ObjectType> ModelContext<O> unwrapModelContext(LensContextType lensContextType, ModelInteractionService modelInteractionService, Task opTask, OperationResult result) throws ObjectNotFoundException { if (lensContextType != null) { try { return modelInteractionService.unwrapModelContext(lensContextType, opTask, result); } catch (SchemaException | CommunicationException | ConfigurationException |ExpressionEvaluationException e) { // todo treat appropriately throw new SystemException("Couldn't access model operation context in task: " + e.getMessage(), e); } } else { return null; } } }
private CertificationManager getCertificationManagerChecked() { if (certificationManager == null) { throw new SystemException("Certification manager not present"); } return certificationManager; }
private Collection<ItemDelta<?, ?>> parseDeltas(List<ItemDeltaType> deltas) { try { //noinspection unchecked return (Collection<ItemDelta<?, ?>>) DeltaConvertor.toModifications(deltas, taskDefinition); } catch (SchemaException e) { throw new SystemException("Couldn't parse task item deltas: " + e.getMessage(), e); } }
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); }
public <IV extends PrismValue,ID extends ItemDefinition, I extends Item<IV,ID>> I findItem(ItemPath itemPath, Class<I> type) { try { return findCreateItem(itemPath, type, null, false); } catch (SchemaException e) { // This should not happen throw new SystemException("Internal Error: "+e.getMessage(),e); } }
private void notNull(String value, String message) { if (value == null) { throw new SystemException(message); } }
public <IV extends PrismValue,ID extends ItemDefinition,I extends Item<IV,ID>> I findItem(QName itemQName, Class<I> type) { try { return findCreateItem(itemQName, type, false); } catch (SchemaException e) { // This should not happen throw new SystemException("Internal Error: "+e.getMessage(),e); } }
public <IV extends PrismValue,ID extends ItemDefinition> Item<IV,ID> findItem(ItemPath path) { try { return findCreateItem(path, Item.class, null, false); } catch (SchemaException e) { // This should not happen throw new SystemException("Internal Error:(path="+path+"): "+e.getMessage(),e); } }
public static <IV extends PrismValue,ID extends ItemDefinition,I extends Item<IV,ID>> I createItem(PrismContainerValue parentValue, QName name, Class<I> type) { Validate.notNull(parentValue, "Parent container value must not be null."); Validate.notNull(name, "QName must not be null."); try { return (I) parentValue.findOrCreateItem(name, type); } catch (SchemaException ex) { throw new SystemException(ex.getMessage(), ex); } }
private PrismObject<TaskType> createPrism() { try { return getPrismContext().createObject(TaskType.class); } catch (SchemaException e) { throw new SystemException(e.getMessage(), e); } }
private static ItemDeltaItem<PrismContainerValue<AssignmentType>, PrismContainerDefinition<AssignmentType>> createAssignmentIdi( AssignmentType assignment) { try { ItemDeltaItem<PrismContainerValue<AssignmentType>, PrismContainerDefinition<AssignmentType>> idi = new ItemDeltaItem<>(); idi.setItemOld(LensUtil.createAssignmentSingleValueContainerClone(assignment)); idi.recompute(); return idi; } catch (SchemaException e) { // should not really occur! throw new SystemException("Couldn't create assignment IDI: " + e.getMessage(), e); } }