@Override public String getName() { throw new BonitaRuntimeException("Call getName method on XPDLProcess is not allowed! We must always use ids!"); } }
@Override public Class<?> getType(final WireDefinition wireDefinition) { if (className != null) { try { return ReflectUtil.loadClass(wireDefinition.getClassLoader(), className); } catch (final BonitaRuntimeException e) { final String message = ExceptionManager.getInstance().getFullMessage("bp_HCD_1", className, e.getMessage()); throw new WireException(message, e.getCause()); } } return Configuration.class; }
@Override public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable { if (Environment.getCurrent() != null) { return new RESTServerAPIInterceptorCommand(method, args, api) .execute(Environment.getCurrent()); } // If no environment: use directly the command Service with interceptors final EnvironmentFactory envFactory = GlobalEnvironmentFactory .getEnvironmentFactory(DomainOwner.getDomain()); try { return envFactory.get(CommandService.class).execute( new RESTServerAPIInterceptorCommand(method, args, api)); } catch (final BonitaWrapperException e) { throw e.getCause(); } catch (final BonitaRuntimeException e) { if (DefaultCommandService.class.getName().equals(e.getWrappedBy()) || UnRollbackableException.class.getName().equals(e.getWrappedBy())) { throw e.getCause(); } else { throw e; } } }
if (e.getCause() instanceof IllegalArgumentException) { if (LOG.isLoggable(Level.INFO)) { LOG.info("WARNING: couldn't auto wire " + fieldName
public Class<?> getType(WireDefinition wireDefinition) { if (className != null) { try { return ReflectUtil .loadClass(wireDefinition.getClassLoader(), className); } catch (BonitaRuntimeException e) { String message = ExceptionManager.getInstance().getFullMessage( "bp_OD_10", (name != null ? name : className), e.getMessage()); throw new WireException(message, e .getCause()); } } Descriptor descriptor = null; if (factoryDescriptor != null) { descriptor = factoryDescriptor; } else if (factoryObjectName != null) { descriptor = wireDefinition.getDescriptor(factoryObjectName); } if (descriptor != null) { Class<?> factoryClass = descriptor.getType(wireDefinition); if (factoryClass != null) { Method method = ReflectUtilDescriptor.findMethod(factoryClass, methodName, argDescriptors, null); if (method != null) { return method.getReturnType(); } } } return null; }
/** * loads the class from the class loader of the specified WireContext. * * @throws WireException * if the class could not be loaded. */ public Object construct(WireContext wireContext) { ClassLoader classLoader = wireContext.getClassLoader(); try { return ReflectUtil.loadClass(classLoader, text); } catch (BonitaRuntimeException e) { Throwable cause = e.getCause(); String message = ExceptionManager.getInstance().getFullMessage( "bp_CD_1", text, cause.getMessage()); throw new WireException(message, cause); } }
@Override public String getName() { throw new BonitaRuntimeException("Call getName method on XPDLProcess is not allowed! We must always use ids!"); } }
return envFactory.get(CommandService.class).execute(new APIInterceptorCommand(method, args, false)); } catch (final BonitaRuntimeException e) { final Throwable cause = e.getCause(); if (cause instanceof BonitaException) { throw (BonitaException) cause; throw e; } else if (e instanceof BonitaWrapperException) { throw (RuntimeException) e.getCause();
public static final String getBonitaHomeFolder() { final String home = System.getProperty(HOME); if (home == null) { throw new BonitaRuntimeException("The system property '" + HOME + "' is not set"); } return home; }
private void checkExtendingQuerier(Class < ? > clazz) { if (!(Querier.class.isAssignableFrom(clazz))) { throw new BonitaRuntimeException( "Invalid class " + clazz.getName() + " : it doesn't implement " + Querier.class + " interface."); } }
public SerializedCommand(final Command<?> command) { super(); try { this.className = command.getClass().getName(); this.serializedCommand = Misc.serialize(command); } catch (final IOException e) { throw new BonitaRuntimeException(e); } catch (final ClassNotFoundException e) { throw new BonitaRuntimeException(e); } }
public SerializedCommand(final Command<?> command) { super(); try { this.className = command.getClass().getName(); this.serializedCommand = Misc.serialize(command); } catch (final IOException e) { throw new BonitaRuntimeException(e); } catch (final ClassNotFoundException e) { throw new BonitaRuntimeException(e); } }
public SerializedCommand(final Command< ? > command) { try { this.className = command.getClass().getName(); this.serializedCommand = Misc.serialize(command); } catch (final IOException e) { throw new BonitaRuntimeException(e); } catch (final ClassNotFoundException e) { throw new BonitaRuntimeException(e); } }
@Override public void addAttachment(final ProcessInstanceUUID instanceUUID, final String name, final String fileName, final byte[] value) { if (value == null && fileName != null) { throw new BonitaRuntimeException("The content of the attachment cannot be null"); } createDocumentOrVersion(instanceUUID, name, fileName, value, DocumentService.DEFAULT_MIME_TYPE); }
@Override public Set<String> getKeys() { final Set<String> keys = new HashSet<String>(); try { analysePath(this.base, keys); } catch (final Exception e) { throw new BonitaRuntimeException(e); } return keys; }
public static String getEvaluatedCorrelationKey(final ProcessDefinitionUUID definitionUUID, final String correlationKeyName, final String correlationKeyExpression) { if (correlationKeyExpression != null) { try { final String expression = GroovyUtil.evaluate(correlationKeyExpression, null, definitionUUID, false).toString(); return correlationKeyName.concat("||||").concat(expression); } catch (final GroovyException e) { throw new BonitaRuntimeException(e); } } return null; }
public boolean evaluate(final EventListenerExecution xpdlExecution) { if ("bsh".equals(this.scriptType)) { return this.evaluateBsh(xpdlExecution); } throw new BonitaRuntimeException("Unsupported scriptType: " + this.scriptType); }
@Override public void addAttachment(final ProcessInstanceUUID instanceUUID, final String name, final String label, final String description, final String fileName, final Map<String, String> metadata, final byte[] value) { if (value == null && fileName != null) { throw new BonitaRuntimeException("The content of the attachment cannot be null"); } String mimeType = metadata.get("content-type"); if (mimeType == null) { mimeType = DocumentService.DEFAULT_MIME_TYPE; } createDocumentOrVersion(instanceUUID, name, fileName, value, mimeType); }
@Override protected boolean executeBusinessLogic(final Execution execution) { try { TaskManager.ready(execution); } catch (TaskNotFoundException e) { throw new BonitaRuntimeException(e); } return false; }
@SuppressWarnings("unchecked") private <T> T getData(final Class<T> clazz, final File file) { try { final byte[] value = Misc.getAllContentFrom(file); return (T) Misc.deserialize(value); } catch (final IOException e) { throw new BonitaRuntimeException(e); } catch (final ClassNotFoundException e) { throw new BonitaRuntimeException(e); } }