@JsonIgnore public Optional<ConnConfProperty> getConf(final String schemaName) { return conf.stream().filter(property -> property.getSchema().getName().equals(schemaName)).findFirst(); }
@Override public ConnConfPropSchema build(final ConfigurationProperty property) { ConnConfPropSchema connConfPropSchema = new ConnConfPropSchema(); connConfPropSchema.setName(property.getName()); connConfPropSchema.setDisplayName(property.getDisplayName(property.getName())); connConfPropSchema.setHelpMessage(property.getHelpMessage(property.getName())); connConfPropSchema.setRequired(property.isRequired()); connConfPropSchema.setType(property.getType().getName()); connConfPropSchema.setOrder(((ConfigurationPropertyImpl) property).getOrder()); connConfPropSchema.setConfidential(property.isConfidential()); if (property.getValue() != null) { if (property.getValue().getClass().isArray()) { connConfPropSchema.getDefaultValues().addAll(Arrays.asList((Object[]) property.getValue())); } else if (property.getValue() instanceof Collection<?>) { connConfPropSchema.getDefaultValues().addAll((Collection<?>) property.getValue()); } else { connConfPropSchema.getDefaultValues().add(property.getValue()); } } return connConfPropSchema; }
final ConnConfProperty property = item.getModelObject(); final String label = StringUtils.isBlank(property.getSchema().getDisplayName()) ? property.getSchema().getName() : property.getSchema().getDisplayName(); if (property.getSchema().isConfidential() || Constants.GUARDED_STRING.equalsIgnoreCase(property.getSchema().getType()) || Constants.GUARDED_BYTE_ARRAY.equalsIgnoreCase(property.getSchema().getType())) { required = property.getSchema().isRequired(); } else { Class<?> propertySchemaClass; try { propertySchemaClass = ClassUtils.getClass(property.getSchema().getType()); if (ClassUtils.isPrimitiveOrWrapper(propertySchemaClass)) { propertySchemaClass = org.apache.commons.lang3.ClassUtils.primitiveToWrapper(propertySchemaClass); Class<Number> numberClass = (Class<Number>) propertySchemaClass; field = new AjaxSpinnerFieldPanel.Builder<>().build("panel", label, numberClass, new Model<>()); required = property.getSchema().isRequired(); } else if (ClassUtils.isAssignable(Boolean.class, propertySchemaClass)) { field = new AjaxCheckBoxPanel("panel", label, new Model<>()); } else { field = new AjaxTextFieldPanel("panel", label, new Model<>()); required = property.getSchema().isRequired(); field.setTitle(property.getSchema().getHelpMessage(), true);
/** * Get available configuration properties. * * @param instance connector instance. * @return configuration properties. */ @Override protected final List<ConnConfProperty> getConnProperties(final ConnInstanceTO instance) { return ConnectorWizardBuilder.getBundle(instance, bundles).getProperties().stream(). map(key -> { ConnConfProperty property = new ConnConfProperty(); property.setSchema(key); instance.getConf(key.getName()).ifPresent(conf -> { if (conf.getValues() != null) { property.getValues().addAll(conf.getValues()); property.setOverridable(conf.isOverridable()); } }); if (property.getValues().isEmpty() && !key.getDefaultValues().isEmpty()) { property.getValues().addAll(key.getDefaultValues()); } return property; }).collect(Collectors.toList()); } }
@JsonIgnore public Optional<ConnConfProperty> getConf(final String schemaName) { return conf.stream().filter(property -> property.getSchema().getName().equals(schemaName)).findFirst(); }
private String getCipherAlgorithm(final ConnInstance connInstance) { Optional<ConnConfProperty> cipherAlgorithm = connInstance.getConf().stream(). filter(property -> "cipherAlgorithm".equals(property.getSchema().getName()) && property.getValues() != null && !property.getValues().isEmpty()).findFirst(); return cipherAlgorithm.isPresent() ? (String) cipherAlgorithm.get().getValues().get(0) : CLEARTEXT; }
private String getCipherAlgorithm(final ConnInstance connInstance) { Optional<ConnConfProperty> cipherAlgorithm = connInstance.getConf().stream(). filter(property -> "passwordHashAlgorithm".equals(property.getSchema().getName()) && property.getValues() != null && !property.getValues().isEmpty()).findFirst(); return cipherAlgorithm.isPresent() ? (String) cipherAlgorithm.get().getValues().get(0) : CLEARTEXT; }
private String getCipherAlgorithm(final ConnInstance connInstance) { Optional<ConnConfProperty> cipherAlgorithm = connInstance.getConf().stream(). filter(property -> "cipherAlgorithm".equals(property.getSchema().getName()) && property.getValues() != null && !property.getValues().isEmpty()).findFirst(); return cipherAlgorithm.isPresent() ? (String) cipherAlgorithm.get().getValues().get(0) : CLEARTEXT; }
/** * Allows easy subclassing for the ConnId AD connector bundle. * * @param connector A Connector instance to query for the groupMemberAttribute property name * @return the name of the attribute used to keep track of group memberships */ protected String getGroupMembershipAttrName(final Connector connector) { Optional<ConnConfProperty> groupMembership = connector.getConnInstance().getConf().stream(). filter(property -> "groupMemberAttribute".equals(property.getSchema().getName()) && !property.getValues().isEmpty()). findFirst(); return groupMembership.isPresent() ? (String) groupMembership.get().getValues().get(0) : "uniquemember"; }
/** * Allows easy subclassing for the ConnId AD connector bundle. * * @param connector A Connector instance to query for the groupMemberAttribute property name * @return the name of the attribute used to keep track of group memberships */ @Override protected String getGroupMembershipAttrName(final Connector connector) { Optional<ConnConfProperty> groupMembership = connector.getConnInstance().getConf().stream(). filter(property -> "groupMemberReferenceAttribute".equals(property.getSchema().getName()) && !property.getValues().isEmpty()). findFirst(); return groupMembership.isPresent() ? (String) groupMembership.get().getValues().get(0) : "member"; }