Search in sources :

Example 1 with FeedPropertyType

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);
        }
    });
}
Also used : Arrays(java.util.Arrays) RegisteredTemplateService(com.thinkbiganalytics.feedmgr.service.template.RegisteredTemplateService) Produces(javax.ws.rs.Produces) DatasourceDefinitions(com.thinkbiganalytics.metadata.rest.model.data.DatasourceDefinitions) DatasourceDefinition(com.thinkbiganalytics.metadata.rest.model.data.DatasourceDefinition) StringUtils(org.apache.commons.lang3.StringUtils) FeedModelTransform(com.thinkbiganalytics.feedmgr.service.feed.FeedModelTransform) NifiClientRuntimeException(com.thinkbiganalytics.nifi.rest.client.NifiClientRuntimeException) MediaType(javax.ws.rs.core.MediaType) HiveService(com.thinkbiganalytics.hive.service.HiveService) Map(java.util.Map) AccessController(com.thinkbiganalytics.security.AccessController) NifiFeed(com.thinkbiganalytics.feedmgr.rest.model.NifiFeed) Sort(org.springframework.data.domain.Sort) FeedServicesAccessControl(com.thinkbiganalytics.feedmgr.security.FeedServicesAccessControl) FeedCleanupTimeoutException(com.thinkbiganalytics.feedmgr.service.FeedCleanupTimeoutException) MetadataService(com.thinkbiganalytics.feedmgr.service.MetadataService) PermissionsChange(com.thinkbiganalytics.security.rest.model.PermissionsChange) NifiProperty(com.thinkbiganalytics.nifi.rest.model.NifiProperty) FeedCleanupFailedException(com.thinkbiganalytics.feedmgr.service.FeedCleanupFailedException) ActionGroup(com.thinkbiganalytics.security.rest.model.ActionGroup) MetadataAccessControl(com.thinkbiganalytics.metadata.api.security.MetadataAccessControl) PageRequest(org.springframework.data.domain.PageRequest) Set(java.util.Set) Page(org.springframework.data.domain.Page) EntityVersionDifference(com.thinkbiganalytics.feedmgr.rest.model.EntityVersionDifference) FeedPropertyType(com.thinkbiganalytics.metadata.FeedPropertyType) Stream(java.util.stream.Stream) WebApplicationException(javax.ws.rs.WebApplicationException) RoleMembershipChange(com.thinkbiganalytics.security.rest.model.RoleMembershipChange) BodyPartEntity(org.glassfish.jersey.media.multipart.BodyPartEntity) AccessDeniedException(java.nio.file.AccessDeniedException) VersionNotFoundException(com.thinkbiganalytics.metadata.modeshape.versioning.VersionNotFoundException) SecurityModelTransform(com.thinkbiganalytics.security.rest.controller.SecurityModelTransform) GET(javax.ws.rs.GET) FeedPropertySection(com.thinkbiganalytics.metadata.FeedPropertySection) FeedMetadata(com.thinkbiganalytics.feedmgr.rest.model.FeedMetadata) HiveUtils(com.thinkbiganalytics.hive.util.HiveUtils) AnnotationFieldNameResolver(com.thinkbiganalytics.annotations.AnnotationFieldNameResolver) StandardCopyOption(java.nio.file.StandardCopyOption) ArrayList(java.util.ArrayList) Lists(com.google.common.collect.Lists) RestResponseStatus(com.thinkbiganalytics.rest.model.RestResponseStatus) ResourceBundle(java.util.ResourceBundle) FieldUtils(org.apache.commons.lang3.reflect.FieldUtils) Api(io.swagger.annotations.Api) DuplicateFeedNameException(com.thinkbiganalytics.feedmgr.service.feed.DuplicateFeedNameException) Files(java.nio.file.Files) SecurityService(com.thinkbiganalytics.feedmgr.service.security.SecurityService) IOException(java.io.IOException) Pair(com.thinkbiganalytics.search.rest.model.Pair) SearchResult(com.thinkbiganalytics.rest.model.search.SearchResult) FeedCurrentlyRunningException(com.thinkbiganalytics.feedmgr.service.feed.reindexing.FeedCurrentlyRunningException) File(java.io.File) Paths(java.nio.file.Paths) SwaggerDefinition(io.swagger.annotations.SwaggerDefinition) ApiResponse(io.swagger.annotations.ApiResponse) Strings(org.apache.directory.api.util.Strings) LoggerFactory(org.slf4j.LoggerFactory) Path(javax.ws.rs.Path) ClientErrorException(javax.ws.rs.ClientErrorException) ApiOperation(io.swagger.annotations.ApiOperation) QueryParam(javax.ws.rs.QueryParam) Consumes(javax.ws.rs.Consumes) JDBCException(org.hibernate.JDBCException) BodyPart(org.glassfish.jersey.media.multipart.BodyPart) NifiPropertyUtil(com.thinkbiganalytics.nifi.rest.support.NifiPropertyUtil) DefaultValue(javax.ws.rs.DefaultValue) ChangeType(com.thinkbiganalytics.security.rest.model.PermissionsChange.ChangeType) DELETE(javax.ws.rs.DELETE) FeedVersions(com.thinkbiganalytics.feedmgr.rest.model.FeedVersions) FeedHistoryDataReindexingNotEnabledException(com.thinkbiganalytics.feedmgr.service.feed.reindexing.FeedHistoryDataReindexingNotEnabledException) Collection(java.util.Collection) InternalServerErrorException(javax.ws.rs.InternalServerErrorException) UUID(java.util.UUID) Collectors(java.util.stream.Collectors) EditFeedEntity(com.thinkbiganalytics.feedmgr.rest.model.EditFeedEntity) NotFoundException(javax.ws.rs.NotFoundException) AnnotatedFieldProperty(com.thinkbiganalytics.annotations.AnnotatedFieldProperty) FeedSummary(com.thinkbiganalytics.feedmgr.rest.model.FeedSummary) List(java.util.List) Generex(com.mifmif.common.regex.Generex) Principal(java.security.Principal) Response(javax.ws.rs.core.Response) AccessControlException(java.security.AccessControlException) PreconditionRule(com.thinkbiganalytics.policy.rest.model.PreconditionRule) DataAccessException(org.springframework.dao.DataAccessException) PathParam(javax.ws.rs.PathParam) FormDataMultiPart(org.glassfish.jersey.media.multipart.FormDataMultiPart) ApiResponses(io.swagger.annotations.ApiResponses) Inject(javax.inject.Inject) UIFeed(com.thinkbiganalytics.feedmgr.rest.model.UIFeed) FeedManagerPreconditionService(com.thinkbiganalytics.feedmgr.service.feed.FeedManagerPreconditionService) PropertyExpressionResolver(com.thinkbiganalytics.feedmgr.nifi.PropertyExpressionResolver) ServiceLevelAgreementService(com.thinkbiganalytics.feedmgr.sla.ServiceLevelAgreementService) Tag(io.swagger.annotations.Tag) Nonnull(javax.annotation.Nonnull) Status(javax.ws.rs.core.Response.Status) FeedNotFoundException(com.thinkbiganalytics.metadata.api.feed.FeedNotFoundException) DatasourceService(com.thinkbiganalytics.feedmgr.service.datasource.DatasourceService) Logger(org.slf4j.Logger) POST(javax.ws.rs.POST) FeedNameUtil(com.thinkbiganalytics.support.FeedNameUtil) FeedLineageStyle(com.thinkbiganalytics.metadata.rest.model.feed.FeedLineageStyle) FeedServiceLevelAgreement(com.thinkbiganalytics.metadata.rest.model.sla.FeedServiceLevelAgreement) Component(org.springframework.stereotype.Component) QueryResult(com.thinkbiganalytics.discovery.schema.QueryResult) InputStream(java.io.InputStream) AnnotatedFieldProperty(com.thinkbiganalytics.annotations.AnnotatedFieldProperty) AnnotationFieldNameResolver(com.thinkbiganalytics.annotations.AnnotationFieldNameResolver)

