Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up unused endpoints #294

Merged
merged 3 commits into from
Mar 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion mdm-core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ Controller: semanticLink
| GET | /api/${catalogueItemDomainType}/${catalogueItemId}/semanticLinks/${id} | Action: show

Controller: session
| GET | /api/session/keepAlive | Action: keepAlive
| GET | /api/admin/activeSessions | Action: activeSessions
| GET | /api/session/isAuthenticated/${sessionId}? | Action: isAuthenticatedSession

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ class UrlMappings {
// Open access url
get "/session/isAuthenticated/$sessionId?"(controller: 'session', action: 'isAuthenticatedSession') // New Url
get '/session/isApplicationAdministration'(controller: 'session', action: 'isApplicationAdministrationSession') // New Url
get '/session/keepAlive'(controller: 'session', action: 'keepAlive') // New Url
get '/properties'(controller: 'apiProperty', action: 'index') {
openAccess = true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ package uk.ac.ox.softeng.maurodatamapper.core.session

import uk.ac.ox.softeng.maurodatamapper.core.traits.controller.ResourcelessMdmController

import io.micronaut.http.HttpStatus

class SessionController implements ResourcelessMdmController {

SessionService sessionService
Expand All @@ -39,8 +37,4 @@ class SessionController implements ResourcelessMdmController {
def isApplicationAdministrationSession() {
respond applicationAdministrationSession: currentUserSecurityPolicyManager.isApplicationAdministrator()
}

def keepAlive() {
render status: HttpStatus.CONTINUE
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class MauroDataMapperServiceProviderServiceSpec extends MdmSpecification {
map.values().flatten().size() == mauroDataMapperServiceProviderService.providerServices.size()

and:
map.values().flatten().each {p ->
map.values().flatten().every {p ->
mauroDataMapperServiceProviderService.providerServices.any {it == p}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@
| DELETE | /api/${catalogueItemDomainType}/${catalogueItemId}/semanticLinks/${id} | delete |
| PUT | /api/${catalogueItemDomainType}/${catalogueItemId}/semanticLinks/${id} | update |
| GET | /api/${catalogueItemDomainType}/${catalogueItemId}/semanticLinks/${id} | show |
| GET | /api/session/keepAlive | keepAlive |
| GET | /api/session/isApplicationAdministration | isApplicationAdministrationSession |
| GET | /api/admin/activeSessions | activeSessions |
| GET | /api/session/isAuthenticated/${sessionId}? | isAuthenticatedSession |
Expand Down
2 changes: 0 additions & 2 deletions mdm-plugin-datamodel/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ Controller: dataModel
| GET | /api/dataModels/types | Action: types
| POST | /api/dataModels/import/${importerNamespace}/${importerName}/${importerVersion} | Action: importModels
| POST | /api/dataModels/export/${exporterNamespace}/${exporterName}/${exporterVersion} | Action: exportModels
| DELETE | /api/dataModels/${dataModelId}/dataClasses/clean | Action: deleteAllUnusedDataClasses
| DELETE | /api/dataModels/${dataModelId}/dataTypes/clean | Action: deleteAllUnusedDataTypes
| GET | /api/folders/${folderId}/dataModels | Action: index
| DELETE | /api/dataModels/${dataModelId}/readByAuthenticated | Action: readByAuthenticated
| PUT | /api/dataModels/${dataModelId}/readByAuthenticated | Action: readByAuthenticated
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,36 +84,6 @@ class DataModelController extends ModelController<DataModel> {
dataModelService
}

@Transactional
def deleteAllUnusedDataClasses() {
if (handleReadOnly()) {
return
}

DataModel dataModel = queryForResource params.dataModelId

if (!dataModel) return notFound(params.dataModelId)

dataModelService.deleteAllUnusedDataClasses(dataModel)

render status: NO_CONTENT // NO CONTENT STATUS CODE
}

@Transactional
def deleteAllUnusedDataTypes() {
if (handleReadOnly()) {
return
}

DataModel dataModel = queryForResource params.dataModelId

if (!dataModel) return notFound(params.dataModelId)

dataModelService.deleteAllUnusedDataTypes(dataModel)

render status: NO_CONTENT // NO CONTENT STATUS CODE
}

def search(SearchParams searchParams) {

if (searchParams.hasErrors()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,6 @@ class UrlMappings {
put "/subset/$otherDataModelId"(controller: 'dataModel', action: 'subset')
get "/intersects/$otherDataModelId"(controller: 'dataModel', action: 'intersects')

delete '/dataTypes/clean'(controller: 'dataModel', action: 'deleteAllUnusedDataTypes')
delete '/dataClasses/clean'(controller: 'dataModel', action: 'deleteAllUnusedDataClasses')

get '/hierarchy'(controller: 'dataModel', action: 'hierarchy')

post '/search'(controller: 'dataModel', action: 'search')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@
| GET | /api/dataModels/types | types |
| POST | /api/dataModels/import/${importerNamespace}/${importerName}/${importerVersion} | importModels |
| POST | /api/dataModels/export/${exporterNamespace}/${exporterName}/${exporterVersion} | exportModels |
| DELETE | /api/dataModels/${dataModelId}/dataClasses/clean | deleteAllUnusedDataClasses |
| DELETE | /api/dataModels/${dataModelId}/dataTypes/clean | deleteAllUnusedDataTypes |
| GET | /api/folders/${folderId}/dataModels | index |
| DELETE | /api/dataModels/${dataModelId}/readByAuthenticated | readByAuthenticated |
| PUT | /api/dataModels/${dataModelId}/readByAuthenticated | readByAuthenticated |
Expand Down
2 changes: 0 additions & 2 deletions mdm-plugin-referencedata/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ Controller: dataModel
| GET | /api/dataModels/types | Action: types
| POST | /api/dataModels/import/${importerNamespace}/${importerName}/${importerVersion} | Action: importModels
| POST | /api/dataModels/export/${exporterNamespace}/${exporterName}/${exporterVersion} | Action: exportModels
| DELETE | /api/dataModels/${dataModelId}/dataClasses/clean | Action: deleteAllUnusedDataClasses
| DELETE | /api/dataModels/${dataModelId}/dataTypes/clean | Action: deleteAllUnusedDataTypes
| GET | /api/folders/${folderId}/dataModels | Action: index
| DELETE | /api/dataModels/${dataModelId}/readByAuthenticated | Action: readByAuthenticated
| PUT | /api/dataModels/${dataModelId}/readByAuthenticated | Action: readByAuthenticated
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,36 +72,6 @@ class ReferenceDataModelController extends ModelController<ReferenceDataModel> {
resource ? respond(resource, [model: [userSecurityPolicyManager: currentUserSecurityPolicyManager], view: 'hierarchy']) : notFound(params.id)
}

@Transactional
def deleteAllUnusedDataClasses() {
if (handleReadOnly()) {
return
}

ReferenceDataModel referenceDataModel = queryForResource params.referenceDataModelId

if (!referenceDataModel) return notFound(params.referenceDataModelId)

referenceDataModelService.deleteAllUnusedDataClasses(referenceDataModel)

render status: NO_CONTENT // NO CONTENT STATUS CODE
}

@Transactional
def deleteAllUnusedDataTypes() {
if (handleReadOnly()) {
return
}

ReferenceDataModel referenceDataModel = queryForResource params.referenceDataModelId

if (!referenceDataModel) return notFound(params.referenceDataModelId)

referenceDataModelService.deleteAllUnusedDataTypes(referenceDataModel)

render status: NO_CONTENT // NO CONTENT STATUS CODE
}

def search(SearchParams searchParams) {

if (searchParams.hasErrors()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ class UrlMappings {
put "/folder/$folderId"(controller: 'referenceDataModel', action: 'changeFolder')
get "/export/$exporterNamespace/$exporterName/$exporterVersion"(controller: 'referenceDataModel', action: 'exportModel')

delete '/referenceDataTypes/clean'(controller: 'referenceDataModel', action: 'deleteAllUnusedReferenceDataTypes')

get '/hierarchy'(controller: 'referenceDataModel', action: 'hierarchy')

post '/search'(controller: 'referenceDataModel', action: 'search')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -682,8 +682,8 @@ class ReferenceDataModelServiceIntegrationSpec extends BaseReferenceDataModelInt

then:
availableBranches.size() == 2
availableBranches.each { it.id in [draftModel.id, testModel.id] }
availableBranches.each { it.label == dataModel.label }
availableBranches.every {it.id in [draftModel.id, testModel.id]}
availableBranches.every {it.label == dataModel.label}
}

void 'DMSV01 : test validation on valid model'() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
| PUT | /api/admin/referenceDataModels/${id}/undoSoftDelete | undoSoftDelete |
| POST | /api/referenceDataModels/import/${importerNamespace}/${importerName}/${importerVersion} | importModels |
| POST | /api/referenceDataModels/export/${exporterNamespace}/${exporterName}/${exporterVersion} | exportModels |
| DELETE | /api/referenceDataModels/${referenceDataModelId}/referenceDataTypes/clean | deleteAllUnusedReferenceDataTypes |
| GET | /api/folders/${folderId}/referenceDataModels | index |
| DELETE | /api/referenceDataModels/${referenceDataModelId}/readByAuthenticated | readByAuthenticated |
| PUT | /api/referenceDataModels/${referenceDataModelId}/readByAuthenticated | readByAuthenticated |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -333,8 +333,8 @@ class TerminologyServiceIntegrationSpec extends BaseTerminologyIntegrationSpec {

then:
availableBranches.size() == 2
availableBranches.each {it.id in [draftModel.id, testModel.id]}
availableBranches.each {it.label == terminology.label}
availableBranches.every {it.id in [draftModel.id, testModel.id]}
availableBranches.every {it.label == terminology.label}
}

void 'TSM01 : test finding merge difference between two terminologies'() {
Expand Down
4 changes: 0 additions & 4 deletions mdm-testing-functional/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,6 @@ Controller: dataModel
| GET | /api/dataModels/types | Action: types
| POST | /api/dataModels/import/${importerNamespace}/${importerName}/${importerVersion} | Action: importModels
| POST | /api/dataModels/export/${exporterNamespace}/${exporterName}/${exporterVersion} | Action: exportModels
| DELETE | /api/dataModels/${dataModelId}/dataClasses/clean | Action: deleteAllUnusedDataClasses
| DELETE | /api/dataModels/${dataModelId}/dataTypes/clean | Action: deleteAllUnusedDataTypes
| GET | /api/folders/${folderId}/dataModels | Action: index
| DELETE | /api/dataModels/${dataModelId}/readByAuthenticated | Action: readByAuthenticated
| PUT | /api/dataModels/${dataModelId}/readByAuthenticated | Action: readByAuthenticated
Expand Down Expand Up @@ -418,7 +416,6 @@ Controller: referenceDataModel
| PUT | /api/admin/referenceDataModels/${id}/undoSoftDelete | Action: undoSoftDelete
| POST | /api/referenceDataModels/import/${importerNamespace}/${importerName}/${importerVersion} | Action: importModels
| POST | /api/referenceDataModels/export/${exporterNamespace}/${exporterName}/${exporterVersion} | Action: exportModels
| DELETE | /api/referenceDataModels/${referenceDataModelId}/referenceDataTypes/clean | Action: deleteAllUnusedReferenceDataTypes
| GET | /api/folders/${folderId}/referenceDataModels | Action: index
| DELETE | /api/referenceDataModels/${referenceDataModelId}/readByAuthenticated | Action: readByAuthenticated
| PUT | /api/referenceDataModels/${referenceDataModelId}/readByAuthenticated | Action: readByAuthenticated
Expand Down Expand Up @@ -565,7 +562,6 @@ Controller: semanticLink
| GET | /api/${catalogueItemDomainType}/${catalogueItemId}/semanticLinks/${id} | Action: show

Controller: session
| GET | /api/session/keepAlive | Action: keepAlive
| GET | /api/session/isApplicationAdministration | Action: isApplicationAdministrationSession
| GET | /api/admin/activeSessions | Action: activeSessions
| GET | /api/session/isAuthenticated/${sessionId}? | Action: isAuthenticatedSession
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1887,35 +1887,35 @@ class VersionedFolderFunctionalSpec extends UserAccessAndPermissionChangingFunct
then:
verifyResponse OK, response
responseBody().count == 5
responseBody().items.each {it.id in expectedBrancheIds}
responseBody().items.each {it.label == validJson.label}
responseBody().items.every {it.id in expectedBrancheIds}
responseBody().items.every {it.label == validJson.label}

when:
GET("$data.v2/availableBranches")

then:
verifyResponse OK, response
responseBody().count == 5
responseBody().items.each {it.id in expectedBrancheIds}
responseBody().items.each {it.label == validJson.label}
responseBody().items.every {it.id in expectedBrancheIds}
responseBody().items.every {it.label == validJson.label}

when:
GET("$data.v1/availableBranches")

then:
verifyResponse OK, response
responseBody().count == 5
responseBody().items.each {it.id in expectedBrancheIds}
responseBody().items.each {it.label == validJson.label}
responseBody().items.every {it.id in expectedBrancheIds}
responseBody().items.every {it.label == validJson.label}

when:
GET("$data.main/availableBranches")

then:
verifyResponse OK, response
responseBody().count == 5
responseBody().items.each {it.id in expectedBrancheIds}
responseBody().items.each {it.label == validJson.label}
responseBody().items.every {it.id in expectedBrancheIds}
responseBody().items.every {it.label == validJson.label}

cleanup:
cleanupModelVersionTree(data)
Expand Down
Loading