Search in sources :

Example 1 with TagLibrarySerializationHandler

use of de.catma.serialization.TagLibrarySerializationHandler in project catma by forTEXT.

the class GraphWorktreeProject method loadTagLibrary.

@Override
public List<TagsetDefinitionImportStatus> loadTagLibrary(InputStream inputStream) throws IOException {
    TeiSerializationHandlerFactory factory = new TeiSerializationHandlerFactory();
    factory.setTagManager(new TagManager(new TagLibrary()));
    TagLibrarySerializationHandler tagLibrarySerializationHandler = factory.getTagLibrarySerializationHandler();
    TagLibrary importedLibrary = tagLibrarySerializationHandler.deserialize(null, inputStream);
    List<String> resourceIds = gitProjectHandler.getResourceIds();
    List<TagsetDefinitionImportStatus> tagsetDefinitionImportStatusList = new ArrayList<>();
    for (TagsetDefinition tagset : importedLibrary) {
        boolean inProjectHistory = resourceIds.contains(tagset.getUuid());
        boolean current = inProjectHistory && (getTagManager().getTagLibrary().getTagsetDefinition(tagset.getUuid()) != null);
        tagsetDefinitionImportStatusList.add(new TagsetDefinitionImportStatus(tagset, inProjectHistory, current));
    }
    return tagsetDefinitionImportStatusList;
}
Also used : TagLibrary(de.catma.tag.TagLibrary) TagsetDefinition(de.catma.tag.TagsetDefinition) TagManager(de.catma.tag.TagManager) TeiSerializationHandlerFactory(de.catma.serialization.tei.TeiSerializationHandlerFactory) TeiTagLibrarySerializationHandler(de.catma.serialization.tei.TeiTagLibrarySerializationHandler) TagLibrarySerializationHandler(de.catma.serialization.TagLibrarySerializationHandler) ArrayList(java.util.ArrayList) TagsetDefinitionImportStatus(de.catma.serialization.TagsetDefinitionImportStatus)

Aggregations

TagLibrarySerializationHandler (de.catma.serialization.TagLibrarySerializationHandler)1 TagsetDefinitionImportStatus (de.catma.serialization.TagsetDefinitionImportStatus)1 TeiSerializationHandlerFactory (de.catma.serialization.tei.TeiSerializationHandlerFactory)1 TeiTagLibrarySerializationHandler (de.catma.serialization.tei.TeiTagLibrarySerializationHandler)1 TagLibrary (de.catma.tag.TagLibrary)1 TagManager (de.catma.tag.TagManager)1 TagsetDefinition (de.catma.tag.TagsetDefinition)1 ArrayList (java.util.ArrayList)1