private void addEnumsToProperty(ArrayNode enumList, ArrayNode enumNames, Property property) { List possibleValues = property.getPossibleValues(); for (Object possibleValue : possibleValues) { String value = possibleValue.toString(); if (NamedThing.class.isAssignableFrom(possibleValue.getClass())) { value = ((NamedThing) possibleValue).getName(); } enumList.add(value); enumNames.add(property.getPossibleValuesDisplayName(possibleValue)); } }
private void resolveEnum(ObjectNode schema, Property property) { schema.put(JsonSchemaConstants.TAG_TYPE, JsonSchemaConstants.TYPE_STRING); ArrayNode enumNames = schema.putArray(JsonSchemaConstants.TAG_ENUM_NAMES); ArrayNode enumValues = schema.putArray(JsonSchemaConstants.TAG_ENUM); List possibleValues = property.getPossibleValues(); for (Object possibleValue : possibleValues) { enumValues.add(possibleValue.toString()); enumNames.add(property.getPossibleValuesDisplayName(possibleValue)); } }
sprops.outputAction.getPossibleValuesDisplayName(outputAction.getValue()).toLowerCase(), dataCount));
sprops.outputAction.getPossibleValuesDisplayName(outputAction.getValue()).toLowerCase(), dataCount));
/** * This will look if {@link NamedThing} where used as possible values and use associated * {@link NamedThing#getDisplayName()}. If there are possible Values as NamedThing and the value is not found the an * exception is thrown. If no NamedThing was set as possible values it will delegate to * {@link Property#getPossibleValuesDisplayName(Object)} * * @return the associated {@link NamedThing#getDisplayName()} if found or the default i18n value from super. * @throws TalendRuntimeException is the possible value does not belong to the list of possible values. */ @Override public String getPossibleValuesDisplayName(Object possibleValue) { String possibleValueDisplayName = possibleValue == null ? "null" : possibleValue.toString(); // first check that the possibleValue is part of the possible values if (!isAPossibleValue(possibleValue)) { throw new TalendRuntimeException(CommonErrorCodes.UNEXPECTED_ARGUMENT, ExceptionContext.build().put("argument", "possibleValues").put("value", possibleValue)); } // look for the named thing named possibleValue and return it's display name if not null if (possibleValues2 != null && !possibleValues2.isEmpty()) { for (NamedThing nt : possibleValues2) { if (possibleValue != null && possibleValue.equals(nt.getName())) { possibleValueDisplayName = (nt.getDisplayName() != null ? nt.getDisplayName() : nt.getName()); break; } // else keep looking } } else {// delegate to super. possibleValueDisplayName = super.getPossibleValuesDisplayName(possibleValue); } return possibleValueDisplayName; }
Property<OutputAction> outputAction = sprops.outputAction; LOGGER.info(MESSAGES.getMessage("info.startMessage", sprops.outputAction.getPossibleValuesDisplayName(outputAction.getValue()).toLowerCase(), dataCount)); switch (outputAction.getValue()) { case INSERT:
Property<OutputAction> outputAction = sprops.outputAction; LOGGER.info(MESSAGES.getMessage("info.startMessage", sprops.outputAction.getPossibleValuesDisplayName(outputAction.getValue()).toLowerCase(), dataCount)); switch (outputAction.getValue()) { case INSERT: