edit is finding drafts for other documents

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

edit is finding drafts for other documents

bwallis42
When I navigate to the edit url for a form  (http://localhost/orbeon/fr/cpf/form2/edit/201509306), orbeon does a query to see if there are any drafts, the query looks like this (from my persistence layer debug)

POST /cpf/search/cpf/form2 Request Content-Type: application/xml
Path Parameters:
  appname: [cpf]
  formname: [form2]
Query Parameters:
Request Headers:
  orbeon-versioning: false
  orbeon-roles: infomedix, system
  cookie: JSESSIONIDSSO=66E7A2DA49C3ACCDA77802FA841FB4EC, JSESSIONID=80C767F60A843C38C40D305E3A650EF2
  orbeon-username: system
  orbeon-token: b3925a3dfa987e413ea6c8f0737368dbcff33489
  orbeon-group: infomedix
  content-length: 848
  content-type: application/xml
  host: localhost:8080
  connection: Keep-Alive
  cookie2: $Version=1
  accept-encoding: gzip,deflate
Cookies:
JSESSIONIDSSO: path="null" value="66E7A2DA49C3ACCDA77802FA841FB4EC" version=0 domain="null" value=-1 secure=false comment="null"
JSESSIONID: path="null" value="80C767F60A843C38C40D305E3A650EF2" version=0 domain="null" value=-1 secure=false comment="null"
Search request body:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<search>
    <drafts>only</drafts>
    <page-size>10</page-size>
    <page-number>1</page-number>
    <lang>en</lang>
</search>

Form search for template cpf/form2 returning 2 of a total of 2 forms
Forms search returns:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<documents search-total="2" total="2">
    <document created="2015-10-05T15:07:14.563+11:00" last-modified="2015-10-05T15:07:16.926+11:00" draft="true" name="201509307" operations="*">
        <details/>
    </document>
    <document created="2015-10-05T14:10:50.241+11:00" last-modified="2015-10-05T14:40:37.249+11:00" draft="true" name="201509308" operations="*">
        <details/>
    </document>
</documents>

Now, I am editing a form template named "cpf/form2" and with the name (id)  "201509306". The query is for draft forms but has no indication of the form id in it so it returns all matching draft forms for the form template "cpf/form2".

The two forms returned have different IDs from the form I am editing and so to my mind are not autosaved drafts of form "201509306" but the editor prompts me to select the saved form or the autosaved draft. if I select the "Open auto-saved draft" option then the server logs a 404 Not Found error which my persistence layer returned since there is no draft with the id "201509306".  I am presented with an empty form.

Shouldn't the query for drafts be indicating which document ID it is interested in or match the current document ID against the IDs in the result returned from the query?

I don't think this works correctly for drafts of new (unsaved) forms either.

Is this something I've misunderstood in my persistence implementation?

thanks
Reply | Threaded
Open this post in threaded view
|

Re: edit is finding drafts for other documents

bwallis42
I've just been re-reading the persistence api documentation, in particular the section on search and drafts (https://github.com/orbeon/orbeon-forms/wiki/Form-Runner-~-APIs-~-Persistence-~-Search#drafts) where it says:
The <drafts> element can have the following attributes when the value is only or include:

for-document-id="$document-id": return only drafts with the given document id
for-never-saved-document="true": return only drafts for documents never saved
I'm not seeing these values in the search queries that are sent to my persistence layer. Is there something I have to configure to get these included in the search query?

thanks.
Reply | Threaded
Open this post in threaded view
|

Re: edit is finding drafts for other documents

bruno.buzzi
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: edit is finding drafts for other documents

bwallis42
Thanks Bruno,
  Yes there was a problem, my debug logging was not correct.

The two fields (for-document-id and for-never-saved-document) are included and I'm just not capturing them. Fixed now and working as expected.

thanks
brian...