@Override public boolean isConfigured(final ConfiguredPropertyDescriptor configuredProperty, final boolean throwException) throws UnconfiguredConfiguredPropertyException { if (configuredProperty.isRequired()) { final Map<ConfiguredPropertyDescriptor, Object> configuredProperties = getConfiguredProperties(); Object value = configuredProperties.get(configuredProperty); if (configuredProperty.isArray() && value != null) { if (Array.getLength(value) == 0) { value = null; } } if (value == null) { if (throwException) { throw new UnconfiguredConfiguredPropertyException(this, configuredProperty); } else { logger.debug("Configured property is not set: " + configuredProperty); return false; } } } return true; }
(UnconfiguredConfiguredPropertyException) ex; final ConfiguredPropertyDescriptor configuredProperty = unconfiguredConfiguredPropertyException.getConfiguredProperty(); final ComponentBuilder componentBuilder = unconfiguredConfiguredPropertyException.getComponentBuilder(); title = "Configure " + "'" + LabelUtils.getLabel(componentBuilder) + "' ..."; errorMessage = "Please set '" + configuredProperty.getName() + "' to continue";
(UnconfiguredConfiguredPropertyException) ex; final ConfiguredPropertyDescriptor configuredProperty = unconfiguredConfiguredPropertyException.getConfiguredProperty(); final ComponentBuilder componentBuilder = unconfiguredConfiguredPropertyException.getComponentBuilder(); errorMessage = "Property '" + configuredProperty.getName() + "' in " + LabelUtils .getLabel(componentBuilder) + " is not set!";
/** * @param errorAware * defines whether or not the method should throw an exception in * case some of the applied properties are missing or erroneous */ public final void applyPropertyValues(final boolean errorAware) { for (final PropertyWidget<?> propertyWidget : getPropertyWidgetCollection().getWidgets()) { final ConfiguredPropertyDescriptor propertyDescriptor = propertyWidget.getPropertyDescriptor(); if (propertyWidget.isSet()) { final Object value = propertyWidget.getValue(); setConfiguredProperty(propertyDescriptor, value); } else { if (errorAware && propertyDescriptor.isRequired()) { throw new UnconfiguredConfiguredPropertyException(getComponentBuilder(), propertyDescriptor); } } } }
@Override public final boolean isConfigured(final boolean throwException) throws ComponentValidationException, UnconfiguredConfiguredPropertyException { for (final ConfiguredPropertyDescriptor configuredProperty : _descriptor.getConfiguredProperties()) { if (!isConfigured(configuredProperty, throwException)) { if (throwException) { throw new UnconfiguredConfiguredPropertyException(this, configuredProperty); } else { return false; } } } try { final LifeCycleHelper lifeCycleHelper = new LifeCycleHelper(_analysisJobBuilder.getConfiguration(), null, false); lifeCycleHelper.validate(getDescriptor(), getComponentInstance()); } catch (final RuntimeException e) { if (throwException) { throw e; } else { return false; } } return true; }