Redesigning E/R instance definition

This commit is contained in:
Luca Frosini 2023-04-20 16:59:19 +02:00
parent e2bd5c85d8
commit 09eb625a14
7 changed files with 10 additions and 12 deletions

View File

@ -142,7 +142,7 @@ public abstract class ElementManagement<El extends OElement, T extends Type> {
this.ignoreKeys.add(Element.SUPERCLASSES_PROPERTY); this.ignoreKeys.add(Element.SUPERCLASSES_PROPERTY);
this.ignoreKeys.add(IdentifiableElement.UUID_PROPERTY); this.ignoreKeys.add(IdentifiableElement.UUID_PROPERTY);
this.ignoreKeys.add(IdentifiableElement.METADATA_PROPERTY); this.ignoreKeys.add(IdentifiableElement.METADATA_PROPERTY);
this.ignoreStartWithKeys = new HashSet<String>(); this.ignoreStartWithKeys = new HashSet<String>();
this.ignoreStartWithKeys.add(ElementManagement.AT); this.ignoreStartWithKeys.add(ElementManagement.AT);
this.ignoreStartWithKeys.add(ElementManagement.UNDERSCORE); this.ignoreStartWithKeys.add(ElementManagement.UNDERSCORE);

View File

@ -450,8 +450,7 @@ public class ContextManagementTest extends ContextTest {
return all; return all;
} }
/* @Test
// @Test
public void deleteAll() throws Exception { public void deleteAll() throws Exception {
ContextTest.setContextByName(PARENT_DEFAULT_TEST_SCOPE); ContextTest.setContextByName(PARENT_DEFAULT_TEST_SCOPE);
List<Context> all = getAll(); List<Context> all = getAll();
@ -460,13 +459,12 @@ public class ContextManagementTest extends ContextTest {
logger.trace(ElementMapper.marshal(context)); logger.trace(ElementMapper.marshal(context));
List<IsParentOf> children = context.getChildren(); List<IsParentOf> children = context.getChildren();
if(children==null || children.size()==0) { if(children==null || children.size()==0) {
// delete(context); delete(context);
} }
} }
all = getAll(); all = getAll();
} }
} }
*/
@Test @Test
public void testGetAll() throws Exception { public void testGetAll() throws Exception {

View File

@ -42,7 +42,7 @@ public class InvalidOperationTest extends ERManagementTest {
private static Logger logger = LoggerFactory.getLogger(InvalidOperationTest.class); private static Logger logger = LoggerFactory.getLogger(InvalidOperationTest.class);
public static final String ACTIVATES = "{\"propagationConstraint\":{\"@class\":\"PropagationConstraint\",\"add\":\"propagate\",\"remove\":\"cascade\",\"delete\":\"cascade\"},\"@class\":\"Activates\",\"source\":{\"@class\":\"Configuration\",\"uuid\":\"CONFIGURATION_UUID\"},\"target\":{\"uuid\":\"ESERVICE_UUID\",\"@class\":\"EService\"}}"; public static final String ACTIVATES = "{\"propagationConstraint\":{\"@class\":\"PropagationConstraint\",\"add\":\"propagate\",\"remove\":\"cascade\",\"delete\":\"cascade\"},\"@class\":\"Activates\",\"source\":{\"@class\":\"Configuration\",\"uuid\":\"CONFIGURATION_UUID\"},\"target\":{\"uuid\":\"ESERVICE_UUID\",\"@class\":\"EService\"}}";
public static final String ACTOR = "{\"@class\":\"Actor\",\"@metadata\":null,\"consistsOf\":[{\"@class\":\"IsIdentifiedBy\",\"@metadata\":null,\"propagationConstraint\":{\"@class\":\"PropagationConstraint\",\"remove\":\"cascade\",\"delete\":\"cascade\",\"add\":\"propagate\"},\"source\":{\"@class\":\"Actor\",\"@metadata\":null},\"target\":{\"@class\":\"ContactFacet\",\"@metadata\":null,\"title\":\"Dr.\",\"name\":\"Frosini\",\"middleName\":null,\"surname\":null,\"eMail\":\"luca.frosini@isti.cnr.it\"}}],\"isRelatedTo\":[]}"; public static final String ACTOR = "{\"@class\":\"Actor\",\"metadata\":null,\"consistsOf\":[{\"@class\":\"IsIdentifiedBy\",\"metadata\":null,\"propagationConstraint\":{\"@class\":\"PropagationConstraint\",\"remove\":\"cascade\",\"delete\":\"cascade\",\"add\":\"propagate\"},\"source\":{\"@class\":\"Actor\",\"metadata\":null},\"target\":{\"@class\":\"ContactFacet\",\"metadata\":null,\"title\":\"Dr.\",\"name\":\"Frosini\",\"middleName\":null,\"surname\":null,\"eMail\":\"luca.frosini@isti.cnr.it\"}}],\"isRelatedTo\":[]}";
@Test(expected = SchemaViolationException.class) @Test(expected = SchemaViolationException.class)
public void createInvalidIsRealtedTo() throws Exception { public void createInvalidIsRealtedTo() throws Exception {

View File

@ -8,11 +8,11 @@
"$or": [ "$or": [
{"$and": { {"$and": {
"uuid" : "aec0ef31-c735-4a4c-b2f4-57dfbd2fe925", "uuid" : "aec0ef31-c735-4a4c-b2f4-57dfbd2fe925",
"@metadata" :{ "createdBy": {"$ne": "luca.frosini"} } "metadata" :{ "createdBy": {"$ne": "luca.frosini"} }
}}, }},
{"$and": { {"$and": {
"uuid" : "0255b7ec-e3da-4071-b456-9a2907ece1db", "uuid" : "0255b7ec-e3da-4071-b456-9a2907ece1db",
"@metadata" : { "createdBy": "DataTransfer:data-transfer-service:pc-frosini.isti.cnr.it_8080" } "metadata" : { "createdBy": "DataTransfer:data-transfer-service:pc-frosini.isti.cnr.it_8080" }
}} }}
] ]
} }

View File

@ -1 +1 @@
SELECT FROM ( TRAVERSE inV("StateFacet") FROM ( TRAVERSE outE("ConsistsOf") FROM ( SELECT FROM ( SELECT FROM EService) WHERE ((uuid = "aec0ef31-c735-4a4c-b2f4-57dfbd2fe925" AND @metadata.createdBy <> "luca.frosini") OR (uuid = "0255b7ec-e3da-4071-b456-9a2907ece1db" AND @metadata.createdBy = "DataTransfer:data-transfer-service:pc-frosini.isti.cnr.it_8080"))))) WHERE value = "down" SELECT FROM ( TRAVERSE inV("StateFacet") FROM ( TRAVERSE outE("ConsistsOf") FROM ( SELECT FROM ( SELECT FROM EService) WHERE ((uuid = "aec0ef31-c735-4a4c-b2f4-57dfbd2fe925" AND metadata.createdBy <> "luca.frosini") OR (uuid = "0255b7ec-e3da-4071-b456-9a2907ece1db" AND metadata.createdBy = "DataTransfer:data-transfer-service:pc-frosini.isti.cnr.it_8080"))))) WHERE value = "down"

View File

@ -7,11 +7,11 @@
"$or": [ "$or": [
{"$and": { {"$and": {
"uuid" : "aec0ef31-c735-4a4c-b2f4-57dfbd2fe925", "uuid" : "aec0ef31-c735-4a4c-b2f4-57dfbd2fe925",
"@metadata" :{ "createdBy": {"$ne": "luca.frosini"} } "metadata" :{ "createdBy": {"$ne": "luca.frosini"} }
}}, }},
{"$and": { {"$and": {
"uuid" : "0255b7ec-e3da-4071-b456-9a2907ece1db", "uuid" : "0255b7ec-e3da-4071-b456-9a2907ece1db",
"@metadata" : { "createdBy": "DataTransfer:data-transfer-service:pc-frosini.isti.cnr.it_8080" } "metadata" : { "createdBy": "DataTransfer:data-transfer-service:pc-frosini.isti.cnr.it_8080" }
}} }}
] ]
} }

View File

@ -1 +1 @@
SELECT FROM ( TRAVERSE inV("StateFacet") FROM ( TRAVERSE outE("ConsistsOf") FROM ( SELECT FROM ( SELECT FROM EService) WHERE ((uuid = "aec0ef31-c735-4a4c-b2f4-57dfbd2fe925" AND @metadata.createdBy <> "luca.frosini") OR (uuid = "0255b7ec-e3da-4071-b456-9a2907ece1db" AND metadata.createdBy = "DataTransfer:data-transfer-service:pc-frosini.isti.cnr.it_8080"))))) SELECT FROM ( TRAVERSE inV("StateFacet") FROM ( TRAVERSE outE("ConsistsOf") FROM ( SELECT FROM ( SELECT FROM EService) WHERE ((uuid = "aec0ef31-c735-4a4c-b2f4-57dfbd2fe925" AND metadata.createdBy <> "luca.frosini") OR (uuid = "0255b7ec-e3da-4071-b456-9a2907ece1db" AND metadata.createdBy = "DataTransfer:data-transfer-service:pc-frosini.isti.cnr.it_8080")))))