Skip to content
Snippets Groups Projects
Commit 2e6c0c8f authored by Henrik tom Wörden's avatar Henrik tom Wörden
Browse files

wip

parent 9eeca52e
No related branches found
No related tags found
No related merge requests found
Pipeline #61384 failed
......@@ -85,13 +85,27 @@ public class DatabaseUtils {
return replacementCount;
}
private static void processPropertiesStage1(
final List<Property> stage1Inserts, final Property p, final EntityInterface e) {
if (!p.isDescOverride()
/**
* Determines whether the property p of entity e needs a replacement property to be stored in the
* database. A property needs a replacement property if it overrides the description, name, or
* datatype and if it does not have a unique property ID, or if it has properties, or if it is
* some kind of collection (e.g. list).
*
* @param p
* @param e
* @return true if the property needs a replacement property, false otherwise
*/
private static boolean noReplacementneeded(final Property p, final EntityInterface e) {
return (!p.isDescOverride()
&& !p.isNameOverride()
&& !p.isDatatypeOverride()
&& (!p.hasProperties() || hasUniquePropertyId(p, e))
&& !(p.getDatatype() instanceof AbstractCollectionDatatype)) {
&& !(p.getDatatype() instanceof AbstractCollectionDatatype));
}
private static void processPropertiesStage1(
final List<Property> stage1Inserts, final Property p, final EntityInterface e) {
if (noReplacementneeded(p, e)) {
stage1Inserts.add(p);
processSubPropertiesStage1(stage1Inserts, p);
} else {
......@@ -127,6 +141,9 @@ public class DatabaseUtils {
}
}
/*
* Returns true if the entity e has no other property with the same ID as the property p.
*/
private static boolean hasUniquePropertyId(final EntityInterface p, final EntityInterface e) {
final EntityID id = p.getId();
for (final EntityInterface p2 : e.getProperties()) {
......
......@@ -35,6 +35,7 @@ public abstract class AbstractCollectionDatatype extends AbstractDatatype {
private static HashMap<String, CollectionDatatypeFactory> instances =
new HashMap<String, CollectionDatatypeFactory>();
static Pattern p =
// with < and > this evaluates to: "^([^<]+)<([^>]+)>$"
Pattern.compile(
"^([^"
+ LEFT_DELIMITER
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment