Skip to content

Commit

Permalink
namespace change feature, different fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
nikitaeverywhere committed May 25, 2015
1 parent 033b148 commit 3db6439
Show file tree
Hide file tree
Showing 10 changed files with 269 additions and 111 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ An UML Class explorer for InterSystems Caché.

## Screenshots

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

## Installation

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

Expand Down
189 changes: 117 additions & 72 deletions cache/projectTemplate.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,38 @@
<Description>
Cache UML Explorer vX.X.X/*build.replace:pkg.version*/
Class contains methods that return structured classes/packages data.</Description>
<TimeChanged>63690,48954.853237</TimeChanged>
<TimeChanged>63697,66596.619226</TimeChanged>
<TimeCreated>63653,67019.989197</TimeCreated>

<Method name="getAllNamespacesList">
<Description>
Return list with all namespaces</Description>
<ClassMethod>1</ClassMethod>
<ReturnType>%ZEN.proxyObject</ReturnType>
<Implementation><![CDATA[
set resp = ##class(%ZEN.proxyObject).%New()
set resp.namespaces = ##class(%ZEN.proxyObject).%New()
set resp.currentNamespace = $NAMESPACE
set result = ##class(%ResultSet).%New("%SYS.Namespace:List")
do result.Execute()
while (result.Next()) {
set ns = ##class(%ZEN.proxyObject).%New()
set ns.remote = result.Get("Remote")
set ns.status = result.Get("Status")
do resp.namespaces.%DispatchSetProperty(result.Get("Nsp"), ns)
}
return resp
]]></Implementation>
</Method>

<Method name="getClassTree">
<Description>
Returns structured class tree with all classes available in current namespace</Description>
<ClassMethod>1</ClassMethod>
<FormalSpec>namespace:%String</FormalSpec>
<ReturnType>%ZEN.proxyObject</ReturnType>
<Implementation><![CDATA[
zn:$GET(namespace)'="" namespace
set resp = ##class(%ZEN.proxyObject).%New()
set classes = ##class(%ResultSet).%New("%Dictionary.ClassDefinition:Summary")
Expand All @@ -22,16 +45,23 @@ Returns structured class tree with all classes available in current namespace</D
set level = 1
do objects.SetAt(resp, level)
do classes.Execute()
while (classes.Next()) {
set name = classes.Data("Name")
if ($EXTRACT(name, 1, 1) = "%") && ($NAMESPACE '= "%SYS") { continue }
set parts = $LISTFROMSTRING(name, ".")
set i = 0
while (i < $LISTLENGTH(parts)) && ($LISTGET(lastParts, i + 1) = $LISTGET(parts, i + 1)) {
set i = i + 1
}
set level = i + 1
set resp = objects.GetAt(level)
if (resp="") {
set resp = ##class(%ZEN.proxyObject).%New()
do objects.GetAt(level - 1).%DispatchSetProperty($LISTGET(parts, level - 1), resp)
do objects.SetAt(resp, level)
}
while ($LISTLENGTH(parts) > level) {
set level = level + 1
set resp = ##class(%ZEN.proxyObject).%New()
Expand Down Expand Up @@ -130,9 +160,10 @@ Return structured data about class.</Description>
<Description>
Return method data.</Description>
<ClassMethod>1</ClassMethod>
<FormalSpec>className:%String,methodName:%String</FormalSpec>
<FormalSpec>className:%String,methodName:%String,namespace:%String</FormalSpec>
<ReturnType>%ZEN.proxyObject</ReturnType>
<Implementation><![CDATA[
zn:$GET(namespace)'="" namespace
set oMeth = ##class(%ZEN.proxyObject).%New()
set met = ##class(%Dictionary.MethodDefinition).%OpenId(className _ "||" _ methodName)
if (met = "") { set oMeth.error = 1 quit oMeth }
Expand Down Expand Up @@ -267,9 +298,10 @@ Returns if class with given name exists.</Description>
<Description>
Returns structured class data</Description>
<ClassMethod>1</ClassMethod>
<FormalSpec>className:%String</FormalSpec>
<FormalSpec>className:%String,namespace:%String</FormalSpec>
<ReturnType>%ZEN.proxyObject</ReturnType>
<Implementation><![CDATA[
zn:$GET(namespace)'="" namespace
set package = $LISTTOSTRING($LIST($LISTFROMSTRING(className, "."), 1, *-1), ".")
set oData = ..getBaseOData(package)
do ..setClassData(oData, className)
Expand All @@ -281,9 +313,10 @@ Returns structured class data</Description>
<Description>
Returns structured package data</Description>
<ClassMethod>1</ClassMethod>
<FormalSpec>rootPackageName:%String</FormalSpec>
<FormalSpec>rootPackageName:%String,namespace:%String</FormalSpec>
<ReturnType>%ZEN.proxyObject</ReturnType>
<Implementation><![CDATA[
zn:$GET(namespace)'="" namespace
set oData = ..getBaseOData(rootPackageName)
set classes = ##class(%ResultSet).%New("%Dictionary.ClassDefinition:Summary")
do classes.Execute()
Expand All @@ -303,69 +336,7 @@ Returns structured package data</Description>
</Class>


<Class name="UMLExplorer.WebAppInstaller">
<Super>%Projection.AbstractProjection</Super>
<TimeChanged>63696,65168.289869</TimeChanged>
<TimeCreated>63696,64041.85537</TimeCreated>

<Projection name="Reference">
<Type>WebAppInstaller</Type>
</Projection>

<Method name="CreateProjection">
<Description>
This method is invoked when a class is compiled.</Description>
<ClassMethod>1</ClassMethod>
<FormalSpec><![CDATA[cls:%String,&params]]></FormalSpec>
<ReturnType>%Status</ReturnType>
<Implementation><![CDATA[
set ns = $NAMESPACE
zn:ns'="%SYS" "%SYS"
do ##class(Security.System).GetInstallationSecuritySetting(.security)
if (security="None") {
set cspProperties("AutheEnabled") = 64 // Unauthenticated
} else {
set cspProperties("AutheEnabled") = 32 // Password
}
set cspProperties("NameSpace") = ns
set cspProperties("Description") = "A WEB application for Cache UML Explorer."
set cspProperties("IsNameSpaceDefault") = 1
set cspProperties("DispatchClass") = "UMLExplorer.Router"
if ('##class(Security.Applications).Exists("/UMLExplorer")) {
w !, "Creating WEB application ""/UMLExplorer""..."
set tSC = ##class(Security.Applications).Create("/UMLExplorer", .cspProperties)
if $$$ISERR(tSC) throw ##class(%Installer.Exception).CreateFromStatus(tSC)
w !, "WEB application ""/UMLExplorer"" created."
} else {
w !, "WEB application ""/UMLExplorer"" already exists, so it is ready to use."
}
zn:ns'="%SYS" ns
quit $$$OK
]]></Implementation>
</Method>

<Method name="RemoveProjection">
<Description>
This method is invoked when a class is 'uncompiled'.</Description>
<ClassMethod>1</ClassMethod>
<FormalSpec><![CDATA[cls:%String,&params,recompile:%Boolean]]></FormalSpec>
<ReturnType>%Status</ReturnType>
<Implementation><![CDATA[
set ns = $NAMESPACE
zn:ns'="%SYS" "%SYS"
if (##class(Security.Applications).Exists("/UMLExplorer")) {
w !, "Deleting WEB application ""/UMLExplorer""..."
do ##class(Security.Applications).Delete("/UMLExplorer")
w !, "WEB application ""/UMLExplorer"" was successfully removed."
}
zn:ns'="%SYS" ns
QUIT $$$OK
]]></Implementation>
</Method>
</Class>


<Project name="UMLExplorer" LastModified="2015-05-24 18:07:22.008232">
<Project name="UMLExplorer" LastModified="2015-05-24 18:14:48.579613">
<Items>
<ProjectItem name="UMLExplorer.ClassView" type="CLS"></ProjectItem>
<ProjectItem name="UMLExplorer.Router" type="CLS"></ProjectItem>
Expand All @@ -379,7 +350,7 @@ This method is invoked when a class is 'uncompiled'.</Description>
<Description>
REST interface for UMLExplorer</Description>
<Super>%CSP.REST</Super>
<TimeChanged>63687,39024.811955</TimeChanged>
<TimeChanged>63697,59148.775813</TimeChanged>
<TimeCreated>63648,30450.187229</TimeCreated>

<XData name="UrlMap">
Expand All @@ -392,6 +363,7 @@ REST interface for UMLExplorer</Description>
<Route Url="/Test" Method="GET" Call="Test"/>
<Route Url="/GetClassTree" Method="GET" Call="GetClassTree"/>
<Route Url="/GetClassView" Method="GET" Call="GetClassView"/>
<Route Url="/GetAllNamespacesList" Method="GET" Call="GetAllNamespacesList"/>
<Route Url="/GetPackageView" Method="GET" Call="GetPackageView"/>
<Route Url="/GetMethod" Method="GET" Call="GetMethod"/>
</Routes>
Expand All @@ -404,7 +376,7 @@ Method returns whole class tree visible in the current namespace.</Description>
<ClassMethod>1</ClassMethod>
<ReturnType>%Status</ReturnType>
<Implementation><![CDATA[
do ##class(UMLExplorer.ClassView).getClassTree().%ToJSON(, "ou")
do ##class(UMLExplorer.ClassView).getClassTree(%request.Get("namespace")).%ToJSON(, "ou")
return $$$OK
]]></Implementation>
</Method>
Expand All @@ -416,7 +388,7 @@ Returns classTree by given class name</Description>
<ReturnType>%Status</ReturnType>
<Implementation><![CDATA[
set className = %request.Get("name")
set classData = ##class(UMLExplorer.ClassView).getClassView(className)
set classData = ##class(ClassView).getClassView(className, %request.Get("namespace"))
do classData.%ToJSON(, "ou")
return $$$OK
]]></Implementation>
Expand All @@ -429,12 +401,23 @@ Returns all package class trees by given package name</Description>
<ReturnType>%Status</ReturnType>
<Implementation><![CDATA[
set packageName = %request.Get("name")
set classData = ##class(UMLExplorer.ClassView).getPackageView(packageName)
set classData = ##class(ClassView).getPackageView(packageName, %request.Get("namespace"))
do classData.%ToJSON(, "ou")
return $$$OK
]]></Implementation>
</Method>

<Method name="GetAllNamespacesList">
<Description>
Return the list of all namespaces</Description>
<ClassMethod>1</ClassMethod>
<ReturnType>%Status</ReturnType>
<Implementation><![CDATA[
do ##class(UMLExplorer.ClassView).getAllNamespacesList().%ToJSON(, "ou")
return $$$OK
]]></Implementation>
</Method>

<Method name="GetMethod">
<Description>
Returns method description and code</Description>
Expand All @@ -443,7 +426,7 @@ Returns method description and code</Description>
<Implementation><![CDATA[
set className = %request.Get("className")
set methodName = %request.Get("methodName")
set methodData = ##class(ClassView).getMethod(className, methodName)
set methodData = ##class(ClassView).getMethod(className, methodName, %request.Get("namespace"))
do methodData.%ToJSON(, "ou")
return $$$OK
]]></Implementation>
Expand Down Expand Up @@ -530,4 +513,66 @@ Write the contents of xData tag</Description>
]]></Data>
</XData>
</Class>


<Class name="UMLExplorer.WebAppInstaller">
<Super>%Projection.AbstractProjection</Super>
<TimeChanged>63696,65168.289869</TimeChanged>
<TimeCreated>63696,64041.85537</TimeCreated>

<Projection name="Reference">
<Type>WebAppInstaller</Type>
</Projection>

<Method name="CreateProjection">
<Description>
This method is invoked when a class is compiled.</Description>
<ClassMethod>1</ClassMethod>
<FormalSpec><![CDATA[cls:%String,&params]]></FormalSpec>
<ReturnType>%Status</ReturnType>
<Implementation><![CDATA[
set ns = $NAMESPACE
zn:ns'="%SYS" "%SYS"
do ##class(Security.System).GetInstallationSecuritySetting(.security)
if (security="None") {
set cspProperties("AutheEnabled") = 64 // Unauthenticated
} else {
set cspProperties("AutheEnabled") = 32 // Password
}
set cspProperties("NameSpace") = ns
set cspProperties("Description") = "A WEB application for Cache UML Explorer."
set cspProperties("IsNameSpaceDefault") = 1
set cspProperties("DispatchClass") = "UMLExplorer.Router"
if ('##class(Security.Applications).Exists("/UMLExplorer")) {
w !, "Creating WEB application ""/UMLExplorer""..."
set tSC = ##class(Security.Applications).Create("/UMLExplorer", .cspProperties)
if $$$ISERR(tSC) throw ##class(%Installer.Exception).CreateFromStatus(tSC)
w !, "WEB application ""/UMLExplorer"" created."
} else {
w !, "WEB application ""/UMLExplorer"" already exists, so it is ready to use."
}
zn:ns'="%SYS" ns
quit $$$OK
]]></Implementation>
</Method>

<Method name="RemoveProjection">
<Description>
This method is invoked when a class is 'uncompiled'.</Description>
<ClassMethod>1</ClassMethod>
<FormalSpec><![CDATA[cls:%String,&params,recompile:%Boolean]]></FormalSpec>
<ReturnType>%Status</ReturnType>
<Implementation><![CDATA[
set ns = $NAMESPACE
zn:ns'="%SYS" "%SYS"
if (##class(Security.Applications).Exists("/UMLExplorer")) {
w !, "Deleting WEB application ""/UMLExplorer""..."
do ##class(Security.Applications).Delete("/UMLExplorer")
w !, "WEB application ""/UMLExplorer"" was successfully removed."
}
zn:ns'="%SYS" ns
QUIT $$$OK
]]></Implementation>
</Method>
</Class>
</Export>
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "CacheUMLExplorer",
"version": "0.9.4",
"version": "0.10.0",
"description": "An UML Class explorer for InterSystems Caché",
"directories": {
"test": "test"
Expand Down
8 changes: 8 additions & 0 deletions web/css/extras.css
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,14 @@
box-shadow: 0 0 5px 2px #ffcc1b;
}

.icon.select {
width: auto;
color: white;
border: 0;
vertical-align: top;
padding-left: 3px;
}

.icon.help:after {
content: "?";
position: absolute;
Expand Down
3 changes: 3 additions & 0 deletions web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
<div class="ui-topRightToolBar">
<div id="button.showInfo" class="icon info"></div>
<div id="button.showHelp" class="icon help"></div>
<select id="namespaces" class="icon select">
<option value="Loading..." selected>Loading...</option>
</select>
</div>
<div class="ui-leftBottomToolBar">
<div id="button.downloadSVG" class="icon download"></div>
Expand Down
Loading

0 comments on commit 3db6439

Please sign in to comment.