Class ModelLoader


  • public class ModelLoader
    extends Object
    • Constructor Detail

      • ModelLoader

        public ModelLoader()
    • Method Detail

      • doLoad

        protected void doLoad​(URL url,
                              com.axelor.meta.loader.Module module,
                              boolean update)
      • findFiles

        protected List<URL> findFiles​(com.axelor.meta.loader.Module module)
      • doLoad

        protected void doLoad​(com.axelor.meta.loader.Module module,
                              boolean update)
        Implement this method the load the data.
        Parameters:
        module - the module for which to load the data
        update - whether to force update while loading
      • feedTransactionExecutor

        protected void feedTransactionExecutor​(ParallelTransactionExecutor transactionExecutor,
                                               com.axelor.meta.loader.Module module,
                                               boolean update,
                                               Set<Path> paths)
      • findFiles

        protected List<URL> findFiles​(com.axelor.meta.loader.Module module,
                                      Set<Path> paths)
      • isVisited

        protected boolean isVisited​(Class<?> type,
                                    String name,
                                    Class<?> baseType,
                                    String xmlId)
        Checks whether an element is already visited. Element can be either identified the pair type/name or by its xmlId.
        Parameters:
        type - element type
        name - element name
        baseType - element base type
        xmlId - element xmlId
        Returns:
        whether the element is already visited or not
      • isVisited

        protected boolean isVisited​(Class<?> type,
                                    String name,
                                    String xmlId)
        Checks whether an element is already visited. Element can be either identified the pair type/name or by its xmlId.
        Parameters:
        type - element type
        name - element name
        xmlId - element xmlId
        Returns:
        whether the element is already visited or not
      • getDuplicates

        protected Set<String> getDuplicates()
        Returns items that have been visited several times.
        Returns:
        duplicate items
      • setUnresolved

        protected <T> void setUnresolved​(Class<T> type,
                                         String unresolvedKey,
                                         Long entityId)
        Put a value of the given type for resolution for the given unresolved key.

        The value is put inside a Map with unresolvedKey as the key.
        Parameters:
        type -
        unresolvedKey -
        entityId -
      • resolve

        protected <T> Set<Long> resolve​(Class<T> type,
                                        String unresolvedKey)
        Resolve the given unresolved key.

        All the pending values of the unresolved key are returned for further processing. The values are removed from the backing Map.
        Parameters:
        type - the type of pending objects
        unresolvedKey - the unresolved key
        Returns:
        a set of all the pending objects
      • runResolveTasks

        protected void runResolveTasks()
      • unresolvedKeys

        protected Set<String> unresolvedKeys()
        Return set of all the unresolved keys.
        Returns:
        set of unresolved keys
      • load

        public final void load​(com.axelor.meta.loader.Module module,
                               boolean update)