Skip to content

Commit

Permalink
bug id mapping en vocabularios
Browse files Browse the repository at this point in the history
  • Loading branch information
sasierrassis committed Jul 26, 2024
1 parent f47dcd9 commit 0c40709
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import jakarta.json.Json;
import jakarta.json.JsonObject;
Expand Down Expand Up @@ -63,7 +64,12 @@ public void retrieveVocabularies(Config config, Result<TokenRepresentation> toke
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
List<Vocabulary> vocabularies = objectMapper.readValue(response, new TypeReference<>() {
});
vocabularies.forEach(vocabularySharedService::create);
List<JsonNode> nodes = objectMapper.readValue(response, new TypeReference<>() {
});
for(int i=0; i< vocabularies.size(); i++){
Vocabulary vocabulary = vocabularies.get(i).toBuilder().id(nodes.get(i).get("@id").asText()).build();
vocabularySharedService.create(vocabulary);
}
} catch (Exception e) {
monitor.severe("Exception occurred while making HTTP POST request: " + e.getMessage());
}
Expand Down

0 comments on commit 0c40709

Please sign in to comment.