Skip to content

Commit 78bc6e7

Browse files
connections mechanism rewrite, relationships visualization
1 parent bc79de5 commit 78bc6e7

File tree

8 files changed

+386
-91
lines changed

8 files changed

+386
-91
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# CacheUMLExplorer
1+
# Cache UML Explorer
22
An UML Class explorer for InterSystems Caché.
33

44
##### Key features

cache/projectTemplate.xml

Lines changed: 36 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<Description>
55
Cache UML Explorer vX.X.X/*build.replace:pkg.version*/
66
Class contains methods that return structured classes/packages data.</Description>
7-
<TimeChanged>63706,86042.410811</TimeChanged>
7+
<TimeChanged>63808,84964.699928</TimeChanged>
88
<TimeCreated>63653,67019.989197</TimeCreated>
99

1010
<Method name="getAllNamespacesList">
@@ -78,7 +78,7 @@ Returns structured class tree with all classes available in current namespace</D
7878
]]></Implementation>
7979
</Method>
8080

81-
<Method name="setClassData">
81+
<Method name="fillClassData">
8282
<Description>
8383
Return structured data about class.</Description>
8484
<ClassMethod>1</ClassMethod>
@@ -93,7 +93,8 @@ Return structured data about class.</Description>
9393
do oData.classes.%DispatchSetProperty(classDefinition.Name, oClass) // prevent from recursive setup
9494
set package = $LISTTOSTRING($LIST($LISTFROMSTRING(classDefinition.Name, "."), 1, *-1),".")
9595
set oProperties = ##class(%ZEN.proxyObject).%New()
96-
set oClass.super = classDefinition.Super
96+
97+
set oClass.super = ..correctInheritance(oData, classDefinition, package)
9798
set oClass.NAMESPACE = $NAMESPACE
9899
set oClass.SYSTEM = classDefinition.System
99100
set oClass.PROCEDUREBLOCK = classDefinition.ProcedureBlock
@@ -114,9 +115,17 @@ Return structured data about class.</Description>
114115
do oProperties.%DispatchSetProperty(p.Name, oProp)
115116
set oProp.private = p.Private
116117
set oProp.readOnly = p.ReadOnly
117-
set oProp.type = p.Type
118-
do ..collectAggregation(oData, classDefinition, p.Type, p.Private)
119-
do ..collectAggregation(oData, classDefinition, package _ "." _ p.Type, p.Private)
118+
set oProp.cardinality = p.Cardinality
119+
set oProp.inverse = p.Inverse
120+
if (..classExists(package _ "." _ p.Type)) {
121+
set oProp.type = package _ "." _ p.Type
122+
do ..fillClassData(oData, package _ "." _ p.Type)
123+
} elseif (..classExists(..extendClassFromType(p.Type))) {
124+
set oProp.type = ..extendClassFromType(p.Type)
125+
do ..fillClassData(oData, ..extendClassFromType(p.Type))
126+
} else {
127+
set oProp.type = p.Type
128+
}
120129
}
121130
122131
set oMethods = ##class(%ZEN.proxyObject).%New()
@@ -151,7 +160,7 @@ Return structured data about class.</Description>
151160
do oParameters.%DispatchSetProperty(p.Name, oPar)
152161
}
153162
154-
do ..collectInheritance(oData, classDefinition, package)
163+
do ..collectInheritance(oData, oClass.super)
155164
156165
quit oClass
157166
]]></Implementation>
@@ -201,67 +210,56 @@ Wrap registered types to class names</Description>
201210
<Private>1</Private>
202211
<ReturnType>%String</ReturnType>
203212
<Implementation><![CDATA[
204-
return typeName
205-
/*$CASE(typeName,
213+
return $CASE(typeName,
214+
"%Boolean": "%Library.Boolean",
206215
"%String": "%Library.String",
207216
"%Integer": "%Library.Integer",
208217
"%DataType": "%Library.DataType",
209218
"%Status": "%Library.Status",
210219
"%CacheString": "%Library.CacheString",
211220
"%Persistent": "%Library.Persistent",
212-
:typeName)*/
221+
:typeName)
213222
]]></Implementation>
214223
</Method>
215224

216-
<Method name="collectInheritance">
225+
<Method name="correctInheritance">
217226
<Description>
218-
Fill inheritance data</Description>
227+
Return extended inheritance names</Description>
219228
<ClassMethod>1</ClassMethod>
220229
<FormalSpec>oData:%ZEN.proxyObject,baseClassDefinition:%Dictionary.ClassDefinition,basePack:%String</FormalSpec>
221230
<Private>1</Private>
222-
<ReturnType>%Status</ReturnType>
231+
<ReturnType>%String</ReturnType>
223232
<Implementation><![CDATA[
224233
set superParts = $LISTFROMSTRING(baseClassDefinition.Super, ",")
225-
set oInherit = ##class(%ZEN.proxyObject).%New()
226-
do oData.inheritance.%DispatchSetProperty(baseClassDefinition.Name, oInherit)
227234
for i=1:1:$LISTLENGTH(superParts) {
228-
set className = ..extendClassFromType($LISTGET(superParts, i))
235+
set className = $LISTGET(superParts, i)
229236
230237
// try to find class with base package, if not successfull - try to add class as it is
231238
if (..classExists(basePack_"."_className)) {
232239
set clsName = basePack_"."_className
233240
} else {
234-
set clsName = className
241+
set clsName = ..extendClassFromType(className)
235242
}
236243
237-
do oInherit.%DispatchSetProperty(clsName, 1)
238-
do ..setClassData(oData, clsName)
244+
set $LIST(superParts, i) = clsName
239245
}
240-
quit $$$OK
246+
quit $LISTTOSTRING(superParts)
241247
]]></Implementation>
242248
</Method>
243249

244-
<Method name="collectAggregation">
250+
<Method name="collectInheritance">
245251
<Description>
246-
Fill aggregation/composition data</Description>
252+
Fill inheritance data
253+
Returns new (correct) super</Description>
247254
<ClassMethod>1</ClassMethod>
248-
<FormalSpec>oData:%ZEN.proxyObject,classDef:%Dictionary.ClassDefinition,aggClassName:%String,private:%String</FormalSpec>
255+
<FormalSpec>oData:%ZEN.proxyObject,super:%String</FormalSpec>
249256
<Private>1</Private>
250257
<ReturnType>%Status</ReturnType>
251258
<Implementation><![CDATA[
252-
set aggClassDef = ##class(%Dictionary.ClassDefinition).%OpenId(aggClassName)
253-
if (aggClassDef '= "") {
254-
if (private) { set t = "composition" } else { set t = "aggregation" }
255-
set oAgg = oData.%DispatchGetProperty(t).%DispatchGetProperty(classDef.Name)
256-
if (oAgg = "") {
257-
set oAgg = ##class(%ZEN.proxyObject).%New()
258-
do oData.%DispatchGetProperty(t).%DispatchSetProperty(classDef.Name, oAgg)
259-
}
260-
} else { quit $$$OK }
261-
262-
do oAgg.%DispatchSetProperty(aggClassName, "1..1")
263-
do ..setClassData(oData, aggClassName)
264-
259+
set superParts = $LISTFROMSTRING(super, ",")
260+
for i=1:1:$LISTLENGTH(superParts) {
261+
do ..fillClassData(oData, $LISTGET(superParts, i))
262+
}
265263
quit $$$OK
266264
]]></Implementation>
267265
</Method>
@@ -278,9 +276,6 @@ Setup basic output data object</Description>
278276
set oData.basePackageName = packageName
279277
set oData.restrictPackage = 1 // expand classes only in base package
280278
set oData.classes = ##class(%ZEN.proxyObject).%New()
281-
set oData.inheritance = ##class(%ZEN.proxyObject).%New()
282-
set oData.aggregation = ##class(%ZEN.proxyObject).%New()
283-
set oData.composition = ##class(%ZEN.proxyObject).%New()
284279
quit oData
285280
]]></Implementation>
286281
</Method>
@@ -305,7 +300,7 @@ Returns structured class data</Description>
305300
zn:$GET(namespace)'="" namespace
306301
set package = $LISTTOSTRING($LIST($LISTFROMSTRING(className, "."), 1, *-1), ".")
307302
set oData = ..getBaseOData(package)
308-
do ..setClassData(oData, className)
303+
do ..fillClassData(oData, className)
309304
quit oData
310305
]]></Implementation>
311306
</Method>
@@ -327,7 +322,7 @@ Returns structured package data</Description>
327322
set className = classes.Data("Name")
328323
set packageName = $LISTTOSTRING($LIST($LISTFROMSTRING(className, "."), 1, listLen), ".")
329324
if (packageName = rootPackageName) {
330-
do ..setClassData(oData, className)
325+
do ..fillClassData(oData, className)
331326
}
332327
}
333328

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "CacheUMLExplorer",
3-
"version": "0.15.0",
3+
"version": "1.0.0",
44
"description": "An UML Class explorer for InterSystems Caché",
55
"directories": {
66
"test": "test"

web/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
<script type="text/javascript" src="jsLib/joint.js"></script>
1818
<script type="text/javascript" src="jsLib/joint.shapes.uml.js"></script>
1919
<script type="text/javascript" src="jsLib/joint.layout.DirectedGraph.min.js"></script>
20+
<script type="text/javascript" src="js/Logic.js"></script>
2021
<script type="text/javascript" src="jsLib/ImageExporter.js"></script>
2122
<script type="text/javascript" src="js/ClassView.js"></script>
2223
<script type="text/javascript" src="js/Lib.js"></script>

0 commit comments

Comments
 (0)