Project

General

Profile

Revision 2638be38

ID2638be38d1f2f957820ca1906df2aa1795123eb2
Parent 398bcf3e
Child 69f17e7e

Added by Andreas Müller over 4 years ago

migrate to hibernate 5 for cdmlib-services and cdmlib-ext #4716

  • (except for hibernate search tests)
  • including new spring-config structure

View differences:

cdmlib-persistence/src/main/resources/eu/etaxonomy/cdm/persistence_security.xml
9 9
    http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd
10 10
    ">
11 11

  
12
    <bean id="transactionManager" class="org.springframework.orm.hibernate5.HibernateTransactionManager">
13
      <property name="sessionFactory" ref="sessionFactory" />
14
    </bean>
12
   <import resource="classpath:/eu/etaxonomy/cdm/persistence.xml"/>
13
   <import resource="classpath:/eu/etaxonomy/cdm/security_base.xml"/>
15 14

  
16
    <bean id="sessionFactory" class="org.springframework.orm.hibernate5.LocalSessionFactoryBean" depends-on="tableGeneratorGlobalOverride">
17
        <property name="implicitNamingStrategy">
18
          <bean class="org.hibernate.boot.model.naming.ImplicitNamingStrategyComponentPathImpl" />
19
        </property>
20

  
21
        <property name="entityInterceptor" ref="securityHibernateInterceptor" />
22

  
23
        <property name="configLocation" value="classpath:eu/etaxonomy/cdm/hibernate.cfg.xml"/>
24

  
25
        <!--
26
              If dataSource is set, this will override corresponding settings in Hibernate properties.
27
              If this is set, the Hibernate settings should not define a connection provider to
28
              avoid meaningless double configuration.
29

  
30
              see also org.springframework.orm.hibernate3.AbstractSessionFactoryBean.setDataSource(DataSource dataSource)
31
           -->
32
        <property name="dataSource" ref="dataSource"/>
33
        <property name="hibernateProperties" ref="hibernateProperties"/>
34
    </bean>
35

  
36
    <!--
37
       Configuration for the BeanInitialization
38
     -->
39
    <bean id="titleAndNameCacheAutoInitializer" class="eu.etaxonomy.cdm.persistence.dao.initializer.TitleAndNameCacheAutoInitializer"></bean>
40
    <bean id="annotationTypeAutoInitializer" class="eu.etaxonomy.cdm.persistence.dao.initializer.AnnotationTypeAutoInitializer"></bean>
41
    <bean id="markerTypeAutoInitializer" class="eu.etaxonomy.cdm.persistence.dao.initializer.MarkerTypeAutoInitializer"></bean>
42
    <bean id="gatheringEventLocationAutoInitializer" class="eu.etaxonomy.cdm.persistence.dao.initializer.GatheringEventLocationAutoInitializer"></bean>
43
    <bean id="termBaseAutoInitializer" class="eu.etaxonomy.cdm.persistence.dao.initializer.TermBaseAutoInitializer"></bean>
44
    <bean id="mediaAutoInitializer" class="eu.etaxonomy.cdm.persistence.dao.initializer.MediaAutoInitializer"></bean>
45
    <bean id="typeDesignationAutoInitializer" class="eu.etaxonomy.cdm.persistence.dao.initializer.TypeDesignationAutoInitializer"></bean>
46

  
47
   <bean id="defaultBeanInitializer" class="eu.etaxonomy.cdm.persistence.dao.initializer.AdvancedBeanInitializer">
48
   <!--
49
   <bean id="defaultBeanInitializer" class="eu.etaxonomy.cdm.persistence.dao.hibernate.HibernateBeanInitializer">
50
   -->
51
       <property name="beanAutoInitializers">
52
           <map>
53
               <entry key="eu.etaxonomy.cdm.model.common.IdentifiableEntity"  value-ref="titleAndNameCacheAutoInitializer" />
54
               <entry key="eu.etaxonomy.cdm.model.common.Annotation"  value-ref="annotationTypeAutoInitializer" />
55
               <entry key="eu.etaxonomy.cdm.model.common.Marker"  value-ref="markerTypeAutoInitializer" />
