Search in sources :

Example 86 with MetadataRepositoryException

use of com.thinkbiganalytics.metadata.modeshape.MetadataRepositoryException in project kylo by Teradata.

the class JcrFeedProvider method getFeedsForDataHistoryReindexing.

@Override
public List<Feed> getFeedsForDataHistoryReindexing() {
    String query = "SELECT e.*\n" + "        FROM [tba:feed] as e\n" + "        JOIN [tba:feedSummary] AS fs ON ISCHILDNODE(fs, e)\n" + "        JOIN [tba:feedData] AS fd ON ISCHILDNODE(fd, e)\n" + "        JOIN [tba:historyReindexing] AS fh ON ISCHILDNODE(fh, fd)\n" + "        WHERE fh.[tba:reindexingStatus] = 'DIRTY'";
    try {
        QueryResult result = JcrQueryUtil.query(getSession(), query);
        List<JcrFeed> jcrFeeds = JcrQueryUtil.queryResultToList(result, JcrFeed.class);
        List<Feed> feeds = new ArrayList<>();
        if (jcrFeeds != null) {
            feeds.addAll(jcrFeeds);
        }
        return feeds;
    } catch (RepositoryException e) {
        throw new MetadataRepositoryException("Unable to get feeds for data history reindexing ", e);
    }
}
Also used : MetadataRepositoryException(com.thinkbiganalytics.metadata.modeshape.MetadataRepositoryException) QueryResult(javax.jcr.query.QueryResult) ArrayList(java.util.ArrayList) MetadataRepositoryException(com.thinkbiganalytics.metadata.modeshape.MetadataRepositoryException) RepositoryException(javax.jcr.RepositoryException) Feed(com.thinkbiganalytics.metadata.api.feed.Feed)

Example 87 with MetadataRepositoryException

use of com.thinkbiganalytics.metadata.modeshape.MetadataRepositoryException in project kylo by Teradata.

the class FeedData method updateHistoryReindexingStatus.

public Node updateHistoryReindexingStatus(HistoryReindexingStatus historyReindexingStatus) {
    try {
        Node historyReindexingNode = JcrUtil.getOrCreateNode(getNode(), HISTORY_REINDEXING, HISTORY_REINDEXING);
        historyReindexingNode.setProperty(REINDEXING_STATUS, historyReindexingStatus.getHistoryReindexingState().toString());
        historyReindexingNode.setProperty("jcr:lastModified", historyReindexingStatus.getLastModifiedTimestamp().toString());
        return historyReindexingNode;
    } catch (RepositoryException e) {
        throw new MetadataRepositoryException("Failed to access history reindexing status for feed", e);
    }
}
Also used : MetadataRepositoryException(com.thinkbiganalytics.metadata.modeshape.MetadataRepositoryException) Node(javax.jcr.Node) MetadataRepositoryException(com.thinkbiganalytics.metadata.modeshape.MetadataRepositoryException) RepositoryException(javax.jcr.RepositoryException)

Example 88 with MetadataRepositoryException

use of com.thinkbiganalytics.metadata.modeshape.MetadataRepositoryException in project kylo by Teradata.

the class JcrActionsGroupBuilder method module.

/* (non-Javadoc)
     * @see com.thinkbiganalytics.security.action.config.ActionsModuleBuilder#group(java.lang.String)
     */
@Override
public ActionsTreeBuilder<ActionsModuleBuilder> module(String name) {
    Session session = JcrMetadataAccess.getActiveSession();
    try {
        Node securityNode = session.getRootNode().getNode(SecurityPaths.SECURITY.toString());
        this.groupsNode = this.groupsNode == null || !this.groupsNode.getSession().isLive() ? session.getRootNode().getNode(this.protoModulesPath) : this.groupsNode;
        this.protoActionsNode = JcrUtil.getOrCreateNode(groupsNode, name, JcrAllowedActions.NODE_TYPE);
        return new JcrActionTreeBuilder<>(protoActionsNode, this);
    } catch (RepositoryException e) {
        throw new MetadataRepositoryException("Failed to access root node for allowable actions", e);
    }
}
Also used : MetadataRepositoryException(com.thinkbiganalytics.metadata.modeshape.MetadataRepositoryException) Node(javax.jcr.Node) MetadataRepositoryException(com.thinkbiganalytics.metadata.modeshape.MetadataRepositoryException) RepositoryException(javax.jcr.RepositoryException) Session(javax.jcr.Session)

Example 89 with MetadataRepositoryException

use of com.thinkbiganalytics.metadata.modeshape.MetadataRepositoryException in project kylo by Teradata.

the class JcrExtensibleEntityProvider method getEntity.

@Override
public ExtensibleEntity getEntity(ID id) {
    JcrExtensibleEntity.EntityId idImpl = (JcrExtensibleEntity.EntityId) id;
    try {
        Session session = getSession();
        Node node = session.getNodeByIdentifier(idImpl.getIdValue());
        if (node != null) {
            return new JcrExtensibleEntity(node);
        } else {
            return null;
        }
    } catch (RepositoryException e) {
        throw new MetadataRepositoryException("Failure while finding entity by ID: " + idImpl.getIdValue(), e);
    }
}
Also used : MetadataRepositoryException(com.thinkbiganalytics.metadata.modeshape.MetadataRepositoryException) Node(javax.jcr.Node) MetadataRepositoryException(com.thinkbiganalytics.metadata.modeshape.MetadataRepositoryException) RepositoryException(javax.jcr.RepositoryException) Session(javax.jcr.Session)

Example 90 with MetadataRepositoryException

use of com.thinkbiganalytics.metadata.modeshape.MetadataRepositoryException in project kylo by Teradata.

the class JcrExtensibleEntityProvider method cleanupDeletedType.

protected static boolean cleanupDeletedType(Session session, String typeName) {
    try {
        String path = EntityUtil.pathForExtensibleEntity();
        Node entitiesNode = session.getNode(path);
        if (entitiesNode.hasNode(typeName)) {
            Node typesNode = entitiesNode.getNode(typeName);
            typesNode.remove();
            return true;
        } else {
            return false;
        }
    } catch (RepositoryException e) {
        throw new MetadataRepositoryException("Failed to cleanup for deleted entity type: " + typeName, e);
    }
}
Also used : MetadataRepositoryException(com.thinkbiganalytics.metadata.modeshape.MetadataRepositoryException) Node(javax.jcr.Node) MetadataRepositoryException(com.thinkbiganalytics.metadata.modeshape.MetadataRepositoryException) RepositoryException(javax.jcr.RepositoryException)

Aggregations

MetadataRepositoryException (com.thinkbiganalytics.metadata.modeshape.MetadataRepositoryException)99 RepositoryException (javax.jcr.RepositoryException)90 Node (javax.jcr.Node)61 AccessControlException (java.security.AccessControlException)36 AccessDeniedException (javax.jcr.AccessDeniedException)36 Session (javax.jcr.Session)29 ArrayList (java.util.ArrayList)19 HashMap (java.util.HashMap)17 HashSet (java.util.HashSet)16 NodeIterator (javax.jcr.NodeIterator)14 Value (javax.jcr.Value)14 Nonnull (javax.annotation.Nonnull)13 Map (java.util.Map)12 Property (javax.jcr.Property)12 Set (java.util.Set)10 DateTime (org.joda.time.DateTime)10 UserFieldDescriptor (com.thinkbiganalytics.metadata.api.extension.UserFieldDescriptor)9 ItemNotFoundException (javax.jcr.ItemNotFoundException)9 Collection (java.util.Collection)8 List (java.util.List)8