use of javax.annotation.Nonnull in project jackrabbit-oak by apache.
the class Delegatee method syncUser.
@Nonnull
private List<SyncResult> syncUser(@Nonnull ExternalIdentity id, @Nonnull List<SyncResult> results, @Nonnull List<String> list) {
try {
SyncResult r = context.sync(id);
if (r.getIdentity() == null) {
r = new DefaultSyncResultImpl(new DefaultSyncedIdentity(id.getId(), id.getExternalId(), false, -1), SyncResult.Status.NO_SUCH_IDENTITY);
log.warn("sync failed. {}", r.getIdentity());
} else {
log.info("synced {}", r.getIdentity());
}
results.add(r);
} catch (SyncException e) {
log.error(ERROR_SYNC_USER, id, e);
results.add(new ErrorSyncResult(id.getExternalId(), e));
}
return commit(list, results, batchSize);
}
use of javax.annotation.Nonnull in project jackrabbit-oak by apache.
the class TypePredicate method isOrderable.
@Nonnull
public static TypePredicate isOrderable(@Nonnull NodeState root) {
Set<String> orderable = newHashSet();
NodeState types = checkNotNull(root).getChildNode(JCR_SYSTEM).getChildNode(JCR_NODE_TYPES);
for (ChildNodeEntry entry : types.getChildNodeEntries()) {
NodeState type = entry.getNodeState();
if (type.getBoolean(JCR_HASORDERABLECHILDNODES)) {
orderable.add(entry.getName());
}
}
return new TypePredicate(root, orderable);
}
use of javax.annotation.Nonnull in project jackrabbit-oak by apache.
the class VersionablePathHook method processCommit.
@Nonnull
@Override
public NodeState processCommit(NodeState before, NodeState after, CommitInfo info) throws CommitFailedException {
NodeBuilder rootBuilder = after.builder();
NodeBuilder vsRoot = rootBuilder.child(NodeTypeConstants.JCR_SYSTEM).child(NodeTypeConstants.JCR_VERSIONSTORAGE);
ReadWriteVersionManager vMgr = new ReadWriteVersionManager(vsRoot, rootBuilder);
List<CommitFailedException> exceptions = new ArrayList<CommitFailedException>();
after.compareAgainstBaseState(before, new Diff(vMgr, new Node(rootBuilder), exceptions));
if (!exceptions.isEmpty()) {
throw exceptions.get(0);
}
return rootBuilder.getNodeState();
}
use of javax.annotation.Nonnull in project jackrabbit-oak by apache.
the class ReadWriteVersionManager method getVersionLabels.
@Nonnull
private Iterable<String> getVersionLabels(@Nonnull String historyRelPath, @Nonnull String versionId) throws CommitFailedException {
List<String> labels = new ArrayList<String>();
NodeBuilder labelNode = getVersionLabelsFor(historyRelPath);
for (PropertyState ps : labelNode.getProperties()) {
if (Type.REFERENCE == ps.getType()) {
if (versionId.equals(ps.getValue(Type.REFERENCE))) {
labels.add(ps.getName());
}
}
}
return labels;
}
use of javax.annotation.Nonnull in project jackrabbit-oak by apache.
the class AbstractMutableTree method addChild.
@Nonnull
@Override
public Tree addChild(@Nonnull String name) throws IllegalArgumentException {
checkArgument(!isHidden(name));
if (!hasChild(name)) {
NodeBuilder nodeBuilder = getNodeBuilder();
nodeBuilder.setChildNode(name);
PropertyState order = nodeBuilder.getProperty(OAK_CHILD_ORDER);
if (order != null) {
List<String> names = newArrayListWithCapacity(order.count() + 1);
for (String n : order.getValue(NAMES)) {
if (!n.equals(name)) {
names.add(n);
}
}
names.add(name);
nodeBuilder.setProperty(OAK_CHILD_ORDER, names, NAMES);
}
}
return createChild(name);
}
Aggregations