use of com.thinkbiganalytics.metadata.modeshape.MetadataRepositoryException in project kylo by Teradata.
the class JcrExtensibleTypeProvider method updateType.
@Nonnull
@Override
public ExtensibleTypeBuilder updateType(@Nonnull final ID id) {
try {
final JcrExtensibleType.TypeId typeId = (JcrExtensibleType.TypeId) id;
final Node typeNode = getSession().getNodeByIdentifier(typeId.getIdValue());
return new TypeBuilder(typeNode.getName(), typeNode);
} catch (RepositoryException e) {
throw new MetadataRepositoryException("Unable to retrieve extensible type: " + id, e);
}
}
use of com.thinkbiganalytics.metadata.modeshape.MetadataRepositoryException in project kylo by Teradata.
the class FeedData method updateInitStatus.
public void updateInitStatus(InitializationStatus status) {
try {
Node initNode = JcrUtil.getOrCreateNode(getNode(), INITIALIZATION, INITIALIZATION);
Node statusNode = initNode.addNode(INIT_HISTORY, INIT_STATUS_TYPE);
statusNode.setProperty(INIT_STATE, status.getState().toString());
initNode.setProperty(CURRENT_INIT_STATUS, statusNode);
// Trim the history if necessary
NodeIterator itr = initNode.getNodes(INIT_HISTORY);
if (itr.getSize() > MAX_INIT_HISTORY) {
long excess = itr.getSize() - MAX_INIT_HISTORY;
for (int cnt = 0; cnt < excess; cnt++) {
Node node = itr.nextNode();
node.remove();
}
}
} catch (RepositoryException e) {
throw new MetadataRepositoryException("Failed to access initializations statuses", e);
}
}
use of com.thinkbiganalytics.metadata.modeshape.MetadataRepositoryException in project kylo by Teradata.
the class FeedDetails method removeServiceLevelAgreement.
public void removeServiceLevelAgreement(ServiceLevelAgreement.ID id) {
try {
Set<Node> nodes = JcrPropertyUtil.getSetProperty(this.node, SLA);
Set<Value> updatedSet = new HashSet<>();
for (Node node : nodes) {
if (!node.getIdentifier().equalsIgnoreCase(id.toString())) {
Value value = this.node.getSession().getValueFactory().createValue(node, true);
updatedSet.add(value);
}
}
node.setProperty(SLA, (Value[]) updatedSet.stream().toArray(size -> new Value[size]));
} catch (RepositoryException e) {
throw new MetadataRepositoryException("Unable to remove reference to SLA " + id + "from feed " + this.getId());
}
}
use of com.thinkbiganalytics.metadata.modeshape.MetadataRepositoryException in project kylo by Teradata.
the class JcrFeedProvider method buildPrecondition.
private PreconditionBuilder buildPrecondition(JcrFeed feed) {
try {
Node slaNode = feed.createNewPrecondition();
ServiceLevelAgreementBuilder slaBldr = ((JcrServiceLevelAgreementProvider) this.slaProvider).builder(slaNode);
return new JcrPreconditionbuilder(slaBldr, feed);
} catch (RepositoryException e) {
throw new MetadataRepositoryException("Failed to create the precondition for feed " + feed.getId(), e);
}
}
use of com.thinkbiganalytics.metadata.modeshape.MetadataRepositoryException in project kylo by Teradata.
the class JcrFeedProvider method findByCategoryId.
@Override
public List<? extends Feed> findByCategoryId(Category.ID categoryId) {
String query = "SELECT e.* from " + EntityUtil.asQueryProperty(JcrFeed.NODE_TYPE) + " as e " + "INNER JOIN [" + CategoryDetails.NODE_TYPE + "] as det on ISCHILDNODE(e, det)" + "INNER JOIN [" + JcrCategory.NODE_TYPE + "] as cat on ISCHILDNODE(det, cat)" + "WHERE cat.[mode:id] = $id";
Map<String, String> bindParams = new HashMap<>();
bindParams.put("id", categoryId.toString());
try {
QueryResult result = JcrQueryUtil.query(getSession(), query, bindParams);
// not accessible. For now filter the result based on the feed summary access.
return JcrQueryUtil.queryResultStream(result, JcrFeed.class).filter(feed -> feed.getFeedSummary().isPresent()).collect(Collectors.toList());
} catch (RepositoryException e) {
throw new MetadataRepositoryException("Unable to getFeeds for Category ", e);
}
}
Aggregations