de.deepamehta.core.impl
Class AttachedType
java.lang.Object
de.deepamehta.core.impl.AttachedDeepaMehtaObject
de.deepamehta.core.impl.AttachedTopic
de.deepamehta.core.impl.AttachedType
- All Implemented Interfaces:
- DeepaMehtaObject, Identifiable, JSONEnabled, Topic, Type
- Direct Known Subclasses:
- AttachedAssociationType, AttachedTopicType
abstract class AttachedType
- extends AttachedTopic
- implements Type
Method Summary |
private void |
_addAssocDef(AssociationDefinitionModel model)
|
private AttachedAssociationDefinition |
_removeAssocDef(String childTypeUri)
|
void |
addAssocDef(AssociationDefinitionModel model)
|
private void |
addDeleteTypeDirective(Directives directives)
|
void |
delete(Directives directives)
Deletes all sub-topics of this DeepaMehta object (associated via "dm4.core.composition", recursively) and
deletes all the remaining direct associations of this DeepaMehta object. |
AssociationDefinition |
getAssocDef(String childTypeUri)
|
Collection<AssociationDefinition> |
getAssocDefs()
|
String |
getDataTypeUri()
|
(package private) abstract Directive |
getDeleteTypeDirective()
|
List<IndexMode> |
getIndexModes()
|
List<String> |
getLabelConfig()
|
TypeModel |
getModel()
|
ViewConfiguration |
getViewConfig()
|
Object |
getViewConfig(String typeUri,
String settingUri)
|
boolean |
hasAssocDef(String childTypeUri)
|
private boolean |
hasSequenceChanged(Collection<AssociationDefinitionModel> newAssocDefs)
|
private boolean |
hasUriChanged(String newUri)
|
protected void |
initAssocDefs()
|
private void |
initViewConfig()
|
private AssociationDefinitionModel |
lastAssocDef()
Returns the last association definition of this type or
null if there are no association definitions. |
(package private) abstract void |
putInTypeCache()
|
void |
removeAssocDef(String childTypeUri)
|
(package private) abstract void |
removeFromTypeCache()
|
private void |
removeFromTypeCache(Directives directives)
Removes this type from type cache and adds a DELETE TYPE directive to the given set of directives. |
void |
setDataTypeUri(String dataTypeUri,
Directives directives)
|
void |
setIndexModes(List<IndexMode> indexModes)
|
void |
setLabelConfig(List<String> labelConfig,
Directives directives)
|
private void |
storeDataTypeUri(String dataTypeUri,
Directives directives)
|
void |
update(TypeModel model,
ClientState clientState,
Directives directives)
|
void |
updateAssocDef(AssociationDefinitionModel model)
Note: in contrast to the other "update" methods this one updates the memory only, not the DB!
If you want to update memory and DB use AssociationDefinition.update(de.deepamehta.core.model.AssociationDefinitionModel, de.deepamehta.core.service.ClientState, de.deepamehta.core.service.Directives) . |
private void |
updateAssocDefs(Collection<AssociationDefinitionModel> newAssocDefs,
ClientState clientState,
Directives directives)
|
private void |
updateDataTypeUri(String newDataTypeUri,
Directives directives)
|
private void |
updateLabelConfig(List<String> newLabelConfig,
Directives directives)
|
private void |
updateSequence(Collection<AssociationDefinitionModel> newAssocDefs)
|
Methods inherited from class de.deepamehta.core.impl.AttachedTopic |
_update, addUpdateDirective, className, fetchRelatedTopic, fetchRelatedTopics, getAssociation, getAssociations, getProperty, getRelatedAssociation, getRelatedAssociations, getRelatedTopics, getTopicType, hasProperty, removeProperty, setProperty, storeTypeUri, storeUri, update |
Methods inherited from class de.deepamehta.core.impl.AttachedDeepaMehtaObject |
equals, getCompositeValue, getId, getRelatedTopic, getRelatedTopics, getRelatedTopics, getSimpleValue, getType, getTypeUri, getUri, hashCode, loadChildTopics, loadChildTopics, setCompositeValue, setSimpleValue, setSimpleValue, setSimpleValue, setSimpleValue, setSimpleValue, setTypeUri, setUri, toJSON, toString, update, updateChildTopic, updateChildTopics |
Methods inherited from interface de.deepamehta.core.DeepaMehtaObject |
getAssociation, getAssociations, getCompositeValue, getId, getProperty, getRelatedTopic, getRelatedTopics, getRelatedTopics, getRelatedTopics, getSimpleValue, getTypeUri, getUri, hasProperty, loadChildTopics, loadChildTopics, removeProperty, setCompositeValue, setProperty, setSimpleValue, setSimpleValue, setSimpleValue, setSimpleValue, setSimpleValue, setTypeUri, setUri, update, updateChildTopic, updateChildTopics |
assocDefs
private Map<String,AssociationDefinition> assocDefs
viewConfig
private ViewConfiguration viewConfig
logger
private Logger logger
AttachedType
AttachedType(TypeModel model,
EmbeddedService dms)
update
public void update(TypeModel model,
ClientState clientState,
Directives directives)
- Specified by:
update
in interface Type
delete
public void delete(Directives directives)
- Description copied from class:
AttachedDeepaMehtaObject
- Deletes all sub-topics of this DeepaMehta object (associated via "dm4.core.composition", recursively) and
deletes all the remaining direct associations of this DeepaMehta object.
Note: deletion of the object itself is up to the subclasses.
- Specified by:
delete
in interface DeepaMehtaObject
- Overrides:
delete
in class AttachedTopic
getDataTypeUri
public String getDataTypeUri()
- Specified by:
getDataTypeUri
in interface Type
setDataTypeUri
public void setDataTypeUri(String dataTypeUri,
Directives directives)
- Specified by:
setDataTypeUri
in interface Type
getIndexModes
public List<IndexMode> getIndexModes()
- Specified by:
getIndexModes
in interface Type
setIndexModes
public void setIndexModes(List<IndexMode> indexModes)
- Specified by:
setIndexModes
in interface Type
getAssocDefs
public Collection<AssociationDefinition> getAssocDefs()
- Specified by:
getAssocDefs
in interface Type
getAssocDef
public AssociationDefinition getAssocDef(String childTypeUri)
- Specified by:
getAssocDef
in interface Type
hasAssocDef
public boolean hasAssocDef(String childTypeUri)
- Specified by:
hasAssocDef
in interface Type
addAssocDef
public void addAssocDef(AssociationDefinitionModel model)
- Specified by:
addAssocDef
in interface Type
updateAssocDef
public void updateAssocDef(AssociationDefinitionModel model)
- Description copied from interface:
Type
- Note: in contrast to the other "update" methods this one updates the memory only, not the DB!
If you want to update memory and DB use
AssociationDefinition.update(de.deepamehta.core.model.AssociationDefinitionModel, de.deepamehta.core.service.ClientState, de.deepamehta.core.service.Directives)
.
This method is here to support a special case: the user retypes an association which results in
a changed type definition. In this case the DB is already up-to-date and only the type's memory
representation must be updated. So, here the DB update is the *cause* for a necessary memory-update.
Normally the situation is vice-versa: the DB update is the necessary *effect* of a memory-update.
### TODO: get rid of this peculiar situation and remove this method. This might be achieved by using
the PRE_UPDATE_ASSOCIATION hook instead the POST_UPDATE_ASSOCIATION hook in the Type Editor module.
On pre-update we would perform a regular AssociationDefinition.update(de.deepamehta.core.model.AssociationDefinitionModel, de.deepamehta.core.service.ClientState, de.deepamehta.core.service.Directives)
and suppress further
processing by returning false.
- Specified by:
updateAssocDef
in interface Type
- Parameters:
model
- the new association definition.
Note: in contrast to the other "update" methods this one does not support partial updates.
That is all association definition fields must be initialized.
removeAssocDef
public void removeAssocDef(String childTypeUri)
- Specified by:
removeAssocDef
in interface Type
getLabelConfig
public List<String> getLabelConfig()
- Specified by:
getLabelConfig
in interface Type
setLabelConfig
public void setLabelConfig(List<String> labelConfig,
Directives directives)
- Specified by:
setLabelConfig
in interface Type
getViewConfig
public ViewConfiguration getViewConfig()
- Specified by:
getViewConfig
in interface Type
getViewConfig
public Object getViewConfig(String typeUri,
String settingUri)
- Specified by:
getViewConfig
in interface Type
getModel
public TypeModel getModel()
- Specified by:
getModel
in interface DeepaMehtaObject
- Specified by:
getModel
in interface Topic
- Specified by:
getModel
in interface Type
- Overrides:
getModel
in class AttachedTopic
putInTypeCache
abstract void putInTypeCache()
removeFromTypeCache
abstract void removeFromTypeCache()
getDeleteTypeDirective
abstract Directive getDeleteTypeDirective()
hasUriChanged
private boolean hasUriChanged(String newUri)
updateDataTypeUri
private void updateDataTypeUri(String newDataTypeUri,
Directives directives)
storeDataTypeUri
private void storeDataTypeUri(String dataTypeUri,
Directives directives)
updateAssocDefs
private void updateAssocDefs(Collection<AssociationDefinitionModel> newAssocDefs,
ClientState clientState,
Directives directives)
updateSequence
private void updateSequence(Collection<AssociationDefinitionModel> newAssocDefs)
hasSequenceChanged
private boolean hasSequenceChanged(Collection<AssociationDefinitionModel> newAssocDefs)
updateLabelConfig
private void updateLabelConfig(List<String> newLabelConfig,
Directives directives)
lastAssocDef
private AssociationDefinitionModel lastAssocDef()
- Returns the last association definition of this type or
null
if there are no association definitions.
### TODO: move to class TypeModel?
initAssocDefs
protected void initAssocDefs()
_addAssocDef
private void _addAssocDef(AssociationDefinitionModel model)
- Parameters:
model
- the new association definition.
Note: all fields must be initialized.
_removeAssocDef
private AttachedAssociationDefinition _removeAssocDef(String childTypeUri)
initViewConfig
private void initViewConfig()
removeFromTypeCache
private void removeFromTypeCache(Directives directives)
- Removes this type from type cache and adds a DELETE TYPE directive to the given set of directives.
addDeleteTypeDirective
private void addDeleteTypeDirective(Directives directives)
Copyright © 2014. All Rights Reserved.