Class ModelUpdate


  • public class ModelUpdate
    extends java.lang.Object
    Update savedquery, savedtemplatequery and savedbag when the model has been changed
    Author:
    butano
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String DELETE
      label in modelUpdate.properties file to identify deleted classes or fields
      static java.lang.String OLD
      suffix used to rename the previous items
      static java.lang.String RENAME
      label in modelUpdate.properties file to identify renamed classes or fields
    • Constructor Summary

      Constructors 
      Constructor Description
      ModelUpdate​(ObjectStore os, ObjectStoreWriter uosw, Model oldModel)
      Construct a ModelUpdate for updating items built in the userprofile with the oldModel given in input
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void deleteBags()
      Delete all bags having as a type one of the classes deleted
      java.util.Set<java.lang.String> getDeletedClasses()
      Return a set containing all the deleted classes
      java.util.Map<java.lang.String,​java.lang.String> getRenamedClasses()
      Return a map containing the couple previous class and new class
      java.util.Map<java.lang.String,​java.lang.String> getRenamedFields()
      Return a map containing the couple previousClass.previuosField and new field
      void update()
      Update bags, savedquery and savedtemplatequery if class has been renamed -> update type bags, update savedquery and savedtemplatequery if a field has been renamed -> update savedquery and savedtemplatequery if class has been deleted -> delete bags with that type
      void updateReferredQueryAndTemplate()
      Update savedquery and savedtemplatequery when they reeferring to renamed classes or fields
      void updateTypeBag()
      Update the type to all bags having as a type one of the classes renamed
      • Methods inherited from class java.lang.Object

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

      • DELETE

        public static final java.lang.String DELETE
        label in modelUpdate.properties file to identify deleted classes or fields
        See Also:
        Constant Field Values
      • RENAME

        public static final java.lang.String RENAME
        label in modelUpdate.properties file to identify renamed classes or fields
        See Also:
        Constant Field Values
      • OLD

        public static final java.lang.String OLD
        suffix used to rename the previous items
        See Also:
        Constant Field Values
    • Constructor Detail

      • ModelUpdate

        public ModelUpdate​(ObjectStore os,
                           ObjectStoreWriter uosw,
                           Model oldModel)
        Construct a ModelUpdate for updating items built in the userprofile with the oldModel given in input
        Parameters:
        os - objectstore
        uosw - userprofile
        oldModel - old schema
    • Method Detail

      • getDeletedClasses

        public java.util.Set<java.lang.String> getDeletedClasses()
        Return a set containing all the deleted classes
        Returns:
        the set
      • getRenamedClasses

        public java.util.Map<java.lang.String,​java.lang.String> getRenamedClasses()
        Return a map containing the couple previous class and new class
        Returns:
        the map
      • getRenamedFields

        public java.util.Map<java.lang.String,​java.lang.String> getRenamedFields()
        Return a map containing the couple previousClass.previuosField and new field
        Returns:
        the map
      • update

        public void update()
                    throws PathException
        Update bags, savedquery and savedtemplatequery if class has been renamed -> update type bags, update savedquery and savedtemplatequery if a field has been renamed -> update savedquery and savedtemplatequery if class has been deleted -> delete bags with that type
        Throws:
        PathException - if path is wrong
      • deleteBags

        public void deleteBags()
        Delete all bags having as a type one of the classes deleted
      • updateTypeBag

        public void updateTypeBag()
        Update the type to all bags having as a type one of the classes renamed
      • updateReferredQueryAndTemplate

        public void updateReferredQueryAndTemplate()
                                            throws PathException
        Update savedquery and savedtemplatequery when they reeferring to renamed classes or fields
        Throws:
        PathException - if path is not found