|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectpl.edu.agh.cast.model.visual.VisualModelCachingFactory
public class VisualModelCachingFactory
Class responsible for creating visual model elements from base model elements. This class implements a caching mechanism that creates new nodes, connections and connection groups only if they don't exist yet.
Field Summary | |
---|---|
protected ConnectionGroupAttributeManager |
_connectionGroupPropertyManager
|
protected java.util.Map<Connection,ConnectionGroup> |
_connectionToConnectionGroup
|
protected java.util.Map<Connection,pl.edu.agh.cast.model.base.IRelation> |
_connectionToRelation
|
protected java.util.Map<java.lang.String,Node> |
_entityToNode
Maps IEntity.getId() to Node |
protected NodeAttributeManager |
_nodeAttributeManager
|
protected java.util.Map<pl.edu.agh.cast.model.base.IRelation,Connection> |
_relationToConnection
|
Constructor Summary | |
---|---|
VisualModelCachingFactory()
No argument constructor (for deserialization purpose) |
|
VisualModelCachingFactory(NodeAttributeManager nodePropMgr,
ConnectionGroupAttributeManager connectionGroupPropMgr)
|
Method Summary | |
---|---|
boolean |
containsNode(java.lang.String nodeId)
Returns true if factory has created a node with specific id. |
protected void |
copyAttributes(pl.edu.agh.cast.model.mapper.Mappable mappable,
ModelElement element)
Copies entity's attributes to a node |
Connection |
copyConnection(Connection conn)
|
ConnectionGroup |
copyConnectionGroup(ConnectionGroup cg,
Connection conn)
|
Node |
copyNode(Node node)
|
Connection |
createConnection(pl.edu.agh.cast.model.base.IRelation relation)
Returns a connection corresponding to the given relation, creating it if necessary. |
Connection |
createConnection(pl.edu.agh.cast.model.base.IRelation relation,
java.util.Set<java.lang.String> currentDS)
Returns a connection corresponding to the given relation, creating it if necessary. |
ConnectionGroup |
createConnectionGroup(Connection connection)
|
Node |
createNode(pl.edu.agh.cast.model.base.IEntity entity)
Returns a node corresponding to the given entity, creating if it necessary. |
Node |
createNode(pl.edu.agh.cast.model.base.IEntity entity,
java.util.Set<java.lang.String> currentDS)
Returns a node corresponding to the given entity, creating if it necessary. |
Connection |
findConnection(java.lang.String sourceNodeId,
java.lang.String targetNodeId,
java.util.Date date)
|
Node |
findNode(java.lang.String nodeId)
|
pl.edu.agh.cast.model.base.IRelation |
findRelation(Connection conn)
Find relation which was used to create given connection |
protected ConnectionGroup |
getConnectionGroup(Node source,
Node target)
Find ConnectionGroup for given nodes. |
java.util.Collection<Connection> |
getConnections()
|
int |
getNodeCount()
|
java.util.Collection<Node> |
getNodes()
|
protected java.util.Collection<pl.edu.agh.cast.model.base.IRelation> |
getRelations()
Returns all relations kept in the local (diagram) model |
void |
initAfterDeserialization(java.util.Set<Connection> connections)
Initializes all fields after custom de-serialization |
void |
removeConnection(Connection c)
|
void |
removeNode(Node node)
|
protected void |
setupConnectionGroups()
TODO This is temporary fix to get back connections after deserialization. |
boolean |
wasCreatedHere(Connection connection)
|
boolean |
wasCreatedHere(ConnectionGroup cg)
|
boolean |
wasCreatedHere(Node node)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.util.Map<java.lang.String,Node> _entityToNode
IEntity.getId()
to Node
protected java.util.Map<pl.edu.agh.cast.model.base.IRelation,Connection> _relationToConnection
protected java.util.Map<Connection,pl.edu.agh.cast.model.base.IRelation> _connectionToRelation
protected java.util.Map<Connection,ConnectionGroup> _connectionToConnectionGroup
protected NodeAttributeManager _nodeAttributeManager
protected ConnectionGroupAttributeManager _connectionGroupPropertyManager
Constructor Detail |
---|
public VisualModelCachingFactory(NodeAttributeManager nodePropMgr, ConnectionGroupAttributeManager connectionGroupPropMgr)
public VisualModelCachingFactory()
Method Detail |
---|
public Node createNode(pl.edu.agh.cast.model.base.IEntity entity)
entity
-
public Node createNode(pl.edu.agh.cast.model.base.IEntity entity, java.util.Set<java.lang.String> currentDS)
currentDS
collection holds the IDs of already processed
nodes from current IDataSet
. This is to prevent multiple
processing of same node's attributes. If the parameter is
null
then such processing is performed each time.
entity
- currentDS
-
public Connection createConnection(pl.edu.agh.cast.model.base.IRelation relation)
relation
- input relation
public Connection createConnection(pl.edu.agh.cast.model.base.IRelation relation, java.util.Set<java.lang.String> currentDS)
relation
- input relationcurrentDS
- see createNode(IEntity, Set)
for parameter details
public ConnectionGroup createConnectionGroup(Connection connection)
protected ConnectionGroup getConnectionGroup(Node source, Node target)
source
- target
-
protected void copyAttributes(pl.edu.agh.cast.model.mapper.Mappable mappable, ModelElement element)
mappable
- attributes sourceelement
- attributes destinationpublic int getNodeCount()
public java.util.Collection<Node> getNodes()
public java.util.Collection<Connection> getConnections()
public boolean wasCreatedHere(Node node)
public boolean wasCreatedHere(Connection connection)
public boolean wasCreatedHere(ConnectionGroup cg)
public void removeNode(Node node)
public void removeConnection(Connection c)
public boolean containsNode(java.lang.String nodeId)
nodeId
- node id
public Node copyNode(Node node)
public Connection copyConnection(Connection conn)
public ConnectionGroup copyConnectionGroup(ConnectionGroup cg, Connection conn)
public Node findNode(java.lang.String nodeId)
public Connection findConnection(java.lang.String sourceNodeId, java.lang.String targetNodeId, java.util.Date date)
public pl.edu.agh.cast.model.base.IRelation findRelation(Connection conn)
conn
- The connection for which the relation is searched
public void initAfterDeserialization(java.util.Set<Connection> connections)
connections
- protected java.util.Collection<pl.edu.agh.cast.model.base.IRelation> getRelations()
protected void setupConnectionGroups()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |