My use case is to run a backend Scheduler job in hippo CMS (which is working)
From there, I need to create a new document dynamically or edit an existing document.
// 5. Create or update document at documentLocation from contentNode with locale and localized name.
updatedDocumentLocation =
importTask.createOrUpdateDocumentFromVariantContentNode(contentNode, primaryTypeName,
documentLocation, locale, localizedName)
localizedName is for display name in CMS.
For example, “The Medusa News” document in a CMS folder is a display name, or to be more precise, a localized display name in English, whereas its physical node name is ‘the-medusa-news’ which is probably inside the contentNode object.
Thanks for the update Woonsan.
There are two further questions:
Suppose if I pass ‘Foo Bar’ as localized name, it still creates document with name foo_bar.
I am passing path as: /content/documents/app/dynamic-documents/foo_bar
I am opening a session (Session session = context.createSystemSession();), Looping through data for creating say 10 documents and saving the session in each iteration and finally doing session.logout() after loop ends.
, but I see following exception from EXIM plugin for some cases -
Do you have idea, why is it so? because Data being passed looks fine to me.
[INFO] [talledLocalContainer] #component==GML# #sourcetype==log4j# [13 Jul 2018 14:49:06,704] [ERROR] [org.quartz.core.JobRunShell]: [Job DEFAULT.d055f4a0-f48a-4d9c-bb69-78843aba3947 threw an unhandled Exception: ]
[INFO] [talledLocalContainer] java.lang.NoSuchMethodError: org.hippoecm.repository.standardworkflow.DefaultWorkflow.setDisplayName(Ljava/lang/String;)V
[INFO] [talledLocalContainer] at org.onehippo.forge.content.exim.core.impl.WorkflowDocumentManagerImpl.createDocument(WorkflowDocumentManagerImpl.java:422)
[INFO] [talledLocalContainer] at org.onehippo.forge.content.exim.core.impl.WorkflowDocumentVariantImportTask.createDocument(WorkflowDocumentVariantImportTask.java:153)
[INFO] [talledLocalContainer] at org.onehippo.forge.content.exim.core.impl.WorkflowDocumentVariantImportTask.createOrUpdateDocumentFromVariantContentNode(WorkflowDocumentVariantImportTask.java:86)
Thanks a lot Woonsan. #1 was also happening because of version conflict.
I was seeing URL safe string (foo_bar) instead of the localized name (Foo Bar)
Can you suggest some way to unit/integration test the related code?
With older plugin , I was redirected to JCRJobStoreTest (based on RepositoryTestCase)
So, Just wanted your inputs on creating the test case and what expected value to look for. (e.g. String path returned by method - createOrUpdateDocumentFromVariantContentNode() to check if document got created? )
I don’t think we have any product support for Mocking with Hippo Workflow API on which Content EXIM depends.
So, RepositoryTestCase is the only way to go for unit/integration tests.
As we were working on one of the feature, I came across a scenario.
If I am setting 3(a,b,c) out of 4 properties (a,b,c,d) of a document, then
EXIM API clears the property value for d. (Image in my case)
Based on some previous conversations, I had an idea that it doesn’t override and in fact, worked fine for some of the properties like taxonomy values.
Can you suggest , how to prevent overriding of a property which I don’t want to update?
Could you please start a new thread for the new question? It’s better to create a new post for a new topic wherever possible as not many people can associate the question with the old one.