Skip to content

Commit

Permalink
Fix compile issue - updating framework
Browse files Browse the repository at this point in the history
  • Loading branch information
philip committed Jul 3, 2019
1 parent b0587c8 commit 25ab7e8
Show file tree
Hide file tree
Showing 999 changed files with 15,033 additions and 3,484 deletions.
3 changes: 0 additions & 3 deletions bizcore/.settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,3 @@ org.eclipse.jdt.core.compiler.source=1.8






32 changes: 32 additions & 0 deletions bizcore/WEB-INF/caf_core_src/com/skynet/bootstrap/AppEntrance.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package com.skynet.bootstrap;

import com.terapico.uccaf.UCInvocationServlet;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
//import org.springframework.boot.autoconfigure.elasticsearch.rest.RestClientAutoConfiguration;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ImportResource;
import org.springframework.web.servlet.DispatcherServlet;

@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
@ImportResource(locations = {"classpath:/META-INF/spring.xml", "classpath:/META-INF/online-system.xml"})
@ServletComponentScan(basePackageClasses = {UCInvocationServlet.class})
public class AppEntrance {
public static void main(String[] args) {
SpringApplication.run(AppEntrance.class, args);
}

@Bean
public ServletRegistrationBean dispatcherRegistration(DispatcherServlet dispatcherServlet) {
ServletRegistrationBean reg = new ServletRegistrationBean(dispatcherServlet);
reg.getUrlMappings().clear();
reg.addUrlMappings("*.css");
reg.addUrlMappings("*.txt");
reg.addUrlMappings("*.js");
reg.addUrlMappings("*.jpg");
return reg;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Collections;
import java.util.List;

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

@Override
public List<String> provide() throws Exception {
File file = ResourceUtils.getFile(filePath);
return Files.readAllLines(Paths.get(file.toURI()));
// File file = ResourceUtils.getFile(filePath);
// return Files.readAllLines(Paths.get(file.toURI()));
return Collections.EMPTY_LIST;
}
}
48 changes: 48 additions & 0 deletions bizcore/WEB-INF/caf_core_src/com/terapico/caf/ReflectionTool.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.terapico.caf;

import java.io.IOException;
import java.lang.reflect.Array;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
Expand All @@ -13,6 +14,11 @@
import java.util.List;
import java.util.TimeZone;

import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;



@SuppressWarnings("rawtypes")
Expand Down Expand Up @@ -58,7 +64,49 @@ protected boolean isArrayOfPrimaryType(Type type) {
}
return false;
}
public static boolean hasRemoteInitiableInterface(Type parameterType) {

return RemoteInitiable.class.isAssignableFrom((Class) parameterType);

}

private static ObjectMapper mapper ;
static {
mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);

}

public static Object convertOnlyOneParameter(Type[] types, String value) {
int length = types.length;

if(length == 0) {
throw new IllegalArgumentException("Only one type allowed here, but the length of the length is: "+length);

}
Type firstParameterType = types[0]; //it is safe here, there is ONE param when code runs to here

//String type supported
if(firstParameterType == java.lang.String.class) {
return value;
}
//otherwise this should be a json object with a class
if(!hasRemoteInitiableInterface(firstParameterType)) {
throw new IllegalArgumentException("The type should implement a RemoteInitiable interface, but the class is: " + firstParameterType.getTypeName());
}
//parse to a json object and return



try {
Object responseObj = mapper.readValue(value, (Class)firstParameterType);
return responseObj;
} catch (Exception e) {
e.printStackTrace();
return null;
}

}
protected Constructor getOneStringConstructor(Class clazz) {
Constructor constructors[] = clazz.getDeclaredConstructors();

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.terapico.caf;

public interface RemoteInitiable {

}
Loading

0 comments on commit 25ab7e8

Please sign in to comment.