09-08-2022 07:33 AM
Hello,
Developing a custom snap that is an expression and accepts input schema.
This is how I defined my parameters/ functions :
@Inputs(min = 1, max = 1, accepts = {ViewType.DOCUMENT})
@Outputs(min = 1, max = 1, offers = {ViewType.DOCUMENT})
@Errors(min = 1, max = 1, offers = {ViewType.DOCUMENT})
@Version(snap = 1)
@Category(snap = SnapCategory.WRITE)
public class InputExample extends SimpleSnap {
private static final String KEY = "Key";
ExpressionProperty valueCategoryExp;
String valueCategory;
private String Key;
@Override
public void defineProperties(final PropertyBuilder propertyBuilder)
{
propertyBuilder.describe(KEY,KEY)
.required()
.expression(SnapProperty.DecoratorType.ACCEPTS_SCHEMA)
. expression(SnapProperty.DecoratorType.ENABLED_EXPRESSION)
.type(SnapType.STRING)
.add();
}
@Override
public void configure(PropertyValues propertyValues) throws ConfigurationException
{
valueKeyExp = propertyValues.getAsExpression(KEY);
}
@Override
protected void process(Document document, String s) {
valueKey = valueKeyExp.eval(document);
}
please any idea of what needs to get the input schema to work?