Skip to content

Commit 3db6439

Browse files
namespace change feature, different fixes
1 parent 033b148 commit 3db6439

File tree

10 files changed

+269
-111
lines changed

10 files changed

+269
-111
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ An UML Class explorer for InterSystems Caché.
1111

1212
## Screenshots
1313

14-
![Demo](https://cloud.githubusercontent.com/assets/4989256/7642972/f2c3e33c-fa9d-11e4-90b4-d35c809c9e60.png)
14+
![Demo](https://cloud.githubusercontent.com/assets/4989256/7799624/f0255216-0310-11e5-8783-06300fc6d957.png)
1515

1616
## Installation
1717

18-
To install latests Caché UML Explorer, you just need to import UMLExplorer package. Download the
18+
To install latest Caché UML Explorer, you just need to import UMLExplorer package. Download the
1919
archive from [latest releases](https://github.com/ZitRos/CacheUMLExplorer/releases), and then import
2020
<code>Cache/CacheUMLExplorer-vX.X.X.xml</code> file.
2121

cache/projectTemplate.xml

Lines changed: 117 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,38 @@
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>63690,48954.853237</TimeChanged>
7+
<TimeChanged>63697,66596.619226</TimeChanged>
88
<TimeCreated>63653,67019.989197</TimeCreated>
99

10+
<Method name="getAllNamespacesList">
11+
<Description>
12+
Return list with all namespaces</Description>
13+
<ClassMethod>1</ClassMethod>
14+
<ReturnType>%ZEN.proxyObject</ReturnType>
15+
<Implementation><![CDATA[
16+
set resp = ##class(%ZEN.proxyObject).%New()
17+
set resp.namespaces = ##class(%ZEN.proxyObject).%New()
18+
set resp.currentNamespace = $NAMESPACE
19+
set result = ##class(%ResultSet).%New("%SYS.Namespace:List")
20+
do result.Execute()
21+
while (result.Next()) {
22+
set ns = ##class(%ZEN.proxyObject).%New()
23+
set ns.remote = result.Get("Remote")
24+
set ns.status = result.Get("Status")
25+
do resp.namespaces.%DispatchSetProperty(result.Get("Nsp"), ns)
26+
}
27+
return resp
28+
]]></Implementation>
29+
</Method>
30+
1031
<Method name="getClassTree">
1132
<Description>
1233
Returns structured class tree with all classes available in current namespace</Description>
1334
<ClassMethod>1</ClassMethod>
35+
<FormalSpec>namespace:%String</FormalSpec>
1436
<ReturnType>%ZEN.proxyObject</ReturnType>
1537
<Implementation><![CDATA[
38+
zn:$GET(namespace)'="" namespace
1639
set resp = ##class(%ZEN.proxyObject).%New()
1740
1841
set classes = ##class(%ResultSet).%New("%Dictionary.ClassDefinition:Summary")
@@ -22,16 +45,23 @@ Returns structured class tree with all classes available in current namespace</D
2245
set level = 1
2346
do objects.SetAt(resp, level)
2447
48+
2549
do classes.Execute()
2650
while (classes.Next()) {
2751
set name = classes.Data("Name")
52+
if ($EXTRACT(name, 1, 1) = "%") && ($NAMESPACE '= "%SYS") { continue }
2853
set parts = $LISTFROMSTRING(name, ".")
2954
set i = 0
3055
while (i < $LISTLENGTH(parts)) && ($LISTGET(lastParts, i + 1) = $LISTGET(parts, i + 1)) {
3156
set i = i + 1
3257
}
3358
set level = i + 1
3459
set resp = objects.GetAt(level)
60+
if (resp="") {
61+
set resp = ##class(%ZEN.proxyObject).%New()
62+
do objects.GetAt(level - 1).%DispatchSetProperty($LISTGET(parts, level - 1), resp)
63+
do objects.SetAt(resp, level)
64+
}
3565
while ($LISTLENGTH(parts) > level) {
3666
set level = level + 1
3767
set resp = ##class(%ZEN.proxyObject).%New()
@@ -130,9 +160,10 @@ Return structured data about class.</Description>
130160
<Description>
131161
Return method data.</Description>
132162
<ClassMethod>1</ClassMethod>
133-
<FormalSpec>className:%String,methodName:%String</FormalSpec>
163+
<FormalSpec>className:%String,methodName:%String,namespace:%String</FormalSpec>
134164
<ReturnType>%ZEN.proxyObject</ReturnType>
135165
<Implementation><![CDATA[
166+
zn:$GET(namespace)'="" namespace
136167
set oMeth = ##class(%ZEN.proxyObject).%New()
137168
set met = ##class(%Dictionary.MethodDefinition).%OpenId(className _ "||" _ methodName)
138169
if (met = "") { set oMeth.error = 1 quit oMeth }
@@ -267,9 +298,10 @@ Returns if class with given name exists.</Description>
267298
<Description>
268299
Returns structured class data</Description>
269300
<ClassMethod>1</ClassMethod>
270-
<FormalSpec>className:%String</FormalSpec>
301+
<FormalSpec>className:%String,namespace:%String</FormalSpec>
271302
<ReturnType>%ZEN.proxyObject</ReturnType>
272303
<Implementation><![CDATA[
304+
zn:$GET(namespace)'="" namespace
273305
set package = $LISTTOSTRING($LIST($LISTFROMSTRING(className, "."), 1, *-1), ".")
274306
set oData = ..getBaseOData(package)
275307
do ..setClassData(oData, className)
@@ -281,9 +313,10 @@ Returns structured class data</Description>
281313
<Description>
282314
Returns structured package data</Description>
283315
<ClassMethod>1</ClassMethod>
284-
<FormalSpec>rootPackageName:%String</FormalSpec>
316+
<FormalSpec>rootPackageName:%String,namespace:%String</FormalSpec>
285317
<ReturnType>%ZEN.proxyObject</ReturnType>
286318
<Implementation><![CDATA[
319+
zn:$GET(namespace)'="" namespace
287320
set oData = ..getBaseOData(rootPackageName)
288321
set classes = ##class(%ResultSet).%New("%Dictionary.ClassDefinition:Summary")
289322
do classes.Execute()
@@ -303,69 +336,7 @@ Returns structured package data</Description>
303336
</Class>
304337

305338

306-
<Class name="UMLExplorer.WebAppInstaller">
307-
<Super>%Projection.AbstractProjection</Super>
308-
<TimeChanged>63696,65168.289869</TimeChanged>
309-
<TimeCreated>63696,64041.85537</TimeCreated>
310-
311-
<Projection name="Reference">
312-
<Type>WebAppInstaller</Type>
313-
</Projection>
314-
315-
<Method name="CreateProjection">
316-
<Description>
317-
This method is invoked when a class is compiled.</Description>
318-
<ClassMethod>1</ClassMethod>
319-
<FormalSpec><![CDATA[cls:%String,&params]]></FormalSpec>
320-
<ReturnType>%Status</ReturnType>
321-
<Implementation><![CDATA[
322-
set ns = $NAMESPACE
323-
zn:ns'="%SYS" "%SYS"
324-
do ##class(Security.System).GetInstallationSecuritySetting(.security)
325-
if (security="None") {
326-
set cspProperties("AutheEnabled") = 64 // Unauthenticated
327-
} else {
328-
set cspProperties("AutheEnabled") = 32 // Password
329-
}
330-
set cspProperties("NameSpace") = ns
331-
set cspProperties("Description") = "A WEB application for Cache UML Explorer."
332-
set cspProperties("IsNameSpaceDefault") = 1
333-
set cspProperties("DispatchClass") = "UMLExplorer.Router"
334-
if ('##class(Security.Applications).Exists("/UMLExplorer")) {
335-
w !, "Creating WEB application ""/UMLExplorer""..."
336-
set tSC = ##class(Security.Applications).Create("/UMLExplorer", .cspProperties)
337-
if $$$ISERR(tSC) throw ##class(%Installer.Exception).CreateFromStatus(tSC)
338-
w !, "WEB application ""/UMLExplorer"" created."
339-
} else {
340-
w !, "WEB application ""/UMLExplorer"" already exists, so it is ready to use."
341-
}
342-
zn:ns'="%SYS" ns
343-
quit $$$OK
344-
]]></Implementation>
345-
</Method>
346-
347-
<Method name="RemoveProjection">
348-
<Description>
349-
This method is invoked when a class is 'uncompiled'.</Description>
350-
<ClassMethod>1</ClassMethod>
351-
<FormalSpec><![CDATA[cls:%String,&params,recompile:%Boolean]]></FormalSpec>
352-
<ReturnType>%Status</ReturnType>
353-
<Implementation><![CDATA[
354-
set ns = $NAMESPACE
355-
zn:ns'="%SYS" "%SYS"
356-
if (##class(Security.Applications).Exists("/UMLExplorer")) {
357-
w !, "Deleting WEB application ""/UMLExplorer""..."
358-
do ##class(Security.Applications).Delete("/UMLExplorer")
359-
w !, "WEB application ""/UMLExplorer"" was successfully removed."
360-
}
361-
zn:ns'="%SYS" ns
362-
QUIT $$$OK
363-
]]></Implementation>
364-
</Method>
365-
</Class>
366-
367-
368-
<Project name="UMLExplorer" LastModified="2015-05-24 18:07:22.008232">
339+
<Project name="UMLExplorer" LastModified="2015-05-24 18:14:48.579613">
369340
<Items>
370341
<ProjectItem name="UMLExplorer.ClassView" type="CLS"></ProjectItem>
371342
<ProjectItem name="UMLExplorer.Router" type="CLS"></ProjectItem>
@@ -379,7 +350,7 @@ This method is invoked when a class is 'uncompiled'.</Description>
379350
<Description>
380351
REST interface for UMLExplorer</Description>
381352
<Super>%CSP.REST</Super>
382-
<TimeChanged>63687,39024.811955</TimeChanged>
353+
<TimeChanged>63697,59148.775813</TimeChanged>
383354
<TimeCreated>63648,30450.187229</TimeCreated>
384355

385356
<XData name="UrlMap">
@@ -392,6 +363,7 @@ REST interface for UMLExplorer</Description>
392363
<Route Url="/Test" Method="GET" Call="Test"/>
393364
<Route Url="/GetClassTree" Method="GET" Call="GetClassTree"/>
394365
<Route Url="/GetClassView" Method="GET" Call="GetClassView"/>
366+
<Route Url="/GetAllNamespacesList" Method="GET" Call="GetAllNamespacesList"/>
395367
<Route Url="/GetPackageView" Method="GET" Call="GetPackageView"/>
396368
<Route Url="/GetMethod" Method="GET" Call="GetMethod"/>
397369
</Routes>
@@ -404,7 +376,7 @@ Method returns whole class tree visible in the current namespace.</Description>
404376
<ClassMethod>1</ClassMethod>
405377
<ReturnType>%Status</ReturnType>
406378
<Implementation><![CDATA[
407-
do ##class(UMLExplorer.ClassView).getClassTree().%ToJSON(, "ou")
379+
do ##class(UMLExplorer.ClassView).getClassTree(%request.Get("namespace")).%ToJSON(, "ou")
408380
return $$$OK
409381
]]></Implementation>
410382
</Method>
@@ -416,7 +388,7 @@ Returns classTree by given class name</Description>
416388
<ReturnType>%Status</ReturnType>
417389
<Implementation><![CDATA[
418390
set className = %request.Get("name")
419-
set classData = ##class(UMLExplorer.ClassView).getClassView(className)
391+
set classData = ##class(ClassView).getClassView(className, %request.Get("namespace"))
420392
do classData.%ToJSON(, "ou")
421393
return $$$OK
422394
]]></Implementation>
@@ -429,12 +401,23 @@ Returns all package class trees by given package name</Description>
429401
<ReturnType>%Status</ReturnType>
430402
<Implementation><![CDATA[
431403
set packageName = %request.Get("name")
432-
set classData = ##class(UMLExplorer.ClassView).getPackageView(packageName)
404+
set classData = ##class(ClassView).getPackageView(packageName, %request.Get("namespace"))
433405
do classData.%ToJSON(, "ou")
434406
return $$$OK
435407
]]></Implementation>
436408
</Method>
437409

410+
<Method name="GetAllNamespacesList">
411+
<Description>
412+
Return the list of all namespaces</Description>
413+
<ClassMethod>1</ClassMethod>
414+
<ReturnType>%Status</ReturnType>
415+
<Implementation><![CDATA[
416+
do ##class(UMLExplorer.ClassView).getAllNamespacesList().%ToJSON(, "ou")
417+
return $$$OK
418+
]]></Implementation>
419+
</Method>
420+
438421
<Method name="GetMethod">
439422
<Description>
440423
Returns method description and code</Description>
@@ -443,7 +426,7 @@ Returns method description and code</Description>
443426
<Implementation><![CDATA[
444427
set className = %request.Get("className")
445428
set methodName = %request.Get("methodName")
446-
set methodData = ##class(ClassView).getMethod(className, methodName)
429+
set methodData = ##class(ClassView).getMethod(className, methodName, %request.Get("namespace"))
447430
do methodData.%ToJSON(, "ou")
448431
return $$$OK
449432
]]></Implementation>
@@ -530,4 +513,66 @@ Write the contents of xData tag</Description>
530513
]]></Data>
531514
</XData>
532515
</Class>
516+
517+
518+
<Class name="UMLExplorer.WebAppInstaller">
519+
<Super>%Projection.AbstractProjection</Super>
520+
<TimeChanged>63696,65168.289869</TimeChanged>
521+
<TimeCreated>63696,64041.85537</TimeCreated>
522+
523+
<Projection name="Reference">
524+
<Type>WebAppInstaller</Type>
525+
</Projection>
526+
527+
<Method name="CreateProjection">
528+
<Description>
529+
This method is invoked when a class is compiled.</Description>
530+
<ClassMethod>1</ClassMethod>
531+
<FormalSpec><![CDATA[cls:%String,&params]]></FormalSpec>
532+
<ReturnType>%Status</ReturnType>
533+
<Implementation><![CDATA[
534+
set ns = $NAMESPACE
535+
zn:ns'="%SYS" "%SYS"
536+
do ##class(Security.System).GetInstallationSecuritySetting(.security)
537+
if (security="None") {
538+
set cspProperties("AutheEnabled") = 64 // Unauthenticated
539+
} else {
540+
set cspProperties("AutheEnabled") = 32 // Password
541+
}
542+
set cspProperties("NameSpace") = ns
543+
set cspProperties("Description") = "A WEB application for Cache UML Explorer."
544+
set cspProperties("IsNameSpaceDefault") = 1
545+
set cspProperties("DispatchClass") = "UMLExplorer.Router"
546+
if ('##class(Security.Applications).Exists("/UMLExplorer")) {
547+
w !, "Creating WEB application ""/UMLExplorer""..."
548+
set tSC = ##class(Security.Applications).Create("/UMLExplorer", .cspProperties)
549+
if $$$ISERR(tSC) throw ##class(%Installer.Exception).CreateFromStatus(tSC)
550+
w !, "WEB application ""/UMLExplorer"" created."
551+
} else {
552+
w !, "WEB application ""/UMLExplorer"" already exists, so it is ready to use."
553+
}
554+
zn:ns'="%SYS" ns
555+
quit $$$OK
556+
]]></Implementation>
557+
</Method>
558+
559+
<Method name="RemoveProjection">
560+
<Description>
561+
This method is invoked when a class is 'uncompiled'.</Description>
562+
<ClassMethod>1</ClassMethod>
563+
<FormalSpec><![CDATA[cls:%String,&params,recompile:%Boolean]]></FormalSpec>
564+
<ReturnType>%Status</ReturnType>
565+
<Implementation><![CDATA[
566+
set ns = $NAMESPACE
567+
zn:ns'="%SYS" "%SYS"
568+
if (##class(Security.Applications).Exists("/UMLExplorer")) {
569+
w !, "Deleting WEB application ""/UMLExplorer""..."
570+
do ##class(Security.Applications).Delete("/UMLExplorer")
571+
w !, "WEB application ""/UMLExplorer"" was successfully removed."
572+
}
573+
zn:ns'="%SYS" ns
574+
QUIT $$$OK
575+
]]></Implementation>
576+
</Method>
577+
</Class>
533578
</Export>

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.9.4",
3+
"version": "0.10.0",
44
"description": "An UML Class explorer for InterSystems Caché",
55
"directories": {
66
"test": "test"

web/css/extras.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,14 @@
8484
box-shadow: 0 0 5px 2px #ffcc1b;
8585
}
8686

87+
.icon.select {
88+
width: auto;
89+
color: white;
90+
border: 0;
91+
vertical-align: top;
92+
padding-left: 3px;
93+
}
94+
8795
.icon.help:after {
8896
content: "?";
8997
position: absolute;

web/index.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@
3838
<div class="ui-topRightToolBar">
3939
<div id="button.showInfo" class="icon info"></div>
4040
<div id="button.showHelp" class="icon help"></div>
41+
<select id="namespaces" class="icon select">
42+
<option value="Loading..." selected>Loading...</option>
43+
</select>
4144
</div>
4245
<div class="ui-leftBottomToolBar">
4346
<div id="button.downloadSVG" class="icon download"></div>

0 commit comments

Comments
 (0)