use of com.b2international.index.revision.RevisionBranch in project snow-owl by b2ihealthcare.
the class CodeSystemConverter method expandExtensionOfBranchState.
private void expandExtensionOfBranchState(List<CodeSystem> results) {
if (!expand().containsKey(CodeSystem.Expand.EXTENSION_OF_BRANCH_INFO)) {
return;
}
// extensionOf branches are the parent branches of the CodeSystem, so simple branch state calculation is enough
BaseRevisionBranching branching = context().service(BaseRevisionBranching.class);
for (CodeSystem result : results) {
RevisionBranch branch = branching.getBranch(result.getBranchPath());
BranchState branchState = branching.getBranchState(branch);
result.setExtensionOfBranchInfo(new BranchInfo(branch.getPath(), branchState, branch.getBaseTimestamp(), branch.getHeadTimestamp()));
}
}
use of com.b2international.index.revision.RevisionBranch in project snow-owl by b2ihealthcare.
the class LocksCommand method parseLockTarget.
private static DatastoreLockTarget parseLockTarget(final String lockTargetOrAll) {
if (ALL.equalsIgnoreCase(lockTargetOrAll)) {
return DatastoreLockTarget.ALL;
}
final String repositoryId;
final String path;
String[] parts = lockTargetOrAll.split(":");
if (parts.length == 2) {
repositoryId = parts[0];
path = parts[1];
} else if (parts.length == 1) {
repositoryId = parts[0];
path = null;
} else {
return null;
}
final RepositoryManager repositoryManager = ApplicationContext.getInstance().getService(RepositoryManager.class);
final Repository repository = repositoryManager.get(repositoryId);
if (null == repository) {
return null;
}
if (Strings.isNullOrEmpty(path)) {
return new DatastoreLockTarget(repositoryId, null);
}
final IBranchPath branchPath = BranchPathUtils.createPath(path);
// assuming active connection manager service here
RevisionBranch branch = repository.service(BaseRevisionBranching.class).getBranch(path);
if (null == branch) {
return null;
}
return new DatastoreLockTarget(repositoryId, branchPath.getPath());
}
Aggregations