View Javadoc
1   package fr.ifremer.tutti.persistence.service;
2   
3   /*
4    * #%L
5    * Tutti :: Persistence
6    * %%
7    * Copyright (C) 2012 - 2014 Ifremer
8    * %%
9    * This program is free software: you can redistribute it and/or modify
10   * it under the terms of the GNU General Public License as
11   * published by the Free Software Foundation, either version 3 of the
12   * License, or (at your option) any later version.
13   * 
14   * This program is distributed in the hope that it will be useful,
15   * but WITHOUT ANY WARRANTY; without even the implied warranty of
16   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17   * GNU General Public License for more details.
18   * 
19   * You should have received a copy of the GNU General Public
20   * License along with this program.  If not, see
21   * <http://www.gnu.org/licenses/gpl-3.0.html>.
22   * #L%
23   */
24  
25  import fr.ifremer.tutti.persistence.TuttiPersistenceServiceImplementor;
26  import fr.ifremer.tutti.persistence.entities.referential.TuttiReferentialEntity;
27  import org.nuiton.version.Version;
28  import org.springframework.transaction.annotation.Transactional;
29  
30  import java.util.concurrent.Callable;
31  
32  /**
33   * Contains some technical services.
34   *
35   * Created on 4/20/14.
36   *
37   * @author Tony Chemit - chemit@codelutin.com
38   * @since 3.5
39   */
40  @Transactional(readOnly = true)
41  public interface TechnicalPersistenceService extends TuttiPersistenceServiceImplementor {
42  
43      boolean isTemporary(TuttiReferentialEntity entity);
44  
45      /**
46       * To clear all caches.
47       *
48       * @since 1.0.1
49       */
50      void clearAllCaches();
51  
52      /**
53       * To invoke the given call code.
54       *
55       * <strong>Note:</strong> this is mainly to execute a code in a single
56       * transaction.
57       *
58       * @param call call to invoke
59       * @param <V>  return type
60       * @return the return of the call
61       * @since 2.4
62       */
63      @Transactional(readOnly = false)
64      <V> V invoke(Callable<V> call);
65  
66      Version getSchemaVersion();
67  
68      Version getSchemaVersionIfUpdate();
69  
70      /**
71       * To init the update schema context.
72       *
73       * We are initialized it with current schema version, next schema version and use the call back if needed to
74       * interact with user.
75       *
76       * @param <U>     type of context
77       * @param context context to fill.
78       * @since 3.12
79       */
80      <U extends UpdateSchemaContextSupport> void prepareUpdateSchemaContext(U context);
81  
82      @Transactional(readOnly = false)
83      void updateSchema();
84  
85      @Transactional(readOnly = false)
86      void sanityDb();
87  }