de.deepamehta.core.impl
Class ValueStorage

Show UML class diagram
java.lang.Object
  extended by de.deepamehta.core.impl.ValueStorage

 class ValueStorage
extends Object

Helper for storing/fetching simple values and composite value models.


Field Summary
private  EmbeddedService dms
           
private static String LABEL_CHILD_SEPARATOR
           
private static String LABEL_TOPIC_SEPARATOR
           
private  Logger logger
           
 
Constructor Summary
ValueStorage(EmbeddedService dms)
           
 
Method Summary
private  void appendLabel(String label, StringBuilder builder, String separator)
           
(package private)  void associateChildTopic(DeepaMehtaObjectModel parent, long childTopicId, AssociationDefinition assocDef, ClientState clientState)
           
(package private)  void associateChildTopic(DeepaMehtaObjectModel parent, String childTopicUri, AssociationDefinition assocDef, ClientState clientState)
           
private  void associateChildTopic(DeepaMehtaObjectModel parent, TopicRoleModel child, AssociationDefinition assocDef, ClientState clientState)
           
(package private)  Topic associateReferencedChildTopic(DeepaMehtaObjectModel parent, TopicReferenceModel childTopicRef, AssociationDefinition assocDef, ClientState clientState)
          Creates an association between the given parent object ("Parent" role) and the referenced topic ("Child" role).
private  String buildChildLabel(DeepaMehtaObjectModel parent, String childTypeUri)
           
private  String buildDefaultLabel(DeepaMehtaObjectModel model)
           
private  String buildLabel(DeepaMehtaObjectModel model)
           
private  String buildLabelFromConfig(DeepaMehtaObjectModel model, List<String> labelConfig)
          Builds the specified object model's label according to a label configuration.
private  RelatedTopicModel fetchChildTopic(long parentId, AssociationDefinition assocDef)
          Fetches and returns a child topic or null if no such topic extists.
(package private)  void fetchChildTopics(DeepaMehtaObjectModel parent, AssociationDefinition assocDef)
          Recursively fetches the child topic models of the given parent object model and updates it in-place.
private  ResultList<RelatedTopicModel> fetchChildTopics(long parentId, AssociationDefinition assocDef)
           
(package private)  void fetchCompositeValue(DeepaMehtaObjectModel parent)
          Recursively fetches the composite value (child topic models) of the given parent object model and updates it in-place.
private  SimpleValue getIndexValue(DeepaMehtaObjectModel model)
          Calculates the simple value that is to be indexed for this object.
(package private)  Type getType(DeepaMehtaObjectModel model)
          Convenience method to get the (attached) type of a DeepaMehta object model.
(package private)  void indexSimpleValue(DeepaMehtaObjectModel model, IndexMode indexMode)
          Indexes the simple value of the given object model according to the given index mode.
private  void putInCompositeValue(DeepaMehtaObjectModel parent, Topic childTopic, AssociationDefinition assocDef)
          For single-valued childs
(package private)  void refreshLabel(DeepaMehtaObjectModel model)
          Prerequisite: this is a composite object.
private  void replaceReference(TopicModel topicRef, Topic topic)
          Replaces a topic reference with the resolved topic.
(package private)  void setSimpleValue(DeepaMehtaObjectModel model, SimpleValue value)
           
private  void storeAggregationMany(List<TopicModel> models, DeepaMehtaObjectModel parent, AssociationDefinition assocDef, ClientState clientState, Directives directives)
           
private  void storeAggregationOne(TopicModel model, DeepaMehtaObjectModel parent, AssociationDefinition assocDef, ClientState clientState, Directives directives)
           
private  void storeChildTopics(TopicModel childTopic, List<TopicModel> childTopics, DeepaMehtaObjectModel parent, AssociationDefinition assocDef, ClientState clientState, Directives directives)
           
private  void storeCompositeValue(DeepaMehtaObjectModel parent, ClientState clientState, Directives directives)
          Called to store the initial value of a newly created topic/association.
private  void storeCompositionMany(List<TopicModel> models, DeepaMehtaObjectModel parent, AssociationDefinition assocDef, ClientState clientState, Directives directives)
           
private  void storeCompositionOne(TopicModel model, DeepaMehtaObjectModel parent, AssociationDefinition assocDef, ClientState clientState, Directives directives)
           
private  void storeSimpleValue(DeepaMehtaObjectModel model)
          Stores and indexes the simple value of the specified topic or association model.
(package private)  void storeValue(DeepaMehtaObjectModel model, ClientState clientState, Directives directives)
          Stores and indexes the specified model's value, either a simple value or a composite value (child topics).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LABEL_CHILD_SEPARATOR

private static final String LABEL_CHILD_SEPARATOR
See Also:
Constant Field Values

LABEL_TOPIC_SEPARATOR

private static final String LABEL_TOPIC_SEPARATOR
See Also:
Constant Field Values

dms

private EmbeddedService dms

logger

private Logger logger
Constructor Detail

ValueStorage

ValueStorage(EmbeddedService dms)
Method Detail

fetchCompositeValue

void fetchCompositeValue(DeepaMehtaObjectModel parent)
Recursively fetches the composite value (child topic models) of the given parent object model and updates it in-place.


fetchChildTopics

void fetchChildTopics(DeepaMehtaObjectModel parent,
                      AssociationDefinition assocDef)
Recursively fetches the child topic models of the given parent object model and updates it in-place.

Works for both, "one" and "many" association definitions.

Parameters:
assocDef - The child topic models according to this association definition are fetched.

storeValue

void storeValue(DeepaMehtaObjectModel model,
                ClientState clientState,
                Directives directives)
Stores and indexes the specified model's value, either a simple value or a composite value (child topics). Depending on the model type's data type dispatches either to storeSimpleValue() or to storeCompositeValue().

Called to store the initial value of a newly created topic/association.


indexSimpleValue

void indexSimpleValue(DeepaMehtaObjectModel model,
                      IndexMode indexMode)
Indexes the simple value of the given object model according to the given index mode.

Called to index existing topics/associations once an index mode has been added to a type definition.


refreshLabel

void refreshLabel(DeepaMehtaObjectModel model)
Prerequisite: this is a composite object.


setSimpleValue

void setSimpleValue(DeepaMehtaObjectModel model,
                    SimpleValue value)

associateReferencedChildTopic

Topic associateReferencedChildTopic(DeepaMehtaObjectModel parent,
                                    TopicReferenceModel childTopicRef,
                                    AssociationDefinition assocDef,
                                    ClientState clientState)
Creates an association between the given parent object ("Parent" role) and the referenced topic ("Child" role). The association type is taken from the given association definition.

Returns:
the resolved child topic, including its composite values.

associateChildTopic

void associateChildTopic(DeepaMehtaObjectModel parent,
                         long childTopicId,
                         AssociationDefinition assocDef,
                         ClientState clientState)

associateChildTopic

void associateChildTopic(DeepaMehtaObjectModel parent,
                         String childTopicUri,
                         AssociationDefinition assocDef,
                         ClientState clientState)

getType

Type getType(DeepaMehtaObjectModel model)
Convenience method to get the (attached) type of a DeepaMehta object model. The type is obtained from the core service's type cache.


storeSimpleValue

private void storeSimpleValue(DeepaMehtaObjectModel model)
Stores and indexes the simple value of the specified topic or association model. Determines the index key and index modes.


storeCompositeValue

private void storeCompositeValue(DeepaMehtaObjectModel parent,
                                 ClientState clientState,
                                 Directives directives)
Called to store the initial value of a newly created topic/association. Just prepares the arguments and calls storeChildTopics() repetitively.

Note: the given model can contain childs not defined in the type definition. Only the childs defined in the type definition are stored.


storeChildTopics

private void storeChildTopics(TopicModel childTopic,
                              List<TopicModel> childTopics,
                              DeepaMehtaObjectModel parent,
                              AssociationDefinition assocDef,
                              ClientState clientState,
                              Directives directives)

storeCompositionOne

private void storeCompositionOne(TopicModel model,
                                 DeepaMehtaObjectModel parent,
                                 AssociationDefinition assocDef,
                                 ClientState clientState,
                                 Directives directives)

storeCompositionMany

private void storeCompositionMany(List<TopicModel> models,
                                  DeepaMehtaObjectModel parent,
                                  AssociationDefinition assocDef,
                                  ClientState clientState,
                                  Directives directives)

storeAggregationOne

private void storeAggregationOne(TopicModel model,
                                 DeepaMehtaObjectModel parent,
                                 AssociationDefinition assocDef,
                                 ClientState clientState,
                                 Directives directives)

storeAggregationMany

private void storeAggregationMany(List<TopicModel> models,
                                  DeepaMehtaObjectModel parent,
                                  AssociationDefinition assocDef,
                                  ClientState clientState,
                                  Directives directives)

putInCompositeValue

private void putInCompositeValue(DeepaMehtaObjectModel parent,
                                 Topic childTopic,
                                 AssociationDefinition assocDef)
For single-valued childs


replaceReference

private void replaceReference(TopicModel topicRef,
                              Topic topic)
Replaces a topic reference with the resolved topic. Used for multiple-valued childs.


buildLabel

private String buildLabel(DeepaMehtaObjectModel model)

buildLabelFromConfig

private String buildLabelFromConfig(DeepaMehtaObjectModel model,
                                    List<String> labelConfig)
Builds the specified object model's label according to a label configuration.


buildDefaultLabel

private String buildDefaultLabel(DeepaMehtaObjectModel model)

buildChildLabel

private String buildChildLabel(DeepaMehtaObjectModel parent,
                               String childTypeUri)

appendLabel

private void appendLabel(String label,
                         StringBuilder builder,
                         String separator)

fetchChildTopic

private RelatedTopicModel fetchChildTopic(long parentId,
                                          AssociationDefinition assocDef)
Fetches and returns a child topic or null if no such topic extists.


fetchChildTopics

private ResultList<RelatedTopicModel> fetchChildTopics(long parentId,
                                                       AssociationDefinition assocDef)

associateChildTopic

private void associateChildTopic(DeepaMehtaObjectModel parent,
                                 TopicRoleModel child,
                                 AssociationDefinition assocDef,
                                 ClientState clientState)

getIndexValue

private SimpleValue getIndexValue(DeepaMehtaObjectModel model)
Calculates the simple value that is to be indexed for this object. HTML tags are stripped from HTML values. Non-HTML values are returned directly.



Copyright © 2014. All Rights Reserved.