02-13-2015 08:34 AM
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.MF
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,
02-13-2015 08:18 PM
You should add new fields to your version of create_relation.xhtml. After that you should add to your deployment-fragment.xml file a require statement:
<require>org.nuxeo.ecm.relations.web</require>
Then you should replace RelationActionsBean.java by your version. You can do this by adding a proper "precedence".
@Name("relationActions")
@Scope(CONVERSATION)
@AutomaticDocumentBasedInvalidation
@Install(precedence = 100)
public class RelationActionsBean extends DocumentContextBoundActionBean
In RelationActionsBean.java it is necessary to change the addStatement method.
If you need a validation for your new fields then the RelationCreationBean.java should be also repleaced.
Adam
02-26-2015 01:20 PM
Yes, we also have reduced the bundle to the bean class, we have copied your code exactly. And we think that it's not a MANIFEST.MF problem, because we see in the logs that the bundle is deployed
02-27-2015 04:11 AM
I don't think that this is the Nuxeo IDE.
03-02-2015 06:54 AM
Thank you Adam,
03-09-2015 12:16 PM
We have tried creating a JAR and copying to the plugins folder and it works, so we think it is something related with the IDE or the SDK. We have posted another question
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.