001package systems.dmx.core.impl; 002 003import systems.dmx.core.AssociationDefinition; 004import systems.dmx.core.ViewConfiguration; 005import systems.dmx.core.model.AssociationDefinitionModel; 006import systems.dmx.core.model.RoleModel; 007 008 009 010/** 011 * An association definition that is attached to the {@link CoreService}. 012 */ 013class AssociationDefinitionImpl extends AssociationImpl implements AssociationDefinition { 014 015 // ---------------------------------------------------------------------------------------------------- Constructors 016 017 AssociationDefinitionImpl(AssociationDefinitionModelImpl model, PersistenceLayer pl) { 018 super(model, pl); 019 } 020 021 // -------------------------------------------------------------------------------------------------- Public Methods 022 023 024 025 // ******************************************** 026 // *** AssociationDefinition Implementation *** 027 // ******************************************** 028 029 030 031 @Override 032 public String getAssocDefUri() { 033 return getModel().getAssocDefUri(); 034 } 035 036 // --- 037 038 @Override 039 public String getParentTypeUri() { 040 return getModel().getParentTypeUri(); 041 } 042 043 @Override 044 public String getChildTypeUri() { 045 return getModel().getChildTypeUri(); 046 } 047 048 // --- 049 050 @Override 051 public String getCustomAssocTypeUri() { 052 return getModel().getCustomAssocTypeUri(); 053 } 054 055 @Override 056 public String getInstanceLevelAssocTypeUri() { 057 return getModel().getInstanceLevelAssocTypeUri(); 058 } 059 060 // --- Parent Cardinality --- 061 062 @Override 063 public String getParentCardinalityUri() { 064 return getModel().getParentCardinalityUri(); 065 } 066 067 @Override 068 public void setParentCardinalityUri(String parentCardinalityUri) { 069 getModel().updateParentCardinalityUri(parentCardinalityUri); 070 } 071 072 // --- Child Cardinality --- 073 074 @Override 075 public String getChildCardinalityUri() { 076 return getModel().getChildCardinalityUri(); 077 } 078 079 @Override 080 public void setChildCardinalityUri(String childCardinalityUri) { 081 getModel().updateChildCardinalityUri(childCardinalityUri); 082 } 083 084 // --- 085 086 @Override 087 public ViewConfiguration getViewConfig() { 088 RoleModel configurable = pl.typeStorage.newAssocDefRole(getId()); // ### ID is uninitialized 089 return new ViewConfigurationImpl(configurable, getModel().getViewConfig(), pl); 090 } 091 092 // --- 093 094 @Override 095 public void update(AssociationDefinitionModel updateModel) { 096 model.update((AssociationDefinitionModelImpl) updateModel); // ### FIXME: call through pl for access control 097 } 098 099 // --- 100 101 @Override 102 public AssociationDefinitionModelImpl getModel() { 103 return (AssociationDefinitionModelImpl) model; 104 } 105}