use of com.thinkbiganalytics.metadata.api.extension.ExtensibleEntity in project kylo by Teradata.
the class FeedSlaUpgradeAction method upgradeFeedSla.
private void upgradeFeedSla(ExtensibleType type) {
List<ExtensibleEntity> slaRels = entityProvider.getEntities(SLA_REL_TYPE_NAME);
for (ExtensibleEntity rel : slaRels) {
ServiceLevelAgreement sla = JcrUtil.getJcrObject(rel.getProperty("sla"), JcrServiceLevelAgreement.class);
Set<Feed> feeds = rel.getPropertyAsSet("feeds", Node.class).stream().map(JcrFeed::new).collect(Collectors.toSet());
feedSlaProvider.relateFeeds(sla, feeds);
entityProvider.deleteEntity(rel.getId());
}
this.typeProvider.deleteType(type.getId());
}
use of com.thinkbiganalytics.metadata.api.extension.ExtensibleEntity in project kylo by Teradata.
the class FeedSlaUpgradeAction method upgradeFeedSla.
private void upgradeFeedSla(ExtensibleType type) {
List<ExtensibleEntity> slaRels = entityProvider.getEntities(SLA_REL_TYPE_NAME);
for (ExtensibleEntity rel : slaRels) {
ServiceLevelAgreement sla = JcrUtil.getJcrObject(rel.getProperty("sla"), JcrServiceLevelAgreement.class);
Set<Feed> feeds = rel.getPropertySet("feeds", Node.class).stream().map(JcrFeed::new).collect(Collectors.toSet());
feedSlaProvider.relateFeeds(sla, feeds);
entityProvider.deleteEntity(rel.getId());
}
}
use of com.thinkbiganalytics.metadata.api.extension.ExtensibleEntity in project kylo by Teradata.
the class JcrExtensibleProvidersTest method testGetEntity.
@Test(dependsOnMethods = "testCreatePersonType")
public void testGetEntity() {
String typeName = metadata.commit(() -> {
List<ExtensibleEntity> list = entityProvider.getEntities();
assertThat(list).isNotNull().hasSize(1);
ExtensibleEntity.ID id = list.get(0).getId();
ExtensibleEntity entity = entityProvider.getEntity(id);
assertThat(entity).isNotNull();
assertThat(entity.<String>getProperty("name")).isEqualTo("Bob");
return entity.getTypeName();
}, MetadataAccess.SERVICE);
assertThat(typeName).isEqualTo("Person");
}
use of com.thinkbiganalytics.metadata.api.extension.ExtensibleEntity in project kylo by Teradata.
the class JcrExtensibleProvidersTest method testCreateEntity.
@Test(dependsOnMethods = "testCreatePersonType")
public void testCreateEntity() {
ExtensibleEntity.ID id = metadata.commit(() -> {
ExtensibleType type = typeProvider.getType("Person");
Map<String, Object> props = new HashMap<>();
props.put("name", "Bob");
props.put("description", "Silly");
props.put("age", 50);
ExtensibleEntity entity = entityProvider.createEntity(type, props);
return entity.getId();
}, MetadataAccess.SERVICE);
assertThat(id).isNotNull();
}
use of com.thinkbiganalytics.metadata.api.extension.ExtensibleEntity in project kylo by Teradata.
the class JcrExtensibleEntityProvider method getEntities.
@Override
public List<ExtensibleEntity> getEntities() {
List<ExtensibleEntity> list = new ArrayList<>();
Session session = getSession();
try {
String path = EntityUtil.pathForExtensibleEntity();
Node genericsNode = session.getNode(path);
NodeIterator typeNameItr = genericsNode.getNodes();
while (typeNameItr.hasNext()) {
Node typeNameNode = (Node) typeNameItr.next();
NodeIterator entityItr = typeNameNode.getNodes();
while (entityItr.hasNext()) {
Node entNode = (Node) entityItr.next();
list.add(new JcrExtensibleEntity(entNode));
}
}
return list;
} catch (RepositoryException e) {
throw new MetadataRepositoryException("Failed to retrieve list of extensible entities", e);
}
}
Aggregations