Search in sources :

Example 6 with JcrObject

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

the class JcrUtil method jcrObjectAsMap.

public static Map<String, Object> jcrObjectAsMap(JcrObject obj) {
    String nodeName = obj.getNodeName();
    String path = obj.getPath();
    String identifier = null;
    try {
        identifier = obj.getObjectId();
    } catch (AccessDeniedException e) {
        log.debug("Access denied", e);
        throw new AccessControlException(e.getMessage());
    } catch (RepositoryException e) {
        throw new RuntimeException(e);
    }
    String type = obj.getTypeName();
    Map<String, Object> props = obj.getProperties();
    Map<String, Object> finalProps = new HashMap<>();
    if (props != null) {
        finalProps.putAll(finalProps);
    }
    finalProps.put("nodeName", nodeName);
    if (identifier != null) {
        finalProps.put("nodeIdentifier", identifier);
    }
    finalProps.put("nodePath", path);
    finalProps.put("nodeType", type);
    return finalProps;
}
Also used : AccessDeniedException(javax.jcr.AccessDeniedException) HashMap(java.util.HashMap) AccessControlException(java.security.AccessControlException) MetadataRepositoryException(com.thinkbiganalytics.metadata.modeshape.MetadataRepositoryException) RepositoryException(javax.jcr.RepositoryException) JcrObject(com.thinkbiganalytics.metadata.modeshape.common.JcrObject)

Aggregations

JcrObject (com.thinkbiganalytics.metadata.modeshape.common.JcrObject)6 RepositoryException (javax.jcr.RepositoryException)4 MetadataRepositoryException (com.thinkbiganalytics.metadata.modeshape.MetadataRepositoryException)3 AccessControlException (java.security.AccessControlException)3 HashMap (java.util.HashMap)3 AccessDeniedException (javax.jcr.AccessDeniedException)3 InputStream (java.io.InputStream)2 BigDecimal (java.math.BigDecimal)2 Calendar (java.util.Calendar)2 Date (java.util.Date)2 Binary (javax.jcr.Binary)2 Node (javax.jcr.Node)2 Value (javax.jcr.Value)2 DateTime (org.joda.time.DateTime)2 Category (com.thinkbiganalytics.metadata.api.category.Category)1 FeedSource (com.thinkbiganalytics.metadata.api.feed.FeedSource)1 JcrCategory (com.thinkbiganalytics.metadata.modeshape.category.JcrCategory)1 JcrDatasource (com.thinkbiganalytics.metadata.modeshape.datasource.JcrDatasource)1 JcrDerivedDatasource (com.thinkbiganalytics.metadata.modeshape.datasource.JcrDerivedDatasource)1 JcrExtensiblePropertyCollection (com.thinkbiganalytics.metadata.modeshape.extension.JcrExtensiblePropertyCollection)1