@Override public Set<Object> keySet() { throw new FlowableException("unsupported operation on configuration beans"); // List<String> beanNames = // Arrays.asList(beanFactory.getBeanDefinitionNames()); // return new HashSet<Object>(beanNames); }
@Override public Collection<Object> values() { throw new FlowableException("unsupported operation on configuration beans"); } }
@Override public Object put(Object key, Object value) { throw new FlowableException("unsupported operation on configuration beans"); }
@Override public void setValue(ELContext context, Object base, Object property, Object value) { if (base == null) { if (wrappedMap.containsKey(property)) { throw new FlowableException("Cannot set value of '" + property + "', it's readonly!"); } } }
protected void assertOperationsNotEmpty() { if (operations.isEmpty()) { throw new FlowableException("Unable to peek empty agenda."); } }
@Override public BusinessCalendar getBusinessCalendar(String businessCalendarRef) { BusinessCalendar businessCalendar = businessCalendars.get(businessCalendarRef); if (businessCalendar == null) { throw new FlowableException("Requested business calendar " + businessCalendarRef + " does not exist. Allowed calendars are " + this.businessCalendars.keySet() + "."); } return businessCalendar; }
@Override public InputStream getInputStream() { try { return new ByteArrayInputStream(byteArrayEncoding == null ? string.getBytes() : string.getBytes(byteArrayEncoding)); } catch (UnsupportedEncodingException e) { throw new FlowableException("Unsupported encoding for string", e); } }
protected DataSource getCurrentDataSource() { String tenantId = tenantInfoHolder.getCurrentTenantId(); DataSource dataSource = dataSources.get(tenantId); if (dataSource == null) { throw new FlowableException("Could not find a dataSource for tenant " + tenantId); } return dataSource; }
@Override public InputStream getInputStream() { if (bytes == null) { try { bytes = getBytesFromInputStream(inputStream); } catch (IOException e) { throw new FlowableException("Could not read from inputstream", e); } } return new BufferedInputStream(new ByteArrayInputStream(bytes)); }
protected Method getNoParameterMethod(String methodName) { try { return functionClass().getDeclaredMethod(methodName); } catch (Exception e) { throw new FlowableException("Error getting method " + methodName, e); } }
protected Method getSingleObjectParameterMethod(String methodName) { try { return functionClass().getDeclaredMethod(methodName, Object.class); } catch (Exception e) { throw new FlowableException("Error getting method " + methodName, e); } }
protected Method getTwoObjectParameterMethod(String methodName) { try { return functionClass().getDeclaredMethod(methodName, Object.class, Object.class); } catch (Exception e) { throw new FlowableException("Error getting method " + methodName, e); } }
public static Object instantiate(String className, Object[] args) { Class<?> clazz = loadClass(className); Constructor<?> constructor = findMatchingConstructor(clazz, args); if (constructor == null) { throw new FlowableException("couldn't find constructor for " + className + " with args " + Arrays.asList(args)); } try { return constructor.newInstance(args); } catch (Exception e) { throw new FlowableException("couldn't find constructor for " + className + " with args " + Arrays.asList(args), e); } }
public static void writeStringToFile(String content, String filePath) { BufferedOutputStream outputStream = null; try { outputStream = new BufferedOutputStream(new FileOutputStream(getFile(filePath))); outputStream.write(content.getBytes()); outputStream.flush(); } catch (Exception e) { throw new FlowableException("Couldn't write file " + filePath, e); } finally { IoUtil.closeSilently(outputStream); } }
public U executeSingleResult(CommandContext commandContext) { List<U> results = executeList(commandContext, generateParameterMap()); if (results.size() == 1) { return results.get(0); } else if (results.size() > 1) { throw new FlowableException("Query return " + results.size() + " results instead of max 1"); } return null; }
public static String readFileAsString(String filePath) { byte[] buffer = new byte[(int) getFile(filePath).length()]; BufferedInputStream inputStream = null; try { inputStream = new BufferedInputStream(new FileInputStream(getFile(filePath))); inputStream.read(buffer); } catch (Exception e) { throw new FlowableException("Couldn't read file " + filePath + ": " + e.getMessage()); } finally { IoUtil.closeSilently(inputStream); } return new String(buffer); }
@Override public Date resolveDuedate(String duedate, int maxIterations) { try { DurationHelper dh = new DurationHelper(duedate, clockReader); return dh.getDateAfter(); } catch (Exception e) { throw new FlowableException("couldn't resolve duedate: " + e.getMessage(), e); } }
protected Method getSingleObjectParameterMethod() { try { return functionClass().getDeclaredMethod(localName(), Object.class); } catch (Exception e) { throw new FlowableException("Error getting method " + localName(), e); } }
protected Method getTwoObjectParameterMethod() { try { return functionClass().getDeclaredMethod(localName(), Object.class, Object.class); } catch (Exception e) { throw new FlowableException("Error getting method " + localName(), e); } }
protected Method getFourObjectParameterMethod() { try { return functionClass().getDeclaredMethod(localName(), Object.class, Object.class, Object.class, Object.class); } catch (Exception e) { throw new FlowableException("Error getting method " + localName(), e); } }