/** Low-level method. Used for bootstrapping. */ void _associateDataType(String typeUri, String dataTypeUri) { AssociationModel assoc = new AssociationModel( "dm4.core.aggregation", new TopicRoleModel(typeUri, "dm4.core.type"), new TopicRoleModel(dataTypeUri, "dm4.core.default")); dms.storage.createAssociation(assoc); dms.storage.setAssociationValue(assoc.getId(), assoc.getSimpleValue()); associateWithAssociationType(assoc.getId(), assoc.getTypeUri()); }
void associateWithTopicType(long topicId, String topicTypeUri) { try { AssociationModel assoc = new AssociationModel( "dm4.core.instantiation", new TopicRoleModel(topicTypeUri, "dm4.core.type"), new TopicRoleModel(topicId, "dm4.core.instance")); dms.storage.createAssociation(assoc); dms.storage.setAssociationValue(assoc.getId(), assoc.getSimpleValue()); associateWithAssociationType(assoc.getId(), assoc.getTypeUri()); // low-level (storage) call used here ### explain } catch (Exception e) { throw new RuntimeException( "Associating topic " + topicId + " with topic type \"" + topicTypeUri + "\" failed", e); } }
Association storeAssociation( AssociationModel model, ClientState clientState, Directives directives) { setDefaults(model); dms.storage.createAssociation(model); associateWithAssociationType(model.getId(), model.getTypeUri()); // AttachedAssociation assoc = new AttachedAssociation(model, dms); assoc.storeValue(clientState, directives); // return assoc; }