Search in sources :

Example 11 with FeedManagerTemplate

use of com.thinkbiganalytics.metadata.api.template.FeedManagerTemplate in project kylo by Teradata.

the class DefaultSecurityService method accessTemplate.

private Optional<FeedManagerTemplate> accessTemplate(String id) {
    this.accessController.checkPermission(AccessController.SERVICES, FeedServicesAccessControl.ACCESS_TEMPLATES);
    FeedManagerTemplate.ID templateId = templateProvider.resolveId(id);
    FeedManagerTemplate template = templateProvider.findById(templateId);
    return Optional.ofNullable(template);
}
Also used : FeedManagerTemplate(com.thinkbiganalytics.metadata.api.template.FeedManagerTemplate)

Example 12 with FeedManagerTemplate

use of com.thinkbiganalytics.metadata.api.template.FeedManagerTemplate in project kylo by Teradata.

the class DefaultFeedManagerTemplateService method disableTemplate.

@Override
public RegisteredTemplate disableTemplate(String templateId) {
    return metadataAccess.commit(() -> {
        this.accessController.checkPermission(AccessController.SERVICES, FeedServicesAccessControl.ADMIN_TEMPLATES);
        FeedManagerTemplate.ID domainId = templateProvider.resolveId(templateId);
        if (domainId != null) {
            FeedManagerTemplate template = templateProvider.disable(domainId);
            if (template != null) {
                return templateModelTransform.domainToRegisteredTemplate(template);
            }
        }
        return null;
    });
}
Also used : FeedManagerTemplate(com.thinkbiganalytics.metadata.api.template.FeedManagerTemplate)

Example 13 with FeedManagerTemplate

use of com.thinkbiganalytics.metadata.api.template.FeedManagerTemplate in project kylo by Teradata.

the class DefaultFeedManagerTemplateService method enableTemplate.

@Override
public RegisteredTemplate enableTemplate(String templateId) {
    return metadataAccess.commit(() -> {
        this.accessController.checkPermission(AccessController.SERVICES, FeedServicesAccessControl.ADMIN_TEMPLATES);
        FeedManagerTemplate.ID domainId = templateProvider.resolveId(templateId);
        if (domainId != null) {
            FeedManagerTemplate template = templateProvider.enable(domainId);
            if (template != null) {
                return templateModelTransform.domainToRegisteredTemplate(template);
            }
        }
        return null;
    });
}
Also used : FeedManagerTemplate(com.thinkbiganalytics.metadata.api.template.FeedManagerTemplate)

Example 14 with FeedManagerTemplate

use of com.thinkbiganalytics.metadata.api.template.FeedManagerTemplate in project kylo by Teradata.

the class RegisteredTemplateService method findRegisteredTemplateByName.

/**
 * Find a template by the name
 *
 * @param templateName the name of the template
 * @param principals   list of principals required to access
 * @return the RegisteredTemplate matching the passed in name or null if not found
 */
public RegisteredTemplate findRegisteredTemplateByName(final String templateName, TEMPLATE_TRANSFORMATION_TYPE transformationType, Principal... principals) {
    return metadataAccess.read(() -> {
        this.accessController.checkPermission(AccessController.SERVICES, FeedServicesAccessControl.ACCESS_TEMPLATES);
        RegisteredTemplate registeredTemplate = null;
        FeedManagerTemplate template = templateProvider.findByName(templateName);
        if (template != null) {
            registeredTemplate = templateModelTransform.getTransformationFunction(transformationType).apply(template);
        }
        return registeredTemplate;
    }, principals);
}
Also used : RegisteredTemplate(com.thinkbiganalytics.feedmgr.rest.model.RegisteredTemplate) FeedManagerTemplate(com.thinkbiganalytics.metadata.api.template.FeedManagerTemplate)

Example 15 with FeedManagerTemplate

use of com.thinkbiganalytics.metadata.api.template.FeedManagerTemplate in project kylo by Teradata.

the class RegisteredTemplateService method orderTemplates.

/**
 * pass in the Template Ids in Order
 */
public void orderTemplates(List<String> orderedTemplateIds, Set<String> exclude) {
    metadataAccess.commit(() -> {
        this.accessController.checkPermission(AccessController.SERVICES, FeedServicesAccessControl.EDIT_TEMPLATES);
        if (orderedTemplateIds != null && !orderedTemplateIds.isEmpty()) {
            IntStream.range(0, orderedTemplateIds.size()).forEach(i -> {
                String id = orderedTemplateIds.get(i);
                if (!"NEW".equals(id) && (exclude == null || (exclude != null && !exclude.contains(id)))) {
                    FeedManagerTemplate template = templateProvider.findById(templateProvider.resolveId(id));
                    if (template != null) {
                        if (template.getOrder() == null || !template.getOrder().equals(new Long(i))) {
                            // save the new order
                            template.setOrder(new Long(i));
                            templateProvider.update(template);
                        }
                    }
                }
            });
        }
    }, MetadataAccess.ADMIN);
}
Also used : FeedManagerTemplate(com.thinkbiganalytics.metadata.api.template.FeedManagerTemplate)

Aggregations

FeedManagerTemplate (com.thinkbiganalytics.metadata.api.template.FeedManagerTemplate)21 RegisteredTemplate (com.thinkbiganalytics.feedmgr.rest.model.RegisteredTemplate)8 Feed (com.thinkbiganalytics.metadata.api.feed.Feed)7 Category (com.thinkbiganalytics.metadata.api.category.Category)6 FeedMetadata (com.thinkbiganalytics.feedmgr.rest.model.FeedMetadata)3 MetadataRepositoryException (com.thinkbiganalytics.metadata.modeshape.MetadataRepositoryException)3 Principal (java.security.Principal)3 DefaultTag (com.thinkbiganalytics.discovery.model.DefaultTag)2 FeedCategory (com.thinkbiganalytics.feedmgr.rest.model.FeedCategory)2 FeedSummary (com.thinkbiganalytics.feedmgr.rest.model.FeedSummary)2 UIFeed (com.thinkbiganalytics.feedmgr.rest.model.UIFeed)2 UserProperty (com.thinkbiganalytics.feedmgr.rest.model.UserProperty)2 MetadataEventService (com.thinkbiganalytics.metadata.api.event.MetadataEventService)2 UserFieldDescriptor (com.thinkbiganalytics.metadata.api.extension.UserFieldDescriptor)2 HadoopSecurityGroup (com.thinkbiganalytics.metadata.api.security.HadoopSecurityGroup)2 FeedManagerTemplateProvider (com.thinkbiganalytics.metadata.api.template.FeedManagerTemplateProvider)2 JcrHadoopSecurityGroup (com.thinkbiganalytics.metadata.modeshape.security.JcrHadoopSecurityGroup)2 AccessController (com.thinkbiganalytics.security.AccessController)2 Serializable (java.io.Serializable)2 ArrayList (java.util.ArrayList)2