Uploaded image for project: 'Nuxeo Studio'
  1. Nuxeo Studio
  2. NXS-119

Simplify upgrade tool

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.2
    • Component/s: None

      Description

      Remove annotations since they are redundant with information stored in ExtensionType.
      See java doc on PersistenceUpgrade class for how to create a new upgrade tool.

      Here is a copy of that java doc:

      To create a new persistence upgrade tool extend this class and implement

      {@link #getBuilder()}

      and

      {@link #process(Document, String)}
      Also you need to update the corresponding feature type version by overriding {@link ExtensionType#getVersion()}.

      The {@link #process(Document, String)}

      method will be called for each persisted file of the same type and with the dom4j Document corresponding to the file and the persisted feature version as arguments.
      To ignore the persisted file (upgrade will not be done) return null.
      To force file deletion (a backup will be made) throw an exception (this should be done when file cannot be upgraded and should be removed)
      Otherwise if the input version is known read the input document and transform it into a feature model that should be returned back to be stored in the place of the older model.

      The method you need to implement to do an upgrade:

      /**

      • Try to convert the given document (of the given version) into a feature model.
      • If cannot convert (version is not known) you should either return null (to ignore the model and let it as this)
      • or to throw an exception to force input file deletion.
        *
      • @param doc the document to process
      • @param version the document version
      • @return the model read from the document or null to ignore upgrade.
      • @throws Exception if any error occurs pr model is not compatible and should be deleted.
        */
        protected abstract T process(Document doc, String version) throws Exception;

        Attachments

          Activity

            People

            • Assignee:
              bstefanescu Bogdan Stefanescu
              Reporter:
              bstefanescu Bogdan Stefanescu
              Participants:
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: