use of de.catma.project.OpenProjectListener in project catma by forTEXT.
the class GitProjectManager method forkTagset.
@Override
public ForkStatus forkTagset(TagsetDefinition tagset, String sourceProjectId, ProjectReference targetProject) throws Exception {
String targetProjectId = targetProject.getProjectId();
String tagsetId = tagset.getUuid();
cloneRootLocallyIfNotExists(targetProject, new OpenProjectListener() {
@Override
public void ready(Project project) {
/**
* not used *
*/
}
@Override
public void conflictResolutionNeeded(ConflictedProject project) {
/**
* not used *
*/
}
@Override
public void failure(Throwable t) {
/**
* not used *
*/
}
@Override
public void progress(String msg, Object... params) {
logger.info(String.format(msg, params));
}
});
GitProjectHandler targetProjectHandler = new GitProjectHandler(this.user, targetProjectId, this.localGitRepositoryManager, this.remoteGitServerManager);
targetProjectHandler.loadRolesPerResource();
if (targetProjectHandler.hasConflicts()) {
return ForkStatus.targetHasConflicts();
} else if (targetProjectHandler.hasUncommittedChanges()) {
return ForkStatus.targetNotClean();
}
ForkStatus forkStatus = remoteGitServerManager.forkResource(tagsetId, sourceProjectId, targetProjectId);
if (forkStatus.isSuccess()) {
targetProjectHandler.cloneAndAddTagset(tagset.getUuid(), tagset.getName(), String.format("Forked Tagset %1$s with ID %2$s from %3$s with ID %4$s", tagset.getName(), tagset.getUuid(), targetProject.getName(), targetProjectId));
} else {
return forkStatus;
}
return ForkStatus.success();
}
Aggregations