Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
MKCLOS
Core Development Platform
corepkgv2
Commits
9ab4b4f2
Commit
9ab4b4f2
authored
4 years ago
by
Vikram Ingawale
2
Browse files
Options
Downloads
Patches
Plain Diff
CallService: Branch changes added
parent
6c448279
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!220
Release v2.0.0 alpha
,
!219
Add: Support for branches
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
routebuildermdl/serviceCachemdl.go
+30
-8
routebuildermdl/serviceCachemdl.go
with
30 additions
and
8 deletions
routebuildermdl/serviceCachemdl.go
+
30
−
8
View file @
9ab4b4f2
package
routebuildermdl
import
(
"strings"
"time"
"corelab.mkcl.org/MKCLOS/coredevelopmentplatform/corepkgv2/constantmdl"
"corelab.mkcl.org/MKCLOS/coredevelopmentplatform/corepkgv2/errormdl"
"corelab.mkcl.org/MKCLOS/coredevelopmentplatform/corepkgv2/loggermdl"
"corelab.mkcl.org/MKCLOS/coredevelopmentplatform/corepkgv2/servicebuildermdl"
...
...
@@ -153,17 +156,36 @@ func SetAppVersion(appVersion, minSupportedVersion string) error {
// CallService - calls service with provided configuration, returns result and error from executed service
func
CallService
(
name
string
,
rs
*
gjson
.
Result
,
isRestricted
bool
,
isRoleBased
bool
,
p
servicebuildermdl
.
Principal
)
(
interface
{},
error
)
{
return
CallServiceWithBranch
(
name
,
constantmdl
.
Branch_Main
,
rs
,
isRestricted
,
isRoleBased
,
p
)
}
// CallServiceWithBranch - calls service of given branch with provided configuration, returns result and error from executed service
func
CallServiceWithBranch
(
name
,
branch
string
,
rs
*
gjson
.
Result
,
isRestricted
bool
,
isRoleBased
bool
,
p
servicebuildermdl
.
Principal
)
(
interface
{},
error
)
{
var
found
bool
var
service
interface
{}
if
isRestricted
{
if
isRoleBased
{
service
,
found
=
roleBasedServices
.
Get
(
name
)
}
else
{
service
,
found
=
restrictedServices
.
Get
(
name
)
}
}
else
{
service
,
found
=
openServices
.
Get
(
name
)
if
strings
.
TrimSpace
(
branch
)
==
""
{
loggermdl
.
LogError
(
"Branch is empty"
)
return
nil
,
errormdl
.
Wrap
(
"Branch is empty"
)
}
activityName
:=
ConcatenateEntityWithBranch
(
name
,
branch
)
// if isRestricted {
// if isRoleBased {
// service, found = roleBasedServices.Get(activityName)
// } else {
// service, found = restrictedServices.Get(activityName)
// }
// } else {
// service, found = openServices.Get(activityName)
// }
switch
{
case
isRestricted
==
true
&&
isRoleBased
==
true
:
service
,
found
=
roleBasedServices
.
Get
(
activityName
)
case
isRestricted
==
true
&&
isRoleBased
==
false
:
service
,
found
=
restrictedServices
.
Get
(
activityName
)
case
isRestricted
==
false
:
service
,
found
=
openServices
.
Get
(
activityName
)
}
if
!
found
{
loggermdl
.
LogError
(
"Service Not Found: "
+
name
)
return
nil
,
errormdl
.
Wrap
(
"Service Not Found: "
+
name
)
...
...
This diff is collapsed.
Click to expand it.
Ajit Jagtap
@ajitj
mentioned in commit
45b93576
·
4 years ago
mentioned in commit
45b93576
mentioned in commit 45b93576613fffa28ac13e87fd0c8f3486586208
Toggle commit list
Akshay Bharambe
@akshayb
mentioned in merge request
!226 (merged)
·
4 years ago
mentioned in merge request
!226 (merged)
mentioned in merge request !226
Toggle commit list
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets