use of com.thinkbiganalytics.metadata.api.security.HadoopSecurityGroup in project kylo by Teradata.
the class SimpleCategoryModelTransform method domainToFeedCategorySimple.
/**
* Transforms the specified Metadata category to a simple Feed Manager category.
*
* @param domainCategory the Metadata category
* @return the Feed Manager category
*/
@Nullable
public FeedCategory domainToFeedCategorySimple(@Nullable final Category domainCategory, boolean includeProperties, boolean includeSecurityGroups) {
if (domainCategory != null) {
FeedCategory category = new FeedCategory();
category.setId(domainCategory.getId().toString());
category.setIconColor(domainCategory.getIconColor());
category.setIcon(domainCategory.getIcon());
category.setName(domainCategory.getDisplayName());
// in pre-0.8.4 version of Kylo there was no system name stored for domain categories
category.setSystemName(domainCategory.getSystemName() == null ? domainCategory.getDisplayName() : domainCategory.getSystemName());
category.setDescription(domainCategory.getDescription());
category.setCreateDate(domainCategory.getCreatedTime() != null ? domainCategory.getCreatedTime().toDate() : null);
category.setUpdateDate(domainCategory.getModifiedTime() != null ? domainCategory.getModifiedTime().toDate() : null);
if (includeProperties) {
// Transform user-defined fields and properties
category.setUserFields(UserPropertyTransform.toUserFields(categoryProvider.getFeedUserFields(domainCategory.getId()).orElse(Collections.emptySet())));
category.setUserProperties(UserPropertyTransform.toUserProperties(domainCategory.getUserProperties(), categoryProvider.getUserFields()));
}
if (includeSecurityGroups) {
// Convert JCR securitygroup to DTO
List<com.thinkbiganalytics.feedmgr.rest.model.HadoopSecurityGroup> restSecurityGroups = new ArrayList<>();
if (domainCategory.getSecurityGroups() != null && domainCategory.getSecurityGroups().size() > 0) {
for (Object group : domainCategory.getSecurityGroups()) {
HadoopSecurityGroup hadoopSecurityGroup = (HadoopSecurityGroup) group;
com.thinkbiganalytics.feedmgr.rest.model.HadoopSecurityGroup restSecurityGroup = new com.thinkbiganalytics.feedmgr.rest.model.HadoopSecurityGroup();
restSecurityGroup.setDescription(hadoopSecurityGroup.getDescription());
restSecurityGroup.setId(hadoopSecurityGroup.getGroupId());
restSecurityGroup.setName(hadoopSecurityGroup.getName());
restSecurityGroups.add(restSecurityGroup);
}
}
category.setSecurityGroups(restSecurityGroups);
}
return category;
} else {
return null;
}
}
use of com.thinkbiganalytics.metadata.api.security.HadoopSecurityGroup in project kylo by Teradata.
the class CategoryDetails method getSecurityGroups.
public List<? extends HadoopSecurityGroup> getSecurityGroups() {
Set<Node> list = JcrPropertyUtil.getReferencedNodeSet(this.node, HADOOP_SECURITY_GROUPS);
List<HadoopSecurityGroup> hadoopSecurityGroups = new ArrayList<>();
if (list != null) {
for (Node n : list) {
hadoopSecurityGroups.add(JcrUtil.createJcrObject(n, JcrHadoopSecurityGroup.class));
}
}
return hadoopSecurityGroups;
}
use of com.thinkbiganalytics.metadata.api.security.HadoopSecurityGroup in project kylo by Teradata.
the class CategoryDetails method setSecurityGroups.
public void setSecurityGroups(List<? extends HadoopSecurityGroup> hadoopSecurityGroups) {
JcrPropertyUtil.setProperty(this.node, HADOOP_SECURITY_GROUPS, null);
for (HadoopSecurityGroup securityGroup : hadoopSecurityGroups) {
Node securityGroupNode = ((JcrHadoopSecurityGroup) securityGroup).getNode();
JcrPropertyUtil.addToSetProperty(this.node, HADOOP_SECURITY_GROUPS, securityGroupNode, true);
}
}
use of com.thinkbiganalytics.metadata.api.security.HadoopSecurityGroup in project kylo by Teradata.
the class FeedData method getSecurityGroups.
public List<? extends HadoopSecurityGroup> getSecurityGroups() {
Set<Node> list = JcrPropertyUtil.getReferencedNodeSet(this.node, HADOOP_SECURITY_GROUPS);
List<HadoopSecurityGroup> hadoopSecurityGroups = new ArrayList<>();
if (list != null) {
for (Node n : list) {
hadoopSecurityGroups.add(JcrUtil.createJcrObject(n, JcrHadoopSecurityGroup.class));
}
}
return hadoopSecurityGroups;
}
use of com.thinkbiganalytics.metadata.api.security.HadoopSecurityGroup in project kylo by Teradata.
the class JcrFeedProvider method mergeFeedProperties.
@Override
public Map<String, Object> mergeFeedProperties(ID feedId, Map<String, Object> properties) {
JcrFeed feed = (JcrFeed) getFeed(feedId);
List<String> securityGroupNames = new ArrayList<>();
for (Object o : feed.getSecurityGroups()) {
HadoopSecurityGroup securityGroup = (HadoopSecurityGroup) o;
securityGroupNames.add(securityGroup.getName());
}
Map<String, Object> merged = feed.mergeProperties(properties);
PropertyChange change = new PropertyChange(feed.getId().getIdValue(), feed.getCategory().getSystemName(), feed.getSystemName(), securityGroupNames, feed.getProperties(), properties);
this.metadataEventService.notify(new FeedPropertyChangeEvent(change));
return merged;
}
Aggregations