Class StoreCleaner

java.lang.Object
com.jalios.jstore.StoreCleaner

public class StoreCleaner extends Object
Write clean line of Store.
- Use a file as a new Store (do not load it)
- Write Create Operation of Collection Storable or single Storable to the new Store
- Write Update Operation needed of Collection Storable or single Storable to the new Store
- Can Optimize Collection
- Can Override Id
- Can Override Stamp
Author:
Jean-Philippe Encausse
  • Field Details

    • store

      protected Store store
    • toCreate

      protected Set<Storable> toCreate
    • toUpdate

      protected Map<Storable,Storable> toUpdate
    • overrideId

      protected boolean overrideId
    • doClean

      protected boolean doClean
    • mainLang

      protected String mainLang
    • convLang

      protected String convLang
  • Constructor Details

  • Method Details

    • writeComment

      public void writeComment() throws IOException
      Throws:
      IOException
    • writeComment

      public void writeComment(String str) throws IOException
      Write a comment in the Store.
      Parameters:
      str -
      Throws:
      IOException
    • writeStore

      public void writeStore(Collection<Storable> collection) throws IOException
      Write create of a collection of Storable then prepare update
      Parameters:
      collection -
      Throws:
      IOException
      Since:
      jcms-4.0
    • writeStore

      public void writeStore(Collection<Storable> collection, boolean sort) throws IOException
      Write create of a collection of Storable then prepare update
      Parameters:
      collection -
      sort -
      Throws:
      IOException
      Since:
      jcms-4.0
    • writeStore

      public void writeStore(Collection<Storable> collection, boolean sort, boolean overrideId) throws IOException
      Write create of a collection of Storable then prepare update
      Parameters:
      collection -
      sort -
      overrideId -
      Throws:
      IOException
      Since:
      jcms-4.0
    • writeStore

      public void writeStore(Collection<Storable> collection, Stamp stamp) throws IOException
      Write create of a collection of Storable then prepare update
      Parameters:
      collection -
      stamp -
      Throws:
      IOException
      Since:
      jcms-4.0
    • writeStore

      public void writeStore(Collection<Storable> collection, Stamp stamp, boolean sort) throws IOException
      Write create of a collection of Storable then prepare update
      Parameters:
      collection -
      stamp -
      sort -
      Throws:
      IOException
      Since:
      jcms-4.0
    • writeStore

      public void writeStore(Collection<Storable> collection, Stamp stamp, boolean sort, boolean overrideId) throws IOException
      Write create of a collection of Storable then prepare update
      Parameters:
      collection -
      stamp -
      sort -
      overrideId -
      Throws:
      IOException
      Since:
      jcms-4.0
    • writeStore

      public void writeStore(Storable storable) throws IOException
      Write create of a Storable then prepare update
      Parameters:
      storable -
      Throws:
      IOException
      Since:
      jcms-4.0
    • writeStore

      public void writeStore(Storable storable, boolean overrideId) throws IOException
      Write create of a Storable then prepare update
      Parameters:
      storable -
      overrideId -
      Throws:
      IOException
      Since:
      jcms-4.0
    • writeStore

      public void writeStore(Storable storable, Stamp stamp) throws IOException
      Write create of a Storable then prepare update
      Parameters:
      storable -
      stamp -
      Throws:
      IOException
      Since:
      jcms-4.0
    • writeStore

      public void writeStore(Storable storable, Stamp stamp, boolean overrideId) throws IOException
      Write create of a Storable then prepare update
      Parameters:
      storable -
      stamp -
      overrideId -
      Throws:
      IOException
      Since:
      jcms-4.0
    • updateStore

      public void updateStore() throws IOException
      Write all updates
      Throws:
      IOException
      Since:
      jcms-4.0
    • updateStore

      public void updateStore(Collection<Storable> collection) throws IOException
      Write all updates for the given collection
      Parameters:
      collection -
      Throws:
      IOException
      Since:
      jcms-4.0
    • updateStore

      public void updateStore(Collection<Storable> collection, Stamp stamp) throws IOException
      Write all updates for the given collection
      Parameters:
      collection -
      stamp -
      Throws:
      IOException
      Since:
      jcms-4.0
    • updateStore

      public void updateStore(Storable storable, Stamp stamp) throws IOException
      Write an update of a given Storable already created
      If the Storable need an Update then doUpdate and remove it from the Update Table
      If the Storable doesn't need an update but exist in the Store (warning retrieve it by it's Id) then do an update. Write all updates for the given collection
      Parameters:
      storable -
      stamp -
      Throws:
      IOException
      Since:
      jcms-4.0
    • updateStore

      public void updateStore(Storable storable) throws IOException
      Write an update of a given Storable already created
      If the Storable need an Update then doUpdate and remove it from the Update Table
      If the Storable doesn't need an update but exist in the Store (warning retrieve it by it's Id) then do an update. Write all updates for the given collection
      Parameters:
      storable -
      Throws:
      IOException
      Since:
      jcms-4.0
    • addClassTag

      public void addClassTag(String tag, Class<?> clazz)
    • sortCreate

      public List<Storable> sortCreate(Collection<Storable> toSortCollection)
      Sort a Collection by less update probability
      Parameters:
      toSortCollection -
      Returns:
      a sorted collection
      Since:
      jcms-4.0
    • sortCreate

      protected void sortCreate(Storable storable, Collection<Storable> toSortCollection, Collection<Storable> isVisitedCollection, List<Storable> sortedList)
      Recursive call to sort storables collection by less update probability.
      Parameters:
      storable -
      toSortCollection -
      isVisitedCollection -
      sortedList -
      Since:
      jcms-4.0
    • cleanUnknownLinks

      public boolean cleanUnknownLinks(Storable storable, Field field, Set<Storable> storableSet)
      Clean all unknown Storable from the given field of the given storable
      Returns:
      true if a clean has be done
      Since:
      jcms-4.0
    • cleanUnknownLinks

      public boolean cleanUnknownLinks(Storable storable, Map<Field,Set<Storable>> referencedLinkMap)
      Clean all unknown Storable from the given field map of the given storable
      Parameters:
      storable -
      referencedLinkMap -
      Returns:
      true if a clean has be done
      Since:
      jcms-4.0
    • getReferencedLinkMap

      public Map<Field,Set<Storable>> getReferencedLinkMap(Storable storable, Set<Field> fieldSet)
      Return all storable referenced by the given storable fields
      Parameters:
      storable -
      fieldSet -
      Returns:
      Map Fields / Set of Storable
      Since:
      jcms-4.0
    • getReferencedLinkSet

      public Set<Storable> getReferencedLinkSet(Storable storable, Set<Field> fieldSet)
      Return all storable referenced by the given storable fields
      Parameters:
      storable -
      fieldSet -
      Returns:
      Set of Storable
      Since:
      jcms-4.0
    • getReferencedLinkSet

      public Set<Storable> getReferencedLinkSet(Storable storable, Field field)
      Return all storable referenced by the given storable field
      Parameters:
      storable -
      field -
      Returns:
      Set of Storable
      Since:
      jcms-4.0
    • getFieldSet

      public Set<Field> getFieldSet(Storable storable)
      Return all the fields of a given storable
      Returns:
      Set of Field
      Since:
      jcms-4.0
    • convertLang

      public void convertLang(Storable data)