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
Methods inherited from class de.deepamehta.core.impl.AttachedTopic |
_update, className, fetchRelatedTopic, fetchRelatedTopics, getAssociation, getAssociations, getRelatedAssociation, getRelatedAssociations, getRelatedTopics, getType, getUpdateDirective, loadChildTopics, loadChildTopics, removeProperty, setProperty, storeTypeUri, storeUri, update, updateChildTopics |
Methods inherited from class de.deepamehta.core.impl.AttachedDeepaMehtaObject |
equals, getChildTopics, getDatabaseVendorObject, getId, getProperty, getRelatedTopic, getRelatedTopics, getRelatedTopics, getSimpleValue, getTypeUri, getUri, hashCode, hasProperty, setChildTopics, setSimpleValue, setSimpleValue, setSimpleValue, setSimpleValue, setSimpleValue, setTypeUri, setUri, toJSON, toString, update, updateChildTopic, updateChildTopics |
Methods inherited from interface de.deepamehta.core.DeepaMehtaObject |
getAssociation, getAssociations, getChildTopics, getDatabaseVendorObject, getId, getProperty, getRelatedAssociation, getRelatedAssociations, getRelatedTopic, getRelatedTopics, getRelatedTopics, getRelatedTopics, getSimpleValue, getTypeUri, getUri, hasProperty, removeProperty, setChildTopics, setProperty, setSimpleValue, setSimpleValue, setSimpleValue, setSimpleValue, setSimpleValue, setTypeUri, setUri, update, updateChildTopic, updateChildTopics |
assocDefs
private SequencedHashMap<String,AssociationDefinition> assocDefs
viewConfig
private ViewConfiguration viewConfig
logger
private Logger logger
AttachedType
AttachedType(TypeModel model,
EmbeddedService dms)
update
public void update(TypeModel model)
- Specified by:
update
in interface Type
delete
public void delete()
- Description copied from class:
AttachedDeepaMehtaObject
- Deletes 1) this DeepaMehta object's child topics (recursively) which have an underlying association definition of
type "Composition Definition" and 2) 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)
- Specified by:
setDataTypeUri
in interface Type
getIndexModes
public List<IndexMode> getIndexModes()
- Specified by:
getIndexModes
in interface Type
addIndexMode
public void addIndexMode(IndexMode indexMode)
- Specified by:
addIndexMode
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 Type addAssocDef(AssociationDefinitionModel assocDef)
- Specified by:
addAssocDef
in interface Type
addAssocDefBefore
public Type addAssocDefBefore(AssociationDefinitionModel assocDef,
String beforeChildTypeUri)
- Specified by:
addAssocDefBefore
in interface Type
beforeChildTypeUri
- the assoc def before the assoc def is inserted into the sequence.
If null
the assoc def is appended at the end.
updateAssocDef
public void updateAssocDef(AssociationDefinitionModel assocDef)
- 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)
.
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)
and suppress further
processing by returning false.
- Specified by:
updateAssocDef
in interface Type
- Parameters:
assocDef
- 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 Type 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)
- 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()
getAllInstances
abstract List<? extends DeepaMehtaObject> getAllInstances()
removeAssocDefFromMemoryAndRebuildSequence
void removeAssocDefFromMemoryAndRebuildSequence(String childTypeUri)
hasUriChanged
private boolean hasUriChanged(String newUri)
updateDataTypeUri
private void updateDataTypeUri(String newDataTypeUri)
storeDataTypeUri
private void storeDataTypeUri(String dataTypeUri)
indexAllInstances
private void indexAllInstances(IndexMode indexMode)
updateAssocDefs
private void updateAssocDefs(Collection<AssociationDefinitionModel> newAssocDefs)
updateSequence
private void updateSequence(Collection<AssociationDefinitionModel> newAssocDefs)
hasSequenceChanged
private boolean hasSequenceChanged(Collection<AssociationDefinitionModel> newAssocDefs)
updateLabelConfig
private void updateLabelConfig(List<String> newLabelConfig)
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?
firstAssocDef
private AssociationDefinitionModel firstAssocDef()
initAssocDefs
protected void initAssocDefs()
_addAssocDef
private void _addAssocDef(AssociationDefinitionModel model)
_addAssocDefBefore
private void _addAssocDefBefore(AssociationDefinitionModel model,
String beforeChildTypeUri)
- Parameters:
beforeChildTypeUri
- the assoc def before the assoc def is inserted into the sequence.
If null
the assoc def is appended at the end.
_removeAssocDef
private void _removeAssocDef(String childTypeUri)
initViewConfig
private void initViewConfig()
_removeFromTypeCache
private void _removeFromTypeCache()
- Removes this type from type cache and adds a DELETE TYPE directive to the given set of directives.
addDeleteTypeDirective
private void addDeleteTypeDirective()
Copyright © 2015. All Rights Reserved.