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);
}
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;
});
}
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;
});
}
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);
}
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);
}
Aggregations