From: Marko Luukkainen Date: Thu, 17 Dec 2020 15:01:40 +0000 (+0200) Subject: Allow copying enumerated properties. X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=de2f70de613d571b80c759d04ff6ce11ab5f55bf;p=simantics%2Finterop.git Allow copying enumerated properties. gitlab #25 Change-Id: I7b662d2146211f25205177bcc3c067c1e98d4c91 --- diff --git a/org.simantics.interop.update/src/org/simantics/interop/update/model/AddDeleteUpdateOp.java b/org.simantics.interop.update/src/org/simantics/interop/update/model/AddDeleteUpdateOp.java index 3f4b6bf..a505864 100644 --- a/org.simantics.interop.update/src/org/simantics/interop/update/model/AddDeleteUpdateOp.java +++ b/org.simantics.interop.update/src/org/simantics/interop/update/model/AddDeleteUpdateOp.java @@ -87,7 +87,13 @@ public abstract class AddDeleteUpdateOp extends UpdateOp { g.claim(destination, s.getPredicate(), valueResource); copyProperties(g, s.getObject(), valueResource); } else { - throw new DatabaseException("Expected to copy property resource " + s.getObject()); + Resource type = g.getPossibleType(s.getObject(), l0.Value); + if (type != null && g.hasStatement(type, l0.Enumeration, type)) { + g.deny(destination, s.getPredicate()); + g.claim(destination, s.getPredicate(), s.getObject()); + } else { + throw new DatabaseException("Expected to copy property resource " + s.getObject()); + } } } }