com.redhat.lightblue.hook.audit.AuditHookConfigurationParser Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of audit Show documentation
Show all versions of audit Show documentation
Lightblue Audit Hook components
The newest version!
package com.redhat.lightblue.hook.audit;
import com.fasterxml.jackson.databind.JsonNode;
import com.redhat.lightblue.metadata.HookConfiguration;
import com.redhat.lightblue.metadata.parser.HookConfigurationParser;
import com.redhat.lightblue.metadata.parser.MetadataParser;
/**
* Parser for AuditHookConfiguration.
*
* @author nmalik
*/
public class AuditHookConfigurationParser implements HookConfigurationParser {
public static final String PROPERTY_ENTITY_NAME = "entityName";
public static final String PROPERTY_VERSION = "version";
@Override
public String getName() {
return AuditHook.HOOK_NAME;
}
@Override
public HookConfiguration parse(String name, MetadataParser p, JsonNode node) {
// note: name is the hook name (comes from generic Parser interface)
String entityName = p.getRequiredStringProperty(node, PROPERTY_ENTITY_NAME);
String version = p.getRequiredStringProperty(node, PROPERTY_VERSION);
return new AuditHookConfiguration(entityName, version);
}
@Override
public void convert(MetadataParser p, JsonNode emptyNode, HookConfiguration object) {
if (object instanceof AuditHookConfiguration) {
AuditHookConfiguration ahc = (AuditHookConfiguration) object;
p.putValue(emptyNode, PROPERTY_ENTITY_NAME, ahc.getEntityName());
p.putValue(emptyNode, PROPERTY_VERSION, ahc.getVersion());
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy