de.deepamehta.core.impl
Class AttachedChildTopics

Show UML class diagram
java.lang.Object
  extended by de.deepamehta.core.impl.AttachedChildTopics
All Implemented Interfaces:
ChildTopics

 class AttachedChildTopics
extends Object
implements ChildTopics

A composite value model that is attached to the DB.


Field Summary
private  Map<String,Object> childTopics
          Attached object cache.
private  EmbeddedService dms
           
private  Logger logger
           
private  ChildTopicsModel model
           
private  AttachedDeepaMehtaObject parent
           
 
Constructor Summary
AttachedChildTopics(ChildTopicsModel model, AttachedDeepaMehtaObject parent, EmbeddedService dms)
           
 
Method Summary
private  Topic _getTopic(String childTypeUri)
           
private  AttachedTopic _getTopic(String childTypeUri, AttachedTopic defaultTopic)
           
private  List<Topic> _getTopics(String childTypeUri)
           
private  List<Topic> _getTopics(String childTypeUri, List<Topic> defaultValue)
           
private  ChildTopics _update(String childTypeUri, TopicModel newChildTopic)
           
private  void add(String childTypeUri, Topic topic)
          Adds a value to a multiple-valued child.
private  void addToChildTopics(Topic childTopic, AssociationDefinition assocDef)
          For multiple-valued childs
 Iterable<String> childTypeUris()
           
private  Topic createAttachedObject(TopicModel model)
          Creates an attached topic to be put in this attached object cache.
private  void createChildTopicMany(TopicModel newChildTopic, AssociationDefinition assocDef)
           
private  void createChildTopicOne(TopicModel newChildTopic, AssociationDefinition assocDef)
           
private  AttachedRelatedTopic findChildTopic(long childTopicId, AssociationDefinition assocDef)
           
 Object get(String childTypeUri)
           
private  AssociationDefinition getAssocDef(String childTypeUri)
           
 boolean getBoolean(String childTypeUri)
          Convenience accessor for the *simple* value of a single-valued child.
 ChildTopics getChildTopics(String childTypeUri)
          Convenience accessor for the *composite* value of a single-valued child.
 double getDouble(String childTypeUri)
          Convenience accessor for the *simple* value of a single-valued child.
 int getInt(String childTypeUri)
          Convenience accessor for the *simple* value of a single-valued child.
 long getLong(String childTypeUri)
          Convenience accessor for the *simple* value of a single-valued child.
 ChildTopicsModel getModel()
           
 Object getObject(String childTypeUri)
          Convenience accessor for the *simple* value of a single-valued child.
 String getString(String childTypeUri)
          Convenience accessor for the *simple* value of a single-valued child.
 Topic getTopic(String childTypeUri)
          Accesses a single-valued child.
 List<Topic> getTopics(String childTypeUri)
          Accesses a multiple-valued child.
 boolean has(String childTypeUri)
           
private  void initAttachedObjectCache()
          Initializes this attached object cache.
private  void initAttachedObjectCache(String childTypeUri)
          Initializes this attached object cache selectively (and recursively).
private  boolean isReferingToAny(TopicReferenceModel topicRef, AssociationDefinition assocDef)
          Checks weather the given topic reference refers to any of the child topics.
(package private)  void loadChildTopics()
           
private  void loadChildTopics(AssociationDefinition assocDef)
          Recursively loads child topics (model) and updates this attached object cache accordingly.
(package private)  void loadChildTopics(String childTypeUri)
           
private  void put(String childTypeUri, Topic topic)
          Puts a single-valued child.
private  void putInChildTopics(Topic childTopic, AssociationDefinition assocDef)
          For single-valued childs
 ChildTopics remove(String childTypeUri, long topicId)
           
private  void remove(String childTypeUri, Topic topic)
          Removes a value from a multiple-valued child.
private  void removeFromChildTopics(Topic childTopic, AssociationDefinition assocDef)
          For multiple-valued childs
 ChildTopics set(String childTypeUri, ChildTopicsModel value)
          Convenience method to set the composite value of a child.
 ChildTopics set(String childTypeUri, Object value)
          Convenience method to set the simple value of a child.
 ChildTopics set(String childTypeUri, TopicModel value)
          Sets a child.
 ChildTopics setRef(String childTypeUri, long refTopicId)
           
 ChildTopics setRef(String childTypeUri, String refTopicUri)
           
 int size()
           
(package private)  void update(ChildTopicsModel newComp)
           
private  void updateAggregationMany(List<TopicModel> newChildTopics, AssociationDefinition assocDef)
           
private  void updateAggregationOne(TopicModel newChildTopic, AssociationDefinition assocDef)
           
private  void updateChildTopicMany(TopicModel newChildTopic, AssociationDefinition assocDef)
           
private  void updateChildTopicOne(TopicModel newChildTopic, AssociationDefinition assocDef)
           
(package private)  void updateChildTopics(TopicModel newChildTopic, List<TopicModel> newChildTopics, AssociationDefinition assocDef)
           
private  void updateCompositionMany(List<TopicModel> newChildTopics, AssociationDefinition assocDef)
           
private  void updateCompositionOne(TopicModel newChildTopic, AssociationDefinition assocDef)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

model

private ChildTopicsModel model

parent

private AttachedDeepaMehtaObject parent

childTopics

private Map<String,Object> childTopics
Attached object cache. Key: child type URI (String), value: AttachedTopic or List


dms

private EmbeddedService dms

logger

private Logger logger
Constructor Detail

AttachedChildTopics

AttachedChildTopics(ChildTopicsModel model,
                    AttachedDeepaMehtaObject parent,
                    EmbeddedService dms)
Method Detail

getTopic

public Topic getTopic(String childTypeUri)
Description copied from interface: ChildTopics
Accesses a single-valued child. Throws if there is no such child.

Specified by:
getTopic in interface ChildTopics

getTopics

public List<Topic> getTopics(String childTypeUri)
Description copied from interface: ChildTopics
Accesses a multiple-valued child. Throws if there is no such child.

Specified by:
getTopics in interface ChildTopics

get

public Object get(String childTypeUri)
Specified by:
get in interface ChildTopics

has

public boolean has(String childTypeUri)
Specified by:
has in interface ChildTopics

childTypeUris

public Iterable<String> childTypeUris()
Specified by:
childTypeUris in interface ChildTopics

size

public int size()
Specified by:
size in interface ChildTopics

getModel

public ChildTopicsModel getModel()
Specified by:
getModel in interface ChildTopics

getString

public String getString(String childTypeUri)
Description copied from interface: ChildTopics
Convenience accessor for the *simple* value of a single-valued child. Throws if the child doesn't exist.

Specified by:
getString in interface ChildTopics

getInt

public int getInt(String childTypeUri)
Description copied from interface: ChildTopics
Convenience accessor for the *simple* value of a single-valued child. Throws if the child doesn't exist.

Specified by:
getInt in interface ChildTopics

getLong

public long getLong(String childTypeUri)
Description copied from interface: ChildTopics
Convenience accessor for the *simple* value of a single-valued child. Throws if the child doesn't exist.

Specified by:
getLong in interface ChildTopics

getDouble

public double getDouble(String childTypeUri)
Description copied from interface: ChildTopics
Convenience accessor for the *simple* value of a single-valued child. Throws if the child doesn't exist.

Specified by:
getDouble in interface ChildTopics

getBoolean

public boolean getBoolean(String childTypeUri)
Description copied from interface: ChildTopics
Convenience accessor for the *simple* value of a single-valued child. Throws if the child doesn't exist.

Specified by:
getBoolean in interface ChildTopics

getObject

public Object getObject(String childTypeUri)
Description copied from interface: ChildTopics
Convenience accessor for the *simple* value of a single-valued child. Throws if the child doesn't exist.

Specified by:
getObject in interface ChildTopics

getChildTopics

public ChildTopics getChildTopics(String childTypeUri)
Description copied from interface: ChildTopics
Convenience accessor for the *composite* value of a single-valued child. Throws if the child doesn't exist.

Specified by:
getChildTopics in interface ChildTopics

set

public ChildTopics set(String childTypeUri,
                       TopicModel value)
Description copied from interface: ChildTopics
Sets a child. Works for both, single-valued child and multiple-valued child (cardinality "many").

Specified by:
set in interface ChildTopics

set

public ChildTopics set(String childTypeUri,
                       Object value)
Description copied from interface: ChildTopics
Convenience method to set the simple value of a child. Works for both, single-valued child and multiple-valued child (cardinality "many").

Specified by:
set in interface ChildTopics
value - The simple value. Either String, Integer, Long, Double, or Boolean. Primitive values are auto-boxed.

set

public ChildTopics set(String childTypeUri,
                       ChildTopicsModel value)
Description copied from interface: ChildTopics
Convenience method to set the composite value of a child. Works for both, single-valued child and multiple-valued child (cardinality "many").

Specified by:
set in interface ChildTopics

setRef

public ChildTopics setRef(String childTypeUri,
                          long refTopicId)
Specified by:
setRef in interface ChildTopics

setRef

public ChildTopics setRef(String childTypeUri,
                          String refTopicUri)
Specified by:
setRef in interface ChildTopics

remove

public ChildTopics remove(String childTypeUri,
                          long topicId)
Specified by:
remove in interface ChildTopics

update

void update(ChildTopicsModel newComp)

updateChildTopics

void updateChildTopics(TopicModel newChildTopic,
                       List<TopicModel> newChildTopics,
                       AssociationDefinition assocDef)

loadChildTopics

void loadChildTopics()

loadChildTopics

void loadChildTopics(String childTypeUri)

loadChildTopics

private void loadChildTopics(AssociationDefinition assocDef)
Recursively loads child topics (model) and updates this attached object cache accordingly. If the child topics are loaded already nothing is performed.

Parameters:
assocDef - the child topics according to this association definition are loaded.

Note: the association definition must not necessarily originate from this object's type definition. It may originate from a facet definition as well.


_getTopic

private Topic _getTopic(String childTypeUri)

_getTopic

private AttachedTopic _getTopic(String childTypeUri,
                                AttachedTopic defaultTopic)

_getTopics

private List<Topic> _getTopics(String childTypeUri)

_getTopics

private List<Topic> _getTopics(String childTypeUri,
                               List<Topic> defaultValue)

_update

private ChildTopics _update(String childTypeUri,
                            TopicModel newChildTopic)

updateCompositionOne

private void updateCompositionOne(TopicModel newChildTopic,
                                  AssociationDefinition assocDef)

updateCompositionMany

private void updateCompositionMany(List<TopicModel> newChildTopics,
                                   AssociationDefinition assocDef)

updateAggregationOne

private void updateAggregationOne(TopicModel newChildTopic,
                                  AssociationDefinition assocDef)

updateAggregationMany

private void updateAggregationMany(List<TopicModel> newChildTopics,
                                   AssociationDefinition assocDef)

updateChildTopicOne

private void updateChildTopicOne(TopicModel newChildTopic,
                                 AssociationDefinition assocDef)

updateChildTopicMany

private void updateChildTopicMany(TopicModel newChildTopic,
                                  AssociationDefinition assocDef)

createChildTopicOne

private void createChildTopicOne(TopicModel newChildTopic,
                                 AssociationDefinition assocDef)

createChildTopicMany

private void createChildTopicMany(TopicModel newChildTopic,
                                  AssociationDefinition assocDef)

initAttachedObjectCache

private void initAttachedObjectCache()
Initializes this attached object cache. For all childs contained in the underlying model attached topics are created and put in the attached object cache (recursively).


initAttachedObjectCache

private void initAttachedObjectCache(String childTypeUri)
Initializes this attached object cache selectively (and recursively).


createAttachedObject

private Topic createAttachedObject(TopicModel model)
Creates an attached topic to be put in this attached object cache.


putInChildTopics

private void putInChildTopics(Topic childTopic,
                              AssociationDefinition assocDef)
For single-valued childs


addToChildTopics

private void addToChildTopics(Topic childTopic,
                              AssociationDefinition assocDef)
For multiple-valued childs


removeFromChildTopics

private void removeFromChildTopics(Topic childTopic,
                                   AssociationDefinition assocDef)
For multiple-valued childs


put

private void put(String childTypeUri,
                 Topic topic)
Puts a single-valued child. An existing value is overwritten.


add

private void add(String childTypeUri,
                 Topic topic)
Adds a value to a multiple-valued child.


remove

private void remove(String childTypeUri,
                    Topic topic)
Removes a value from a multiple-valued child.


findChildTopic

private AttachedRelatedTopic findChildTopic(long childTopicId,
                                            AssociationDefinition assocDef)

isReferingToAny

private boolean isReferingToAny(TopicReferenceModel topicRef,
                                AssociationDefinition assocDef)
Checks weather the given topic reference refers to any of the child topics.

Parameters:
assocDef - the child topics according to this association definition are considered.

getAssocDef

private AssociationDefinition getAssocDef(String childTypeUri)


Copyright © 2014. All Rights Reserved.