Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] Content bootstrapping #8

Closed
yregaieg opened this issue Jun 16, 2020 · 4 comments
Closed

[Question] Content bootstrapping #8

yregaieg opened this issue Jun 16, 2020 · 4 comments
Labels

Comments

@yregaieg
Copy link

Hello there,

I see here no example for bootstrapping content inside of "Data Dictionary" or the likes, but I thought that should be possible OOTB with Dynamic Extensions, anyway and example of that would be a great addition to this repo.

Regards,
Younes

@kerkhofsd
Copy link
Contributor

Hi @yregaieg,

Thanks for your suggestion!
This functionality is indeed available in DE, however I did not yet use it myself.

I had a quick look at adding this example based on the documentation.
However the BootstrapService used for this purpose is part of the annotations-runtime submodule, which is considered internal API. I'll ask around with other team members that have used this functionality how it should be used. Nevertheless I am convinced that these examples should never have a dependency on the annotations-runtime internal dependency, hence we probably need to consider moving the BootstrapService to the public API.

Kind regards,
Daan

@kerkhofsd
Copy link
Contributor

Hi @yregaieg,

FYI: I've created xenit-eu/dynamic-extensions-for-alfresco#304

In my opinion we should avoid adding a dependency to annotations-runtime in the example-dynamic-extension project. Therefore I will not yet add a content bootstrapping example.

Kind regards,
Daan

@yregaieg
Copy link
Author

Awesome, thanks! That documentation was exactly what I was looking for!

@yregaieg yregaieg changed the title Question [Question] Content bootstrapping Jun 17, 2020
@yregaieg
Copy link
Author

Again, thanks for the help guys!
I just wanted to share that BootstrapService doesn't seem to have automatic transaction wrapping, so I needed to add my own transaction wrapper, I have also needed to add myself a valid secure context, here is my code for future reference, should any other developer come across the same issue :

transactionService.getRetryingTransactionHelper().doInTransaction(() ->
      AuthenticationUtil.runAsSystem(() ->
        bootstrapService.deployResources(
          "osgibundle:/META-INF/alfresco/bootstrap/*.ftl",
          new RepositoryLocation(
            StoreRef.STORE_REF_WORKSPACE_SPACESSTORE,
            "/app:company_home/app:dictionary/app:email_templates",
            SearchService.LANGUAGE_XPATH
          ),
          new ContentCompareStrategy(resourceHelper),
          null, null, ContentModel.TYPE_CONTENT
        )
      ), false, true);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants