Project

General

Profile

Revision c2cac51d

IDc2cac51d598b0015048c978ee8f90025aceb6a31
Parent f36a0784
Child d74e55d1

Added by Cherian Mathew about 5 years ago

#5000 Add new metadata service

View differences:

cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/application/CdmApplicationController.java
49 49
import eu.etaxonomy.cdm.api.service.IIdentificationKeyService;
50 50
import eu.etaxonomy.cdm.api.service.ILocationService;
51 51
import eu.etaxonomy.cdm.api.service.IMediaService;
52
import eu.etaxonomy.cdm.api.service.IMetadataService;
52 53
import eu.etaxonomy.cdm.api.service.INameService;
53 54
import eu.etaxonomy.cdm.api.service.IOccurrenceService;
54 55
import eu.etaxonomy.cdm.api.service.IPolytomousKeyNodeService;
......
499 500
	public final IMediaService getMediaService(){
500 501
		return configuration.getMediaService();
501 502
	}
503

  
504

  
505
    @Override
506
    public final IMetadataService getMetadataService(){
507
        return configuration.getMetadataService();
508
    }
502 509

  
503 510

  
504 511
	@Override
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/application/CdmApplicationDefaultConfiguration.java
47 47
import eu.etaxonomy.cdm.api.service.IIdentificationKeyService;
48 48
import eu.etaxonomy.cdm.api.service.ILocationService;
49 49
import eu.etaxonomy.cdm.api.service.IMediaService;
50
import eu.etaxonomy.cdm.api.service.IMetadataService;
50 51
import eu.etaxonomy.cdm.api.service.INameService;
51 52
import eu.etaxonomy.cdm.api.service.IOccurrenceService;
52 53
import eu.etaxonomy.cdm.api.service.IPolytomousKeyNodeService;
......
122 123
	@Autowired
123 124
	//@Qualifier("mediaService")
124 125
	private IMediaService mediaService;
126
    @Autowired
127
    //@Qualifier("mediaService")
128
    private IMetadataService metadataService;
125 129
	@Autowired
126 130
	//@Qualifier("commonService")
127 131
	private ICommonService commonService;
......
275 279
		return this.mediaService;
276 280
	}
277 281

  
282
    /**
283
     * {@inheritDoc}
284
     */
285
    @Override
286
    public IMetadataService getMetadataService() {
287
        return this.metadataService;
288
    }
289

  
278 290
	@Override
279 291
	public ITermService getTermService(){
280 292
		return this.termService;
......
443 455
		SecurityContext context = SecurityContextHolder.getContext();
444 456
		context.setAuthentication(authentication);
445 457
	}
446

  
447

  
448 458
}
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/application/ICdmApplicationConfiguration.java
31 31
import eu.etaxonomy.cdm.api.service.IIdentificationKeyService;
32 32
import eu.etaxonomy.cdm.api.service.ILocationService;
33 33
import eu.etaxonomy.cdm.api.service.IMediaService;
34
import eu.etaxonomy.cdm.api.service.IMetadataService;
34 35
import eu.etaxonomy.cdm.api.service.INameService;
35 36
import eu.etaxonomy.cdm.api.service.IOccurrenceService;
36 37
import eu.etaxonomy.cdm.api.service.IPolytomousKeyNodeService;
......
145 146
	 */
146 147
	public IMediaService getMediaService();
147 148

  
149
   /**
150
     * @return
151
     */
152
    public IMetadataService getMetadataService();
153

  
148 154

  
149 155
	/**
150 156
	 * @return
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/IMetadataService.java
1
// $Id$
2
/**
3
* Copyright (C) 2015 EDIT
4
* European Distributed Institute of Taxonomy
5
* http://www.e-taxonomy.eu
6
*
7
* The contents of this file are subject to the Mozilla Public License Version 1.1
8
* See LICENSE.TXT at the top of this package for the full license terms.
9
*/
10
package eu.etaxonomy.cdm.api.service;
11

  
12
import java.util.Map;
13

  
14
import eu.etaxonomy.cdm.config.CdmSourceException;
15
import eu.etaxonomy.cdm.model.metadata.CdmMetaData.MetaDataPropertyName;
16

  
17
/**
18
 * @author cmathew
19
 * @date 20 Nov 2015
20
 *
21
 */
