Skip to content

Commit 918f523

Browse files
author
philip
committed
Fix compile issue - updating framework
1 parent 6483d24 commit 918f523

File tree

999 files changed

+15033
-3484
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

999 files changed

+15033
-3484
lines changed

bizcore/.settings/org.eclipse.jdt.core.prefs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,3 @@ org.eclipse.jdt.core.compiler.source=1.8
2727

2828

2929

30-
31-
32-
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package com.skynet.bootstrap;
2+
3+
import com.terapico.uccaf.UCInvocationServlet;
4+
import org.springframework.boot.SpringApplication;
5+
import org.springframework.boot.autoconfigure.SpringBootApplication;
6+
//import org.springframework.boot.autoconfigure.elasticsearch.rest.RestClientAutoConfiguration;
7+
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
8+
import org.springframework.boot.web.servlet.ServletComponentScan;
9+
import org.springframework.boot.web.servlet.ServletRegistrationBean;
10+
import org.springframework.context.annotation.Bean;
11+
import org.springframework.context.annotation.ImportResource;
12+
import org.springframework.web.servlet.DispatcherServlet;
13+
14+
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
15+
@ImportResource(locations = {"classpath:/META-INF/spring.xml", "classpath:/META-INF/online-system.xml"})
16+
@ServletComponentScan(basePackageClasses = {UCInvocationServlet.class})
17+
public class AppEntrance {
18+
public static void main(String[] args) {
19+
SpringApplication.run(AppEntrance.class, args);
20+
}
21+
22+
@Bean
23+
public ServletRegistrationBean dispatcherRegistration(DispatcherServlet dispatcherServlet) {
24+
ServletRegistrationBean reg = new ServletRegistrationBean(dispatcherServlet);
25+
reg.getUrlMappings().clear();
26+
reg.addUrlMappings("*.css");
27+
reg.addUrlMappings("*.txt");
28+
reg.addUrlMappings("*.js");
29+
reg.addUrlMappings("*.jpg");
30+
return reg;
31+
}
32+
}

bizcore/WEB-INF/caf_core_src/com/skynet/infrastructure/FileSensitiveWordsProvider.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import java.io.File;
66
import java.nio.file.Files;
77
import java.nio.file.Paths;
8+
import java.util.Collections;
89
import java.util.List;
910

1011
public class FileSensitiveWordsProvider implements SensitiveWordsProvider {
@@ -17,7 +18,8 @@ public void setFilePath(String filePath) {
1718

1819
@Override
1920
public List<String> provide() throws Exception {
20-
File file = ResourceUtils.getFile(filePath);
21-
return Files.readAllLines(Paths.get(file.toURI()));
21+
// File file = ResourceUtils.getFile(filePath);
22+
// return Files.readAllLines(Paths.get(file.toURI()));
23+
return Collections.EMPTY_LIST;
2224
}
2325
}

bizcore/WEB-INF/caf_core_src/com/terapico/caf/ReflectionTool.java

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.terapico.caf;
22

3+
import java.io.IOException;
34
import java.lang.reflect.Array;
45
import java.lang.reflect.Constructor;
56
import java.lang.reflect.Method;
@@ -13,6 +14,11 @@
1314
import java.util.List;
1415
import java.util.TimeZone;
1516

17+
import com.fasterxml.jackson.core.JsonParseException;
18+
import com.fasterxml.jackson.databind.DeserializationFeature;
19+
import com.fasterxml.jackson.databind.JsonMappingException;
20+
import com.fasterxml.jackson.databind.ObjectMapper;
21+
1622

1723

1824
@SuppressWarnings("rawtypes")
@@ -58,7 +64,49 @@ protected boolean isArrayOfPrimaryType(Type type) {
5864
}
5965
return false;
6066
}
67+
public static boolean hasRemoteInitiableInterface(Type parameterType) {
68+
69+
return RemoteInitiable.class.isAssignableFrom((Class) parameterType);
70+
71+
}
72+
73+
private static ObjectMapper mapper ;
74+
static {
75+
mapper = new ObjectMapper();
76+
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
77+
78+
}
79+
80+
public static Object convertOnlyOneParameter(Type[] types, String value) {
81+
int length = types.length;
82+
83+
if(length == 0) {
84+
throw new IllegalArgumentException("Only one type allowed here, but the length of the length is: "+length);
85+
86+
}
87+
Type firstParameterType = types[0]; //it is safe here, there is ONE param when code runs to here
88+
89+
//String type supported
90+
if(firstParameterType == java.lang.String.class) {
91+
return value;
92+
}
93+
//otherwise this should be a json object with a class
94+
if(!hasRemoteInitiableInterface(firstParameterType)) {
95+
throw new IllegalArgumentException("The type should implement a RemoteInitiable interface, but the class is: " + firstParameterType.getTypeName());
96+
}
97+
//parse to a json object and return
98+
99+
100+
101+
try {
102+
Object responseObj = mapper.readValue(value, (Class)firstParameterType);
103+
return responseObj;
104+
} catch (Exception e) {
105+
e.printStackTrace();
106+
return null;
107+
}
61108

109+
}
62110
protected Constructor getOneStringConstructor(Class clazz) {
63111
Constructor constructors[] = clazz.getDeclaredConstructors();
64112

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package com.terapico.caf;
2+
3+
public interface RemoteInitiable {
4+
5+
}

0 commit comments

Comments
 (0)