cancel
Showing results for 
Search instead for 
Did you mean: 

Web Client Import

nyronian
Champ in-the-making
Champ in-the-making
Is there a reason the web-client import process does not have the options for the UUID bindings?  Does the client have to be shutdown for it to work?  I am considering building or extending your UI to do it and got to thinking, maybe there is a techinal reason why it does not give those options by default.

The other question is, does the WebService API give those options so I could import to a remote repository.

The Key for me though is I need to specify the UUID binding options.
7 REPLIES 7

kevinr
Star Contributor
Star Contributor
There is no technical reason. It's just an area of UI we have not revisited since it was written. It would be really great if you add that to the UI - it would not be a big task - and then contribute it back.

Thanks,

Kevin

smyers
Champ in-the-making
Champ in-the-making
I have a similar desire, but I'm a code guy, not really an interface guy. I was wondering if the ImporterComponent implementation of the ImporterService could just be made a little smarter until I or someone else can find the time to properly expose the UUID Binding options in the web client UI.

I have an as yet untested change that might help make the import process just a little smarter in regard to UUIDs. Specifically, the part where I change the AND to OR is what's untested, simply importing the UUIDs works fine in my custom-generated ACPs.

Here's a diff of what I'm talking about:
Index: /Alfresco/projects/repository/source/java/org/alfresco/repo/importer/ImporterComponent.java
===================================================================
— /Alfresco/projects/repository/source/java/org/alfresco/repo/importer/ImporterComponent.java   (revision 1242)
+++ /Alfresco/projects/repository/source/java/org/alfresco/repo/importer/ImporterComponent.java   (working copy)
@@ -460,7 +460,7 @@
         {

             if (uuidBinding == null)

             {

-                return new CreateNewNodeImporterStrategy(true);

+                return new CreateNewNodeImporterStrategy(false);

             }

             else if (uuidBinding.equals(UUID_BINDING.CREATE_NEW))

             {

@@ -488,7 +488,7 @@
             }

             else

             {

-                return new CreateNewNodeImporterStrategy(true);

+                return new CreateNewNodeImporterStrategy(false);

             }

         }

        

@@ -1256,7 +1256,7 @@
                 Map<QName, Serializable> initialProperties = bindProperties(node);

                

                 // Assign UUID if already specified on imported node

-                if (!assignNewUUID && node.getUUID() != null)

+                if (!assignNewUUID || node.getUUID() != null)

                 {

                     initialProperties.put(ContentModel.PROP_NODE_UUID, node.getUUID());

                 }

Standard disclaimer here…there's a lot of code involved in making Alfresco go, and I freely admit that I am unaware of any effects of my alterations that are farther reaching than those I intend. The intended changes are these:

By default, when importing content, Alfresco appears to use the CREATE_NEW binding. I have changed the default to be CREATE_NEW_WITH_UUID. When importing, Alfresco checks to see if assignNewUUID is false AND if the node being imported has a UUID that is not null. My understanding of this is that you need to have a UUID assigned AND you have to specifically not want to create new ones on import, and my understanding of my change is that it will instruct Alfresco to look for and import UUIDs by default, and generate them as when they are not present in the imported package.

A possible "gotcha" here is that this seems to put the onus of ensuring that the UUIDs are actually unique to the Alfresco repository squarely on the shoulders of the importer, and so more may need to be done there. In my case, as I alluded to before, I am generating ACPs on the fly. The content I'm generating isn't participating in Alfresco's more advanced features, like workflow or versioning, it's largely using Alfresco's content storage, delivery, and transcription features. That all said, I recognize that my patch works for my use case, but a cleaner solution is likely necessary.

Hope this helps someone. Smiley Happy

nyronian
Champ in-the-making
Champ in-the-making
I have actually created the ability (in the UI) to select any import binding option the user wishes and it works fine.  (I just haven't had the time to actually bundle it and contribute the change)

Unfortunately, I have found a few odd bugs when using (at least REPLACE_EXISTING and UPDATE_EXISTING).  I need to get them detailed out so the Alfresco Team can use them. 

One I clearly remember is that if the node has a metadata type that is a NodeRef, there are times the import process will turn the value from a valid value to a null.  Of course the noderef is referencing a node that is in the import.  I'm guessing there some "chicken & egg" thing, where the node it is referencing does not yet exist (as it has not been imported) so it cannot resolve it so it does not import the reference.

I find if I simply rename the node folder I am importing and reimport with a CREATE_NEW, it works perfectly.

smyers
Champ in-the-making
Champ in-the-making
Is there any chance you could throw an SVN diff my way, smyers@americanri.com? I'm curious to see the work you've done.

smyers
Champ in-the-making
Champ in-the-making
Specifically, the part where I change the AND to OR is what's untested, simply importing the UUIDs works fine in my custom-generated ACPs.

This has now been tested. I imported an ACP with a mixture of nodes that have defined UUIDs and nodes that do not. The nodes without UUIDs had then automatically created, as expected, whereas the nodes with UUIDs defined were created with the UUID defined in the package descriptor XML.

nyronian
Champ in-the-making
Champ in-the-making
There are really only 3 files that had to change…

1. org.alfresco.web.bean.ImportBean
    This bean I added the option to read the available UUID Binding options and create a list of them for the jsp page.  I also then read those and send them to the ActionExecuter with a new parm for binding.
2. org.alfresco.repo.action.executer.ImporterActionExecuter
    Added the ability to read in the binding option sent from the Import Bean and send it to the ImporterService

       I also added a ImporterProgress class but have not been able to get output from it.  (I tried to just send ImporterProgress to the console)
3.  jsp.dialog.import.jsp
    I simply added the dropdown of option as provided by the ImportBean.  I also added all the text from the documentation of what each import option means….it's not real pretty but the info is there.
I will send these files to you directly.

kevinr
Star Contributor
Star Contributor
If you are happy to contribute the changes to the Alfresco core, please attach the files to a JIRA issue.

Thanks!

Kevin