-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
292 changed files
with
53,636 additions
and
49,236 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 20 additions & 25 deletions
45
tarjonta-service/src/main/java/fi/vm/sade/tarjonta/config/JSonSerializationConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,45 @@ | ||
/* | ||
* Copyright (c) 2014 The Finnish Board of Education - Opetushallitus | ||
* | ||
* | ||
* This program is free software: Licensed under the EUPL, Version 1.1 or - as | ||
* soon as they will be approved by the European Commission - subsequent versions | ||
* of the EUPL (the "Licence"); | ||
* | ||
* | ||
* You may not use this work except in compliance with the Licence. | ||
* You may obtain a copy of the Licence at: http://www.osor.eu/eupl/ | ||
* | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* European Union Public Licence for more details. | ||
*/ | ||
package fi.vm.sade.tarjonta.config; | ||
|
||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
import com.fasterxml.jackson.annotation.JsonInclude.Include; | ||
import com.fasterxml.jackson.databind.DeserializationFeature; | ||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import com.fasterxml.jackson.databind.SerializationFeature; | ||
import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
/** | ||
* Spring configuraatio Json serialisoinnille (jackson) | ||
*/ | ||
/** Spring configuraatio Json serialisoinnille (jackson) */ | ||
@Configuration | ||
public class JSonSerializationConfig { | ||
|
||
@Bean | ||
public ObjectMapper getObjectMapper() { | ||
ObjectMapper mapper = new ObjectMapper(); | ||
mapper.setSerializationInclusion(Include.NON_NULL); | ||
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); | ||
mapper.configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, false); | ||
return mapper; | ||
} | ||
|
||
@Bean(name="tarjontaJacksonJsonProvider") | ||
public JacksonJaxbJsonProvider getJsonProvider(ObjectMapper mapper) { | ||
JacksonJaxbJsonProvider provider = new JacksonJaxbJsonProvider(); | ||
provider.setMapper(mapper); | ||
@Bean | ||
public ObjectMapper getObjectMapper() { | ||
ObjectMapper mapper = new ObjectMapper(); | ||
mapper.setSerializationInclusion(Include.NON_NULL); | ||
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); | ||
mapper.configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, false); | ||
return mapper; | ||
} | ||
|
||
return provider; | ||
} | ||
@Bean(name = "tarjontaJacksonJsonProvider") | ||
public JacksonJaxbJsonProvider getJsonProvider(ObjectMapper mapper) { | ||
JacksonJaxbJsonProvider provider = new JacksonJaxbJsonProvider(); | ||
provider.setMapper(mapper); | ||
|
||
return provider; | ||
} | ||
} |
61 changes: 30 additions & 31 deletions
61
tarjonta-service/src/main/java/fi/vm/sade/tarjonta/config/OidConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,42 @@ | ||
package fi.vm.sade.tarjonta.config; | ||
|
||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.ComponentScan; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
import fi.vm.sade.oid.generator.OIDGenerator; | ||
import fi.vm.sade.oid.generator.impl.RandomLuhnOIDGenerator; | ||
import fi.vm.sade.tarjonta.service.OidService; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.ComponentScan; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
@ComponentScan(basePackages = { "fi.vm.sade.oid.dao" }) | ||
@ComponentScan(basePackages = {"fi.vm.sade.oid.dao"}) | ||
@Configuration | ||
public class OidConfig { | ||
|
||
public OidConfig() { | ||
System.out.println("OidConfig init()"); | ||
} | ||
@Bean | ||
public OIDGenerator getGenerator() { | ||
return new RandomLuhnOIDGenerator(); | ||
} | ||
@Bean | ||
public OidService getOidService(){ | ||
return new OidService(); | ||
} | ||
public OidConfig() { | ||
System.out.println("OidConfig init()"); | ||
} | ||
|
||
@Bean | ||
public OIDGenerator getGenerator() { | ||
return new RandomLuhnOIDGenerator(); | ||
} | ||
|
||
@Bean | ||
public OidService getOidService() { | ||
return new OidService(); | ||
} | ||
|
||
// @Bean | ||
// @Autowired | ||
// public OIDGeneratorFactory getFactory(OIDGenerator defaultGenerator) { | ||
// OIDGeneratorFactory factory = new OIDGeneratorFactory(); | ||
// factory.setDefaultGenerator(defaultGenerator); | ||
// return factory; | ||
// } | ||
// | ||
// @Bean | ||
// public OIDService getOidService() { | ||
// OIDServiceImpl oid = new OIDServiceImpl(); | ||
// return oid; | ||
// } | ||
// @Bean | ||
// @Autowired | ||
// public OIDGeneratorFactory getFactory(OIDGenerator defaultGenerator) { | ||
// OIDGeneratorFactory factory = new OIDGeneratorFactory(); | ||
// factory.setDefaultGenerator(defaultGenerator); | ||
// return factory; | ||
// } | ||
// | ||
// @Bean | ||
// public OIDService getOidService() { | ||
// OIDServiceImpl oid = new OIDServiceImpl(); | ||
// return oid; | ||
// } | ||
|
||
} |
Oops, something went wrong.