cancel
Showing results for 
Search instead for 
Did you mean: 

Export and import custom content model with java

odpas
Champ on-the-rise
Champ on-the-rise

Hello, 

I have been searching a lot, but I didn't find yet any possible solution to how (or even if) this is possible to do it.

I have one Alfresco Community installed on one machine, and other installed on another machine. I have created via Alfresco web UI a custom data model with Model Manager tool. Now, I want to export it, and then, import it in the other machine. Which ways would I have to do that?

I was thinking to do it with Java and API rest (like working with Alfresco nodes), but I think this is not possible.I am trying to do some type of application/process to do that, but I am a bit lost right know.

Any help will be appreciated.

Thanks.

1 ACCEPTED ANSWER

janv
Employee
Employee

Hi Odpas,

I assume you're referring to Share Content Model Manager (CMM) ?

Content modeling with Model Manager | Alfresco Documentation 

If you can analyse the calls from Share CMM to the Repository, you will see that Share uses a "private" CMM REST API.

You may be able to use this private API to deploy (dynamic) models that remain compatible with Share CMM ? Please be aware the API is not public, hence subject to change at any time (ie. not officially documented or supported - in terms of backwards compatibility). There are also some limitations for models supported via Share CMM, so your mileage may vary. Please run your own modelling tests (and also search JIRA). 

Alternatively, you can also manage Dynamic Models via the public APIs (CMIS or REST):

Deploying a content model: dynamic approach | Alfresco Documentation 

In this case, you will need to construct a valid XML content model. As an admin, this can be uploaded to the "/Data Dictionary/Models" folder and activated (by setting "cm:modelActive" property to true) - using Share &/or public APIs:

alfresco-repository/contentModel.xml at master · Alfresco/alfresco-repository · GitHub 

It should be noted that dynamic model changes must be "incremental". Dynamic models can only be deleted if there are no existing references. In the future, it might be useful to support a non-incremental development mode. This would be similar to updating / removing static models (and potentially leaving residual references &/or broken behaviours that depend on the model).

Regards,

Jan

View answer in original post

2 REPLIES 2

janv
Employee
Employee

Hi Odpas,

I assume you're referring to Share Content Model Manager (CMM) ?

Content modeling with Model Manager | Alfresco Documentation 

If you can analyse the calls from Share CMM to the Repository, you will see that Share uses a "private" CMM REST API.

You may be able to use this private API to deploy (dynamic) models that remain compatible with Share CMM ? Please be aware the API is not public, hence subject to change at any time (ie. not officially documented or supported - in terms of backwards compatibility). There are also some limitations for models supported via Share CMM, so your mileage may vary. Please run your own modelling tests (and also search JIRA). 

Alternatively, you can also manage Dynamic Models via the public APIs (CMIS or REST):

Deploying a content model: dynamic approach | Alfresco Documentation 

In this case, you will need to construct a valid XML content model. As an admin, this can be uploaded to the "/Data Dictionary/Models" folder and activated (by setting "cm:modelActive" property to true) - using Share &/or public APIs:

alfresco-repository/contentModel.xml at master · Alfresco/alfresco-repository · GitHub 

It should be noted that dynamic model changes must be "incremental". Dynamic models can only be deleted if there are no existing references. In the future, it might be useful to support a non-incremental development mode. This would be similar to updating / removing static models (and potentially leaving residual references &/or broken behaviours that depend on the model).

Regards,

Jan

odpas
Champ on-the-rise
Champ on-the-rise

@Jan Vonka, Great answer. 

You were very helpful. I will try with Dynamic Models via the public APIs (CMIS or REST) approach. 

Thanks.