We are trying to add a new field ("quantity") to relations.
We have created a new schema ("relation-extended"), and we have override Relation doctype adding this schema (in relation-extended-contrib.xml):
<component name="org.nuxeo.sample.relationextended">
<require>org.nuxeo.ecm.core.CoreExtensions</require>
<extension point="schema" target="org.nuxeo.ecm.core.schema.TypeService">
<schema name="relation-extended" prefix="relext" src="schema/relationextended.xsd"/>
</extension>
<extension point="doctype" target="org.nuxeo.ecm.core.schema.TypeService">
<doctype name="Relation"> <!-- no extends -->
<schema name="relation"/>
<schema name="dublincore"/>
<schema name="relation-extended"/>
</doctype>
</extension>
</component>
This is the content of the new schema:
<xs:element name="quantity" type="xs:integer" default="1"/>
We have seen that it has created a new table in the database, with an ID and the field QUANTITY.
Afterwards, we followed http://doc.nuxeo.com/display/NXDOC/How+to+Override+a+Seam+Component how to:
Created RelationExtendedActionsBean.java
package org.nuxeo.sample;
//Imports
@Name("relationActions")
@Scope(CONVERSATION)
@Install(precedence = 100)
public class RelationExtendedActionsBean extends RelationActionsBean {
private static final long serialVersionUID = 1L;
@Override
public String addStatement() throws ClientException {
return null;
}
}
Added an empty seam.properties under the folder src/main/resources.
Added required statements in deployment-fragment:
<fragment version="1">
<require>org.nuxeo.ecm.webapp.ui</require>
<require>org.nuxeo.ecm.relations.web</require>
<install>
<unzip from="${bundle.fileName}" to="/" prefix="web">
<include>web/nuxeo.war/**</include>
</unzip>
</install>
</fragment>
INFO logs are active in log4j.xml for Seam but we don't see our Seam component in the logs:
<category name="org.jboss.seam">
<priority value="INFO" />
</category>
/***/
<category name="org.jboss.seam.contexts.Contexts">
<priority value="INFO" />
</category>
<category name="org.jboss.seam.contexts.Lifecycle">
<priority value="INFO" />
</category>
We don't see our component in the logs if we try to override an existing one, we just see it when we create a new Seam component using Nuxeo IDE:
2015-02-19 18:09:43,491 INFO [http-bio-0.0.0.0-8080-exec-4] [org.jboss.seam.Component] Component: newRelation, scope: CONVERSATION, type: JAVA_BEAN, class: org.nuxeo.sample.NewRelationBean
We notice that it's not overriding, because it keeps creating the relation, and our addStatement does nothing. Also, the debugger doesn't stop in any breakpoint we put in our class.
The bundle structure is:
src/main/
java/org/nuxeo/sample/
RelationExtendedActionsBean.java
resources/
META-INF/
MANIFEST.****
OSGI-INF/
extensions/
relation-extended-contrib.xml
deployment-fragment.xml
schema/
relationextended.xsd
web/nuxeo.war/
create_relation.xhtml
seam.properties
We are new in Nuxeo... What do you mean by registering our Seam bean?
Do we miss a contribution to any extension point to register our Seam component?
We just override create_relation.xhtml, do we need to override document_relations.xhtml?
Thank you in advance,