Skip to content

Commit

Permalink
Merge branch 'hqapi-2.x'
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrick Nguyen committed Nov 20, 2009
2 parents 9f5671e + 40c3625 commit de4e5d6
Showing 1 changed file with 24 additions and 5 deletions.
29 changes: 24 additions & 5 deletions hqu/hqapi1/app/ApplicationController.groovy
Expand Up @@ -29,12 +29,31 @@ class ApplicationController extends ApiController {
opsContact : a.opsContact,
bizContact : a.businessContact) {
def sessionId = SessionManager.instance.put(user)
for (appService in aBoss.findServiceInventoryByApplication(sessionId, a.id, PageControl.PAGE_ALL)) {
def resHelper = resourceHelper
def legacy = true
def inventory = aBoss.findServiceInventoryByApplication(sessionId, a.id, PageControl.PAGE_ALL)

for (appService in inventory) {
if (appService instanceof ServiceValue) {
def resource = resourceHelper.find('service':appService.id)
Resource(id : resource.id,
name : resource.name,
description : resource.description)
if (appService.metaClass.respondsTo(appService, "getResourceId")) {
legacy = false
}
break
}
}

for (appService in inventory) {
if (appService instanceof ServiceValue) {
def resourceId = null
if (legacy) {
def resource = resHelper.find('service':appService.id)
resourceId = resource.id
} else {
resourceId = appService.resourceId
}
Resource(id : resourceId,
name : appService.name,
description : appService.description)
}
}
}
Expand Down

0 comments on commit de4e5d6

Please sign in to comment.