Search in sources :

Example 1 with DefaultCustomActionSpecification

use of co.cask.cdap.internal.customaction.DefaultCustomActionSpecification in project cdap by caskdata.

the class DefaultCustomActionConfigurer method createSpecification.

private DefaultCustomActionSpecification createSpecification() {
    Set<String> datasets = new HashSet<>();
    Reflections.visit(customAction, customAction.getClass(), new PropertyFieldExtractor(properties), new DataSetFieldExtractor(datasets));
    return new DefaultCustomActionSpecification(customAction.getClass().getName(), name, description, properties, datasets);
}
Also used : PropertyFieldExtractor(co.cask.cdap.internal.specification.PropertyFieldExtractor) DataSetFieldExtractor(co.cask.cdap.internal.specification.DataSetFieldExtractor) DefaultCustomActionSpecification(co.cask.cdap.internal.customaction.DefaultCustomActionSpecification) HashSet(java.util.HashSet)

Example 2 with DefaultCustomActionSpecification

use of co.cask.cdap.internal.customaction.DefaultCustomActionSpecification in project cdap by caskdata.

the class CustomActionSpecificationCodec method deserialize.

@Override
public CustomActionSpecification deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
    JsonObject jsonObj = json.getAsJsonObject();
    String className = jsonObj.get("className").getAsString();
    String name = jsonObj.get("name").getAsString();
    String description = jsonObj.get("description").getAsString();
    Set<String> datasets = deserializeSet(jsonObj.get("datasets"), context, String.class);
    Map<String, String> properties = deserializeMap(jsonObj.get("properties"), context, String.class);
    return new DefaultCustomActionSpecification(className, name, description, properties, datasets);
}
Also used : JsonObject(com.google.gson.JsonObject) DefaultCustomActionSpecification(co.cask.cdap.internal.customaction.DefaultCustomActionSpecification)

Aggregations

DefaultCustomActionSpecification (co.cask.cdap.internal.customaction.DefaultCustomActionSpecification)2 DataSetFieldExtractor (co.cask.cdap.internal.specification.DataSetFieldExtractor)1 PropertyFieldExtractor (co.cask.cdap.internal.specification.PropertyFieldExtractor)1 JsonObject (com.google.gson.JsonObject)1 HashSet (java.util.HashSet)1