Refine search
protected void checkQueryOk() { if (orderProperty != null) { throw new FlowableIllegalArgumentException("Invalid query: call asc() or desc() after using orderByXX()"); } }
public FlowableEntityEventImpl(Object entity, FlowableEngineEventType type) { super(type); if (entity == null) { throw new FlowableIllegalArgumentException("Entity cannot be null."); } this.entity = entity; }
protected void checkQueryOk() { if (orderProperty != null) { throw new FlowableIllegalArgumentException("Invalid query: call asc() or desc() after using orderByXX()"); } }
/** * Creates a new event implementation, part of an execution context. */ public FlowableEventImpl(FlowableEngineEventType type, String executionId, String processInstanceId, String processDefinitionId) { if (type == null) { throw new FlowableIllegalArgumentException("type is null"); } this.type = type; this.executionId = executionId; this.processInstanceId = processInstanceId; this.processDefinitionId = processDefinitionId; }
public FlowableEntityExceptionEventImpl(Object entity, FlowableEngineEventType type, Throwable cause) { super(type); if (entity == null) { throw new FlowableIllegalArgumentException("Entity cannot be null."); } this.entity = entity; this.cause = cause; }
public synchronized void addEventListener(FlowableEventListener listenerToAdd) { if (listenerToAdd == null) { throw new FlowableIllegalArgumentException("Listener cannot be null."); } if (!eventListeners.contains(listenerToAdd)) { eventListeners.add(listenerToAdd); } }
@Override public InputStream getInputStream() { try { return new BufferedInputStream(url.openStream()); } catch (IOException e) { throw new FlowableIllegalArgumentException("couldn't open url '" + url + "'", e); } } }
/** * Helper method to easily create a map. * * Takes as input a varargs containing the key1, value1, key2, value2, etc. Note: although an Object, we will cast the key to String internally. */ public static Map<String, Object> map(Object... objects) { if (objects.length % 2 != 0) { throw new FlowableIllegalArgumentException("The input should always be even since we expect a list of key-value pairs!"); } Map<String, Object> map = new HashMap<>(); for (int i = 0; i < objects.length; i += 2) { map.put((String) objects[i], objects[i + 1]); } return map; }
protected Date addSingleUnitQuantity(Date startDate, String singleUnitQuantity) { int spaceIndex = singleUnitQuantity.indexOf(' '); if (spaceIndex == -1 || singleUnitQuantity.length() < spaceIndex + 1) { throw new FlowableIllegalArgumentException("invalid duedate format: " + singleUnitQuantity); } String quantityText = singleUnitQuantity.substring(0, spaceIndex); Integer quantity = new Integer(quantityText); String unitText = singleUnitQuantity.substring(spaceIndex + 1).trim().toLowerCase(); int unit = units.get(unitText); GregorianCalendar calendar = new GregorianCalendar(); calendar.setTime(startDate); calendar.add(unit, quantity); return calendar.getTime(); } }
/** * @param key * string representation of level * @return {@link HistoryLevel} for the given key * @throws FlowableException * when passed in key doesn't correspond to existing level */ public static HistoryLevel getHistoryLevelForKey(String key) { for (HistoryLevel level : values()) { if (level.key.equals(key)) { return level; } } throw new FlowableIllegalArgumentException("Illegal value for history-level: " + key); }
public synchronized void addEventListener(FlowableEventListener listenerToAdd, FlowableEventType... types) { if (listenerToAdd == null) { throw new FlowableIllegalArgumentException("Listener cannot be null."); } if (types == null || types.length == 0) { addEventListener(listenerToAdd); } else { for (FlowableEventType type : types) { addTypedEventListener(listenerToAdd, type); } } }
/** * @param string * the string containing a comma-separated list of event-type names * @return a list of {@link FlowableEngineEventType} based on the given list. * @throws FlowableIllegalArgumentException * when one of the given string is not a valid type name */ public static FlowableEngineEventType[] getTypesFromString(String string) { List<FlowableEngineEventType> result = new ArrayList<>(); if (string != null && !string.isEmpty()) { String[] split = StringUtils.split(string, ","); for (String typeName : split) { boolean found = false; for (FlowableEngineEventType type : values()) { if (typeName.equals(type.name())) { result.add(type); found = true; break; } } if (!found) { throw new FlowableIllegalArgumentException("Invalid event-type: " + typeName); } } } return result.toArray(EMPTY_ARRAY); } }
public static void invokeSetterOrField(Object target, String name, Object value, boolean throwExceptionOnMissingField) { Method setterMethod = getSetter(name, target.getClass(), value.getClass()); if (setterMethod != null) { invokeSetter(setterMethod, target, name, value); } else { Field field = ReflectUtil.getField(name, target); if (field == null) { if (throwExceptionOnMissingField) { throw new FlowableIllegalArgumentException("Field definition uses unexisting field '" + name + "' on class " + target.getClass().getName()); } else { return; } } // Check if the delegate field's type is correct if (!fieldTypeCompatible(value, field)) { throw new FlowableIllegalArgumentException("Incompatible type set on field declaration '" + name + "' for class " + target.getClass().getName() + ". Declared value has type " + value.getClass().getName() + ", while expecting " + field.getType().getName()); } setField(field, target, value); } }
public void dispatchEvent(FlowableEvent event) { if (event == null) { throw new FlowableIllegalArgumentException("Event cannot be null."); } if (event.getType() == null) { throw new FlowableIllegalArgumentException("Event type cannot be null."); } // Call global listeners if (!eventListeners.isEmpty()) { for (FlowableEventListener listener : eventListeners) { dispatchEvent(event, listener); } } // Call typed listeners, if any List<FlowableEventListener> typed = typedListeners.get(event.getType()); if (typed != null && !typed.isEmpty()) { for (FlowableEventListener listener : typed) { dispatchEvent(event, listener); } } }
throw new FlowableIllegalArgumentException("Cannot parse duration");
@SuppressWarnings("unchecked") public T direction(Direction direction) { if (orderProperty == null) { throw new FlowableIllegalArgumentException("You should call any of the orderBy methods first before specifying a direction"); } addOrder(orderProperty.getName(), direction.getName(), nullHandlingOnOrder); orderProperty = null; nullHandlingOnOrder = null; return (T) this; }
@SuppressWarnings("unchecked") public T direction(Direction direction) { if (orderProperty == null) { throw new FlowableIllegalArgumentException("You should call any of the orderBy methods first before specifying a direction"); } addOrder(orderProperty.getName(), direction.getName(), nullHandlingOnOrder); orderProperty = null; nullHandlingOnOrder = null; return (T) this; }
@Override public Date resolveDuedate(String duedateDescription, int maxIterations) { LOGGER.info("Resolving Due Date: {}", duedateDescription); String timeZone = getValueFrom("DSTZONE", duedateDescription); String version = getValueFrom("VER", duedateDescription); // START is a legacy value that is no longer used, but may still exist in deployed job schedules // Could be used in the future as a start date for a CRON job // String startDate = getValueFrom("START", duedateDescription); duedateDescription = removeValueFrom("VER", removeValueFrom("START", removeValueFrom("DSTZONE", duedateDescription))).trim(); try { LOGGER.info("Base Due Date: {}", duedateDescription); Date date = resolvers.get(version == null ? getDefaultScheduleVersion() : Integer.valueOf(version)).resolve(duedateDescription, clockReader, timeZone == null ? clockReader.getCurrentTimeZone() : TimeZone.getTimeZone(timeZone)); LOGGER.info("Calculated Date: {}", date == null ? "Will Not Run Again" : date); return date; } catch (Exception e) { throw new FlowableIllegalArgumentException("Cannot parse duration", e); } }