use of eu.esdihumboldt.hale.ui.function.generic.GenericPropertyFunctionWizardFactory in project hale by halestudio.
the class FunctionWizardExtension method getWizardDescriptor.
/**
* Get the wizard descriptor for the given function ID. If no wizard
* descriptor is available for the function in the extension, a generic
* wizard descriptor will be created.
*
* @param functionId the function ID
* @return the wizard descriptor
*/
public FunctionWizardDescriptor<?> getWizardDescriptor(final String functionId) {
// retrieve matching wizards from extension
List<FunctionWizardDescriptor<?>> factories = getFactories(new FactoryFilter<FunctionWizardFactory, FunctionWizardDescriptor<?>>() {
@Override
public boolean acceptFactory(FunctionWizardDescriptor<?> factory) {
return factory.getFunctionId().equals(functionId);
}
@Override
public boolean acceptCollection(ExtensionObjectFactoryCollection<FunctionWizardFactory, FunctionWizardDescriptor<?>> collection) {
return true;
}
});
if (factories != null && !factories.isEmpty()) {
return factories.get(0);
}
// try to create descriptor for generic wizard
// check if type function
TypeFunctionDefinition typeFunction = FunctionUtil.getTypeFunction(functionId, HaleUI.getServiceProvider());
if (typeFunction != null) {
return new FactoryWizardDescriptor<TypeFunctionDefinition>(new GenericTypeFunctionWizardFactory(functionId), typeFunction);
}
// check if property function
PropertyFunctionDefinition propertyFunction = FunctionUtil.getPropertyFunction(functionId, HaleUI.getServiceProvider());
if (propertyFunction != null) {
return new FactoryWizardDescriptor<PropertyFunctionDefinition>(new GenericPropertyFunctionWizardFactory(functionId), propertyFunction);
}
throw new IllegalArgumentException("Function with ID " + functionId + " is unknown");
}
Aggregations