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);
}
}
}
}
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);
}
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;
}
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;
}
}
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;
}
Aggregations