talk@lists.collectionspace.org

WE HAVE SUNSET THIS LISTSERV - Join us at collectionspace@lyrasislists.org

View all threads

seeking clarification/tips on adding a field to a CollectionObject

JS
Joe Slag
Fri, May 27, 2011 8:33 PM

First, thanks to Patrick for pointing out that the JAXB & maven issue I
was running into earlier this week wasn't actually something I needed to
be dealing with, since I'm just trying to add a field to the
collectionobject schema and then access it through the web UI. Double
thanks for updating
http://wiki.collectionspace.org/display/collectionspace/Adding+a+Custom+Field+to+a+CollectionObject
appropriately.

Since then, I've taken another pass at the process described in that
wiki page. I've got the input showing up on the edit screen (easiest
step, admittantly) but CollectionSpace doesn't want to retain values
entered in that field when the 'save' button is clicked. The only related line I
can find in the logs is:

2011-05-27 15:16:44,521 DEBUG [http-0.0.0.0-8180-8]
[org.collectionspace.services.nuxeo.client.java.RemoteDocumentModelHandlerImpl:148]
<ns2:collectionobjects_wac
xmlns:ns2="http://walkerart.org/collectionobject"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"></ns2:collectionobjects_wac>

'collectionspace_wac' is the name of the schema I added to contain my
new field, so I get that something isn't quite working properly with my
addition, but I'm having a hard time figuring out exactly what. Any
tips on debugging or pointers on where I might have strayed from the
path?

The gory details:

  1. Added the file
    collectionobject/3rdparty/nuxeo-platform-cs-collectionobject/src/main/resources/schemas/collectionobjects_wac.xsd
    (see https://gist.github.com/9f45d84abdbd2283fe0f) which defines a
    'condition' field.

Q: the inline example in the wiki shows an element within the
http://collectionspace.org/collectionobject/ namespace, whereas the
linked example uses a site-specific namespace, which contains an element
called "collection-object_bnhm", which in turn contains the new
field(s).  Does it matter? Is one or the other correct?

  1. Added reference in core-types-contrib.xml to this new
    collectionobjects_wac schema. https://gist.github.com/2bf0aaedd4dd839c3198

  2. ran mvn clean install. Success.

  3. Skipped the JAXB steps and moved on to modifying the tenant binding
    file.  A little confusion here as the wiki indicates that the file in
    question is found at
    services/common/src/main/config/services/tenant-bindings.xml. In my 1.6
    tree, I didn't find one central tenant-bindings.xml file, but did find
    common/src/main/cspace/config/services/tenants/hearstmuseum/tenant-bindings.xml
    and
    common/src/main/cspace/config/services/tenants/collectionspace/tenant-bindings.xml
    I went with the latter, adding the following section:

https://gist.github.com/299b3dd8aaabb0934049

A little confused about what exactly I need there for namespaceURI and
schemaLocation values, tried to follow the examples though.

  1. Moving along, I shut down the servers and ran maven and ant, which
    returned without errors, a few hours later (I kid!).

  2. Added the 'condition' field to CatalogingTemplate.html, giving the
    new field the selector csc-object-identification-condition for the sake
    of having it show up high on the page.

  3. Ran mvn clean install for UI, success.

  4. Modified cspace-config.xml appropriately; added

<services-record-path id="wac">collectionspace_wac:http://walkerart.org/collectionspace,collectionspace_wac</services-record-path>

and

<field id="condition" section="wac"> <selector>.csc-object-identification-condition</selector> </field>

Again, I am a bit confused about label / namespace / root-tag here.

  1. started both servers up, and got the behavior I mentioned up top.

Cheers,
Joe

First, thanks to Patrick for pointing out that the JAXB & maven issue I was running into earlier this week wasn't actually something I needed to be dealing with, since I'm just trying to add a field to the collectionobject schema and then access it through the web UI. Double thanks for updating http://wiki.collectionspace.org/display/collectionspace/Adding+a+Custom+Field+to+a+CollectionObject appropriately. Since then, I've taken another pass at the process described in that wiki page. I've got the input showing up on the edit screen (easiest step, admittantly) but CollectionSpace doesn't want to retain values entered in that field when the 'save' button is clicked. The only related line I can find in the logs is: 2011-05-27 15:16:44,521 DEBUG [http-0.0.0.0-8180-8] [org.collectionspace.services.nuxeo.client.java.RemoteDocumentModelHandlerImpl:148] <ns2:collectionobjects_wac xmlns:ns2="http://walkerart.org/collectionobject" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"></ns2:collectionobjects_wac> 'collectionspace_wac' is the name of the schema I added to contain my new field, so I get that something isn't quite working properly with my addition, but I'm having a hard time figuring out exactly what. Any tips on debugging or pointers on where I might have strayed from the path? The gory details: 1. Added the file collectionobject/3rdparty/nuxeo-platform-cs-collectionobject/src/main/resources/schemas/collectionobjects_wac.xsd (see https://gist.github.com/9f45d84abdbd2283fe0f) which defines a 'condition' field. Q: the inline example in the wiki shows an element within the http://collectionspace.org/collectionobject/ namespace, whereas the linked example uses a site-specific namespace, which contains an element called "collection-object_bnhm", which in turn contains the new field(s). Does it matter? Is one or the other correct? 2. Added reference in core-types-contrib.xml to this new collectionobjects_wac schema. https://gist.github.com/2bf0aaedd4dd839c3198 3. ran `mvn clean install`. Success. 4. Skipped the JAXB steps and moved on to modifying the tenant binding file. A little confusion here as the wiki indicates that the file in question is found at services/common/src/main/config/services/tenant-bindings.xml. In my 1.6 tree, I didn't find one central tenant-bindings.xml file, but did find common/src/main/cspace/config/services/tenants/hearstmuseum/tenant-bindings.xml and common/src/main/cspace/config/services/tenants/collectionspace/tenant-bindings.xml I went with the latter, adding the following section: https://gist.github.com/299b3dd8aaabb0934049 A little confused about what exactly I need there for namespaceURI and schemaLocation values, tried to follow the examples though. 5. Moving along, I shut down the servers and ran maven and ant, which returned without errors, a few hours later (I kid!). 6. Added the 'condition' field to CatalogingTemplate.html, giving the new field the selector csc-object-identification-condition for the sake of having it show up high on the page. 7. Ran `mvn clean install` for UI, success. 8. Modified cspace-config.xml appropriately; added <services-record-path id="wac">collectionspace_wac:http://walkerart.org/collectionspace,collectionspace_wac</services-record-path> and <field id="condition" section="wac"> <selector>.csc-object-identification-condition</selector> </field> Again, I am a bit confused about label / namespace / root-tag here. 9. started both servers up, and got the behavior I mentioned up top. Cheers, Joe
AR
Aron Roberts
Fri, May 27, 2011 9:19 PM

Hi Joe,

At a quick and superficial glance, the steps you followed look good.

As one place to start, it'd be useful to see if Nuxeo created a
database table based on your custom schema; e.g. using the MySQL
command line client:

% mysql -u yourusername -p
Enter password:

mysql> use nuxeo;
mysql> show tables like 'collectionobjects%';
(find your 'wac' table in the list, if present)
mysql> describe collectionobjects_wac;  (or whatever it may be)

Assuming the table is present, a second thing to try would be to
send an XML payload to the CollectionObject service that includes your
custom schema part; e.g.

% curl -i -u admin@collectionspace.org:Administrator -X POST -H
"Content-Type: application/xml"
http://localhost:8180/cspace-services/collectionobjects -T
mysamplefile.xml

where 'admin@collectionspace.org' is your username, 'Administrator' is
your password, 'localhost' is the host where the services layer is
running, and 'mysamplefile.xml' is a file containing an XML payload to
create a new record.

mysamplefile.xml might look something like this (hypothetical, and
untried with your changes):

<?xml version="1.0" encoding="utf-8"?> <document name="collectionobjects"> <ns2:collectionobjects_common xmlns:ns2="http://collectionspace.org/services/collectionobject" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <titleGroupList> <titleGroup> <title>A title</title> </titleGroup> </titleGroupList> <objectNumber>2011.1.5</objectNumber> </ns2:collectionobjects_common> <ns2:collectionobjects_wac xmlns:ns2="http://walkerart.org/collectionobject" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <condition>a condition</condition> </ns2:collectionobjects_wac> </document>

What you'll ideally get back is a success response that includes the
identifier (CSID) of the new record; e.g.

HTTP/1.1 201 Created
...
Location: http://localhost:8180/cspace-services/collectionobjects/557f7356-e60a-419e-8717

You can then either use cURL or paste into a browser to view the
record.  (You may be asked to re-authenticate, if viewing via your
browser.)

If this all works, then the services side is working, and you can
move on to looking at the app and UI layers.

Aron

On Fri, May 27, 2011 at 1:33 PM, Joe Slag joe@slagwerks.com wrote:

First, thanks to Patrick for pointing out that the JAXB & maven issue I
was running into earlier this week wasn't actually something I needed to
be dealing with, since I'm just trying to add a field to the
collectionobject schema and then access it through the web UI. Double
thanks for updating
http://wiki.collectionspace.org/display/collectionspace/Adding+a+Custom+Field+to+a+CollectionObject
appropriately.

Since then, I've taken another pass at the process described in that
wiki page. I've got the input showing up on the edit screen (easiest
step, admittantly) but CollectionSpace doesn't want to retain values
entered in that field when the 'save' button is clicked. The only related line I
can find in the logs is:

 2011-05-27 15:16:44,521 DEBUG [http-0.0.0.0-8180-8]
[org.collectionspace.services.nuxeo.client.java.RemoteDocumentModelHandlerImpl:148]
<ns2:collectionobjects_wac
xmlns:ns2="http://walkerart.org/collectionobject"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"></ns2:collectionobjects_wac>

'collectionspace_wac' is the name of the schema I added to contain my
new field, so I get that something isn't quite working properly with my
addition, but I'm having a hard time figuring out exactly what. Any
tips on debugging or pointers on where I might have strayed from the
path?

The gory details:

  1. Added the file
    collectionobject/3rdparty/nuxeo-platform-cs-collectionobject/src/main/resources/schemas/collectionobjects_wac.xsd
    (see https://gist.github.com/9f45d84abdbd2283fe0f) which defines a
    'condition' field.

Q: the inline example in the wiki shows an element within the
http://collectionspace.org/collectionobject/ namespace, whereas the
linked example uses a site-specific namespace, which contains an element
called "collection-object_bnhm", which in turn contains the new
field(s).  Does it matter? Is one or the other correct?

  1. Added reference in core-types-contrib.xml to this new
    collectionobjects_wac schema. https://gist.github.com/2bf0aaedd4dd839c3198

  2. ran mvn clean install. Success.

  3. Skipped the JAXB steps and moved on to modifying the tenant binding
    file.  A little confusion here as the wiki indicates that the file in
    question is found at
    services/common/src/main/config/services/tenant-bindings.xml. In my 1.6
    tree, I didn't find one central tenant-bindings.xml file, but did find
    common/src/main/cspace/config/services/tenants/hearstmuseum/tenant-bindings.xml
    and
    common/src/main/cspace/config/services/tenants/collectionspace/tenant-bindings.xml
    I went with the latter, adding the following section:

 https://gist.github.com/299b3dd8aaabb0934049

A little confused about what exactly I need there for namespaceURI and
schemaLocation values, tried to follow the examples though.

  1. Moving along, I shut down the servers and ran maven and ant, which
    returned without errors, a few hours later (I kid!).

  2. Added the 'condition' field to CatalogingTemplate.html, giving the
    new field the selector csc-object-identification-condition for the sake
    of having it show up high on the page.

  3. Ran mvn clean install for UI, success.

  4. Modified cspace-config.xml appropriately; added

 <services-record-path id="wac">collectionspace_wac:http://walkerart.org/collectionspace,collectionspace_wac</services-record-path>

and

 <field id="condition" section="wac">
     <selector>.csc-object-identification-condition</selector>
 </field>

Again, I am a bit confused about label / namespace / root-tag here.

  1. started both servers up, and got the behavior I mentioned up top.

Cheers,
Joe


Talk mailing list
Talk@lists.collectionspace.org
http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org

Hi Joe, At a quick and superficial glance, the steps you followed look good. As one place to start, it'd be useful to see if Nuxeo created a database table based on your custom schema; e.g. using the MySQL command line client: % mysql -u yourusername -p Enter password: mysql> use nuxeo; mysql> show tables like 'collectionobjects%'; (find your 'wac' table in the list, if present) mysql> describe collectionobjects_wac; (or whatever it may be) Assuming the table is present, a second thing to try would be to send an XML payload to the CollectionObject service that includes your custom schema part; e.g. % curl -i -u admin@collectionspace.org:Administrator -X POST -H "Content-Type: application/xml" http://localhost:8180/cspace-services/collectionobjects -T mysamplefile.xml where 'admin@collectionspace.org' is your username, 'Administrator' is your password, 'localhost' is the host where the services layer is running, and 'mysamplefile.xml' is a file containing an XML payload to create a new record. mysamplefile.xml might look something like this (hypothetical, and untried with your changes): <?xml version="1.0" encoding="utf-8"?> <document name="collectionobjects"> <ns2:collectionobjects_common xmlns:ns2="http://collectionspace.org/services/collectionobject" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <titleGroupList> <titleGroup> <title>A title</title> </titleGroup> </titleGroupList> <objectNumber>2011.1.5</objectNumber> </ns2:collectionobjects_common> <ns2:collectionobjects_wac xmlns:ns2="http://walkerart.org/collectionobject" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <condition>a condition</condition> </ns2:collectionobjects_wac> </document> What you'll ideally get back is a success response that includes the identifier (CSID) of the new record; e.g. HTTP/1.1 201 Created ... Location: http://localhost:8180/cspace-services/collectionobjects/557f7356-e60a-419e-8717 You can then either use cURL or paste into a browser to view the record. (You may be asked to re-authenticate, if viewing via your browser.) If this all works, then the services side is working, and you can move on to looking at the app and UI layers. Aron On Fri, May 27, 2011 at 1:33 PM, Joe Slag <joe@slagwerks.com> wrote: > First, thanks to Patrick for pointing out that the JAXB & maven issue I > was running into earlier this week wasn't actually something I needed to > be dealing with, since I'm just trying to add a field to the > collectionobject schema and then access it through the web UI. Double > thanks for updating > http://wiki.collectionspace.org/display/collectionspace/Adding+a+Custom+Field+to+a+CollectionObject > appropriately. > > Since then, I've taken another pass at the process described in that > wiki page. I've got the input showing up on the edit screen (easiest > step, admittantly) but CollectionSpace doesn't want to retain values > entered in that field when the 'save' button is clicked. The only related line I > can find in the logs is: > >  2011-05-27 15:16:44,521 DEBUG [http-0.0.0.0-8180-8] > [org.collectionspace.services.nuxeo.client.java.RemoteDocumentModelHandlerImpl:148] > <ns2:collectionobjects_wac > xmlns:ns2="http://walkerart.org/collectionobject" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"></ns2:collectionobjects_wac> > > 'collectionspace_wac' is the name of the schema I added to contain my > new field, so I get that something isn't quite working properly with my > addition, but I'm having a hard time figuring out exactly what. Any > tips on debugging or pointers on where I might have strayed from the > path? > > The gory details: > > 1. Added the file > collectionobject/3rdparty/nuxeo-platform-cs-collectionobject/src/main/resources/schemas/collectionobjects_wac.xsd > (see https://gist.github.com/9f45d84abdbd2283fe0f) which defines a > 'condition' field. > > Q: the inline example in the wiki shows an element within the > http://collectionspace.org/collectionobject/ namespace, whereas the > linked example uses a site-specific namespace, which contains an element > called "collection-object_bnhm", which in turn contains the new > field(s).  Does it matter? Is one or the other correct? > > 2. Added reference in core-types-contrib.xml to this new > collectionobjects_wac schema. https://gist.github.com/2bf0aaedd4dd839c3198 > > 3. ran `mvn clean install`. Success. > > 4. Skipped the JAXB steps and moved on to modifying the tenant binding > file.  A little confusion here as the wiki indicates that the file in > question is found at > services/common/src/main/config/services/tenant-bindings.xml. In my 1.6 > tree, I didn't find one central tenant-bindings.xml file, but did find > common/src/main/cspace/config/services/tenants/hearstmuseum/tenant-bindings.xml > and > common/src/main/cspace/config/services/tenants/collectionspace/tenant-bindings.xml > I went with the latter, adding the following section: > >  https://gist.github.com/299b3dd8aaabb0934049 > > A little confused about what exactly I need there for namespaceURI and > schemaLocation values, tried to follow the examples though. > > 5. Moving along, I shut down the servers and ran maven and ant, which > returned without errors, a few hours later (I kid!). > > 6. Added the 'condition' field to CatalogingTemplate.html, giving the > new field the selector csc-object-identification-condition for the sake > of having it show up high on the page. > > 7. Ran `mvn clean install` for UI, success. > > 8. Modified cspace-config.xml appropriately; added > >  <services-record-path > id="wac">collectionspace_wac:http://walkerart.org/collectionspace,collectionspace_wac</services-record-path> > > and > >  <field id="condition" section="wac"> >      <selector>.csc-object-identification-condition</selector> >  </field> > > Again, I am a bit confused about label / namespace / root-tag here. > > 9. started both servers up, and got the behavior I mentioned up top. > > Cheers, > Joe > > _______________________________________________ > Talk mailing list > Talk@lists.collectionspace.org > http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org >
PS
Patrick Schmitz
Fri, May 27, 2011 9:24 PM

Do you think it would be good to send him the URL to get the UI schema from
the app layer, and make sure it looks right? It is a little non-trivial to
interpret, but...

-----Original Message-----
From: talk-bounces@lists.collectionspace.org
[mailto:talk-bounces@lists.collectionspace.org] On Behalf Of
Aron Roberts
Sent: Friday, May 27, 2011 2:20 PM
To: Joe Slag
Cc: talk@lists.collectionspace.org
Subject: Re: [Talk] seeking clarification/tips on adding a
field to aCollectionObject

Hi Joe,

At a quick and superficial glance, the steps you followed look good.

As one place to start, it'd be useful to see if Nuxeo
created a database table based on your custom schema; e.g.
using the MySQL command line client:

% mysql -u yourusername -p
Enter password:

mysql> use nuxeo;
mysql> show tables like 'collectionobjects%';
(find your 'wac' table in the list, if present)
mysql> describe collectionobjects_wac;  (or whatever it may be)

Assuming the table is present, a second thing to try would
be to send an XML payload to the CollectionObject service
that includes your custom schema part; e.g.

% curl -i -u admin@collectionspace.org:Administrator -X POST -H
"Content-Type: application/xml"
http://localhost:8180/cspace-services/collectionobjects -T
mysamplefile.xml

where 'admin@collectionspace.org' is your username,
'Administrator' is your password, 'localhost' is the host
where the services layer is running, and 'mysamplefile.xml'
is a file containing an XML payload to create a new record.

mysamplefile.xml might look something like this
(hypothetical, and untried with your changes):

<?xml version="1.0" encoding="utf-8"?> <document name="collectionobjects"> <ns2:collectionobjects_common xmlns:ns2="http://collectionspace.org/services/collectionobject" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <titleGroupList> <titleGroup> <title>A title</title> </titleGroup> </titleGroupList> <objectNumber>2011.1.5</objectNumber> </ns2:collectionobjects_common> <ns2:collectionobjects_wac xmlns:ns2="http://walkerart.org/collectionobject" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <condition>a condition</condition> </ns2:collectionobjects_wac> </document>

What you'll ideally get back is a success response that
includes the identifier (CSID) of the new record; e.g.

HTTP/1.1 201 Created
...
Location:
http://localhost:8180/cspace-services/collectionobjects/557f73

56-e60a-419e-8717

You can then either use cURL or paste into a browser to
view the record.  (You may be asked to re-authenticate, if
viewing via your
browser.)

If this all works, then the services side is working, and
you can move on to looking at the app and UI layers.

Aron

On Fri, May 27, 2011 at 1:33 PM, Joe Slag joe@slagwerks.com wrote:

First, thanks to Patrick for pointing out that the JAXB &

maven issue

I was running into earlier this week wasn't actually something I
needed to be dealing with, since I'm just trying to add a

field to the

collectionobject schema and then access it through the web

UI. Double

thanks for updating

m+Field+to+a+CollectionObject
appropriately.

Since then, I've taken another pass at the process

described in that

wiki page. I've got the input showing up on the edit screen

(easiest

step, admittantly) but CollectionSpace doesn't want to

retain values

entered in that field when the 'save' button is clicked. The only
related line I can find in the logs is:

 2011-05-27 15:16:44,521 DEBUG [http-0.0.0.0-8180-8]

[org.collectionspace.services.nuxeo.client.java.RemoteDocumentModelHan

dlerImpl:148]
<ns2:collectionobjects_wac
xmlns:ns2="http://walkerart.org/collectionobject"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"></ns2:collection

objects_wac>

'collectionspace_wac' is the name of the schema I added to

contain my

new field, so I get that something isn't quite working

properly with

my addition, but I'm having a hard time figuring out

exactly what. Any

tips on debugging or pointers on where I might have strayed

from the

path?

The gory details:

  1. Added the file

collectionobject/3rdparty/nuxeo-platform-cs-collectionobject/src/main/

resources/schemas/collectionobjects_wac.xsd
(see https://gist.github.com/9f45d84abdbd2283fe0f) which defines a
'condition' field.

Q: the inline example in the wiki shows an element within the
http://collectionspace.org/collectionobject/ namespace, whereas the
linked example uses a site-specific namespace, which contains an
element called "collection-object_bnhm", which in turn contains the
new field(s).  Does it matter? Is one or the other correct?

  1. Added reference in core-types-contrib.xml to this new
    collectionobjects_wac schema.
    https://gist.github.com/2bf0aaedd4dd839c3198

  2. ran mvn clean install. Success.

  3. Skipped the JAXB steps and moved on to modifying the

tenant binding

file.  A little confusion here as the wiki indicates that

the file in

question is found at
services/common/src/main/config/services/tenant-bindings.xml. In my
1.6 tree, I didn't find one central tenant-bindings.xml

file, but did

find

common/src/main/cspace/config/services/tenants/hearstmuseum/tenant-bin

dings.xml
and

common/src/main/cspace/config/services/tenants/collectionspace/tenant-

bindings.xml I went with the latter, adding the following section:

 https://gist.github.com/299b3dd8aaabb0934049

A little confused about what exactly I need there for

namespaceURI and

schemaLocation values, tried to follow the examples though.

  1. Moving along, I shut down the servers and ran maven and

ant, which

returned without errors, a few hours later (I kid!).

  1. Added the 'condition' field to CatalogingTemplate.html,

giving the

new field the selector csc-object-identification-condition for the
sake of having it show up high on the page.

  1. Ran mvn clean install for UI, success.

  2. Modified cspace-config.xml appropriately; added

 <services-record-path

id="wac">collectionspace_wac:http://walkerart.org/collectionspace,coll

ectionspace_wac</services-record-path>

and

 <field id="condition" section="wac">
     <selector>.csc-object-identification-condition</selector>
 </field>

Again, I am a bit confused about label / namespace / root-tag here.

  1. started both servers up, and got the behavior I mentioned up top.

Cheers,
Joe


Talk mailing list
Talk@lists.collectionspace.org

nspace.org

Do you think it would be good to send him the URL to get the UI schema from the app layer, and make sure it looks right? It is a little non-trivial to interpret, but... > -----Original Message----- > From: talk-bounces@lists.collectionspace.org > [mailto:talk-bounces@lists.collectionspace.org] On Behalf Of > Aron Roberts > Sent: Friday, May 27, 2011 2:20 PM > To: Joe Slag > Cc: talk@lists.collectionspace.org > Subject: Re: [Talk] seeking clarification/tips on adding a > field to aCollectionObject > > Hi Joe, > > At a quick and superficial glance, the steps you followed look good. > > As one place to start, it'd be useful to see if Nuxeo > created a database table based on your custom schema; e.g. > using the MySQL command line client: > > % mysql -u yourusername -p > Enter password: > > mysql> use nuxeo; > mysql> show tables like 'collectionobjects%'; > (find your 'wac' table in the list, if present) > mysql> describe collectionobjects_wac; (or whatever it may be) > > Assuming the table is present, a second thing to try would > be to send an XML payload to the CollectionObject service > that includes your custom schema part; e.g. > > % curl -i -u admin@collectionspace.org:Administrator -X POST -H > "Content-Type: application/xml" > http://localhost:8180/cspace-services/collectionobjects -T > mysamplefile.xml > > where 'admin@collectionspace.org' is your username, > 'Administrator' is your password, 'localhost' is the host > where the services layer is running, and 'mysamplefile.xml' > is a file containing an XML payload to create a new record. > > mysamplefile.xml might look something like this > (hypothetical, and untried with your changes): > > <?xml version="1.0" encoding="utf-8"?> > <document name="collectionobjects"> > <ns2:collectionobjects_common > xmlns:ns2="http://collectionspace.org/services/collectionobject" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> > <titleGroupList> > <titleGroup> > <title>A title</title> > </titleGroup> > </titleGroupList> > <objectNumber>2011.1.5</objectNumber> > </ns2:collectionobjects_common> > <ns2:collectionobjects_wac > xmlns:ns2="http://walkerart.org/collectionobject" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> > <condition>a condition</condition> > </ns2:collectionobjects_wac> > </document> > > What you'll ideally get back is a success response that > includes the identifier (CSID) of the new record; e.g. > > HTTP/1.1 201 Created > ... > Location: > http://localhost:8180/cspace-services/collectionobjects/557f73 56-e60a-419e-8717 > > You can then either use cURL or paste into a browser to > view the record. (You may be asked to re-authenticate, if > viewing via your > browser.) > > If this all works, then the services side is working, and > you can move on to looking at the app and UI layers. > > Aron > > On Fri, May 27, 2011 at 1:33 PM, Joe Slag <joe@slagwerks.com> wrote: > > First, thanks to Patrick for pointing out that the JAXB & > maven issue > > I was running into earlier this week wasn't actually something I > > needed to be dealing with, since I'm just trying to add a > field to the > > collectionobject schema and then access it through the web > UI. Double > > thanks for updating > > > http://wiki.collectionspace.org/display/collectionspace/Adding+a+Custo > > m+Field+to+a+CollectionObject > > appropriately. > > > > Since then, I've taken another pass at the process > described in that > > wiki page. I've got the input showing up on the edit screen > (easiest > > step, admittantly) but CollectionSpace doesn't want to > retain values > > entered in that field when the 'save' button is clicked. The only > > related line I can find in the logs is: > > > >  2011-05-27 15:16:44,521 DEBUG [http-0.0.0.0-8180-8] > > > [org.collectionspace.services.nuxeo.client.java.RemoteDocumentModelHan > > dlerImpl:148] > > <ns2:collectionobjects_wac > > xmlns:ns2="http://walkerart.org/collectionobject" > > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"></ns2:collection > > objects_wac> > > > > 'collectionspace_wac' is the name of the schema I added to > contain my > > new field, so I get that something isn't quite working > properly with > > my addition, but I'm having a hard time figuring out > exactly what. Any > > tips on debugging or pointers on where I might have strayed > from the > > path? > > > > The gory details: > > > > 1. Added the file > > > collectionobject/3rdparty/nuxeo-platform-cs-collectionobject/src/main/ > > resources/schemas/collectionobjects_wac.xsd > > (see https://gist.github.com/9f45d84abdbd2283fe0f) which defines a > > 'condition' field. > > > > Q: the inline example in the wiki shows an element within the > > http://collectionspace.org/collectionobject/ namespace, whereas the > > linked example uses a site-specific namespace, which contains an > > element called "collection-object_bnhm", which in turn contains the > > new field(s).  Does it matter? Is one or the other correct? > > > > 2. Added reference in core-types-contrib.xml to this new > > collectionobjects_wac schema. > > https://gist.github.com/2bf0aaedd4dd839c3198 > > > > 3. ran `mvn clean install`. Success. > > > > 4. Skipped the JAXB steps and moved on to modifying the > tenant binding > > file.  A little confusion here as the wiki indicates that > the file in > > question is found at > > services/common/src/main/config/services/tenant-bindings.xml. In my > > 1.6 tree, I didn't find one central tenant-bindings.xml > file, but did > > find > > > common/src/main/cspace/config/services/tenants/hearstmuseum/tenant-bin > > dings.xml > > and > > > common/src/main/cspace/config/services/tenants/collectionspace/tenant- > > bindings.xml I went with the latter, adding the following section: > > > >  https://gist.github.com/299b3dd8aaabb0934049 > > > > A little confused about what exactly I need there for > namespaceURI and > > schemaLocation values, tried to follow the examples though. > > > > 5. Moving along, I shut down the servers and ran maven and > ant, which > > returned without errors, a few hours later (I kid!). > > > > 6. Added the 'condition' field to CatalogingTemplate.html, > giving the > > new field the selector csc-object-identification-condition for the > > sake of having it show up high on the page. > > > > 7. Ran `mvn clean install` for UI, success. > > > > 8. Modified cspace-config.xml appropriately; added > > > >  <services-record-path > > > id="wac">collectionspace_wac:http://walkerart.org/collectionspace,coll > > ectionspace_wac</services-record-path> > > > > and > > > >  <field id="condition" section="wac"> > >      <selector>.csc-object-identification-condition</selector> > >  </field> > > > > Again, I am a bit confused about label / namespace / root-tag here. > > > > 9. started both servers up, and got the behavior I mentioned up top. > > > > Cheers, > > Joe > > > > _______________________________________________ > > Talk mailing list > > Talk@lists.collectionspace.org > > > http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectio > > nspace.org > > > > _______________________________________________ > Talk mailing list > Talk@lists.collectionspace.org > http://lists.collectionspace.org/mailman/listinfo/talk_lists.c > ollectionspace.org >
AR
Aron Roberts
Fri, May 27, 2011 9:39 PM

Hi Joe,

On Fri, May 27, 2011 at 2:24 PM, Patrick Schmitz pschmitz@berkeley.edu wrote:

Do you think it would be good to send [Joe] the URL to get the UI schema from
the app layer, and make sure it looks right? It is a little non-trivial to
interpret, but...

To follow up on Patrick's suggestion, you can look at the
Application Layer's view of CollectionObject records, after you've
added app layer configuration for the new, custom WAC part, by
submitting GET requests via cURL, a web browser, or some other HTTP
client, to URLs like these:

http://myhost:8180/collectionspace/chain/cataloging/uischema

http://myhost:8180/collectionspace/chain/cataloging/uispec

That is, the app layer has its own set of URLs to which it responds
to REST requests, much like the services layer does, and making
requests to those URLs can help you find out how your customizations
have been reflected in that layer.

The UI schema is essentially the structure of the record, as the app
layer knows about it.  The UI spec has lots of crunchy goodness that
associates incoming JSON data elements for the record with the
corresponding target fields in the HTML template (via their 'class='
selectors) into which that data will be flowed, as well as specifying
JavaScript behaviors (like repeatability or autocomplete for
vocabulary/authority terms) to be applied to those fields.  (That's my
decidedly un-authoritative - and possibly not entirely accurate -
characterization.)

For these and other useful app layer URLs:

http://wiki.collectionspace.org/display/collectionspace/Guidelines+for+Bug+Triage#GuidelinesforBugTriage-Urlsandhowtheyareusefultoyou

(In that document, references to 'objects' may have been replaced by
'cataloging')

Aron

-----Original Message-----
From: talk-bounces@lists.collectionspace.org
[mailto:talk-bounces@lists.collectionspace.org] On Behalf Of
Aron Roberts
Sent: Friday, May 27, 2011 2:20 PM
To: Joe Slag
Cc: talk@lists.collectionspace.org
Subject: Re: [Talk] seeking clarification/tips on adding a
field to aCollectionObject

Hi Joe,

  At a quick and superficial glance, the steps you followed look good.

  As one place to start, it'd be useful to see if Nuxeo
created a database table based on your custom schema; e.g.
using the MySQL command line client:

% mysql -u yourusername -p
Enter password:

mysql> use nuxeo;
mysql> show tables like 'collectionobjects%';
(find your 'wac' table in the list, if present)
mysql> describe collectionobjects_wac;  (or whatever it may be)

  Assuming the table is present, a second thing to try would
be to send an XML payload to the CollectionObject service
that includes your custom schema part; e.g.

% curl -i -u admin@collectionspace.org:Administrator -X POST -H
"Content-Type: application/xml"
http://localhost:8180/cspace-services/collectionobjects -T
mysamplefile.xml

where 'admin@collectionspace.org' is your username,
'Administrator' is your password, 'localhost' is the host
where the services layer is running, and 'mysamplefile.xml'
is a file containing an XML payload to create a new record.

mysamplefile.xml might look something like this
(hypothetical, and untried with your changes):

<?xml version="1.0" encoding="utf-8"?> <document name="collectionobjects">   <ns2:collectionobjects_common xmlns:ns2="http://collectionspace.org/services/collectionobject"   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">     <titleGroupList>       <titleGroup>         <title>A title</title>       </titleGroup>     </titleGroupList>     <objectNumber>2011.1.5</objectNumber>   </ns2:collectionobjects_common>   <ns2:collectionobjects_wac xmlns:ns2="http://walkerart.org/collectionobject"   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">       <condition>a condition</condition>   </ns2:collectionobjects_wac> </document>

  What you'll ideally get back is a success response that
includes the identifier (CSID) of the new record; e.g.

HTTP/1.1 201 Created
...
Location:
http://localhost:8180/cspace-services/collectionobjects/557f73

56-e60a-419e-8717

  You can then either use cURL or paste into a browser to
view the record.  (You may be asked to re-authenticate, if
viewing via your
browser.)

  If this all works, then the services side is working, and
you can move on to looking at the app and UI layers.

Aron

On Fri, May 27, 2011 at 1:33 PM, Joe Slag joe@slagwerks.com wrote:

First, thanks to Patrick for pointing out that the JAXB &

maven issue

I was running into earlier this week wasn't actually something I
needed to be dealing with, since I'm just trying to add a

field to the

collectionobject schema and then access it through the web

UI. Double

thanks for updating

m+Field+to+a+CollectionObject
appropriately.

Since then, I've taken another pass at the process

described in that

wiki page. I've got the input showing up on the edit screen

(easiest

step, admittantly) but CollectionSpace doesn't want to

retain values

entered in that field when the 'save' button is clicked. The only
related line I can find in the logs is:

 2011-05-27 15:16:44,521 DEBUG [http-0.0.0.0-8180-8]

[org.collectionspace.services.nuxeo.client.java.RemoteDocumentModelHan

dlerImpl:148]
<ns2:collectionobjects_wac
xmlns:ns2="http://walkerart.org/collectionobject"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"></ns2:collection

objects_wac>

'collectionspace_wac' is the name of the schema I added to

contain my

new field, so I get that something isn't quite working

properly with

my addition, but I'm having a hard time figuring out

exactly what. Any

tips on debugging or pointers on where I might have strayed

from the

path?

The gory details:

  1. Added the file

collectionobject/3rdparty/nuxeo-platform-cs-collectionobject/src/main/

resources/schemas/collectionobjects_wac.xsd
(see https://gist.github.com/9f45d84abdbd2283fe0f) which defines a
'condition' field.

Q: the inline example in the wiki shows an element within the
http://collectionspace.org/collectionobject/ namespace, whereas the
linked example uses a site-specific namespace, which contains an
element called "collection-object_bnhm", which in turn contains the
new field(s).  Does it matter? Is one or the other correct?

  1. Added reference in core-types-contrib.xml to this new
    collectionobjects_wac schema.
    https://gist.github.com/2bf0aaedd4dd839c3198

  2. ran mvn clean install. Success.

  3. Skipped the JAXB steps and moved on to modifying the

tenant binding

file.  A little confusion here as the wiki indicates that

the file in

question is found at
services/common/src/main/config/services/tenant-bindings.xml. In my
1.6 tree, I didn't find one central tenant-bindings.xml

file, but did

find

common/src/main/cspace/config/services/tenants/hearstmuseum/tenant-bin

dings.xml
and

common/src/main/cspace/config/services/tenants/collectionspace/tenant-

bindings.xml I went with the latter, adding the following section:

 https://gist.github.com/299b3dd8aaabb0934049

A little confused about what exactly I need there for

namespaceURI and

schemaLocation values, tried to follow the examples though.

  1. Moving along, I shut down the servers and ran maven and

ant, which

returned without errors, a few hours later (I kid!).

  1. Added the 'condition' field to CatalogingTemplate.html,

giving the

new field the selector csc-object-identification-condition for the
sake of having it show up high on the page.

  1. Ran mvn clean install for UI, success.

  2. Modified cspace-config.xml appropriately; added

 <services-record-path

id="wac">collectionspace_wac:http://walkerart.org/collectionspace,coll

ectionspace_wac</services-record-path>

and

 <field id="condition" section="wac">
     <selector>.csc-object-identification-condition</selector>
 </field>

Again, I am a bit confused about label / namespace / root-tag here.

  1. started both servers up, and got the behavior I mentioned up top.

Cheers,
Joe


Talk mailing list
Talk@lists.collectionspace.org

nspace.org

Hi Joe, On Fri, May 27, 2011 at 2:24 PM, Patrick Schmitz <pschmitz@berkeley.edu> wrote: > Do you think it would be good to send [Joe] the URL to get the UI schema from > the app layer, and make sure it looks right? It is a little non-trivial to > interpret, but... To follow up on Patrick's suggestion, you can look at the Application Layer's view of CollectionObject records, after you've added app layer configuration for the new, custom WAC part, by submitting GET requests via cURL, a web browser, or some other HTTP client, to URLs like these: http://myhost:8180/collectionspace/chain/cataloging/uischema http://myhost:8180/collectionspace/chain/cataloging/uispec That is, the app layer has its own set of URLs to which it responds to REST requests, much like the services layer does, and making requests to those URLs can help you find out how your customizations have been reflected in that layer. The UI schema is essentially the structure of the record, as the app layer knows about it. The UI spec has lots of crunchy goodness that associates incoming JSON data elements for the record with the corresponding target fields in the HTML template (via their 'class=' selectors) into which that data will be flowed, as well as specifying JavaScript behaviors (like repeatability or autocomplete for vocabulary/authority terms) to be applied to those fields. (That's my decidedly un-authoritative - and possibly not entirely accurate - characterization.) For these and other useful app layer URLs: <http://wiki.collectionspace.org/display/collectionspace/Guidelines+for+Bug+Triage#GuidelinesforBugTriage-Urlsandhowtheyareusefultoyou> (In that document, references to 'objects' may have been replaced by 'cataloging') Aron > >> -----Original Message----- >> From: talk-bounces@lists.collectionspace.org >> [mailto:talk-bounces@lists.collectionspace.org] On Behalf Of >> Aron Roberts >> Sent: Friday, May 27, 2011 2:20 PM >> To: Joe Slag >> Cc: talk@lists.collectionspace.org >> Subject: Re: [Talk] seeking clarification/tips on adding a >> field to aCollectionObject >> >> Hi Joe, >> >>   At a quick and superficial glance, the steps you followed look good. >> >>   As one place to start, it'd be useful to see if Nuxeo >> created a database table based on your custom schema; e.g. >> using the MySQL command line client: >> >> % mysql -u yourusername -p >> Enter password: >> >> mysql> use nuxeo; >> mysql> show tables like 'collectionobjects%'; >> (find your 'wac' table in the list, if present) >> mysql> describe collectionobjects_wac;  (or whatever it may be) >> >>   Assuming the table is present, a second thing to try would >> be to send an XML payload to the CollectionObject service >> that includes your custom schema part; e.g. >> >> % curl -i -u admin@collectionspace.org:Administrator -X POST -H >> "Content-Type: application/xml" >> http://localhost:8180/cspace-services/collectionobjects -T >> mysamplefile.xml >> >> where 'admin@collectionspace.org' is your username, >> 'Administrator' is your password, 'localhost' is the host >> where the services layer is running, and 'mysamplefile.xml' >> is a file containing an XML payload to create a new record. >> >> mysamplefile.xml might look something like this >> (hypothetical, and untried with your changes): >> >> <?xml version="1.0" encoding="utf-8"?> >> <document name="collectionobjects"> >>   <ns2:collectionobjects_common >> xmlns:ns2="http://collectionspace.org/services/collectionobject" >>   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> >>     <titleGroupList> >>       <titleGroup> >>         <title>A title</title> >>       </titleGroup> >>     </titleGroupList> >>     <objectNumber>2011.1.5</objectNumber> >>   </ns2:collectionobjects_common> >>   <ns2:collectionobjects_wac >> xmlns:ns2="http://walkerart.org/collectionobject" >>   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> >>       <condition>a condition</condition> >>   </ns2:collectionobjects_wac> >> </document> >> >>   What you'll ideally get back is a success response that >> includes the identifier (CSID) of the new record; e.g. >> >> HTTP/1.1 201 Created >> ... >> Location: >> http://localhost:8180/cspace-services/collectionobjects/557f73 > 56-e60a-419e-8717 >> >>   You can then either use cURL or paste into a browser to >> view the record.  (You may be asked to re-authenticate, if >> viewing via your >> browser.) >> >>   If this all works, then the services side is working, and >> you can move on to looking at the app and UI layers. >> >> Aron >> >> On Fri, May 27, 2011 at 1:33 PM, Joe Slag <joe@slagwerks.com> wrote: >> > First, thanks to Patrick for pointing out that the JAXB & >> maven issue >> > I was running into earlier this week wasn't actually something I >> > needed to be dealing with, since I'm just trying to add a >> field to the >> > collectionobject schema and then access it through the web >> UI. Double >> > thanks for updating >> > >> http://wiki.collectionspace.org/display/collectionspace/Adding+a+Custo >> > m+Field+to+a+CollectionObject >> > appropriately. >> > >> > Since then, I've taken another pass at the process >> described in that >> > wiki page. I've got the input showing up on the edit screen >> (easiest >> > step, admittantly) but CollectionSpace doesn't want to >> retain values >> > entered in that field when the 'save' button is clicked. The only >> > related line I can find in the logs is: >> > >> >  2011-05-27 15:16:44,521 DEBUG [http-0.0.0.0-8180-8] >> > >> [org.collectionspace.services.nuxeo.client.java.RemoteDocumentModelHan >> > dlerImpl:148] >> > <ns2:collectionobjects_wac >> > xmlns:ns2="http://walkerart.org/collectionobject" >> > >> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"></ns2:collection >> > objects_wac> >> > >> > 'collectionspace_wac' is the name of the schema I added to >> contain my >> > new field, so I get that something isn't quite working >> properly with >> > my addition, but I'm having a hard time figuring out >> exactly what. Any >> > tips on debugging or pointers on where I might have strayed >> from the >> > path? >> > >> > The gory details: >> > >> > 1. Added the file >> > >> collectionobject/3rdparty/nuxeo-platform-cs-collectionobject/src/main/ >> > resources/schemas/collectionobjects_wac.xsd >> > (see https://gist.github.com/9f45d84abdbd2283fe0f) which defines a >> > 'condition' field. >> > >> > Q: the inline example in the wiki shows an element within the >> > http://collectionspace.org/collectionobject/ namespace, whereas the >> > linked example uses a site-specific namespace, which contains an >> > element called "collection-object_bnhm", which in turn contains the >> > new field(s).  Does it matter? Is one or the other correct? >> > >> > 2. Added reference in core-types-contrib.xml to this new >> > collectionobjects_wac schema. >> > https://gist.github.com/2bf0aaedd4dd839c3198 >> > >> > 3. ran `mvn clean install`. Success. >> > >> > 4. Skipped the JAXB steps and moved on to modifying the >> tenant binding >> > file.  A little confusion here as the wiki indicates that >> the file in >> > question is found at >> > services/common/src/main/config/services/tenant-bindings.xml. In my >> > 1.6 tree, I didn't find one central tenant-bindings.xml >> file, but did >> > find >> > >> common/src/main/cspace/config/services/tenants/hearstmuseum/tenant-bin >> > dings.xml >> > and >> > >> common/src/main/cspace/config/services/tenants/collectionspace/tenant- >> > bindings.xml I went with the latter, adding the following section: >> > >> >  https://gist.github.com/299b3dd8aaabb0934049 >> > >> > A little confused about what exactly I need there for >> namespaceURI and >> > schemaLocation values, tried to follow the examples though. >> > >> > 5. Moving along, I shut down the servers and ran maven and >> ant, which >> > returned without errors, a few hours later (I kid!). >> > >> > 6. Added the 'condition' field to CatalogingTemplate.html, >> giving the >> > new field the selector csc-object-identification-condition for the >> > sake of having it show up high on the page. >> > >> > 7. Ran `mvn clean install` for UI, success. >> > >> > 8. Modified cspace-config.xml appropriately; added >> > >> >  <services-record-path >> > >> id="wac">collectionspace_wac:http://walkerart.org/collectionspace,coll >> > ectionspace_wac</services-record-path> >> > >> > and >> > >> >  <field id="condition" section="wac"> >> >      <selector>.csc-object-identification-condition</selector> >> >  </field> >> > >> > Again, I am a bit confused about label / namespace / root-tag here. >> > >> > 9. started both servers up, and got the behavior I mentioned up top. >> > >> > Cheers, >> > Joe >> > >> > _______________________________________________ >> > Talk mailing list >> > Talk@lists.collectionspace.org >> > >> http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectio >> > nspace.org >> > >> >> _______________________________________________ >> Talk mailing list >> Talk@lists.collectionspace.org >> http://lists.collectionspace.org/mailman/listinfo/talk_lists.c >> ollectionspace.org >> > >