Class ViewNsMigrationUtil


  • public final class ViewNsMigrationUtil
    extends java.lang.Object
    Utility class to migrate the view name space uri in a file.
    Since:
    1.17
    Author:
    Lucas Koehler
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean checkMigration​(java.io.File file)
      Checks whether the view name space uri of the given file needs to be migrated.
      static boolean migrateViewEcoreNsUri​(java.io.File file)
      If the given file references the view ecore, migrate the view ecore namespace URI of the template model to the namespace URI of the registered version of the view ecore.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • migrateViewEcoreNsUri

        public static boolean migrateViewEcoreNsUri​(java.io.File file)
                                             throws java.io.IOException
        If the given file references the view ecore, migrate the view ecore namespace URI of the template model to the namespace URI of the registered version of the view ecore. This is necessary for domain model reference selectors to be compatible to the view models of the current version. Thereby, we assume that view models use the registered version of the view ecore because otherwise they could not be used in the current runtime environment.

        Note: If no migration is necessary, nothing is written to the output writer.

        Parameters:
        file - The File containing the template model
        Returns:
        whether the namespace uri was migrated
        Throws:
        java.io.IOException - if something goes wrong reading or writing the template model file
      • checkMigration

        public static boolean checkMigration​(java.io.File file)
                                      throws java.io.IOException
        Checks whether the view name space uri of the given file needs to be migrated.
        Parameters:
        file - The file to check
        Returns:
        true if no migration is necessary and false if the name space uri needs to be migrated.
        Throws:
        java.io.IOException - if the file cannot be read