Skip to content

Commit

Permalink
Showing 2 changed files with 11 additions and 1 deletion.
@@ -71,6 +71,7 @@ public void initRestTemplate() {
}

@PostMapping("/EntityDescriptor")
@Transactional
public ResponseEntity<?> create(@RequestBody EntityDescriptorRepresentation edRepresentation) {
final String entityId = edRepresentation.getEntityId();

@@ -93,11 +94,13 @@ public ResponseEntity<?> create(@RequestBody EntityDescriptorRepresentation edRe
}

@PostMapping(value = "/EntityDescriptor", consumes = "application/xml")
@Transactional
public ResponseEntity<?> upload(@RequestBody byte[] entityDescriptorXml, @RequestParam String spName) throws Exception {
return handleUploadingEntityDescriptorXml(entityDescriptorXml, spName);
}

@PostMapping(value = "/EntityDescriptor", consumes = "application/x-www-form-urlencoded")
@Transactional
public ResponseEntity<?> upload(@RequestParam String metadataUrl, @RequestParam String spName) throws Exception {
try {
byte[] xmlContents = this.restTemplate.getForObject(metadataUrl, byte[].class);
@@ -112,6 +115,7 @@ public ResponseEntity<?> upload(@RequestParam String metadataUrl, @RequestParam
}

@PutMapping("/EntityDescriptor/{resourceId}")
@Transactional
public ResponseEntity<?> update(@RequestBody EntityDescriptorRepresentation edRepresentation, @PathVariable String resourceId) {
User currentUser = userService.getCurrentUser();
EntityDescriptor existingEd = entityDescriptorRepository.findByResourceId(resourceId);
@@ -163,6 +167,7 @@ public ResponseEntity<?> getAll() {
}

@GetMapping("/EntityDescriptor/{resourceId}")
@Transactional(readOnly = true)
public ResponseEntity<?> getOne(@PathVariable String resourceId) {
User currentUser = userService.getCurrentUser();
EntityDescriptor ed = entityDescriptorRepository.findByResourceId(resourceId);
@@ -180,6 +185,7 @@ public ResponseEntity<?> getOne(@PathVariable String resourceId) {
}

@GetMapping(value = "/EntityDescriptor/{resourceId}", produces = "application/xml")
@Transactional(readOnly = true)
public ResponseEntity<?> getOneXml(@PathVariable String resourceId) throws MarshallingException {
User currentUser = userService.getCurrentUser();
EntityDescriptor ed = entityDescriptorRepository.findByResourceId(resourceId);
@@ -195,7 +201,7 @@ public ResponseEntity<?> getOneXml(@PathVariable String resourceId) throws Marsh
}
}

@Transactional
@Transactional(readOnly = true)
@GetMapping(value = "/EntityDescriptor/disabledNonAdmin")
public Iterable<EntityDescriptorRepresentation> getDisabledAndNotOwnedByAdmin() {
return entityDescriptorRepository.findAllDisabledAndNotOwnedByAdmin()
@@ -205,6 +211,7 @@ public Iterable<EntityDescriptorRepresentation> getDisabledAndNotOwnedByAdmin()

@Secured("ROLE_ADMIN")
@DeleteMapping(value = "/EntityDescriptor/{resourceId}")
@Transactional
public ResponseEntity<?> deleteOne(@PathVariable String resourceId) {
EntityDescriptor ed = entityDescriptorRepository.findByResourceId(resourceId);
if (ed == null) {
@@ -220,6 +227,7 @@ public ResponseEntity<?> deleteOne(@PathVariable String resourceId) {
//Versioning endpoints

@GetMapping("/EntityDescriptor/{resourceId}/Versions")
@Transactional(readOnly = true)
public ResponseEntity<?> getAllVersions(@PathVariable String resourceId) {
EntityDescriptor ed = entityDescriptorRepository.findByResourceId(resourceId);
if (ed == null) {
@@ -236,6 +244,7 @@ public ResponseEntity<?> getAllVersions(@PathVariable String resourceId) {
}

@GetMapping("/EntityDescriptor/{resourceId}/Versions/{versionId}")
@Transactional(readOnly = true)
public ResponseEntity<?> getSpecificVersion(@PathVariable String resourceId, @PathVariable String versionId) {
EntityDescriptorRepresentation edRepresentation =
versionService.findSpecificVersionOfEntityDescriptor(resourceId, versionId);
@@ -157,6 +157,7 @@ public ResponseEntity<?> update(@PathVariable String resourceId, @RequestBody Me
//Versioning endpoints

@GetMapping("/MetadataResolvers/{resourceId}/Versions")
@Transactional(readOnly = true)
public ResponseEntity<?> getAllVersions(@PathVariable String resourceId) {
MetadataResolver resolver = resolverRepository.findByResourceId(resourceId);
if (resolver == null) {

0 comments on commit 00151ec

Please sign in to comment.