Search in sources :

Example 6 with OpenProjectListener

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();
}
Also used : ForkStatus(de.catma.project.ForkStatus) Project(de.catma.project.Project) ConflictedProject(de.catma.project.conflict.ConflictedProject) OpenProjectListener(de.catma.project.OpenProjectListener) JsonObject(com.google.gson.JsonObject) ConflictedProject(de.catma.project.conflict.ConflictedProject)

Aggregations

OpenProjectListener (de.catma.project.OpenProjectListener)6 UI (com.vaadin.ui.UI)5 IndexedProject (de.catma.indexer.IndexedProject)5 Project (de.catma.project.Project)4 ConflictedProject (de.catma.project.conflict.ConflictedProject)4 CacheBuilder (com.google.common.cache.CacheBuilder)2 CacheLoader (com.google.common.cache.CacheLoader)2 LoadingCache (com.google.common.cache.LoadingCache)2 RemovalListener (com.google.common.cache.RemovalListener)2 RemovalNotification (com.google.common.cache.RemovalNotification)2 ArrayListMultimap (com.google.common.collect.ArrayListMultimap)2 Multimap (com.google.common.collect.Multimap)2 EventBus (com.google.common.eventbus.EventBus)2 BackgroundService (de.catma.backgroundservice.BackgroundService)2 ExecutionListener (de.catma.backgroundservice.ExecutionListener)2 ProgressListener (de.catma.backgroundservice.ProgressListener)2 AnnotationCollection (de.catma.document.annotation.AnnotationCollection)2 AnnotationCollectionReference (de.catma.document.annotation.AnnotationCollectionReference)2 TagReference (de.catma.document.annotation.TagReference)2 Comment (de.catma.document.comment.Comment)2