Forum Discussion

ashlam's avatar
ashlam
New Contributor
7 years ago

Custom Snap

I can’t able to get the values from previous snap.I used mapper to set a value and retrieve using expression from previous snap but getting error alike cannot set null value.

@General(title = “Example snap”, purpose = “”, author = “”)
@Category(snap = SnapCategory.READ)
@Version(snap = 1)
@Inputs(min = 1, max = 1, accepts = { ViewType.DOCUMENT })
@Outputs(min = 1, max = 1, offers = { ViewType.DOCUMENT })
@Errors(min = 1, max = 1, offers = { ViewType.DOCUMENT })
public class ExampleSnap implements Snap
{

private static final String CACHE_DATA_ID = "Key";


private String Key;
private String valueCategory;



@Inject
private DocumentUtility documentUtility;

@Inject
private InputViews inputViews;
@Inject
private OutputViews outputViews;
@Inject
private ErrorViews errorViews;

@Override
public void defineProperties(final PropertyBuilder propBuilder)
{
	
	propBuilder.describe(CACHE_DATA_ID, CACHE_DATA_ID).expression().schemaAware(SnapProperty.DecoratorType.ACCEPTS_SCHEMA)
			.add();


}

@Override
public void configure(PropertyValues propertyValues) throws ConfigurationException
{
		valueCategory = propertyValues.getAsExpression(CACHE_DATA_ID).eval(null);
		
}

Please give some suggestion.

3 Replies