Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
bobeal committed Dec 9, 2022
2 parents b1e5281 + a66e5de commit 732d993
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 31 deletions.
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ subprojects {
// to ensure we are using mocks and spies from springmockk lib instead
exclude(module = "mockito-core")
}
testImplementation("com.ninja-squad:springmockk:3.1.1")
testImplementation("io.mockk:mockk:1.13.2")
testImplementation("com.ninja-squad:springmockk:3.1.2")
testImplementation("io.mockk:mockk:1.13.3")
testImplementation("io.projectreactor:reactor-test")
testImplementation("org.springframework.security:spring-security-test")
testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test")
Expand Down
2 changes: 1 addition & 1 deletion entity-service/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ plugins {

dependencies {
implementation("org.springframework.boot:spring-boot-starter-data-neo4j")
implementation("eu.michael-simons.neo4j:neo4j-migrations-spring-boot-starter:1.14.0")
implementation("eu.michael-simons.neo4j:neo4j-migrations-spring-boot-starter:1.15.0")
implementation("org.springframework.boot:spring-boot-starter-cache")
implementation(project(":shared"))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ package com.egm.stellio.search.model

import com.egm.stellio.shared.util.JsonUtils.serializeObject
import com.egm.stellio.shared.util.toUri
import com.fasterxml.jackson.databind.JsonNode
import com.fasterxml.jackson.databind.node.ObjectNode
import java.net.URI
import java.time.ZonedDateTime
import java.util.UUID
Expand Down Expand Up @@ -46,31 +44,6 @@ data class AttributeInstance private constructor(
)
}

operator fun invoke(
temporalEntityAttribute: UUID,
instanceId: URI? = null,
timeProperty: TemporalProperty,
time: ZonedDateTime,
value: String? = null,
measuredValue: Double? = null,
jsonNode: JsonNode,
sub: String? = null
): AttributeInstance {
val attributeInstanceId = instanceId ?: generateRandomInstanceId()
(jsonNode as ObjectNode).put("instanceId", attributeInstanceId.toString())

return AttributeInstance(
temporalEntityAttribute = temporalEntityAttribute,
instanceId = attributeInstanceId,
timeProperty = timeProperty,
time = time,
value = value,
measuredValue = measuredValue,
payload = serializeObject(jsonNode),
sub = sub
)
}

private fun generateRandomInstanceId() = "urn:ngsi-ld:Instance:${UUID.randomUUID()}".toUri()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ class AttributeInstanceService(
(time, measured_value, value, temporal_entity_attribute, instance_id, payload)
VALUES (:time, :measured_value, :value, :temporal_entity_attribute, :instance_id, :payload)
ON CONFLICT (time, temporal_entity_attribute)
DO UPDATE SET value = :value, measured_value = :measured_value, payload = :payload
DO UPDATE SET value = :value, measured_value = :measured_value, payload = :payload,
instance_id = :instance_id
""".trimIndent()
else
"""
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
update attribute_instance
set instance_id = trim('"' FROM (payload->'instanceId')::text)
where instance_id != trim('"' FROM (payload->'instanceId')::text);

0 comments on commit 732d993

Please sign in to comment.