How to init repository without restarting the Nuxeo instance and removing data

I would like to reinitialize my Nuxeo instance repository (remove all data and play again structure template) without restarting my instance and removing data.

I need that to test my structure template configuration.

1 votes

1 answers

2465 views

ANSWER

All unit tests are started with an empty repository. In what way do you want to do your tests? If you're doing functional tests, why is restarting the server a problem?
11/14/2012

No this is about Nuxeo Studio project test and development activity, on running Nuxeo instance.
11/14/2012



The following proposition must not be used for production server but only on development instance. I suggest this proposition for advanced user that knows what he is doing. This is like manipulating the “rm -rf /*“, that can be really problematic :D

The structure template is called when the documentCreated on the root document is sent and if the root document have no child. Based on that information, we will implement a reinit button.

Be careful this action will remove all data stored into the repository, especially workflows implemented through Studio and the default one. To re-enabled your own workflow, redeploy your studio project after the cleanup.

CREATE THE BUTTON

  • In Automation > User Actions > New
  • Feature ID: initialize_repository
  • Category: Folder Toolbar
  • Label: Initialize repository
  • Order: -100 (to let it the first one)
  • Current document has one of the types: Root (to display only on the root document)
  • Current user is administrator: checked (to limit disasters)

DECLARE THE ManagementRoot TYPE

  • Go to Settings & Versioning > Registries > Document Types

Copy the following content

{
  doctypes: {
    ManagementRoot: {
      parent: "Document",
    },
  }
}

CREATE THE BEHAVIOR

Create a new operation and attach it the User Action

  • Operation ID: userAction_initialize_repository
  • Fetch > Context Document(s)
  • Fetch > Query
  • query: SELECT * FROM Document WHERE ecm:parentId = '@{Document.id}'
  • Document > Delete
  • Fetch > Document
  • value: /
  • Notification > Send Event
  • name: documentCreated
  • Document > Save
  • Document > Create (need that to have dashboards working)
  • type: ManagementRoot
  • name: management
  • User Interface > Refresh
0 votes