22
public interface IMetadataService {
23

  
24

  
25
    /**
26
     * Returns the CDM model schema version number
27
     *
28
     * @return the CDM model schema version number
29
     * @throws CdmSourceException , incase of an underlying SQL error
30
     */
31
    public String getDbSchemaVersion() throws CdmSourceException;
32

  
33
    /**
34
     * Returns a boolean flag to indicate whether the database is empty
35
     *
36
     * @return boolean flag to indicate whether the database is empty
37
     * @throws CdmSourceException , incase of an underlying SQL error
38
     */
39
    public boolean isDbEmpty() throws CdmSourceException;
40

  
41
    /**
42
     * Returns metadata corresponding to the underlying data source
43
     *
44
     * @return
45
     * @throws CdmSourceException
46
     */
47
    public Map<MetaDataPropertyName, String> getCdmMetadataMap() throws CdmSourceException;
48

  
49
}
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/IUserService.java
10 10
package eu.etaxonomy.cdm.api.service;
11 11

  
12 12
import java.util.List;
13
import java.util.Map;
14 13
import java.util.UUID;
15 14

  
16 15
import org.hibernate.criterion.Criterion;
......
20 19
import org.springframework.security.provisioning.GroupManager;
21 20
import org.springframework.security.provisioning.UserDetailsManager;
22 21

  
23
import eu.etaxonomy.cdm.config.CdmSourceException;
24 22
import eu.etaxonomy.cdm.model.common.User;
25
import eu.etaxonomy.cdm.model.metadata.CdmMetaData.MetaDataPropertyName;
26 23
import eu.etaxonomy.cdm.persistence.dao.initializer.IBeanInitializer;
27 24
import eu.etaxonomy.cdm.persistence.query.MatchMode;
28 25
import eu.etaxonomy.cdm.persistence.query.OrderHint;
......
55 52
     */
56 53
    public List<User> listByUsername(String queryString, MatchMode matchmode, List<Criterion> criteria, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
57 54

  
58
    /**
59
     * @return
60
     * @throws CdmSourceException
61
     */
62
    public String getDbSchemaVersion() throws CdmSourceException;
63

  
64
    /**
65
     * @return
66
     * @throws CdmSourceException
67
     */
68
    public boolean isDbEmpty() throws CdmSourceException;
69

  
70
    /**
71
     * @return
72
     * @throws CdmSourceException
73
     */
74
    public Map<MetaDataPropertyName, String> getCdmMetadataMap() throws CdmSourceException;
75 55

  
76 56

  
77 57
}
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/MetadataServiceImpl.java
1
// $Id$
2
/**
3
* Copyright (C) 2015 EDIT
4
* European Distributed Institute of Taxonomy
5
* http://www.e-taxonomy.eu
6
*
7
* The contents of this file are subject to the Mozilla Public License Version 1.1
8
* See LICENSE.TXT at the top of this package for the full license terms.
9
*/
10
package eu.etaxonomy.cdm.api.service;
11

  
12
import java.util.Map;
13

  
14
import org.springframework.beans.factory.annotation.Autowired;
15
import org.springframework.stereotype.Service;
16
import org.springframework.transaction.annotation.Transactional;
17

  
18
import eu.etaxonomy.cdm.config.CdmSourceException;
19
import eu.etaxonomy.cdm.model.metadata.CdmMetaData.MetaDataPropertyName;
20

  
21
/**
22
 * Provides metadata information corresponding ti the underlying CDM Datasource.
23
 *
24
 * @author cmathew
25
 * @date 20 Nov 2015
26
 *
27
 */
28
@Service
29
@Transactional(readOnly = true)
30
public class MetadataServiceImpl implements IMetadataService {
31

  
32

  
33
    private IDatabaseService databaseService;
34

  
35
    @Autowired
36
    public void setDatabaseService(IDatabaseService databaseService) {
37
        this.databaseService = databaseService;
38
    }
39

  
40
    /**
41
     * {@inheritDoc}
42
     */
43
    @Override
44
    public  String getDbSchemaVersion() throws CdmSourceException  {
45
        return databaseService.getDbSchemaVersion();
46

  
47
    }
48

  
49
    /**
50
     * {@inheritDoc}
51
     */
52
    @Override
53
    public boolean isDbEmpty() throws CdmSourceException {
54
        return databaseService.isDbEmpty();
55
    }
56

  
57
    /**
58
     * {@inheritDoc}
59
     */
60
    @Override
61
    public Map<MetaDataPropertyName, String> getCdmMetadataMap() throws CdmSourceException {
62
        return databaseService.getCdmMetadataMap();
63
    }
64

  
65
}
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/UserService.java
38 38
import org.springframework.transaction.annotation.Transactional;
39 39
import org.springframework.util.Assert;
40 40

  
41
import eu.etaxonomy.cdm.config.CdmSourceException;
42 41
import eu.etaxonomy.cdm.model.common.GrantedAuthorityImpl;
43 42
import eu.etaxonomy.cdm.model.common.Group;
44 43
import eu.etaxonomy.cdm.model.common.User;
45
import eu.etaxonomy.cdm.model.metadata.CdmMetaData.MetaDataPropertyName;
46 44
import eu.etaxonomy.cdm.persistence.dao.common.IGrantedAuthorityDao;
47 45
import eu.etaxonomy.cdm.persistence.dao.common.IGroupDao;
48 46
import eu.etaxonomy.cdm.persistence.dao.common.IUserDao;
......
67 65

  
68 66
    private AuthenticationManager authenticationManager;
69 67

  
70
    private IDatabaseService databaseService;
71 68

  
72 69
    private UserCache userCache = new NullUserCache();
73 70

  
......
109 106
        this.grantedAuthorityDao = grantedAuthorityDao;
110 107
    }
111 108

  
112
    @Autowired
113
    public void setDatabaseService(IDatabaseService databaseService) {
114
        this.databaseService = databaseService;
115
    }
116 109

  
117 110
    /**
118 111
     * Changes the own password of in the database of the user which is
......
542 535
        return super.saveOrUpdate(transientInstances);
543 536
    }
544 537

  
545

  
546
    /* (non-Javadoc)
547
     * @see eu.etaxonomy.cdm.api.service.IUserService#getDbSchemaVersion()
548
     */
549
    @Override
550
    public  String getDbSchemaVersion() throws CdmSourceException  {
551
        return databaseService.getDbSchemaVersion();
552

  
553
    }
554

  
555
    /* (non-Javadoc)
556
     * @see eu.etaxonomy.cdm.api.service.IUserService#isDbEmpty()
557
     */
558
    @Override
559
    public boolean isDbEmpty() throws CdmSourceException {
560
        return databaseService.isDbEmpty();
561
    }
562

  
563
    @Override
564
    public Map<MetaDataPropertyName, String> getCdmMetadataMap() throws CdmSourceException {
565
        return databaseService.getCdmMetadataMap();
566
    }
567

  
568 538
}
cdmlib-services/src/main/resources/eu/etaxonomy/cdm/httpInvokerServices.xml
151 151
      <value>eu.etaxonomy.cdm.api.service.IMediaService</value>
152 152
    </property>
153 153
  </bean>
154
  
155
    <bean id="httpMetadataService"
156
    class="org.springframework.remoting.httpinvoker.HttpInvokerServiceExporter">
157
    <property name="service">
158
      <ref bean="metadataServiceImpl" />
159
    </property>
160
    <property name="serviceInterface">
161
      <value>eu.etaxonomy.cdm.api.service.IMetadataService</value>
162
    </property>
163
  </bean>
154 164

  
155 165
  <bean id="httpNameService"
156 166
    class="org.springframework.remoting.httpinvoker.HttpInvokerServiceExporter">
cdmlib-services/src/main/resources/eu/etaxonomy/cdm/remoting-services.xml
59 59
        <prop key="/remoting/entityvalidation.service">httpEntityValidationService</prop>
60 60
        <prop key="/remoting/entityconstraintviolation.service">httpEntityConstraintViolationService</prop>
61 61
        <prop key="/remoting-public/user.service">httpUserService</prop>
62
        <prop key="/remoting-public/metadata.service">httpMetadataService</prop>
62 63
        <prop key="/remoting/vocabulary.service">httpVocabularyService</prop>
63 64
        <prop key="/remoting/authenticationManager.service">httpAuthenticationManager</prop>
64 65
        <prop key="/remoting/io.service">httpIOService</prop>

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)