use of com.thinkbiganalytics.metadata.FeedPropertyType in project kylo by Teradata.
the class FeedRestController method updateFeedMetadata.
private void updateFeedMetadata(FeedMetadata targetFeedMetadata, FeedMetadata modifiedFeedMetadata, FeedPropertySection feedPropertySection) {
AnnotationFieldNameResolver annotationFieldNameResolver = new AnnotationFieldNameResolver(FeedPropertyType.class);
List<AnnotatedFieldProperty> list = annotationFieldNameResolver.getProperties(FeedMetadata.class);
List<AnnotatedFieldProperty> sectionList = list.stream().filter(annotatedFieldProperty -> feedPropertySection.equals(((FeedPropertyType) annotatedFieldProperty.getAnnotation()).section())).collect(Collectors.toList());
sectionList.forEach(annotatedFieldProperty -> {
try {
Object value = FieldUtils.readField(annotatedFieldProperty.getField(), modifiedFeedMetadata);
FieldUtils.writeField(annotatedFieldProperty.getField(), targetFeedMetadata, value);
} catch (IllegalAccessException e) {
log.warn("Unable to update FeedMetadata field: {}. Exception: {} ", annotatedFieldProperty.getField(), e.getMessage(), e);
}
});
}
Aggregations