use of de.catma.repository.git.serialization.models.json_ld.JsonLdWebAnnotation in project catma by forTEXT.
the class GitMarkupCollectionHandler method getBothModifiedAnnotationConflict.
private AnnotationConflict getBothModifiedAnnotationConflict(String projectId, String collectionId, String serializedConflictingAnnotation) throws Exception {
String masterVersion = serializedConflictingAnnotation.replaceAll("\\Q<<<<<<< HEAD\\E(\\r\\n|\\r|\\n)", "").replaceAll("\\Q=======\\E(\\r\\n|\\r|\\n|.)*?\\Q>>>>>>> \\E.+?(\\r\\n|\\r|\\n)", "");
String devVersion = serializedConflictingAnnotation.replaceAll("\\Q<<<<<<< HEAD\\E(\\r\\n|\\r|\\n|.)*?\\Q=======\\E(\\r\\n|\\r|\\n)", "").replaceAll("\\Q>>>>>>> \\E.+?(\\r\\n|\\r|\\n)", "");
JsonLdWebAnnotation masterVersionJsonLdWebAnnotation = new SerializationHelper<JsonLdWebAnnotation>().deserialize(masterVersion, JsonLdWebAnnotation.class);
JsonLdWebAnnotation devVersionJsonLdWebAnnotation = new SerializationHelper<JsonLdWebAnnotation>().deserialize(devVersion, JsonLdWebAnnotation.class);
List<TagReference> masterTagReferences = masterVersionJsonLdWebAnnotation.toTagReferenceList(projectId, collectionId);
List<TagReference> devTagReferences = devVersionJsonLdWebAnnotation.toTagReferenceList(projectId, collectionId);
AnnotationConflict annotationConflict = new AnnotationConflict(devTagReferences.get(0).getTagInstance(), devTagReferences, masterTagReferences.get(0).getTagInstance(), masterTagReferences);
return annotationConflict;
}
use of de.catma.repository.git.serialization.models.json_ld.JsonLdWebAnnotation in project catma by forTEXT.
the class GitMarkupCollectionHandler method getDeleteByUsAnnotationConflict.
private AnnotationConflict getDeleteByUsAnnotationConflict(String projectId, String collectionId, String serializedConflictingAnnotation) throws Exception {
JsonLdWebAnnotation devVersionJsonLdWebAnnotation = new SerializationHelper<JsonLdWebAnnotation>().deserialize(serializedConflictingAnnotation, JsonLdWebAnnotation.class);
List<TagReference> devTagReferences = devVersionJsonLdWebAnnotation.toTagReferenceList(projectId, collectionId);
AnnotationConflict annotationConflict = new AnnotationConflict(devTagReferences.get(0).getTagInstance(), devTagReferences, null, Collections.emptyList());
return annotationConflict;
}
use of de.catma.repository.git.serialization.models.json_ld.JsonLdWebAnnotation in project catma by forTEXT.
the class GitMarkupCollectionHandler method getDeleteByThemAnnotationConflict.
private AnnotationConflict getDeleteByThemAnnotationConflict(String projectId, String collectionId, String serializedConflictingAnnotation) throws Exception {
JsonLdWebAnnotation masterVersionJsonLdWebAnnotation = new SerializationHelper<JsonLdWebAnnotation>().deserialize(serializedConflictingAnnotation, JsonLdWebAnnotation.class);
List<TagReference> masterTagReferences = masterVersionJsonLdWebAnnotation.toTagReferenceList(projectId, collectionId);
AnnotationConflict annotationConflict = new AnnotationConflict(null, Collections.emptyList(), masterTagReferences.get(0).getTagInstance(), masterTagReferences);
return annotationConflict;
}
use of de.catma.repository.git.serialization.models.json_ld.JsonLdWebAnnotation in project catma by forTEXT.
the class GitProjectHandler method resolveAnnotationConflict.
public void resolveAnnotationConflict(String collectionId, AnnotationConflict annotationConflict, TagLibrary tagLibrary) throws Exception {
try (ILocalGitRepositoryManager localRepoManager = this.localGitRepositoryManager) {
GitMarkupCollectionHandler gitMarkupCollectionHandler = new GitMarkupCollectionHandler(localRepoManager, this.remoteGitServerManager, this.credentialsProvider);
if (annotationConflict.getResolvedTagReferences().isEmpty()) {
TagInstance tagInstance = annotationConflict.getDismissedTagInstance();
gitMarkupCollectionHandler.removeTagInstances(projectId, collectionId, Collections.singleton(tagInstance.getUuid()));
} else {
JsonLdWebAnnotation annotation = new JsonLdWebAnnotation(CATMAPropertyKey.GitLabServerUrl.getValue(), projectId, annotationConflict.getResolvedTagReferences(), tagLibrary);
gitMarkupCollectionHandler.createTagInstance(projectId, collectionId, annotation);
}
}
}
use of de.catma.repository.git.serialization.models.json_ld.JsonLdWebAnnotation in project catma by forTEXT.
the class GitProjectHandler method addOrUpdate.
public void addOrUpdate(String collectionId, Collection<TagReference> tagReferenceList, TagLibrary tagLibrary) throws IOException {
try (ILocalGitRepositoryManager localRepoManager = this.localGitRepositoryManager) {
GitMarkupCollectionHandler gitMarkupCollectionHandler = new GitMarkupCollectionHandler(localRepoManager, this.remoteGitServerManager, this.credentialsProvider);
JsonLdWebAnnotation annotation = new JsonLdWebAnnotation(CATMAPropertyKey.GitLabServerUrl.getValue(), projectId, tagReferenceList, tagLibrary);
gitMarkupCollectionHandler.createTagInstance(projectId, collectionId, annotation);
}
}
Aggregations