Aggregations

Lists (com.google.common.collect.Lists)1 Generex (com.mifmif.common.regex.Generex)1 AnnotatedFieldProperty (com.thinkbiganalytics.annotations.AnnotatedFieldProperty)1 AnnotationFieldNameResolver (com.thinkbiganalytics.annotations.AnnotationFieldNameResolver)1 QueryResult (com.thinkbiganalytics.discovery.schema.QueryResult)1 PropertyExpressionResolver (com.thinkbiganalytics.feedmgr.nifi.PropertyExpressionResolver)1 EditFeedEntity (com.thinkbiganalytics.feedmgr.rest.model.EditFeedEntity)1 EntityVersionDifference (com.thinkbiganalytics.feedmgr.rest.model.EntityVersionDifference)1 FeedMetadata (com.thinkbiganalytics.feedmgr.rest.model.FeedMetadata)1 FeedSummary (com.thinkbiganalytics.feedmgr.rest.model.FeedSummary)1 FeedVersions (com.thinkbiganalytics.feedmgr.rest.model.FeedVersions)1 NifiFeed (com.thinkbiganalytics.feedmgr.rest.model.NifiFeed)1 UIFeed (com.thinkbiganalytics.feedmgr.rest.model.UIFeed)1 FeedServicesAccessControl (com.thinkbiganalytics.feedmgr.security.FeedServicesAccessControl)1 FeedCleanupFailedException (com.thinkbiganalytics.feedmgr.service.FeedCleanupFailedException)1 FeedCleanupTimeoutException (com.thinkbiganalytics.feedmgr.service.FeedCleanupTimeoutException)1 MetadataService (com.thinkbiganalytics.feedmgr.service.MetadataService)1 DatasourceService (com.thinkbiganalytics.feedmgr.service.datasource.DatasourceService)1 DuplicateFeedNameException (com.thinkbiganalytics.feedmgr.service.feed.DuplicateFeedNameException)1 FeedManagerPreconditionService (com.thinkbiganalytics.feedmgr.service.feed.FeedManagerPreconditionService)1