Uploaded image for project: 'CMS'
  1. CMS
  2. CMS-11526

Node name computation is not optimal at content creation

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Critical Critical
    • 4.6.0
    • 4.6.0
    • None
    • None
    • 4.6 RC4

      When we create a new content based on a basic name, it can take several seconds only to compute the JCR node name.
      If we have thousands of contents with the same creation name, multiple operation taking 1 to 3 ms are executed, and it costs a lot when cumulated.

      To solve this, in CreateContentFunction._createContent() (both in CMS and Web) method:

      • Stop calling FilterNameHelper.filterName(...) on each loop, the based name is already filtered and the suffix will already been transformed to "-" + suffix (currently it is only number.
      • Stop to test errorCount, increment the name directly in the catch.
      • Stop incrementing it twice (one for one shot, one for next time).
      • Base the suffix on something more random, I suggest using StringUtils.generateKey().
      • Object type should be compute only one time before the loop.

      That is very thin operations but cumulated, it takes time.

      Also to avoid names like basedName-suffix1-suffix2-suffix3 after multiple copy, be smarter and cut the name before the last "-" and check if the suffix can be a generated key (8 characters only numbers and digits).

      Note: Same recommandations for following calls, some are not critical:

      • CloneComponent._getAvailableNodeName(...) - plugin CMS
      • CloneComponent.createNodeClone(...) - plugin CMS
      • SharedContentManager.createContent(...) - plugin Web
      • PageDAO.createPage(...) - plugin Web
      • PageDAO._createPage(...) - plugin Web
      • PageDAO.renamePage(...) - plugin Web
      • ProjectsCatalogueManager._findName(...) - plugin Workspaces
      • BPMWorkflowManager.addWorkflow(...) - plugin BPM
      • BPMWorkflowManager.createProcess(...) - plugin BPM
      • CartsDAO.createCart(...) - plugin Cart
      • JcrQueryDao._getNotExistingNodeName(...) - plugin External Data
      • FormPropertiesManager._getNotExistingNodeName(...) - plugin Forms
      • FormDAO.createForm(...) - plugin Forms
      • FormPageDAO.createPage(...) - plugin Forms
      • FormQuestionDAO.findUniqueQuestionName(...) - plugin Forms
      • GlossaryDAO.createDefinition(...) - plugin Glossary
      • LinkDAO._createLink(...) - plugin Link Directory
      • QueryDAO.createQuery(...) - plugin Queries Directory
      • PageDAO.createPage(...) - plugin Survey
      • QuestionDAO.findUniqueQuestionName(...) - plugin Survey
      • SurveyDAO.createSurvey(...) - plugin Survey
      • SurveyDAO.copySurvey(...) - plugin Survey
      • ThesaurusDAO.createThesaurus(...} - plugin Thesaurus
      • ContentIOManager._importFromDirectory(...) - plugin Web Content IO
      • ContentIOManager._convertFileToContent(...) - plugin Web Content IO
      • ContentIOManager._createPageAndSetContent(...) - plugin Web Content IO
      • AbstractCreateODFContentByCopyFunction._createContent(...) - plugin ODF
      • AbstractCreateODFContentFunction._createContent(...) - plugin ODF

      Some of these methods can be probably factorized.

            bmaurel Bérénice Maurel
            bmaurel Bérénice Maurel
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: