cancel
Showing results for 
Search instead for 
Did you mean: 

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

Benjamin_Jalon1
Elite Collaborator
Elite Collaborator

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 ACCEPTED ANSWER

Benjamin_Jalon1
Elite Collaborator
Elite Collaborator

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 😄

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

View answer in original post

3 REPLIES 3

Benjamin_Jalon1
Elite Collaborator
Elite Collaborator

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 😄

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

Florent_Guillau
World-Class Innovator
World-Class Innovator

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?

Benjamin_Jalon1
Elite Collaborator
Elite Collaborator

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

Getting started

Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.