56
               <entry key="eu.etaxonomy.cdm.model.occurrence.GatheringEvent"  value-ref="gatheringEventLocationAutoInitializer" />
57
               <entry key="eu.etaxonomy.cdm.model.common.TermBase"  value-ref="termBaseAutoInitializer" />
58
               <entry key="eu.etaxonomy.cdm.model.media.Media"  value-ref="mediaAutoInitializer" />
59
               <entry key="eu.etaxonomy.cdm.model.name.TypeDesignationBase"  value-ref="typeDesignationAutoInitializer" />
60
           </map>
61
       </property>
62
    </bean>
63

  
64
    <!--
65
      ============================== SECURITY ==============================
66
    -->
67
    <bean id="accessDecisionManager" class="eu.etaxonomy.cdm.persistence.hibernate.permission.UnanimousBasedUnrevokable">
68
        <constructor-arg>
69
            <list>
70
                <bean class="eu.etaxonomy.cdm.persistence.hibernate.permission.voter.GrantAlwaysVoter" />
71
                <bean class="eu.etaxonomy.cdm.persistence.hibernate.permission.voter.TaxonNodeVoter" />
72
                <bean class="eu.etaxonomy.cdm.persistence.hibernate.permission.voter.TaxonBaseVoter" />
73
                <bean class="eu.etaxonomy.cdm.persistence.hibernate.permission.voter.DescriptionBaseVoter" />
74
                <bean class="eu.etaxonomy.cdm.persistence.hibernate.permission.voter.DescriptionElementVoter" />
75
                <bean class="eu.etaxonomy.cdm.persistence.hibernate.permission.voter.TaxonNameBaseVoter" />
76
                <bean class="eu.etaxonomy.cdm.persistence.hibernate.permission.voter.ReferenceVoter" />
77
                <bean class="eu.etaxonomy.cdm.persistence.hibernate.permission.voter.TeamOrPersonBaseVoter" />
78
            </list>
79
        </constructor-arg>
80
        
81
<!--         <property name="decisionVoters">
82
            <list>
83
                <bean class="eu.etaxonomy.cdm.persistence.hibernate.permission.voter.GrantAlwaysVoter" />
84
                <bean class="eu.etaxonomy.cdm.persistence.hibernate.permission.voter.TaxonNodeVoter" />
85
                <bean class="eu.etaxonomy.cdm.persistence.hibernate.permission.voter.TaxonBaseVoter" />
86
                <bean class="eu.etaxonomy.cdm.persistence.hibernate.permission.voter.DescriptionBaseVoter" />
87
                <bean class="eu.etaxonomy.cdm.persistence.hibernate.permission.voter.DescriptionElementVoter" />
88
                <bean class="eu.etaxonomy.cdm.persistence.hibernate.permission.voter.TaxonNameBaseVoter" />
89
                <bean class="eu.etaxonomy.cdm.persistence.hibernate.permission.voter.ReferenceVoter" />
90
                <bean class="eu.etaxonomy.cdm.persistence.hibernate.permission.voter.TeamOrPersonBaseVoter" />
91
            </list>
92
        </property>
93
 -->    </bean>
94

  
95
    <!--
96
        CdmPermissionEvaluator.hasPermissions() evaluates the CdmPermissions like TAXONNODE.UPDATE{20c8f083-5870-4cbd-bf56-c5b2b98ab6a7}
97
    -->
98
    <bean id="cdmPermissionEvaluator" class="eu.etaxonomy.cdm.persistence.hibernate.permission.CdmPermissionEvaluator">
99
        <property name="accessDecisionManager" ref="accessDecisionManager" />
100
    </bean>
101

  
102
    <!-- The CdmSecurityHibernateInterceptor checks onSave() and on flushDirty() if the currently authenticated principal or token  has
103
    sufficient permissions on the entity to be persisted -->
104
    <bean id="securityHibernateInterceptor" class="eu.etaxonomy.cdm.persistence.hibernate.CdmSecurityHibernateInterceptor">
105
        <property name="permissionEvaluator" ref="cdmPermissionEvaluator" />
106
    </bean>
107 15

  
108 16
</beans>

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)