cancel
Showing results for 
Search instead for 
Did you mean: 

Throw-away namespaces and prefixes to the rescue...?

oofdachile
Champ in-the-making
Champ in-the-making
Hi, folks –

  If you haven't read Jeff's "Working with Custom Content Types" guide:

http://www.ecmarchitect.com/images/articles/alfresco-content/content-article-2ed.pdf

… then you now have your lunch-hour assignment for the week.

  Point #3 in his "Content Modeling Best Practices" section reports that content models are not chalk on a chalkboard:  while we can usually add to a content model safely, we shouldn't expect to be able to change an existing model any way we want after it has been read by the Alfresco server.

  As a follow-on, I wonder if some of these headaches could be avoided by developing content models in throw-away namespaces with throw-away prefixes, such as …


<namespaces>
   <namespace uri="http://www.ourCompany.com/OurDepartment/PortraitTest/7.0" prefix="portTest007"/>
</namespaces>


When (when!) this test model is discovered to have an irreversible design flaw, could we not avoid some of the headaches pointed out in Jeff's document by changing this model's namespace & prefix to something like this:


<namespaces>
   <namespace uri="http://www.ourCompany.com/OurDepartment/PortraitTest/8.0" prefix="portTest008"/>
</namespaces>


… and then making the needed changes to the model?  When the model's development is complete, then the meat of the model could be moved into a production metadata model, or this model's namespace and prefix could be changed to something like:


<namespaces>
   <namespace uri="http://www.ourCompany.com/OurDepartment/Portrait/1.0" prefix="port001"/>
</namespaces>


What do you think of an approach like this?

Don
2 REPLIES 2

oofdachile
Champ in-the-making
Champ in-the-making
Ok, I gave this a try:  I changed a metadata model's namespace and prefix, and then updated the prefix references everywhere in the model.  Then I made the changes to the model that would otherwise have driven our Alfresco Community 4.2.d server crazy, and restarted the server.

On the upside, the changes worked (and on the first try, yet)!  I would guess that Alfresco is still hanging onto the old model somewhere, though I can't see it anywhere, since I no longer reference its old prefix.

On the downside, the two or three content items with which I was experimenting disappeared.  Upon reflection, that makes perfect sense.  Though I can't see these old-model content items, if I try to check in one of these documents into this same space again, Alfresco rightfully complains.  Because I'm developing the metadata model on a throw-away instance of Alfresco, I don't have very many items in there, by definition, but it still makes sense to delete the items FIRST and THEN change the model.  I would guess that I can find these "lost" items via the node browser & purge them.

Happy Alfresquing!

Don

tomoconnell
Champ in-the-making
Champ in-the-making
The problem with this though is you still have to delete all the files that were using the model. You can just edit the model without changing its namespace/prefix if you have no data to worry about.