Incremental custom model

cancel
Showing results for 
Search instead for 
Did you mean: 
javiercasfer
Active Member

Incremental custom model

Jump to solution

Hello,

I'm new at Alfresco and, after Googled alot, i have no solution to my current problem. 

My situation is that i have custom content model xml file and a cmm file for that model, both generated by a java application. First time is generated, i deploy the zip file to alfresco, activate the model and use bulk import tool to upload all my documents wich types are on that model. 

After a month, i repeat the process, the java application generates new model wich may have same types as the last model, and may have new with new properties. Now, i want to update the old model adding new types and properties wich are on the new model generated. Of course, I can't  deactivate the old model or add those new properties manually. 

So, what i need is a mechanism to have an active incremental custom model.

My questions are:  

   - What options do i have?

   - Really can i do that?

I'm using Alfresco Community version. 

Thanks in advice!

‌ #

1 Solution

Accepted Solutions
javiercasfer
Active Member

Re: Incremental custom model

Jump to solution

Hi everybody!

I've solved my problem. 

What I do is, when I do a content extraction from the source, i generate a model content xml with the types and properties i get. Then I use the xsd definition to compare my old model with my new one and add all new types and properties i have to the new one. 

Then, from may aggregation model (the old updated), i generate my own share-config-custom.xml with the forms and properties I need and model.propreties files. Then, replace these 3 files on my alfresco instalation and restart it. It works perfectly. Keep in mind that these only will work if you don't remove types or properties when you are updating your custom model. 

Maybe that could help someone. Thanks for all the answers. 

View solution in original post

13 Replies
angelborroy
Alfresco Employee

Re: Incremental custom model

Jump to solution

Probably I'm missing something, but re-deploying your new XML Content Model (the one with the new properties) file should be enough. Just overwrite your old XML file.

Hyland Developer Evangelist
javiercasfer
Active Member

Re: Incremental custom model

Jump to solution

Hi, thanks for the answer, but it doesn't work.

I deploy the model by the ui, on admin tools > Model management. So, when i try to import the same model but with updated properties, Alfresco says that a model with that name already exists. 

angelborroy
Alfresco Employee

Re: Incremental custom model

Jump to solution

Ah, ok, so you are using Model Manager tool.

Sorry, I have no experience with that tool. I'm always using the other content model deployment options.

Hyland Developer Evangelist
afaust
Master

Re: Incremental custom model

Jump to solution

The Model Management tool should come with a big, red sticker stating "This tool is only good for quick prototyping / test models - it should not be used for anything more serious than that".

In short, the UI does not support importing a model as "an update" to an already active/deployed model. You could technically override the XML file by going via the Repository -> Data Dictionary -> Models folder, but be aware that your XML may be overidden by changes made via the model management tool afterwards.

My usual suggestion is to always use the traditional, Spring-based XML bootstrap approach using an extension module (JAR / AMP, whatever you prefer) for serious development use or production.

javiercasfer
Active Member

Re: Incremental custom model

Jump to solution

Ok, gonna try it. 

Do you have a link to any good tutorial of a proyect example? 

Thanks in advice. 

afaust
Master

Re: Incremental custom model

Jump to solution

Well, Jeff Potts' tutorial is a mandatory read.

javiercasfer
Active Member

Re: Incremental custom model

Jump to solution

Thanks!

heiko_robert
Senior Member

Re: Incremental custom model

Jump to solution

I just read your post and want to add to your requirement "mechanism to have an active incremental custom model":

Alfresco's document model behaves like a hierachical, NOT like a relational database (or like a bunch of xml documents you write a xml schema for). Altering the type in the document model is not the equivalent of "alter table modify column ...". This means

If you change the document model it is your responsibility to make only changes which are compatible with your already existing content. There is no mechanism to migrate already existing data to comply with your modified model. Even harder: If you use versions it may not be possible to modify (meta) data already stored and you will get into trouble when you don't expect to since Alfresco parses the model on read and write - e.g. when a user tries to show a document in Share UI years after you made the changes on the document model.

To make the long story short: Alfresco has only very limited support for document model changes and you should therefore spend as much analysis as possible to make sure you don't need to change the model.

Over then years after we started with Alfresco document models we have the best practices:

  • store as few metadata in Alfresco model as possible and reference metadata from other systems if possible (store only data in alfresco properties which are not stored anywhere else).
  • try to implement a generic model which you don't need to modify

Since we had to reengeneer several Alfresco implementations over the years we created our own lowlevel migration module which is able to migrate all the metadata, types and aspects in any node as a batch routine - even for document versions but this approach shouldn't be used on a regular basis ;-)

rsclark3
Member II

Re: Incremental custom model

Jump to solution

This is an odd question but are there any alternatives for model management if you do not have root or admin access to the server? The server teams does not allow the Alfresco support team access to the server. I had hoped Model Manager, and the Model Manager group rights, to help with non-server team model management but we can't use it for the reasons stated above. A vendor installed a Spring-based XML model and if I dare use Model Manager, I'm sure disaster awaits. We're stuck with extending our generic model for various business units that would like additional attributes.