Search in sources :

Example 1 with RepositoryException

use of javax.jcr.RepositoryException in project aem-core-wcm-components by Adobe-Marketing-Cloud.

the class ListImpl method populateSearchListItems.

private void populateSearchListItems() {
    listItems = new ArrayList<>();
    if (!StringUtils.isBlank(query)) {
        SimpleSearch search = resource.adaptTo(SimpleSearch.class);
        if (search != null) {
            search.setQuery(query);
            search.setSearchIn(startIn);
            search.addPredicate(new Predicate("type", "type").set("type", NameConstants.NT_PAGE));
            search.setHitsPerPage(limit);
            try {
                collectSearchResults(search.getResult());
            } catch (RepositoryException e) {
                LOGGER.error("Unable to retrieve search results for query.", e);
            }
        }
    }
}
Also used : SimpleSearch(com.day.cq.search.SimpleSearch) RepositoryException(javax.jcr.RepositoryException) Predicate(com.day.cq.search.Predicate)

Example 2 with RepositoryException

use of javax.jcr.RepositoryException in project jackrabbit-oak by apache.

the class SQL2Parser method parseSelector.

private SelectorImpl parseSelector() throws ParseException {
    String nodeTypeName = readName();
    if (namePathMapper != null) {
        try {
            nodeTypeName = namePathMapper.getOakName(nodeTypeName);
        } catch (RepositoryException e) {
            ParseException e2 = getSyntaxError("could not convert node type name " + nodeTypeName);
            e2.initCause(e);
            throw e2;
        }
    }
    NodeTypeInfo nodeTypeInfo = nodeTypes.getNodeTypeInfo(nodeTypeName);
    if (!nodeTypeInfo.exists()) {
        throw getSyntaxError("unknown node type");
    }
    String selectorName = nodeTypeName;
    if (readIf("AS")) {
        selectorName = readName();
    }
    return factory.selector(nodeTypeInfo, selectorName);
}
Also used : NodeTypeInfo(org.apache.jackrabbit.oak.query.ast.NodeTypeInfo) RepositoryException(javax.jcr.RepositoryException) ParseException(java.text.ParseException)

Example 3 with RepositoryException

use of javax.jcr.RepositoryException in project jackrabbit-oak by apache.

the class TestAzureDS method createDataStore.

@Override
protected DataStore createDataStore() throws RepositoryException {
    DataStore azureds = null;
    try {
        azureds = AzureDataStoreUtils.getAzureDataStore(props, dataStoreDir);
    } catch (Exception e) {
        e.printStackTrace();
    }
    sleep(1000);
    return azureds;
}
Also used : DataStore(org.apache.jackrabbit.core.data.DataStore) RepositoryException(javax.jcr.RepositoryException)

Example 4 with RepositoryException

use of javax.jcr.RepositoryException in project jackrabbit-oak by apache.

the class TypeEditorProvider method isTrivialChange.

private boolean isTrivialChange(ReadOnlyNodeTypeManager ntBefore, ReadOnlyNodeTypeManager ntAfter, String nodeType) {
    NodeType nb, na;
    try {
        nb = ntBefore.getNodeType(nodeType);
    } catch (NoSuchNodeTypeException ex) {
        LOG.info(nodeType + " not present in 'before' state");
        return true;
    } catch (RepositoryException ex) {
        LOG.info("getting node type", ex);
        return false;
    }
    try {
        na = ntAfter.getNodeType(nodeType);
    } catch (NoSuchNodeTypeException ex) {
        LOG.info(nodeType + " was removed");
        return false;
    } catch (RepositoryException ex) {
        LOG.info("getting node type", ex);
        return false;
    }
    NodeTypeDefDiff diff = NodeTypeDefDiff.create(nb, na);
    if (!diff.isModified()) {
        LOG.info("Node type " + nodeType + " was not changed");
        return true;
    } else if (diff.isTrivial()) {
        LOG.info("Node type change for " + nodeType + " appears to be trivial");
        return true;
    } else {
        LOG.info("Node type change for " + nodeType + " requires repository scan: " + diff);
        return false;
    }
}
Also used : NodeType(javax.jcr.nodetype.NodeType) RepositoryException(javax.jcr.RepositoryException) NoSuchNodeTypeException(javax.jcr.nodetype.NoSuchNodeTypeException)

Example 5 with RepositoryException

use of javax.jcr.RepositoryException in project jackrabbit-oak by apache.

the class DateVersionSelector method select.

@Override
public NodeBuilder select(@Nonnull NodeBuilder history) throws RepositoryException {
    long latestDate = Long.MIN_VALUE;
    NodeBuilder latestVersion = null;
    for (String name : history.getChildNodeNames()) {
        // OAK-1192 skip hidden child nodes
        if (name.charAt(0) == ':') {
            continue;
        }
        NodeBuilder v = history.getChildNode(name);
        if (name.equals(JcrConstants.JCR_ROOTVERSION) || name.equals(JcrConstants.JCR_VERSIONLABELS)) {
            // ignore root version and labels node
            continue;
        }
        long c = ISO8601.parse(v.getProperty(JcrConstants.JCR_CREATED).getValue(Type.DATE)).getTimeInMillis();
        if (c > latestDate && c <= timestamp) {
            latestDate = c;
            latestVersion = v;
        } else if (c == latestDate) {
            throw new RepositoryException("two versions share the same jcr:created timestamp in history:" + history);
        }
    }
    return latestVersion;
}
Also used : RepositoryException(javax.jcr.RepositoryException) NodeBuilder(org.apache.jackrabbit.oak.spi.state.NodeBuilder)

Aggregations

RepositoryException (javax.jcr.RepositoryException)1651 Node (javax.jcr.Node)481 Session (javax.jcr.Session)293 IOException (java.io.IOException)201 ArrayList (java.util.ArrayList)167 Value (javax.jcr.Value)110 MetadataRepositoryException (com.thinkbiganalytics.metadata.modeshape.MetadataRepositoryException)102 HashMap (java.util.HashMap)97 Test (org.junit.Test)97 Name (org.apache.jackrabbit.spi.Name)96 Property (javax.jcr.Property)95 Authorizable (org.apache.jackrabbit.api.security.user.Authorizable)94 PathNotFoundException (javax.jcr.PathNotFoundException)91 DavException (org.apache.jackrabbit.webdav.DavException)90 AccessDeniedException (javax.jcr.AccessDeniedException)80 NotExecutableException (org.apache.jackrabbit.test.NotExecutableException)77 ItemNotFoundException (javax.jcr.ItemNotFoundException)74 ItemStateException (org.apache.jackrabbit.core.state.ItemStateException)72 NodeIterator (javax.jcr.NodeIterator)70 Path (org.apache.jackrabbit.spi.Path)68