WE HAVE SUNSET THIS LISTSERV - Join us at collectionspace@lyrasislists.org
View all threadsHi all,
I'm trying to make local customizations to a procedure and have hit a bit of a wall in figuring out why the change is not being reflected in the procedures form.
I followed the steps outlined in http://wiki.collectionspace.org/display/DOC/How+to+add+a+field and successfully added a new field, but when I tried to override an existing field, I could not get the overridden setting to take effect. It just keep using the default configuration.
Here's the very simple local procedure config I'm trying to use:
[https://avatars0.githubusercontent.com/u/10663125?v=3&s=400]https://github.com/CollectionSpace-Deployments/application/blob/mmi-acquisition-extent/tomcat-main/src/main/resources/tenants/mmi/mmi-procedure-acquisition.xml
application/mmi-procedure-acquisition.xml at mmi-acquisition-extent · CollectionSpace-Deployments/application · GitHub
This is a repository that contains Collection Space application layer code.
Read more...https://github.com/CollectionSpace-Deployments/application/blob/mmi-acquisition-extent/tomcat-main/src/main/resources/tenants/mmi/mmi-procedure-acquisition.xml
The extent field is added to my Acquisitions form, but the options are not updated for acquisitionsMethod.
?
What am I missing? Is there any documentation on how this merging takes place?
Thanks
Chad
Hi Chad,
I'm seeing two problems.
The first is in mmi-tenant.xml. The line
<include src="base-procedure-acquisition.xml,mmi-procedure-acquisition.xml" merge="xmlmerge-settings.properties"/>
should be
<include src="base-procedure-acquisition.xml,mmi-procedure-acquisition.xml" merge="xmlmerge.properties"/>
The merge attribute specifies a configuration file that determines how the
merge is done. xmlmerge-settings.properties is intended only for the
"settings" file. xmlmerge.properties should be used for everything else.
The second problem is the section attribute you have on the
acquisitionMethod field in mmi-procedure-acquisition.xml. It shouldn't be
there.
"Section" confusingly has two meanings. As a tag, it is a container for a
bunch of fields. By convention, <section> tags in the app layer usually
correspond to expanding field groups in the UI, although they don't have
to. As an attribute on a <field>, section refers to the schema in which the
field resides. The value of the section attribute must be the id of a
<services-record-path> that appears above, and the section attribute should
only appear on a <field> if the field is in an extension schema. The
acquisitionMethod field isn't in an extension, it's in the common schema,
so section shouldn't be there. Why is this so confusingly named? I don't
know.
Removing that section attribute should solve your problem, but you can
simplify some more. When you overlay an element, attributes and children
are inherited if you don't override them, so you can leave off anything you
don't want to change. So your overlay can look like this:
<!-- Information about your extension schema goes here -->
<services-record-path id="mmi">acquisitions_mmi:
http://collectionspace.org/services/acquisition/local/mmi,acquisitions_mmi
</services-record-path>
<section id="acquisitionInformation">
<field id="acquisitionMethod">
<options>
<option id="gift" default="yes">Gift</option>
<option id="purchase">Purchase</option>
<option id="bequest">Bequest</option>
<option id="loan">Loan</option>
<option id="restricted-gift">Restricted Gift</option>
</options>
</field>
<field id="extent" section="mmi" datatype="text"></field>
</section>
</record>
(I removed all the other attributes from acquisitionMethod, as well as the
<selector> child.)
The merging is done with the EL4J XmlMerge library, and is configured by
the specified properties file. There's a description of how that library
works here:
http://www.javaworld.com/article/2077736/open-source-tools/xml-merging-made-easy.html,
and documentation here: http://el4j.sourceforge.net/documentation.html.
Ray
On Thu, Feb 19, 2015 at 7:32 AM, Chad Nelson chad.nelson@lyrasis.org
wrote:
Hi all,
I'm trying to make local customizations to a procedure and have hit a
bit of a wall in figuring out why the change is not being reflected in the
procedures form.
I followed the steps outlined in
http://wiki.collectionspace.org/display/DOC/How+to+add+a+field and
successfully added a new field, but when I tried to override an existing
field, I could not get the overridden setting to take effect. It just keep
using the default configuration.
Here's the very simple local procedure config I'm trying to use:
https://github.com/CollectionSpace-Deployments/application/blob/mmi-acquisition-extent/tomcat-main/src/main/resources/tenants/mmi/mmi-procedure-acquisition.xml
application/mmi-procedure-acquisition.xml at mmi-acquisition-extent ·
CollectionSpace-Deployments/application · GitHub
This is a repository that contains Collection Space application layer
code.
Read more...
https://github.com/CollectionSpace-Deployments/application/blob/mmi-acquisition-extent/tomcat-main/src/main/resources/tenants/mmi/mmi-procedure-acquisition.xml
The extent field is added to my Acquisitions form, but the options are
not updated for acquisitionsMethod.
What am I missing? Is there any documentation on how this merging takes
place?
Thanks
Chad
Talk mailing list
Talk@lists.collectionspace.org
http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
I already responded directly to the poster, but for future searchers, updating my config files as noted did indeed solve my issues.
Thanks again,
Chad
From: Ray Lee rhlee@berkeley.edu
Sent: Thursday, February 19, 2015 10:32 PM
To: Chad Nelson
Cc: CollectionSpace Talk List
Subject: Re: [Talk] Local procedure config in application layer
Hi Chad,
I'm seeing two problems.
The first is in mmi-tenant.xml. The line
<include src="base-procedure-acquisition.xml,mmi-procedure-acquisition.xml" merge="xmlmerge-settings.properties"/>
should be
<include src="base-procedure-acquisition.xml,mmi-procedure-acquisition.xml" merge="xmlmerge.properties"/>
The merge attribute specifies a configuration file that determines how the merge is done. xmlmerge-settings.properties is intended only for the "settings" file. xmlmerge.properties should be used for everything else.
The second problem is the section attribute you have on the acquisitionMethod field in mmi-procedure-acquisition.xml. It shouldn't be there.
"Section" confusingly has two meanings. As a tag, it is a container for a bunch of fields. By convention, <section> tags in the app layer usually correspond to expanding field groups in the UI, although they don't have to. As an attribute on a <field>, section refers to the schema in which the field resides. The value of the section attribute must be the id of a <services-record-path> that appears above, and the section attribute should only appear on a <field> if the field is in an extension schema. The acquisitionMethod field isn't in an extension, it's in the common schema, so section shouldn't be there. Why is this so confusingly named? I don't know.
Removing that section attribute should solve your problem, but you can simplify some more. When you overlay an element, attributes and children are inherited if you don't override them, so you can leave off anything you don't want to change. So your overlay can look like this:
<record id="acquisition" is-extension="true" type="record,procedure"><!-- Information about your extension schema goes here -->
<services-record-path id="mmi">acquisitions_mmi:http://collectionspace.org/services/acquisition/local/mmi,acquisitions_mmi</services-record-path>
<section id="acquisitionInformation">
<field id="acquisitionMethod">
<options>
<option id="gift" default="yes">Gift</option>
<option id="purchase">Purchase</option>
<option id="bequest">Bequest</option>
<option id="loan">Loan</option>
<option id="restricted-gift">Restricted Gift</option>
</options>
</field>
<field id="extent" section="mmi" datatype="text"></field>
</section>
</record>
(I removed all the other attributes from acquisitionMethod, as well as the <selector> child.)
The merging is done with the EL4J XmlMerge library, and is configured by the specified properties file. There's a description of how that library works here: http://www.javaworld.com/article/2077736/open-source-tools/xml-merging-made-easy.html, and documentation here: http://el4j.sourceforge.net/documentation.html.
Ray
On Thu, Feb 19, 2015 at 7:32 AM, Chad Nelson <chad.nelson@lyrasis.orgmailto:chad.nelson@lyrasis.org> wrote:
Hi all,
I'm trying to make local customizations to a procedure and have hit a bit of a wall in figuring out why the change is not being reflected in the procedures form.
I followed the steps outlined in http://wiki.collectionspace.org/display/DOC/How+to+add+a+field and successfully added a new field, but when I tried to override an existing field, I could not get the overridden setting to take effect. It just keep using the default configuration.
Here's the very simple local procedure config I'm trying to use:
[https://avatars0.githubusercontent.com/u/10663125?v=3&s=400]https://github.com/CollectionSpace-Deployments/application/blob/mmi-acquisition-extent/tomcat-main/src/main/resources/tenants/mmi/mmi-procedure-acquisition.xml
application/mmi-procedure-acquisition.xml at mmi-acquisition-extent · CollectionSpace-Deployments/application · GitHub
This is a repository that contains Collection Space application layer code.
Read more...https://github.com/CollectionSpace-Deployments/application/blob/mmi-acquisition-extent/tomcat-main/src/main/resources/tenants/mmi/mmi-procedure-acquisition.xml
The extent field is added to my Acquisitions form, but the options are not updated for acquisitionsMethod.
?
What am I missing? Is there any documentation on how this merging takes place?
Thanks
Chad
Talk mailing list
Talk@lists.collectionspace.orgmailto:Talk@lists.collectionspace.org
http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org