diff --git a/java/registry/src/main/java/dev/sunbirdrc/registry/dao/VertexReader.java b/java/registry/src/main/java/dev/sunbirdrc/registry/dao/VertexReader.java index f63d939ff..7ed1cb1af 100644 --- a/java/registry/src/main/java/dev/sunbirdrc/registry/dao/VertexReader.java +++ b/java/registry/src/main/java/dev/sunbirdrc/registry/dao/VertexReader.java @@ -357,7 +357,7 @@ private ArrayNode expandChildObject(ObjectNode entityNode, List processe if (expandChildObject.size() == 0 && entityNode.get(field).size() == 0) { entityNode.remove(field); } - if (expandChildObject != null && expandChildObject.size() > 0) { + if (expandChildObject != null && entityNode.get(field).size() == 1) { entityNode.set(field, expandChildObject); } } diff --git a/java/registry/src/main/java/dev/sunbirdrc/registry/helper/RegistryHelper.java b/java/registry/src/main/java/dev/sunbirdrc/registry/helper/RegistryHelper.java index e87fb2b29..951209f04 100644 --- a/java/registry/src/main/java/dev/sunbirdrc/registry/helper/RegistryHelper.java +++ b/java/registry/src/main/java/dev/sunbirdrc/registry/helper/RegistryHelper.java @@ -1078,7 +1078,7 @@ private void updateAttestation(String attestorEntity, String userId, JsonNode en } else if (attestation.get(_osState.name()).asText().equals(States.ATTESTATION_REQUESTED.name())) { JsonNode propertyData = JSONUtil.extractPropertyDataFromEntity(uuidPropertyName, entity, attestationPolicy.getAttestationProperties(), null); if (attestation.has(propertiesUUIDKey)) { - ObjectNode propertiesUUIDs = attestations.get(propertiesUUIDKey).deepCopy(); + ObjectNode propertiesUUIDs = attestation.get(propertiesUUIDKey).deepCopy(); Map> propertiesUUIDMapper = new HashMap<>(); ObjectReader reader = objectMapper.readerFor(new TypeReference>() { }); diff --git a/java/registry/src/main/java/dev/sunbirdrc/registry/service/impl/RegistryServiceImpl.java b/java/registry/src/main/java/dev/sunbirdrc/registry/service/impl/RegistryServiceImpl.java index 989037820..c2af9ef31 100755 --- a/java/registry/src/main/java/dev/sunbirdrc/registry/service/impl/RegistryServiceImpl.java +++ b/java/registry/src/main/java/dev/sunbirdrc/registry/service/impl/RegistryServiceImpl.java @@ -5,6 +5,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ArrayNode; import com.fasterxml.jackson.databind.node.JsonNodeFactory; +import com.fasterxml.jackson.databind.node.JsonNodeType; import com.fasterxml.jackson.databind.node.ObjectNode; import com.jayway.jsonpath.DocumentContext; import com.jayway.jsonpath.JsonPath; @@ -483,7 +484,11 @@ private void doDelete(IRegistryDao registryDao, VertexReader vr, Set pre itemUuid = ArrayHelper.unquoteString(itemUuid); if (!updatedUuids.contains(itemUuid)) { // delete this item - registryDao.deleteEntity(uuidVertexMap.get(itemUuid)); + if(isHardDeleteEnabled) { + registryDao.hardDeleteEntity(uuidVertexMap.get(itemUuid)); + } else { + registryDao.deleteEntity(uuidVertexMap.get(itemUuid)); + } } } } @@ -517,7 +522,7 @@ private void doUpdate(Shard shard, Graph graph, IRegistryDao registryDao, Vertex oneElementNode.isValueNode() || oneElementNode.isArray()) { logger.info("Value or array node, going to update {}", oneElement.getKey()); - if (oneElementNode.isArray()) { + if (oneElementNode.isArray() && (oneElementNode.isEmpty() || oneElementNode.get(0).getNodeType().equals(JsonNodeType.OBJECT))) { // Arrays are treated specially - we create a blank node and then // individual items String arrayRefLabel = RefLabelHelper.getArrayLabel(oneElement.getKey(), uuidPropertyName);