2

We are currently working on Nuxeo Project without Studio as it is out of our budget. Our goal is to create our custom UI and use Nuxeo as a content management system. We were able to perform CRUD using SDK (creating new Documents and adding properties like title and description).

But we need other custom properties like organization name, address, phone number etc. Is there any way of creating our own Document Type without using of Studio? Is it possible to perform CRUD using SDK on that custom type?

Can anyone help on this?

cgrim
  • 4,890
  • 1
  • 23
  • 42
Dipesh KC
  • 2,273
  • 1
  • 15
  • 19

1 Answers1

1

At first create schema (myType.xsd for example) which defines new properties:

<?xml version="1.0"?>
<xs:schema targetNamespace="http://www.nuxeo.org/ecm/schemas/cf-client/"
           xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:element name="organization" type="xs:string"/>
    <xs:element name="phone" type="xs:string"/>
    <xs:element name="expired" type="xs:date"/>
</xs:schema>

Then define the type extension where you refer to the newly created schema:

<?xml version="1.0"?>
<component name="my.project.nuxeo.types">
    <require>org.nuxeo.ecm.core.CoreExtensions</require>

    <extension target="org.nuxeo.ecm.core.schema.TypeService" point="schema">
        <schema name="myType" prefix="mt" src="schema/myType.xsd"/>
    </extension>

    <extension target="org.nuxeo.ecm.core.schema.TypeService" point="doctype">
        <doctype name="MyType" extends="Document">
            <schema name="myType"/>
            <schema name="common" />
            <schema name="dublincore" />
            <schema name="uid" />
            <schema name="file"/>
            <schema name="files" />
            <facet name="Commentable"/>
            <facet name="NXTag"/>
        </doctype>
    </extension>
</component>

Note: You can also:

Then register the new type extension from the previous step in the MANIFEST.MF file:

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: .
Bundle-Vendor: my.project.nuxeo
Bundle-Name: my-project-nuxeo-core
Bundle-SymbolicName: my.project.nuxeo.my-project-nuxeo-core;singleton=true
Bundle-Version: 1.0.0
Nuxeo-Component: OSGI-INF/types.xml

Zip all these files into jar archive with this structure:

my-project-nuxeo-core.jar
├── META-INF
│   └── MANIFEST.MF
├── OSGI-INF
│   └── types.xml
└── schema
    └── myType.xsd

And copy that result jar archive into nxserver/bundles directory of your Nuxeo installation. Restart Nuxeo and it will automatically update DB structure accordingly.

You can find more info in Nuxeo documentation - for example here: https://doc.nuxeo.com/nxdoc/data-modeling/

cgrim
  • 4,890
  • 1
  • 23
  • 42
  • Thanks for your reply :) Do you have any resource with working with workflow without studio(like working with schema you just demonstrated) – Dipesh KC Mar 30 '20 at 14:33
  • To design Workflow is probably the hardest process without Studio :-( Everything else is easily doable. – cgrim Mar 30 '20 at 14:42
  • Thanks for your reply :) What do you think of standout quality of using Nuxeo? For what purpose have you used and choosen Nuxeo over others technology? Can you have your view on this? Thanks – Dipesh KC Mar 30 '20 at 18:17