Loading openapi @ 99ea877d Original line number Diff line number Diff line Subproject commit b639a02180c2b5e301c77483b3a2fa645ba94169 Subproject commit 99ea877dca8ba0587699f12dab77a43f79a836fc server/worldstorage/src/ETSI.ARF.OpenAPI.WorldStorage/ETSI-ARF/ControllersImpl/RelocalizationInformationImpl.cs +11 −2 Original line number Diff line number Diff line Loading @@ -55,6 +55,8 @@ namespace ETSI.ARF.OpenAPI.WorldStorage.Controllers // old: public override IActionResult GetRelocalizationInformation([FromQuery(Name = "uuids")][Required()] List<GetRelocalizationInformationUuidsParameterInner> uuids, [FromQuery(Name = "capabilities")][Required()] List<Capability> capabilities, [FromHeader(Name = "token")] string token) public override IActionResult GetRelocalizationInformation([FromQuery(Name = "uuids")][Required()] List<UuidAndMode> uuids, [FromQuery(Name = "capabilities")][Required()] List<Capability> capabilities, [FromHeader(Name = "token")] string token) { if (!Startup.IsAccessGranted(token)) return StatusCode(511, new Error() { Message = "Invalid token!" }); WorldAnchorService _worldAnchorService = WorldAnchorService.Singleton as WorldAnchorService; TrackableService _trackableService = TrackableService.Singleton as TrackableService; Loading @@ -62,8 +64,12 @@ namespace ETSI.ARF.OpenAPI.WorldStorage.Controllers var result = new RelocalizationInformations(); result.RelocInfo = new List<RelocalizationInformation>(); Guid errorUid = Guid.Empty; foreach (var request in uuids) { //System.Diagnostics.Debug.WriteLine("RelocInfo: Looking in the WS database for UUID=" + request.Uuid.ToString()); var anchor = _worldAnchorService.Get(request.Uuid); Trackable trackable = null; Loading Loading @@ -119,13 +125,16 @@ namespace ETSI.ARF.OpenAPI.WorldStorage.Controllers } else { Console.WriteLine($"WorldAnchor with UUID {request.Uuid} does not exist in database"); Console.WriteLine($"Trackable or WorldAnchor with UUID {request.Uuid} does not exist in database"); } } return result.RelocInfo.Count > 0 ? new ObjectResult(result) : StatusCode(404, new Error() { Message = "Not found, could not find UUID in database." }); return result.RelocInfo.Count > 0 ? new ObjectResult(result) : StatusCode(404, new Error() { Message = "Not found, could not find UUID(s) in database." }); } // // Helpers // private List<RelocObject> FindRelocInfo(Guid targetUUID, ModeWorldStorage mode, Matrix4x4 matrix, List<Capability> capabilities, ref List<Guid> history) { var results = new List<RelocObject>(); Loading server/worldstorage/src/ETSI.ARF.OpenAPI.WorldStorage/ETSI-ARF/ControllersImpl/TrackablesImpl.cs +18 −6 Original line number Diff line number Diff line Loading @@ -15,7 +15,7 @@ // See the License for the specific language governing permissions and // limitations under the License. // // Last change: June 2024 // Last change: September 2024 // /* Loading Loading @@ -66,6 +66,8 @@ namespace ETSI.ARF.OpenAPI.WorldStorage.Controllers /// </summary> public override IActionResult AddTrackable([FromBody] Trackable trackable, [FromHeader] string token) { if (!Startup.IsAccessGranted(token)) return StatusCode(511, new Error() { Message = "Invalid token!" }); if (String.IsNullOrEmpty(trackable.UUID.ToString())) { trackable.UUID = Guid.NewGuid(); Loading @@ -77,7 +79,7 @@ namespace ETSI.ARF.OpenAPI.WorldStorage.Controllers { return StatusCode(409, new Error() { Message = "UUID already existing!" }); } else return StatusCode(200, new Error() { Message = mytrackable.UUID.ToString() }); else return StatusCode(200, new Success() { Message = mytrackable.UUID.ToString() }); } catch (Exception e) { Loading @@ -90,6 +92,8 @@ namespace ETSI.ARF.OpenAPI.WorldStorage.Controllers /// </summary> public override IActionResult DeleteTrackable([FromRoute(Name = "trackableUUID")][Required] Guid trackableUUID, [FromHeader] string token) { if (!Startup.IsAccessGranted(token)) return StatusCode(511, new Error() { Message = "Invalid token!" }); // Access other service(s) WorldLinkService _worldLinkService = WorldLinkService.Singleton as WorldLinkService; Loading Loading @@ -121,7 +125,8 @@ namespace ETSI.ARF.OpenAPI.WorldStorage.Controllers { result += ", removed object was referenced in " + worldlinkinfo + " and removed there as well"; } return (count > 0) ? new ObjectResult(result) : StatusCode(404, new Error() { Message = "Not found, could not find UUID in database." }); result += " Token: " + token; return (count > 0) ? StatusCode(200, new Success() { Message = result }) : StatusCode(404, new Error() { Message = "Not found, could not find UUID in database." }); } /// <summary> Loading @@ -129,6 +134,8 @@ namespace ETSI.ARF.OpenAPI.WorldStorage.Controllers /// </summary> public override IActionResult GetTrackableById([FromRoute(Name = "trackableUUID")][Required] Guid trackableUUID, [FromHeader] string token) { if (!Startup.IsAccessGranted(token)) return StatusCode(511, new Error() { Message = "Invalid token!" }); Trackable trackable = _trackableService.Get(trackableUUID); return (null != trackable) ? new ObjectResult(trackable) : StatusCode(404, new Error() { Message = "Not found, could not find UUID in database." }); } Loading @@ -138,8 +145,11 @@ namespace ETSI.ARF.OpenAPI.WorldStorage.Controllers /// </summary> public override IActionResult GetTrackables([FromHeader] string token) { List<Trackable> trackablelist = _trackableService.Get(); return new ObjectResult(trackablelist); if (!Startup.IsAccessGranted(token)) return StatusCode(511, new Error() { Message = "Invalid token!" }); TrackablesResponse response = new TrackablesResponse(); response.Trackables = _trackableService.Get(); return new ObjectResult(response); } Loading @@ -149,6 +159,8 @@ namespace ETSI.ARF.OpenAPI.WorldStorage.Controllers /// </summary> public override IActionResult ModifyTrackable([FromBody] Trackable trackable, [FromHeader] string token) { if (!Startup.IsAccessGranted(token)) return StatusCode(511, new Error() { Message = "Invalid token!" }); long count = _trackableService.Replace(trackable); if (count == 0) { Loading @@ -156,7 +168,7 @@ namespace ETSI.ARF.OpenAPI.WorldStorage.Controllers } else { return StatusCode(200, new Error() { Message = trackable.UUID.ToString() }); return StatusCode(200, new Success() { Message = trackable.UUID.ToString() }); } } } Loading server/worldstorage/src/ETSI.ARF.OpenAPI.WorldStorage/ETSI-ARF/ControllersImpl/WorldAnchorsImpl.cs +16 −5 Original line number Diff line number Diff line Loading @@ -66,6 +66,8 @@ namespace ETSI.ARF.OpenAPI.WorldStorage.Controllers /// </summary> public override IActionResult AddWorldAnchor([FromBody] WorldAnchor worldAnchor, [FromHeader] string token) { if (!Startup.IsAccessGranted(token)) return StatusCode(511, new Error() { Message = "Invalid token!" }); if (String.IsNullOrEmpty(worldAnchor.UUID.ToString())) { worldAnchor.UUID = Guid.NewGuid(); Loading @@ -77,7 +79,7 @@ namespace ETSI.ARF.OpenAPI.WorldStorage.Controllers { return StatusCode(409, new Error() { Message = "UUID alread exexisting!" }); } else return StatusCode(200, new Error() { Message = myworldanchor.UUID.ToString() }); else return StatusCode(200, new Success() { Message = myworldanchor.UUID.ToString() }); } catch (Exception e) { Loading @@ -90,6 +92,8 @@ namespace ETSI.ARF.OpenAPI.WorldStorage.Controllers /// </summary> public override IActionResult DeleteWorldAnchor([FromRoute(Name = "worldAnchorUUID")][Required] Guid worldAnchorUUID, [FromHeader] string token) { if (!Startup.IsAccessGranted(token)) return StatusCode(511, new Error() { Message = "Invalid token!" }); // Access other service(s) WorldLinkService _worldLinkService = WorldLinkService.Singleton as WorldLinkService; Loading Loading @@ -121,7 +125,7 @@ namespace ETSI.ARF.OpenAPI.WorldStorage.Controllers { result += ", but removed object was referenced in " + worldlinkinfo + " and removed there as well"; } return (count > 0) ? new ObjectResult(result) : StatusCode(404, new Error() { Message = "Not found, could not find UUID in database." }); return (count > 0) ? StatusCode(200, new Success() { Message = result }) : StatusCode(404, new Error() { Message = "Not found, could not find UUID in database." }); } /// <summary> Loading @@ -129,6 +133,8 @@ namespace ETSI.ARF.OpenAPI.WorldStorage.Controllers /// </summary> public override IActionResult GetWorldAnchorById([FromRoute(Name = "worldAnchorUUID")][Required] Guid worldAnchorUUID, [FromHeader] string token) { if (!Startup.IsAccessGranted(token)) return StatusCode(511, new Error() { Message = "Invalid token!" }); WorldAnchor myworldanchor = _worldAnchorService.Get(worldAnchorUUID); return (null != myworldanchor) ? new ObjectResult(myworldanchor) : StatusCode(404, new Error() { Message = "Not found, could not find UUID in database." }); } Loading @@ -138,8 +144,11 @@ namespace ETSI.ARF.OpenAPI.WorldStorage.Controllers /// </summary> public override IActionResult GetWorldAnchors([FromHeader] string token) { List<WorldAnchor> worldanchorlist = _worldAnchorService.Get(); return new ObjectResult(worldanchorlist); if (!Startup.IsAccessGranted(token)) return StatusCode(511, new Error() { Message = "Invalid token!" }); WorldAnchorsResponse response = new WorldAnchorsResponse(); response.WorldAnchors = _worldAnchorService.Get(); return new ObjectResult(response); } Loading @@ -149,6 +158,8 @@ namespace ETSI.ARF.OpenAPI.WorldStorage.Controllers /// </summary> public override IActionResult ModifyWorldAnchor([FromBody] WorldAnchor worldAnchor, [FromHeader] string token) { if (!Startup.IsAccessGranted(token)) return StatusCode(511, new Error() { Message = "Invalid token!" }); long count = _worldAnchorService.Replace(worldAnchor); if (count == 0) { Loading @@ -156,7 +167,7 @@ namespace ETSI.ARF.OpenAPI.WorldStorage.Controllers } else { return StatusCode(200, new Error() { Message = worldAnchor.UUID.ToString() }); return StatusCode(200, new Success() { Message = worldAnchor.UUID.ToString() }); } } Loading server/worldstorage/src/ETSI.ARF.OpenAPI.WorldStorage/ETSI-ARF/ControllersImpl/WorldLinksImpl.cs +19 −7 Original line number Diff line number Diff line Loading @@ -15,7 +15,7 @@ // See the License for the specific language governing permissions and // limitations under the License. // // Last change: June 2024 // Last change: September 2024 // /* Loading Loading @@ -65,6 +65,8 @@ namespace ETSI.ARF.OpenAPI.WorldStorage.Controllers /// </summary> public override IActionResult AddWorldLink([FromBody] WorldLink worldLink, [FromHeader] string token) { if (!Startup.IsAccessGranted(token)) return StatusCode(511, new Error() { Message = "Invalid token!" }); if (String.IsNullOrEmpty(worldLink.UUID.ToString())) { worldLink.UUID = Guid.NewGuid(); Loading @@ -76,7 +78,7 @@ namespace ETSI.ARF.OpenAPI.WorldStorage.Controllers { return StatusCode(409, new Error() { Message = "UUID already existing!" }); } else return StatusCode(200, new Error() { Message = myworldlink.UUID.ToString() }); else return StatusCode(200, new Success() { Message = myworldlink.UUID.ToString() }); } catch (Exception e) { Loading @@ -89,8 +91,10 @@ namespace ETSI.ARF.OpenAPI.WorldStorage.Controllers /// </summary> public override IActionResult DeleteWorldLink([FromRoute(Name = "worldLinkUUID")][Required] Guid worldLinkUUID, [FromHeader] string token) { if (!Startup.IsAccessGranted(token)) return StatusCode(511, new Error() { Message = "Invalid token!" }); long count = _worldLinkService.Remove(worldLinkUUID); return (count > 0) ? new ObjectResult("ok") : StatusCode(404, new Error() { Message = "Not found, could not find UUID in database." }); return (count > 0) ? StatusCode(200, new Success() { Message = "ok" } ) : StatusCode(404, new Error() { Message = "Not found, could not find UUID in database." }); } Loading @@ -99,6 +103,8 @@ namespace ETSI.ARF.OpenAPI.WorldStorage.Controllers /// </summary> public override IActionResult GetWorldLinkById([FromRoute(Name = "worldLinkUUID")][Required] Guid worldLinkUUID, [FromHeader] string token) { if (!Startup.IsAccessGranted(token)) return StatusCode(511, new Error() { Message = "Invalid token!" }); // Access other service(s) TrackableService _trackableService = TrackableService.Singleton as TrackableService; WorldAnchorService _worldAnchorService = WorldAnchorService.Singleton as WorldAnchorService; Loading Loading @@ -149,12 +155,16 @@ namespace ETSI.ARF.OpenAPI.WorldStorage.Controllers /// </summary> public override IActionResult GetWorldLinks([FromHeader] string token) { if (!Startup.IsAccessGranted(token)) return StatusCode(511, new Error() { Message = "Invalid token!" }); WorldLinksResponse response = new WorldLinksResponse(); // Access other service(s) TrackableService _trackableService = TrackableService.Singleton as TrackableService; WorldAnchorService _worldAnchorService = WorldAnchorService.Singleton as WorldAnchorService; List<WorldLink> worldlinklist = _worldLinkService.Get(); foreach (WorldLink myworldlink in worldlinklist) response.WorldLinks = _worldLinkService.Get(); foreach (WorldLink myworldlink in response.WorldLinks) { // check TypeFrom if (myworldlink.TypeFrom == TypeWorldStorage.TRACKABLEEnum) Loading Loading @@ -191,7 +201,7 @@ namespace ETSI.ARF.OpenAPI.WorldStorage.Controllers } } } return new ObjectResult(worldlinklist); return new ObjectResult(response); } Loading @@ -201,6 +211,8 @@ namespace ETSI.ARF.OpenAPI.WorldStorage.Controllers /// </summary> public override IActionResult ModifyWorldLink([FromBody] WorldLink worldLink, [FromHeader] string token) { if (!Startup.IsAccessGranted(token)) return StatusCode(511, new Error() { Message = "Invalid token!" }); long count = _worldLinkService.Replace(worldLink); if (count == 0) { Loading @@ -208,7 +220,7 @@ namespace ETSI.ARF.OpenAPI.WorldStorage.Controllers } else { return StatusCode(200, new Error() { Message = worldLink.UUID.ToString() }); return StatusCode(200, new Success() { Message = worldLink.UUID.ToString() }); } } } Loading Loading
openapi @ 99ea877d Original line number Diff line number Diff line Subproject commit b639a02180c2b5e301c77483b3a2fa645ba94169 Subproject commit 99ea877dca8ba0587699f12dab77a43f79a836fc
server/worldstorage/src/ETSI.ARF.OpenAPI.WorldStorage/ETSI-ARF/ControllersImpl/RelocalizationInformationImpl.cs +11 −2 Original line number Diff line number Diff line Loading @@ -55,6 +55,8 @@ namespace ETSI.ARF.OpenAPI.WorldStorage.Controllers // old: public override IActionResult GetRelocalizationInformation([FromQuery(Name = "uuids")][Required()] List<GetRelocalizationInformationUuidsParameterInner> uuids, [FromQuery(Name = "capabilities")][Required()] List<Capability> capabilities, [FromHeader(Name = "token")] string token) public override IActionResult GetRelocalizationInformation([FromQuery(Name = "uuids")][Required()] List<UuidAndMode> uuids, [FromQuery(Name = "capabilities")][Required()] List<Capability> capabilities, [FromHeader(Name = "token")] string token) { if (!Startup.IsAccessGranted(token)) return StatusCode(511, new Error() { Message = "Invalid token!" }); WorldAnchorService _worldAnchorService = WorldAnchorService.Singleton as WorldAnchorService; TrackableService _trackableService = TrackableService.Singleton as TrackableService; Loading @@ -62,8 +64,12 @@ namespace ETSI.ARF.OpenAPI.WorldStorage.Controllers var result = new RelocalizationInformations(); result.RelocInfo = new List<RelocalizationInformation>(); Guid errorUid = Guid.Empty; foreach (var request in uuids) { //System.Diagnostics.Debug.WriteLine("RelocInfo: Looking in the WS database for UUID=" + request.Uuid.ToString()); var anchor = _worldAnchorService.Get(request.Uuid); Trackable trackable = null; Loading Loading @@ -119,13 +125,16 @@ namespace ETSI.ARF.OpenAPI.WorldStorage.Controllers } else { Console.WriteLine($"WorldAnchor with UUID {request.Uuid} does not exist in database"); Console.WriteLine($"Trackable or WorldAnchor with UUID {request.Uuid} does not exist in database"); } } return result.RelocInfo.Count > 0 ? new ObjectResult(result) : StatusCode(404, new Error() { Message = "Not found, could not find UUID in database." }); return result.RelocInfo.Count > 0 ? new ObjectResult(result) : StatusCode(404, new Error() { Message = "Not found, could not find UUID(s) in database." }); } // // Helpers // private List<RelocObject> FindRelocInfo(Guid targetUUID, ModeWorldStorage mode, Matrix4x4 matrix, List<Capability> capabilities, ref List<Guid> history) { var results = new List<RelocObject>(); Loading
server/worldstorage/src/ETSI.ARF.OpenAPI.WorldStorage/ETSI-ARF/ControllersImpl/TrackablesImpl.cs +18 −6 Original line number Diff line number Diff line Loading @@ -15,7 +15,7 @@ // See the License for the specific language governing permissions and // limitations under the License. // // Last change: June 2024 // Last change: September 2024 // /* Loading Loading @@ -66,6 +66,8 @@ namespace ETSI.ARF.OpenAPI.WorldStorage.Controllers /// </summary> public override IActionResult AddTrackable([FromBody] Trackable trackable, [FromHeader] string token) { if (!Startup.IsAccessGranted(token)) return StatusCode(511, new Error() { Message = "Invalid token!" }); if (String.IsNullOrEmpty(trackable.UUID.ToString())) { trackable.UUID = Guid.NewGuid(); Loading @@ -77,7 +79,7 @@ namespace ETSI.ARF.OpenAPI.WorldStorage.Controllers { return StatusCode(409, new Error() { Message = "UUID already existing!" }); } else return StatusCode(200, new Error() { Message = mytrackable.UUID.ToString() }); else return StatusCode(200, new Success() { Message = mytrackable.UUID.ToString() }); } catch (Exception e) { Loading @@ -90,6 +92,8 @@ namespace ETSI.ARF.OpenAPI.WorldStorage.Controllers /// </summary> public override IActionResult DeleteTrackable([FromRoute(Name = "trackableUUID")][Required] Guid trackableUUID, [FromHeader] string token) { if (!Startup.IsAccessGranted(token)) return StatusCode(511, new Error() { Message = "Invalid token!" }); // Access other service(s) WorldLinkService _worldLinkService = WorldLinkService.Singleton as WorldLinkService; Loading Loading @@ -121,7 +125,8 @@ namespace ETSI.ARF.OpenAPI.WorldStorage.Controllers { result += ", removed object was referenced in " + worldlinkinfo + " and removed there as well"; } return (count > 0) ? new ObjectResult(result) : StatusCode(404, new Error() { Message = "Not found, could not find UUID in database." }); result += " Token: " + token; return (count > 0) ? StatusCode(200, new Success() { Message = result }) : StatusCode(404, new Error() { Message = "Not found, could not find UUID in database." }); } /// <summary> Loading @@ -129,6 +134,8 @@ namespace ETSI.ARF.OpenAPI.WorldStorage.Controllers /// </summary> public override IActionResult GetTrackableById([FromRoute(Name = "trackableUUID")][Required] Guid trackableUUID, [FromHeader] string token) { if (!Startup.IsAccessGranted(token)) return StatusCode(511, new Error() { Message = "Invalid token!" }); Trackable trackable = _trackableService.Get(trackableUUID); return (null != trackable) ? new ObjectResult(trackable) : StatusCode(404, new Error() { Message = "Not found, could not find UUID in database." }); } Loading @@ -138,8 +145,11 @@ namespace ETSI.ARF.OpenAPI.WorldStorage.Controllers /// </summary> public override IActionResult GetTrackables([FromHeader] string token) { List<Trackable> trackablelist = _trackableService.Get(); return new ObjectResult(trackablelist); if (!Startup.IsAccessGranted(token)) return StatusCode(511, new Error() { Message = "Invalid token!" }); TrackablesResponse response = new TrackablesResponse(); response.Trackables = _trackableService.Get(); return new ObjectResult(response); } Loading @@ -149,6 +159,8 @@ namespace ETSI.ARF.OpenAPI.WorldStorage.Controllers /// </summary> public override IActionResult ModifyTrackable([FromBody] Trackable trackable, [FromHeader] string token) { if (!Startup.IsAccessGranted(token)) return StatusCode(511, new Error() { Message = "Invalid token!" }); long count = _trackableService.Replace(trackable); if (count == 0) { Loading @@ -156,7 +168,7 @@ namespace ETSI.ARF.OpenAPI.WorldStorage.Controllers } else { return StatusCode(200, new Error() { Message = trackable.UUID.ToString() }); return StatusCode(200, new Success() { Message = trackable.UUID.ToString() }); } } } Loading
server/worldstorage/src/ETSI.ARF.OpenAPI.WorldStorage/ETSI-ARF/ControllersImpl/WorldAnchorsImpl.cs +16 −5 Original line number Diff line number Diff line Loading @@ -66,6 +66,8 @@ namespace ETSI.ARF.OpenAPI.WorldStorage.Controllers /// </summary> public override IActionResult AddWorldAnchor([FromBody] WorldAnchor worldAnchor, [FromHeader] string token) { if (!Startup.IsAccessGranted(token)) return StatusCode(511, new Error() { Message = "Invalid token!" }); if (String.IsNullOrEmpty(worldAnchor.UUID.ToString())) { worldAnchor.UUID = Guid.NewGuid(); Loading @@ -77,7 +79,7 @@ namespace ETSI.ARF.OpenAPI.WorldStorage.Controllers { return StatusCode(409, new Error() { Message = "UUID alread exexisting!" }); } else return StatusCode(200, new Error() { Message = myworldanchor.UUID.ToString() }); else return StatusCode(200, new Success() { Message = myworldanchor.UUID.ToString() }); } catch (Exception e) { Loading @@ -90,6 +92,8 @@ namespace ETSI.ARF.OpenAPI.WorldStorage.Controllers /// </summary> public override IActionResult DeleteWorldAnchor([FromRoute(Name = "worldAnchorUUID")][Required] Guid worldAnchorUUID, [FromHeader] string token) { if (!Startup.IsAccessGranted(token)) return StatusCode(511, new Error() { Message = "Invalid token!" }); // Access other service(s) WorldLinkService _worldLinkService = WorldLinkService.Singleton as WorldLinkService; Loading Loading @@ -121,7 +125,7 @@ namespace ETSI.ARF.OpenAPI.WorldStorage.Controllers { result += ", but removed object was referenced in " + worldlinkinfo + " and removed there as well"; } return (count > 0) ? new ObjectResult(result) : StatusCode(404, new Error() { Message = "Not found, could not find UUID in database." }); return (count > 0) ? StatusCode(200, new Success() { Message = result }) : StatusCode(404, new Error() { Message = "Not found, could not find UUID in database." }); } /// <summary> Loading @@ -129,6 +133,8 @@ namespace ETSI.ARF.OpenAPI.WorldStorage.Controllers /// </summary> public override IActionResult GetWorldAnchorById([FromRoute(Name = "worldAnchorUUID")][Required] Guid worldAnchorUUID, [FromHeader] string token) { if (!Startup.IsAccessGranted(token)) return StatusCode(511, new Error() { Message = "Invalid token!" }); WorldAnchor myworldanchor = _worldAnchorService.Get(worldAnchorUUID); return (null != myworldanchor) ? new ObjectResult(myworldanchor) : StatusCode(404, new Error() { Message = "Not found, could not find UUID in database." }); } Loading @@ -138,8 +144,11 @@ namespace ETSI.ARF.OpenAPI.WorldStorage.Controllers /// </summary> public override IActionResult GetWorldAnchors([FromHeader] string token) { List<WorldAnchor> worldanchorlist = _worldAnchorService.Get(); return new ObjectResult(worldanchorlist); if (!Startup.IsAccessGranted(token)) return StatusCode(511, new Error() { Message = "Invalid token!" }); WorldAnchorsResponse response = new WorldAnchorsResponse(); response.WorldAnchors = _worldAnchorService.Get(); return new ObjectResult(response); } Loading @@ -149,6 +158,8 @@ namespace ETSI.ARF.OpenAPI.WorldStorage.Controllers /// </summary> public override IActionResult ModifyWorldAnchor([FromBody] WorldAnchor worldAnchor, [FromHeader] string token) { if (!Startup.IsAccessGranted(token)) return StatusCode(511, new Error() { Message = "Invalid token!" }); long count = _worldAnchorService.Replace(worldAnchor); if (count == 0) { Loading @@ -156,7 +167,7 @@ namespace ETSI.ARF.OpenAPI.WorldStorage.Controllers } else { return StatusCode(200, new Error() { Message = worldAnchor.UUID.ToString() }); return StatusCode(200, new Success() { Message = worldAnchor.UUID.ToString() }); } } Loading
server/worldstorage/src/ETSI.ARF.OpenAPI.WorldStorage/ETSI-ARF/ControllersImpl/WorldLinksImpl.cs +19 −7 Original line number Diff line number Diff line Loading @@ -15,7 +15,7 @@ // See the License for the specific language governing permissions and // limitations under the License. // // Last change: June 2024 // Last change: September 2024 // /* Loading Loading @@ -65,6 +65,8 @@ namespace ETSI.ARF.OpenAPI.WorldStorage.Controllers /// </summary> public override IActionResult AddWorldLink([FromBody] WorldLink worldLink, [FromHeader] string token) { if (!Startup.IsAccessGranted(token)) return StatusCode(511, new Error() { Message = "Invalid token!" }); if (String.IsNullOrEmpty(worldLink.UUID.ToString())) { worldLink.UUID = Guid.NewGuid(); Loading @@ -76,7 +78,7 @@ namespace ETSI.ARF.OpenAPI.WorldStorage.Controllers { return StatusCode(409, new Error() { Message = "UUID already existing!" }); } else return StatusCode(200, new Error() { Message = myworldlink.UUID.ToString() }); else return StatusCode(200, new Success() { Message = myworldlink.UUID.ToString() }); } catch (Exception e) { Loading @@ -89,8 +91,10 @@ namespace ETSI.ARF.OpenAPI.WorldStorage.Controllers /// </summary> public override IActionResult DeleteWorldLink([FromRoute(Name = "worldLinkUUID")][Required] Guid worldLinkUUID, [FromHeader] string token) { if (!Startup.IsAccessGranted(token)) return StatusCode(511, new Error() { Message = "Invalid token!" }); long count = _worldLinkService.Remove(worldLinkUUID); return (count > 0) ? new ObjectResult("ok") : StatusCode(404, new Error() { Message = "Not found, could not find UUID in database." }); return (count > 0) ? StatusCode(200, new Success() { Message = "ok" } ) : StatusCode(404, new Error() { Message = "Not found, could not find UUID in database." }); } Loading @@ -99,6 +103,8 @@ namespace ETSI.ARF.OpenAPI.WorldStorage.Controllers /// </summary> public override IActionResult GetWorldLinkById([FromRoute(Name = "worldLinkUUID")][Required] Guid worldLinkUUID, [FromHeader] string token) { if (!Startup.IsAccessGranted(token)) return StatusCode(511, new Error() { Message = "Invalid token!" }); // Access other service(s) TrackableService _trackableService = TrackableService.Singleton as TrackableService; WorldAnchorService _worldAnchorService = WorldAnchorService.Singleton as WorldAnchorService; Loading Loading @@ -149,12 +155,16 @@ namespace ETSI.ARF.OpenAPI.WorldStorage.Controllers /// </summary> public override IActionResult GetWorldLinks([FromHeader] string token) { if (!Startup.IsAccessGranted(token)) return StatusCode(511, new Error() { Message = "Invalid token!" }); WorldLinksResponse response = new WorldLinksResponse(); // Access other service(s) TrackableService _trackableService = TrackableService.Singleton as TrackableService; WorldAnchorService _worldAnchorService = WorldAnchorService.Singleton as WorldAnchorService; List<WorldLink> worldlinklist = _worldLinkService.Get(); foreach (WorldLink myworldlink in worldlinklist) response.WorldLinks = _worldLinkService.Get(); foreach (WorldLink myworldlink in response.WorldLinks) { // check TypeFrom if (myworldlink.TypeFrom == TypeWorldStorage.TRACKABLEEnum) Loading Loading @@ -191,7 +201,7 @@ namespace ETSI.ARF.OpenAPI.WorldStorage.Controllers } } } return new ObjectResult(worldlinklist); return new ObjectResult(response); } Loading @@ -201,6 +211,8 @@ namespace ETSI.ARF.OpenAPI.WorldStorage.Controllers /// </summary> public override IActionResult ModifyWorldLink([FromBody] WorldLink worldLink, [FromHeader] string token) { if (!Startup.IsAccessGranted(token)) return StatusCode(511, new Error() { Message = "Invalid token!" }); long count = _worldLinkService.Replace(worldLink); if (count == 0) { Loading @@ -208,7 +220,7 @@ namespace ETSI.ARF.OpenAPI.WorldStorage.Controllers } else { return StatusCode(200, new Error() { Message = worldLink.UUID.ToString() }); return StatusCode(200, new Success() { Message = worldLink.UUID.ToString() }); } } } Loading