use of com.infiniteautomation.mango.rest.latest.model.filestore.FileStoreModel in project ma-modules-public by infiniteautomation.
the class UserFileStoresRestController method updateUserFileStore.
@ApiOperation(value = "Update a user file store")
@RequestMapping(method = RequestMethod.PUT, value = "/{xid}")
public ResponseEntity<FileStoreModel> updateUserFileStore(@ApiParam(value = "File store XID", required = true) @PathVariable("xid") String xid, @ApiParam(value = "Updated file store", required = true) @RequestBody FileStoreModel fileStore, UriComponentsBuilder builder) {
FileStore updated = this.fileStoreService.update(xid, fileStore.toVO());
URI location = builder.path("/user-file-stores/{xid}").buildAndExpand(updated.getXid()).toUri();
HttpHeaders headers = new HttpHeaders();
headers.setLocation(location);
return new ResponseEntity<>(new FileStoreModel(updated), headers, HttpStatus.OK);
}
use of com.infiniteautomation.mango.rest.latest.model.filestore.FileStoreModel in project ma-modules-public by infiniteautomation.
the class UserFileStoresRestController method getUserFileStoreModel.
@ApiOperation(value = "Get a user file store model")
@RequestMapping(method = RequestMethod.GET, value = "/{xid}")
public MappingJacksonValue getUserFileStoreModel(@PathVariable("xid") String xid, @AuthenticationPrincipal PermissionHolder user) {
FileStore fs = this.fileStoreService.get(xid);
// Seeing the permissions fields should require write protection
MappingJacksonValue resultWithView = new MappingJacksonValue(new FileStoreModel(fs));
if (fileStoreService.hasEditPermission(user, fs)) {
resultWithView.setSerializationView(RoleViews.ShowRoles.class);
} else {
resultWithView.setSerializationView(Object.class);
}
return resultWithView;
}
use of com.infiniteautomation.mango.rest.latest.model.filestore.FileStoreModel in project ma-modules-public by infiniteautomation.
the class UserFileStoresRestController method createUserFileStore.
@ApiOperation(value = "Create a user file store")
@RequestMapping(method = RequestMethod.POST)
public ResponseEntity<FileStoreModel> createUserFileStore(@ApiParam(value = "File store to create", required = true) @RequestBody FileStoreModel fileStore, UriComponentsBuilder builder) {
FileStore newStore = this.fileStoreService.insert(fileStore.toVO());
URI location = builder.path("/user-file-stores/{xid}").buildAndExpand(newStore.getXid()).toUri();
HttpHeaders headers = new HttpHeaders();
headers.setLocation(location);
return new ResponseEntity<>(new FileStoreModel(newStore), headers, HttpStatus.CREATED);
}
Aggregations