/** * Defines a list of Return Properties (a.k.a After Properties). * These properties collect different metrics and information during component execution. * Values of these properties are returned after component finished his work. * Runtime Platform may use this method to retrieve a this list and show in UI * Here, it is defined 2 properties: <br> * 1) Error message * 2) Number of records processed * For Error message property no efforts are required from component developer to set its value. * Runtime Platform will set its value by itself in case of Exception in runtime. * As for Number of records property see Reader implementation in runtime part */ @Override public Property<?>[] getReturnProperties() { Property<Long> totalNBLong = PropertyFactory.newProperty(Long.class, RETURN_TOTAL_RECORD_COUNT); Property<?>[] returnProperties = new Property[] {totalNBLong, RETURN_ERROR_MESSAGE_PROP}; setupI18N(returnProperties); return returnProperties; }
public static Property<Boolean> newBoolean(String name, String initialValue) { return newBoolean(name).setValue(Boolean.valueOf(initialValue)); }
public static Property<Double> newDouble(String name, Double initialValue) { return newDouble(name).setValue(initialValue); }
protected <T extends Enum<T>> Property<T> checkForInvalidStoredEnumProperty(Property<T> property, Class<T> fixEnum) { String name = property.getName(); if (property.getStoredValue() instanceof Enum && fixEnum.getCanonicalName().equals(property.getType())) { return property; } String value = getEnumStoredValue(property.getStoredValue()); if (value == null) { LOG.warn("[checkForInvalidStoredEnumProperty] Cannot determine value for enum {} stored value: {} ({}).", name, property.getStoredValue(), property.getStoredValue().getClass().getCanonicalName()); // don't break everything for that... return property; } try { LOG.warn("[checkForInvalidStoredEnumProperty] Fixing enum {} value: {}", name, value); property = newEnum(name, fixEnum); property.setValue(Enum.valueOf(fixEnum, value)); property.setStoredValue(Enum.valueOf(fixEnum, value)); property.setPossibleValues(fixEnum.getEnumConstants()); } catch (Exception e) { LOG.error("[checkForInvalidStoredEnumProperty] Error during {} fix: {}.", name, e); } return property; }
public static StringProperty newProperty(String name) { return newString(name); }
public static Property<Integer> newInteger(String name, Integer initialValue) { return newInteger(name).setValue(initialValue); }
public static Property<Float> newFloat(String name, String initialValue) { return newFloat(name).setValue(Float.valueOf(initialValue)); }
protected <T extends Enum<T>> Property<T> checkForInvalidStoredEnumProperty(Property<T> property, Class<T> fixEnum) { String name = property.getName(); if (property.getStoredValue() instanceof Enum && fixEnum.getCanonicalName().equals(property.getType())) { return property; } String value = getEnumStoredValue(property.getStoredValue()); if (value == null) { LOG.warn("[checkForInvalidStoredEnumProperty] Cannot determine value for enum {} stored value: {} ({}).", name, property.getStoredValue(), property.getStoredValue().getClass().getCanonicalName()); // don't break everything for that... return property; } try { LOG.warn("[checkForInvalidStoredEnumProperty] Fixing enum {} value: {}", name, value); property = newEnum(name, fixEnum); property.setValue(Enum.valueOf(fixEnum, value)); property.setStoredValue(Enum.valueOf(fixEnum, value)); property.setPossibleValues(fixEnum.getEnumConstants()); } catch (Exception e) { LOG.error("[checkForInvalidStoredEnumProperty] Error during {} fix: {}.", name, e); } return property; }
public static StringProperty newString(String name, String initialValue) { StringProperty property = newString(name); property.setValue(initialValue); return property; }
public static Property<Integer> newInteger(String name, String initialValue) { return newInteger(name).setValue(Integer.valueOf(initialValue)); }
public static Property<Float> newFloat(String name, Float initialValue) { return newFloat(name).setValue(initialValue); }
@Override public Property[] getReturnProperties() { StringProperty return1 = newProperty("return1"); setupI18N(new Property<?>[] { return1 }); return new Property[] { return1, RETURN_ERROR_MESSAGE_PROP, RETURN_TOTAL_RECORD_COUNT_PROP, RETURN_SUCCESS_RECORD_COUNT_PROP, RETURN_REJECT_RECORD_COUNT_PROP }; }
lookupField = newEnum("lookupField", RESTLookupFields.class); lookupField.setPossibleValues(RESTLookupFields.class.getEnumConstants()); if (correctValue) {
public static StringProperty newString(String name, String initialValue, String defaultValue) { StringProperty property = newString(name); property.setValue(initialValue); property.setDefaultValue(defaultValue); return property; }
public static Property<Double> newDouble(String name, String initialValue) { return newDouble(name).setValue(Double.valueOf(initialValue)); }
public static Property<Boolean> newBoolean(String name, Boolean initialValue) { return newBoolean(name).setValue(initialValue); }
@Override public void setupProperties() { super.setupProperties(); initLater = newProperty("initLater"); }
lookupField = newEnum("lookupField", RESTLookupFields.class); lookupField.setPossibleValues(RESTLookupFields.class.getEnumConstants()); if (correctValue) {
@Override public Property[] getReturnProperties() { StringProperty return1 = newProperty("return1"); return1.setI18nMessageFormatter(getI18nMessageFormatter()); return new Property[] { return1, RETURN_ERROR_MESSAGE_PROP, RETURN_TOTAL_RECORD_COUNT_PROP, RETURN_SUCCESS_RECORD_COUNT_PROP, RETURN_REJECT_RECORD_COUNT_PROP }; }
leadKeyTypeREST = newEnum("leadKeyTypeREST", LeadKeyTypeREST.class); leadKeyTypeREST.setPossibleValues(LeadKeyTypeREST.class.getEnumConstants()); if (correctValue) {