Commit 4b6b7f09 authored by Jonas Waeber's avatar Jonas Waeber
Browse files

Change resource builder

If both digital and physical objects are created, it is assumed, that the digital is derived from the physical.
parent d8c471c4
......@@ -49,6 +49,7 @@ class ResourceBuilder(
}
resources.add(record)
val physicalObject: PhysicalObject? =
if (physicalObjectFieldMappers.isNotEmpty()) {
val physicalObject = PhysicalObject(recordId, institutionId, count)
count += 1
......@@ -58,8 +59,11 @@ class ResourceBuilder(
record.addInstantiation(physicalObject)
physicalObject.addRecord(record)
resources.add(physicalObject)
physicalObject
} else {
null
}
val digitalObject: DigitalObject? =
if (digitalObjectFieldMappers.isNotEmpty()) {
val digitalObject = DigitalObject(recordId, institutionId, count)
count += 1
......@@ -73,6 +77,13 @@ class ResourceBuilder(
record.addInstantiation(digitalObject)
resources.add(digitalObject)
}
digitalObject
} else {
null
}
if (physicalObject != null && digitalObject != null) {
physicalObject.addDerivedInstantiation(digitalObject)
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment