Skip to content

Commit 6e040ed

Browse files
committed
Add IOP.Projection class with CreateProjection and RemoveProjection methods
1 parent 67f8d95 commit 6e040ed

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

src/iop/cls/IOP/Projection.cls

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
Class IOP.Projection Extends %Projection.AbstractProjection
2+
{
3+
4+
/// Projection to make install on compile
5+
Projection Reference As Projection;
6+
7+
/// Call of the projection
8+
ClassMethod CreateProjection(
9+
cls As %String,
10+
ByRef params) As %Status
11+
{
12+
set tSC = $$$OK
13+
set tCurrentNamespace = $Namespace
14+
15+
Try {
16+
set $NAMESPACE = "%SYS"
17+
// Create a new Web App for IOP Remote Handler
18+
set webName = "/api/iop"
19+
set webProperties("NameSpace") = tCurrentNamespace
20+
set webProperties("Enabled") = 1
21+
set webProperties("AutheEnabled") = 32
22+
set webProperties("ServeFiles")=2
23+
set webProperties("Recurse")=1
24+
if ##class(Security.Applications).Exists(webName) {
25+
// If the web application already exists, delete it first
26+
$$$ThrowOnError(##class(Security.Applications).Delete(webName))
27+
}
28+
$$$ThrowOnError(##class(Security.Applications).Create(webName, .webProperties))
29+
}
30+
Catch ex {
31+
Set tSC=ex.AsStatus()
32+
Write "Error creating web application: ", ex.DisplayString(), !
33+
Set tSC = $$$OK
34+
}
35+
36+
znspace tCurrentNamespace
37+
Return tSC
38+
}
39+
40+
ClassMethod RemoveProjection(
41+
cls As %String,
42+
ByRef params,
43+
recompile As %Boolean) As %Status
44+
{
45+
Quit $$$OK
46+
}
47+
48+
}

0 commit comments

Comments
 (0)