oslc-op / sysml-oslc-server

Sample code to demonstrate how to use Lyo Designer to create an OSLC server for the SysML v2 REST API.
Apache License 2.0
10 stars 2 forks source link

Selection dialog should support some kind of search #17

Open jamsden opened 4 years ago

jamsden commented 4 years ago

Allow users to search by resource SysML type and title (or identifier if there is no title). See: Updating generated dialogs

Or maybe allow OSLC query Where clause fragment int he Selection dialog search field.

Notes:

Selection Dialog sequence:

  1. User does GET on selector path which calls ServiceProviderService1.ElementSelector (IoTPlatformService.RequirementAndChangeRequestAndResourceSelector)
no changes to this file

  2. ElementSelector dispatches to /org/oasis/oslcop/sysml/elementselector.jsp (iotpselectiondialogselector.jsp) because the first time, terms will be null.
This JSP adds the selectType selection field and dispatches to the delegated-ui-typed.js file.
Also add an additional script to handle the selectType and adds the selected type to the selectionUri?type query parameter which is now used directly in the search

  3. elementselector.jsp (iotpselectiondialogselector.jsp) displays type dropdown list, and allows the user to enter a Java regular expression to match on the dcterms:title of the resources with that type

  4. elementselector.jsp (iotpselectiondialogselector.jsp) uses webapp/static/js/delegeted-ui-typed.js (delegatedUItyped.js) to get the terms search string and makes the second call too get the selection dialog

  5. ServiceProviderService1.ElementSelector is called a second time, this time with terms set to the search string.

  6. ElementSelector calls SysmlServerManager.ElementSelector (CE4IoTConnectorManager.RequirementAndChangeRequestAndResourceSelector) too get the resources that match the terms
ElementSelector needs to be updated to call queryElements
queryElements needs to match on the terms Java regular expression for the dcterms:title

  7. ElementSelector then dispatches to /org/oasis/oslcop/sysml/elementselectorresults.jsp (iotpselectiondialogselectorresults.jsp) to display the results and allow the user to select the target resources for the link. 

  8. User then presses OK which dispatches back to the OSLC client application to actually create the links.

    • [ ] ElementSelector calls queryElements, but isn't providing the resourceType. Don't really need the type dropdown for now because there's no REST API query facility that can use it. Do this later, just match on the name for now. Deprecated by the new approach below.

    • [ ] Better idea: don't change the elementselector.jsp. Instead, allow the user to enter [type::]regex into the search field. Then fix queryElements to use the type and regex to match the elements. This will be better because there are a lot of different types in SysML and a dropdown for them all would be impractical. type:: matches UML type syntax.

Note the regex should match element.toString() to match on the dcterm:title if available, otherwise on the dcterns:identifier.

jadelkhoury commented 4 years ago

Sure. I am considering to change the generator to offer this search filtering as standard.

jadelkhoury commented 3 years ago

This is now solved. I wanted to make a pull request, but ended up pushing to master anyway :-)