Commit 7fa8137a authored by HuangBingGui's avatar HuangBingGui
Browse files

no commit message

parent 6c859da2
......@@ -20,10 +20,10 @@ public class ImageGeo {
GpsDirectory gpsdir = (GpsDirectory) metadata
.getDirectory(GpsDirectory.class);
Rational latpart[] = gpsdir
.getRationalArray(GpsDirectory.TAG_GPS_LATITUDE);
Rational lonpart[] = gpsdir
.getRationalArray(GpsDirectory.TAG_GPS_LONGITUDE);
Rational[] latpart = gpsdir
.getRationalArray(GpsDirectory.TAG_GPS_LATITUDE);
Rational[] lonpart = gpsdir
.getRationalArray(GpsDirectory.TAG_GPS_LONGITUDE);
String northing = gpsdir
.getString(GpsDirectory.TAG_GPS_LATITUDE_REF);
String easting = gpsdir
......@@ -35,11 +35,13 @@ public class ImageGeo {
}
double latsign = 1.0d;
if (northing.equalsIgnoreCase("S"))
latsign = -1.0d;
if ("S".equalsIgnoreCase(northing)) {
latsign = -1.0d;
}
double lonsign = 1.0d;
if (easting.equalsIgnoreCase("W"))
lonsign = -1.0d;
if ("W".equalsIgnoreCase(easting)) {
lonsign = -1.0d;
}
lat = (Math.abs(latpart[0].doubleValue())
+ latpart[1].doubleValue() / 60.0d + latpart[2]
.doubleValue() / 3600.0d) * latsign;
......@@ -47,8 +49,9 @@ public class ImageGeo {
+ lonpart[1].doubleValue() / 60.0d + lonpart[2]
.doubleValue() / 3600.0d) * lonsign;
if (Double.isNaN(lat) || Double.isNaN(lon))
error = true;
if (Double.isNaN(lat) || Double.isNaN(lon)) {
error = true;
}
} catch (Exception ex) {
error = true;
}
......
......@@ -34,8 +34,8 @@ public class MyBeanUtils
// Copy the properties, converting as necessary
if (orig instanceof DynaBean) {
DynaProperty origDescriptors[] =
( (DynaBean) orig).getDynaClass().getDynaProperties();
DynaProperty[] origDescriptors =
((DynaBean) orig).getDynaClass().getDynaProperties();
for (int i = 0; i < origDescriptors.length; i++) {
String name = origDescriptors[i].getName();
if (PropertyUtils.isWriteable(dest, name)) {
......@@ -69,8 +69,8 @@ public class MyBeanUtils
else
/* if (orig is a standard JavaBean) */
{
PropertyDescriptor origDescriptors[] =
PropertyUtils.getPropertyDescriptors(orig);
PropertyDescriptor[] origDescriptors =
PropertyUtils.getPropertyDescriptors(orig);
for (int i = 0; i < origDescriptors.length; i++) {
String name = origDescriptors[i].getName();
// String type = origDescriptors[i].getPropertyType().toString();
......@@ -108,7 +108,7 @@ public class MyBeanUtils
*/
public static void copyBeanNotNull2Bean(Object databean,Object tobean)throws Exception
{
PropertyDescriptor origDescriptors[] = PropertyUtils.getPropertyDescriptors(databean);
PropertyDescriptor[] origDescriptors = PropertyUtils.getPropertyDescriptors(databean);
for (int i = 0; i < origDescriptors.length; i++) {
String name = origDescriptors[i].getName();
// String type = origDescriptors[i].getPropertyType().toString();
......@@ -192,8 +192,8 @@ public class MyBeanUtils
continue;
}
String className = clazz.getName();
if (className.equalsIgnoreCase("java.sql.Timestamp")) {
if (value == null || value.equals("")) {
if ("java.sql.Timestamp".equalsIgnoreCase(className)) {
if (value == null || "".equals(value)) {
continue;
}
}
......@@ -241,7 +241,7 @@ public class MyBeanUtils
}
String className = clazz.getName();
// 临时对策(如果不处理默认的类型转换时会出错)
if (className.equalsIgnoreCase("java.util.Date")) {
if ("java.util.Date".equalsIgnoreCase(className)) {
value = new java.util.Date(((java.sql.Timestamp)value).getTime());// wait to do:貌似有时区问题, 待进一步确认
}
// if (className.equalsIgnoreCase("java.sql.Timestamp")) {
......@@ -287,12 +287,12 @@ public class MyBeanUtils
continue;
}
String className = clazz.getName();
if (className.equalsIgnoreCase("java.sql.Timestamp")) {
if (value == null || value.equals("")) {
if ("java.sql.Timestamp".equalsIgnoreCase(className)) {
if (value == null || "".equals(value)) {
continue;
}
}
if (className.equalsIgnoreCase("java.lang.String")) {
if ("java.lang.String".equalsIgnoreCase(className)) {
if (value == null) {
value = defaultValue;
}
......
......@@ -51,6 +51,7 @@ public class OrderProperties extends Properties {
return context;
}
@Override
public synchronized void load(InputStream inStream) throws IOException {
BufferedReader in;
......@@ -61,21 +62,25 @@ public class OrderProperties extends Properties {
String line = in.readLine();
// intract property/comment string
String intactLine = line;
if (line == null)
return;
if (line == null) {
return;
}
if (line.length() > 0) {
// Find start of key
int len = line.length();
int keyStart;
for (keyStart = 0; keyStart < len; keyStart++)
if (whiteSpaceChars.indexOf(line.charAt(keyStart)) == -1)
break;
for (keyStart = 0; keyStart < len; keyStart++) {
if (whiteSpaceChars.indexOf(line.charAt(keyStart)) == -1) {
break;
}
}
// Blank lines are ignored
if (keyStart == len)
continue;
if (keyStart == len) {
continue;
}
// Continue lines that end in slashes if they are not comments
char firstChar = line.charAt(keyStart);
......@@ -84,14 +89,17 @@ public class OrderProperties extends Properties {
while (continueLine(line)) {
String nextLine = in.readLine();
intactLine = intactLine + "\n" + nextLine;
if (nextLine == null)
nextLine = "";
if (nextLine == null) {
nextLine = "";
}
String loppedLine = line.substring(0, len - 1);
// Advance beyond whitespace on new line
int startIndex;
for (startIndex = 0; startIndex < nextLine.length(); startIndex++)
if (whiteSpaceChars.indexOf(nextLine.charAt(startIndex)) == -1)
break;
for (startIndex = 0; startIndex < nextLine.length(); startIndex++) {
if (whiteSpaceChars.indexOf(nextLine.charAt(startIndex)) == -1) {
break;
}
}
nextLine = nextLine.substring(startIndex, nextLine.length());
line = loppedLine + nextLine;
len = line.length();
......@@ -101,27 +109,33 @@ public class OrderProperties extends Properties {
int separatorIndex;
for (separatorIndex = keyStart; separatorIndex < len; separatorIndex++) {
char currentChar = line.charAt(separatorIndex);
if (currentChar == '\\')
separatorIndex++;
else if (keyValueSeparators.indexOf(currentChar) != -1)
break;
if (currentChar == '\\') {
separatorIndex++;
} else if (keyValueSeparators.indexOf(currentChar) != -1) {
break;
}
}
// Skip over whitespace after key if any
int valueIndex;
for (valueIndex = separatorIndex; valueIndex < len; valueIndex++)
if (whiteSpaceChars.indexOf(line.charAt(valueIndex)) == -1)
break;
for (valueIndex = separatorIndex; valueIndex < len; valueIndex++) {
if (whiteSpaceChars.indexOf(line.charAt(valueIndex)) == -1) {
break;
}
}
// Skip over one non whitespace key value separators if any
if (valueIndex < len)
if (strictKeyValueSeparators.indexOf(line.charAt(valueIndex)) != -1)
valueIndex++;
if (valueIndex < len) {
if (strictKeyValueSeparators.indexOf(line.charAt(valueIndex)) != -1) {
valueIndex++;
}
}
// Skip over white space after other separators if any
while (valueIndex < len) {
if (whiteSpaceChars.indexOf(line.charAt(valueIndex)) == -1)
break;
if (whiteSpaceChars.indexOf(line.charAt(valueIndex)) == -1) {
break;
}
valueIndex++;
}
String key = line.substring(keyStart, separatorIndex);
......@@ -196,12 +210,11 @@ public class OrderProperties extends Properties {
}
outBuffer.append((char) value);
} else {
if (aChar == 't')
outBuffer.append('\t'); /* ibm@7211 */
else if (aChar == 'r')
outBuffer.append('\r'); /* ibm@7211 */
else if (aChar == 'n') {
if (aChar == 't') {
outBuffer.append('\t'); /* ibm@7211 */
} else if (aChar == 'r') {
outBuffer.append('\r'); /* ibm@7211 */
} else if (aChar == 'n') {
/*
* ibm@8897 do not convert a \n to a line.separator
* because on some platforms line.separator is a String
......@@ -212,23 +225,27 @@ public class OrderProperties extends Properties {
*
*/
outBuffer.append('\n'); /* ibm@8897 ibm@7211 */
} else if (aChar == 'f')
outBuffer.append('\f'); /* ibm@7211 */
else
/* ibm@7211 */
outBuffer.append(aChar); /* ibm@7211 */
} else if (aChar == 'f') {
outBuffer.append('\f'); /* ibm@7211 */
} else
/* ibm@7211 */ {
outBuffer.append(aChar); /* ibm@7211 */
}
}
} else
outBuffer.append(aChar);
} else {
outBuffer.append(aChar);
}
}
return outBuffer.toString();
}
@Override
public synchronized void store(OutputStream out, String header) throws IOException {
BufferedWriter awriter;
awriter = new BufferedWriter(new OutputStreamWriter(out, "8859_1"));
if (header != null)
writeln(awriter, "#" + header);
if (header != null) {
writeln(awriter, "#" + header);
}
@SuppressWarnings("rawtypes")
List entrys = context.getCommentOrEntrys();
for (Object obj : entrys) {
......@@ -242,8 +259,9 @@ public class OrderProperties extends Properties {
private boolean continueLine(String line) {
int slashCount = 0;
int index = line.length() - 1;
while ((index >= 0) && (line.charAt(index--) == '\\'))
slashCount++;
while ((index >= 0) && (line.charAt(index--) == '\\')) {
slashCount++;
}
return (slashCount % 2 == 1);
}
......@@ -259,8 +277,9 @@ public class OrderProperties extends Properties {
char aChar = theString.charAt(x);
switch (aChar) {
case ' ':
if (x == 0 || escapeSpace)
outBuffer.append('\\');
if (x == 0 || escapeSpace) {
outBuffer.append('\\');
}
outBuffer.append(' ');
break;
......@@ -293,8 +312,9 @@ public class OrderProperties extends Properties {
outBuffer.append(toHex((aChar >> 4) & 0xF));
outBuffer.append(toHex(aChar & 0xF));
} else {
if (specialSaveChars.indexOf(aChar) != -1)
outBuffer.append('\\');
if (specialSaveChars.indexOf(aChar) != -1) {
outBuffer.append('\\');
}
outBuffer.append(aChar);
}
}
......@@ -302,6 +322,7 @@ public class OrderProperties extends Properties {
return outBuffer.toString();
}
@Override
public synchronized Object put(Object key, Object value) {
context.putOrUpdate(key.toString(), value.toString());
return super.put(key, value);
......@@ -312,6 +333,7 @@ public class OrderProperties extends Properties {
return super.put(key, value);
}
@Override
public synchronized Object remove(Object key) {
context.remove(key.toString());
return super.remove(key);
......@@ -419,6 +441,7 @@ public class OrderProperties extends Properties {
this.value = value;
}
@Override
public String toString() {
if (line != null) {
return line;
......
......@@ -181,8 +181,9 @@ public class PropertiesLoader {
String mapKey = currentkey + "." + key.toString();
values.put(mapKey, currentMap.get(key).toString());
}
} else
} else {
values.put(currentkey, String.valueOf(currentObj));
}
}
return values;
}
......
/**
* Copyright &copy; 2012-2016 <a href="https://github.com.jeespring.>JeeSite</a> All rights reserved.
* Copyright &copy; 2012-2016 <a href="https://gitee.com/JeeHuangBingGui/jeeSpringCloud">JeeSpring</a>All rights reserved.
*/
package com.jeespring.common.utils;
......@@ -159,8 +159,9 @@ public class SendMailUtil {
hemail.setAuthentication(username, password);
hemail.setSubject(subject);
hemail.setMsg(message);
if(from.contains("@qq.com"))
hemail.setSSL(true);
if(from.contains("@qq.com")) {
hemail.setSSL(true);
}
hemail.send();
//System.out.println("email send true!");
} catch (Exception e) {
......@@ -181,8 +182,9 @@ public class SendMailUtil {
hemail.setAuthentication(fromMailUsername, fromMailPassword);
hemail.setSubject(subject);
hemail.setMsg(message);
if(fromMailAddr.contains("@qq.com"))
hemail.setSSL(true);
if(fromMailAddr.contains("@qq.com")) {
hemail.setSSL(true);
}
hemail.send();
//System.out.println("email send true!");
} catch (Exception e) {
......@@ -230,8 +232,9 @@ public class SendMailUtil {
// @SuppressWarnings("unchecked")
public static String getAppPath(Class<?> cls) {
// 检查用户传入的参数是否为空
if (cls == null)
throw new IllegalArgumentException("参数不能为空!");
if (cls == null) {
throw new IllegalArgumentException("参数不能为空!");
}
ClassLoader loader = cls.getClassLoader();
// 获得类的全名,包括包名
String clsName = cls.getName() + ".class";
......@@ -242,14 +245,15 @@ public class SendMailUtil {
if (pack != null) {
String packName = pack.getName();
// 此处简单判定是否是Java基础类库,防止用户传入JDK内置的类库
if (packName.startsWith("java.") || packName.startsWith("javax."))
throw new IllegalArgumentException("不要传送系统类!");
if (packName.startsWith("java.") || packName.startsWith("javax.")) {
throw new IllegalArgumentException("不要传送系统类!");
}
// 在类的名称中,去掉包名的部分,获得类的文件名
clsName = clsName.substring(packName.length() + 1);
// 判定包名是否是简单包名,如果是,则直接将包名转换为路径,
if (packName.indexOf(".") < 0)
path = packName + "/";
else {// 否则按照包名的组成部分,将包名转换为路径
if (packName.indexOf(".") < 0) {
path = packName + "/";
} else {// 否则按照包名的组成部分,将包名转换为路径
int start = 0, end = 0;
end = packName.indexOf(".");
while (end != -1) {
......@@ -266,14 +270,16 @@ public class SendMailUtil {
String realPath = url.getPath();
// 去掉路径信息中的协议名"file:"
int pos = realPath.indexOf("file:");
if (pos > -1)
realPath = realPath.substring(pos + 5);
if (pos > -1) {
realPath = realPath.substring(pos + 5);
}
// 去掉路径信息最后包含类文件信息的部分,得到类所在的路径
pos = realPath.indexOf(path + clsName);
realPath = realPath.substring(0, pos - 1);
// 如果类文件被打包到JAR等文件中时,去掉对应的JAR等打包文件名
if (realPath.endsWith("!"))
realPath = realPath.substring(0, realPath.lastIndexOf("/"));
if (realPath.endsWith("!")) {
realPath = realPath.substring(0, realPath.lastIndexOf("/"));
}
/*------------------------------------------------------------
ClassLoader的getResource方法使用了utf-8对路径信息进行了编码,当路径
中存在中文和空格时,他会对这些字符进行转换,这样,得到的往往不是我们想要
......
......@@ -38,8 +38,9 @@ public class StreamUtils {
String string = null;
int count = 0;
try {
while ((count = in.read(data, 0, BUFFER_SIZE)) != -1)
outStream.write(data, 0, count);
while ((count = in.read(data, 0, BUFFER_SIZE)) != -1) {
outStream.write(data, 0, count);
}
} catch (IOException e) {
e.printStackTrace();
}
......@@ -67,8 +68,9 @@ public class StreamUtils {
byte[] data = new byte[BUFFER_SIZE];
int count = -1;
try {
while ((count = in.read(data, 0, BUFFER_SIZE)) != -1)
outStream.write(data, 0, count);
while ((count = in.read(data, 0, BUFFER_SIZE)) != -1) {
outStream.write(data, 0, count);
}
} catch (IOException e) {
e.printStackTrace();
}
......@@ -126,8 +128,9 @@ public class StreamUtils {
ByteArrayOutputStream outStream = new ByteArrayOutputStream();
byte[] data = new byte[BUFFER_SIZE];
int count = -1;
while ((count = in.read(data, 0, BUFFER_SIZE)) != -1)
outStream.write(data, 0, count);
while ((count = in.read(data, 0, BUFFER_SIZE)) != -1) {
outStream.write(data, 0, count);
}
data = null;
return outStream.toByteArray();
......
......@@ -284,6 +284,7 @@ public class TimeUtils {
+ this.timeSeparator + "mm" + this.timeSeparator + "ss");
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder(16);
sb.append(fields[DAY]).append(',').append(' ');
......@@ -300,6 +301,7 @@ public class TimeUtils {
return sb.append(fields[field]);
}
@Override
public int hashCode() {
final int PRIME = 31;
int result = 1;
......@@ -307,13 +309,17 @@ public class TimeUtils {
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
if (this == obj) {
return true;
if (obj == null)
}
if (obj == null) {
return false;
if (getClass() != obj.getClass())
}
if (getClass() != obj.getClass()) {
return false;
}
final TimeUtils other = (TimeUtils) obj;
if (!Arrays.equals(fields, other.fields)) {
return false;
......
......@@ -82,7 +82,7 @@ public class UploadUtils {
infos[0] = this.validateFields(request);
// 初始化表单元素
Map<String, Object> fieldsMap = new HashMap<String, Object>();
if (infos[0].equals("true")) {
if ("true".equals(infos[0])) {
fieldsMap = this.initFields(request);
}
// 上传
......
......@@ -98,7 +98,7 @@ public class WorkDayUtils {
* @return
*/
public String getChineseWeek(Calendar date) {
final String dayNames[] = { "星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六" };
final String[] dayNames = {"星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"};
int dayOfWeek = date.get(Calendar.DAY_OF_WEEK);
// System.out.println(dayNames[dayOfWeek - 1]);
return dayNames[dayOfWeek - 1];
......
......@@ -23,7 +23,7 @@ import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
/**
* 条形码和二维码编码解码
*
* @author ThinkGem
* @author JeeSpring
* @version 2014-02-28
*/
public class ZxingHandler {
......
......@@ -183,7 +183,7 @@ public class HttpUtils
String ret = "";
while ((ret = br.readLine()) != null)
{
if (ret != null && !ret.trim().equals(""))
if (ret != null && !"".equals(ret.trim()))
{
result.append(new String(ret.getBytes("ISO-8859-1"), "utf-8"));
}
......
......@@ -195,23 +195,31 @@ public abstract class AbstractBaseController {
if(!RedisUtils.isShireRedis()){ return;}
if(!oauthService.isOauthOpen()){ return;}
//if(request.getRequestURI().indexOf("/rest/")<0) return;
if(request.getRequestURI().indexOf("/rest/oauth/apiTimeLimiFaild")>=0) return;
if(request.getRequestURI().indexOf("/admin?login")>=0) return;
if(request.getRequestURI().indexOf("/admin/login")>=0) return;
if(request.getRequestURI().equals("/admin")){
if(request.getRequestURI().indexOf("/rest/oauth/apiTimeLimiFaild")>=0) {
return;
}
if(request.getRequestURI().indexOf("/admin?login")>=0) {
return;
}
if(request.getRequestURI().indexOf("/admin/login")>=0) {
return;
}
if("/admin".equals(request.getRequestURI())){
Result result=oauthService.userOnlineAmount();
if(result.getResultCode().equals("-1"))
if("-1".equals(result.getResultCode())) {
response.sendRedirect("/rest/oauth/userOnlineAmountFaild");
}
return;
}
oauthService.setApiTime();
Result result = oauthService.ApiTimeLimi(request.getRemoteAddr());
if(result.getResultCoe().toString()=="-1"){
//response.sendRedirect("../error/403");
if(request.getRequestURI().indexOf("/rest/")>0)
response.sendRedirect("/rest/oauth/apiTimeLimiFaild?apiTimeLimi="+result.getResultObject());
else
response.sendRedirect("/rest/oauth/apiTimeLimiFaild?apiTimeLimi="+result.getResultObject());
if(request.getRequestURI().indexOf("/rest/")>0) {
response.sendRedirect("/rest/oauth/apiTimeLimiFaild?apiTimeLimi=" + result.getResultObject());
} else {
response.sendRedirect("/rest/oauth/apiTimeLimiFaild?apiTimeLimi=" + result.getResultObject());
}
//response.sendRedirect("/rest/oauth/apiTimeLimifaild");
}
}catch (Exception e){
......@@ -226,10 +234,18 @@ public abstract class AbstractBaseController {
try{
if(!RedisUtils.isShireRedis()){ return;}
if(!oauthService.isOauthOpen()){ return;}
if(request.getRequestURI().indexOf("/rest/")<0) return;
if(request.getRequestURI().indexOf("/rest/oauth/token")>=0) return;
if(request.getRequestURI().indexOf("/rest/oauth/faild")>=0) return;
if(request.getRequestURI().indexOf("/rest/oauth/checkToken")>=0) return;
if(request.getRequestURI().indexOf("/rest/")<0) {
return;
}
if(request.getRequestURI().indexOf("/rest/oauth/token")>=0) {
return;
}
if(request.getRequestURI().indexOf("/rest/oauth/faild")>=0) {
return;
}
if(request.getRequestURI().indexOf("/rest/oauth/checkToken")>=0) {
return;
}
Result result = oauthService.checkToken(request.getParameter("token"),request.getRemoteAddr());
if(result.getResultCoe().toString()=="-1"){
//response.sendRedirect("../error/403");
......
......@@ -96,25 +96,28 @@ public class CKFinderConfig extends Configuration {
for (int i = 0; i < nodeList.getLength(); ++i) {
Node childNode = nodeList.item(i);
if (childNode.getNodeName().equals("enabled"))
if ("enabled".equals(childNode.getNodeName())) {
this.enabled = Boolean.valueOf(childNode.getTextContent().trim()).booleanValue();
}
if (childNode.getNodeName().equals("baseDir")) {
if ("baseDir".equals(childNode.getNodeName())) {
this.baseDir = childNode.getTextContent().trim();
this.baseDir = PathUtils.escape(this.baseDir);
this.baseDir = PathUtils.addSlashToEnd(this.baseDir);
}
if (childNode.getNodeName().equals("baseURL")) {
if ("baseURL".equals(childNode.getNodeName())) {
this.baseURL = childNode.getTextContent().trim();
this.baseURL = PathUtils.escape(this.baseURL);
this.baseURL = PathUtils.addSlashToEnd(this.baseURL);
}
if (childNode.getNodeName().equals("licenseName"))
if ("licenseName".equals(childNode.getNodeName())) {
this.licenseName = childNode.getTextContent().trim();
if (childNode.getNodeName().equals("licenseKey"))
}
if ("licenseKey".equals(childNode.getNodeName())) {
this.licenseKey = childNode.getTextContent().trim();
}
String value;
if (childNode.getNodeName().equals("imgWidth")) {
if ("imgWidth".equals(childNode.getNodeName())) {
value = childNode.getTextContent().trim();
value = value.replaceAll("//D", "");
......@@ -124,14 +127,14 @@ public class CKFinderConfig extends Configuration {
this.imgWidth = null;
}
}
if (childNode.getNodeName().equals("imgQuality")) {
if ("imgQuality".equals(childNode.getNodeName())) {
value = childNode.getTextContent().trim();
value = value.replaceAll("//D", "");
method = clazz.getDeclaredMethod("adjustQuality", new Class[]{String.class});
method.setAccessible(true);
this.imgQuality = Float.parseFloat(method.invoke(this, value).toString());
}
if (childNode.getNodeName().equals("imgHeight")) {
if ("imgHeight".equals(childNode.getNodeName())) {
value = childNode.getTextContent().trim();
value = value.replaceAll("//D", "");
try {
......@@ -140,63 +143,72 @@ public class CKFinderConfig extends Configuration {
this.imgHeight = null;
}
}
if (childNode.getNodeName().equals("thumbs")) {
if ("thumbs".equals(childNode.getNodeName())) {
method = clazz.getDeclaredMethod("setThumbs", new Class[]{NodeList.class});
method.setAccessible(true);
method.invoke(this, childNode.getChildNodes());
}
if (childNode.getNodeName().equals("accessControls")) {
if ("accessControls".equals(childNode.getNodeName())) {
method = clazz.getDeclaredMethod("setACLs", new Class[]{NodeList.class});
method.setAccessible(true);
method.invoke(this, childNode.getChildNodes());
}
if (childNode.getNodeName().equals("hideFolders")) {
if ("hideFolders".equals(childNode.getNodeName())) {
method = clazz.getDeclaredMethod("setHiddenFolders", new Class[]{NodeList.class});
method.setAccessible(true);
method.invoke(this, childNode.getChildNodes());
}
if (childNode.getNodeName().equals("hideFiles")) {
if ("hideFiles".equals(childNode.getNodeName())) {
method = clazz.getDeclaredMethod("setHiddenFiles", new Class[]{NodeList.class});
method.setAccessible(true);
method.invoke(this, childNode.getChildNodes());
}
if (childNode.getNodeName().equals("checkDoubleExtension"))
if ("checkDoubleExtension".equals(childNode.getNodeName())) {
this.doubleExtensions = Boolean.valueOf(childNode.getTextContent().trim()).booleanValue();
if (childNode.getNodeName().equals("disallowUnsafeCharacters"))
}
if ("disallowUnsafeCharacters".equals(childNode.getNodeName())) {
this.disallowUnsafeCharacters = Boolean.valueOf(childNode.getTextContent().trim()).booleanValue();
if (childNode.getNodeName().equals("forceASCII"))
}
if ("forceASCII".equals(childNode.getNodeName())) {
this.forceASCII = Boolean.valueOf(childNode.getTextContent().trim()).booleanValue();
if (childNode.getNodeName().equals("checkSizeAfterScaling"))
}
if ("checkSizeAfterScaling".equals(childNode.getNodeName())) {
this.checkSizeAfterScaling = Boolean.valueOf(childNode.getTextContent().trim()).booleanValue();
}
Scanner sc;
if (childNode.getNodeName().equals("htmlExtensions")) {
if ("htmlExtensions".equals(childNode.getNodeName())) {
value = childNode.getTextContent();
sc = (new Scanner(value)).useDelimiter(",");
while (sc.hasNext()) {
String val = sc.next();
if (val != null && !val.equals(""))
if (val != null && !"".equals(val)) {
this.htmlExtensions.add(val.trim().toLowerCase());
}
}
}
if (childNode.getNodeName().equals("secureImageUploads"))
if ("secureImageUploads".equals(childNode.getNodeName())) {
this.secureImageUploads = Boolean.valueOf(childNode.getTextContent().trim()).booleanValue();
if (childNode.getNodeName().equals("uriEncoding"))
}
if ("uriEncoding".equals(childNode.getNodeName())) {
this.uriEncoding = childNode.getTextContent().trim();
if (childNode.getNodeName().equals("userRoleSessionVar"))
}
if ("userRoleSessionVar".equals(childNode.getNodeName())) {
this.userRoleSessionVar = childNode.getTextContent().trim();
if (childNode.getNodeName().equals("defaultResourceTypes")) {
}
if ("defaultResourceTypes".equals(childNode.getNodeName())) {
value = childNode.getTextContent().trim();
sc = (new Scanner(value)).useDelimiter(",");
while (sc.hasNext())
while (sc.hasNext()) {
this.defaultResourceTypes.add(sc.next());
}
}
if (childNode.getNodeName().equals("plugins")) {
if ("plugins".equals(childNode.getNodeName())) {
method = clazz.getDeclaredMethod("setPlugins", new Class[]{Node.class});
method.setAccessible(true);
method.invoke(this, childNode);
}
if (childNode.getNodeName().equals("basePathBuilderImpl")) {
if ("basePathBuilderImpl".equals(childNode.getNodeName())) {
method = clazz.getDeclaredMethod("setBasePathImpl", new Class[]{String.class});
method.setAccessible(true);
method.invoke(this, childNode.getTextContent().trim());
......
......@@ -239,8 +239,9 @@ public class Servlets {
* @throws Exception
*/
public static boolean isStaticFile(String uri) {
if (staticFiles == null)
if (staticFiles == null) {
staticFiles = StringUtils.split(Global.getConfig("web.staticFile"), ",");
}
return StringUtils.endsWithAny(uri, staticFiles) && !StringUtils.endsWithAny(uri, ".html")
&& !StringUtils.endsWithAny(uri, ".jsp") && !StringUtils.endsWithAny(uri, ".java");
}
......
......@@ -56,7 +56,8 @@ public class WebSockertFilter{
Timer timer = new Timer();
timer.scheduleAtFixedRate(new TimerTask() {
public void run() {
@Override
public void run() {
//PersonService personService = (PersonService)ApplicationContext.getBean("personService");
......
/**
* Copyright &copy; 2012-2016 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
* Copyright &copy; 2012-2016 <a href="https://gitee.com/JeeHuangBingGui/jeeSpringCloud">JeeSpring</a> All rights reserved.
*/
package com.jeespring.modules.act.dao;
......
/**
* Copyright &copy; 2012-2016 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
* Copyright &copy; 2012-2016 <a href="https://gitee.com/JeeHuangBingGui/jeeSpringCloud">JeeSpring</a> All rights reserved.
*/
package com.jeespring.modules.act.entity;
......@@ -22,7 +22,7 @@ import com.jeespring.modules.act.utils.Variable;
/**
* 工作流Entity
* @author ThinkGem
* @author JeeSpring
* @version 2013-11-03
*/
public class Act extends AbstractBaseEntity<Act> {
......
......@@ -127,8 +127,9 @@ public class BaseProcessDefinitionDiagramLayoutResource {
activityArray.add(activityName);
}
for (String flow : highLightedFlows)
flowsArray.add(flow);
for (String flow : highLightedFlows) {
flowsArray.add(flow);
}
responseJSON.put("highLightedActivities", activityArray);
responseJSON.put("highLightedFlows", flowsArray);
......@@ -195,8 +196,9 @@ public class BaseProcessDefinitionDiagramLayoutResource {
laneSetArray.add(laneSetJSON);
}
if (laneSetArray.size() > 0)
responseJSON.put("laneSets", laneSetArray);
if (laneSetArray.size() > 0) {
responseJSON.put("laneSets", laneSetArray);
}
}
ArrayNode sequenceFlowArray = new ObjectMapper().createArrayNode();
......@@ -297,12 +299,15 @@ public class BaseProcessDefinitionDiagramLayoutResource {
flowJSON.put("flow", "(" + sequenceFlow.getSource().getId() + ")--" + sequenceFlow.getId() + "-->("
+ sequenceFlow.getDestination().getId() + ")");
if (isConditional)
flowJSON.put("isConditional", isConditional);
if (isDefault)
flowJSON.put("isDefault", isDefault);
if (isHighLighted)
flowJSON.put("isHighLighted", isHighLighted);
if (isConditional) {
flowJSON.put("isConditional", isConditional);
}
if (isDefault) {
flowJSON.put("isDefault", isDefault);
}
if (isHighLighted) {
flowJSON.put("isHighLighted", isHighLighted);
}
flowJSON.put("xPointArray", xPointArray);
flowJSON.put("yPointArray", yPointArray);
......@@ -320,36 +325,39 @@ public class BaseProcessDefinitionDiagramLayoutResource {
ObjectNode propertiesJSON = new ObjectMapper().createObjectNode();
for (String key : properties.keySet()) {
Object prop = properties.get(key);
if (prop instanceof String)
propertiesJSON.put(key, (String) properties.get(key));
else if (prop instanceof Integer)
propertiesJSON.put(key, (Integer) properties.get(key));
else if (prop instanceof Boolean)
propertiesJSON.put(key, (Boolean) properties.get(key));
else if ("initial".equals(key)) {
if (prop instanceof String) {
propertiesJSON.put(key, (String) properties.get(key));
} else if (prop instanceof Integer) {
propertiesJSON.put(key, (Integer) properties.get(key));
} else if (prop instanceof Boolean) {
propertiesJSON.put(key, (Boolean) properties.get(key));
} else if ("initial".equals(key)) {
ActivityImpl act = (ActivityImpl) properties.get(key);
propertiesJSON.put(key, act.getId());
} else if ("timerDeclarations".equals(key)) {
ArrayList<TimerDeclarationImpl> timerDeclarations = (ArrayList<TimerDeclarationImpl>) properties.get(key);
ArrayNode timerDeclarationArray = new ObjectMapper().createArrayNode();
if (timerDeclarations != null)
for (TimerDeclarationImpl timerDeclaration : timerDeclarations) {
ObjectNode timerDeclarationJSON = new ObjectMapper().createObjectNode();
timerDeclarationJSON.put("isExclusive", timerDeclaration.isExclusive());
if (timerDeclaration.getRepeat() != null)
timerDeclarationJSON.put("repeat", timerDeclaration.getRepeat());
timerDeclarationJSON.put("retries", String.valueOf(timerDeclaration.getRetries()));
timerDeclarationJSON.put("type", timerDeclaration.getJobHandlerType());
timerDeclarationJSON.put("configuration", timerDeclaration.getJobHandlerConfiguration());
//timerDeclarationJSON.put("expression", timerDeclaration.getDescription());
timerDeclarationArray.add(timerDeclarationJSON);
}
if (timerDeclarationArray.size() > 0)
propertiesJSON.put(key, timerDeclarationArray);
if (timerDeclarations != null) {
for (TimerDeclarationImpl timerDeclaration : timerDeclarations) {
ObjectNode timerDeclarationJSON = new ObjectMapper().createObjectNode();
timerDeclarationJSON.put("isExclusive", timerDeclaration.isExclusive());
if (timerDeclaration.getRepeat() != null) {
timerDeclarationJSON.put("repeat", timerDeclaration.getRepeat());
}
timerDeclarationJSON.put("retries", String.valueOf(timerDeclaration.getRetries()));
timerDeclarationJSON.put("type", timerDeclaration.getJobHandlerType());
timerDeclarationJSON.put("configuration", timerDeclaration.getJobHandlerConfiguration());
//timerDeclarationJSON.put("expression", timerDeclaration.getDescription());
timerDeclarationArray.add(timerDeclarationJSON);
}
}
if (timerDeclarationArray.size() > 0) {
propertiesJSON.put(key, timerDeclarationArray);
}
// TODO: implement getting description
} else if ("eventDefinitions".equals(key)) {
ArrayList<EventSubscriptionDeclaration> eventDefinitions = (ArrayList<EventSubscriptionDeclaration>) properties.get(key);
......@@ -359,8 +367,9 @@ public class BaseProcessDefinitionDiagramLayoutResource {
for (EventSubscriptionDeclaration eventDefinition : eventDefinitions) {
ObjectNode eventDefinitionJSON = new ObjectMapper().createObjectNode();
if (eventDefinition.getActivityId() != null)
eventDefinitionJSON.put("activityId", eventDefinition.getActivityId());
if (eventDefinition.getActivityId() != null) {
eventDefinitionJSON.put("activityId", eventDefinition.getActivityId());
}
eventDefinitionJSON.put("eventName", eventDefinition.getEventName());
eventDefinitionJSON.put("eventType", eventDefinition.getEventType());
......@@ -370,8 +379,9 @@ public class BaseProcessDefinitionDiagramLayoutResource {
}
}
if (eventDefinitionsArray.size() > 0)
propertiesJSON.put(key, eventDefinitionsArray);
if (eventDefinitionsArray.size() > 0) {
propertiesJSON.put(key, eventDefinitionsArray);
}
// TODO: implement it
} else if ("errorEventDefinitions".equals(key)) {
......@@ -382,10 +392,11 @@ public class BaseProcessDefinitionDiagramLayoutResource {
for (ErrorEventDefinition errorEventDefinition : errorEventDefinitions) {
ObjectNode errorEventDefinitionJSON = new ObjectMapper().createObjectNode();
if (errorEventDefinition.getErrorCode() != null)
errorEventDefinitionJSON.put("errorCode", errorEventDefinition.getErrorCode());
else
errorEventDefinitionJSON.putNull("errorCode");
if (errorEventDefinition.getErrorCode() != null) {
errorEventDefinitionJSON.put("errorCode", errorEventDefinition.getErrorCode());
} else {
errorEventDefinitionJSON.putNull("errorCode");
}
errorEventDefinitionJSON.put("handlerActivityId", errorEventDefinition.getHandlerActivityId());
......@@ -393,8 +404,9 @@ public class BaseProcessDefinitionDiagramLayoutResource {
}
}
if (errorEventDefinitionsArray.size() > 0)
propertiesJSON.put(key, errorEventDefinitionsArray);
if (errorEventDefinitionsArray.size() > 0) {
propertiesJSON.put(key, errorEventDefinitionsArray);
}
}
}
......@@ -448,14 +460,18 @@ public class BaseProcessDefinitionDiagramLayoutResource {
activityJSON.put("activityId", activity.getId());
activityJSON.put("properties", propertiesJSON);
if (multiInstance != null)
activityJSON.put("multiInstance", multiInstance);
if (collapsed)
activityJSON.put("collapsed", collapsed);
if (nestedActivityArray.size() > 0)
activityJSON.put("nestedActivities", nestedActivityArray);
if (isInterrupting != null)
activityJSON.put("isInterrupting", isInterrupting);
if (multiInstance != null) {
activityJSON.put("multiInstance", multiInstance);
}
if (collapsed) {
activityJSON.put("collapsed", collapsed);
}
if (nestedActivityArray.size() > 0) {
activityJSON.put("nestedActivities", nestedActivityArray);
}
if (isInterrupting != null) {
activityJSON.put("isInterrupting", isInterrupting);
}
activityJSON.put("x", activity.getX());
activityJSON.put("y", activity.getY());
......
......@@ -15,15 +15,18 @@ public class FilterServletOutputStream extends ServletOutputStream {
stream = new DataOutputStream(output);
}
public void write(int b) throws IOException {
@Override
public void write(int b) throws IOException {
stream.write(b);
}
public void write(byte[] b) throws IOException {
@Override
public void write(byte[] b) throws IOException {
stream.write(b);
}
public void write(byte[] b, int off, int len) throws IOException {
@Override
public void write(byte[] b, int off, int len) throws IOException {
stream.write(b, off, len);
}
......
......@@ -22,15 +22,18 @@ public class GenericResponseWrapper extends HttpServletResponseWrapper {
return output.toByteArray();
}
public ServletOutputStream getOutputStream() {
@Override
public ServletOutputStream getOutputStream() {
return new FilterServletOutputStream(output);
}
public PrintWriter getWriter() {
@Override
public PrintWriter getWriter() {
return new PrintWriter(getOutputStream(), true);
}
public void setContentLength(int length) {
@Override
public void setContentLength(int length) {
this.contentLength = length;
super.setContentLength(length);
}
......@@ -39,12 +42,14 @@ public class GenericResponseWrapper extends HttpServletResponseWrapper {
return contentLength;
}
public void setContentType(String type) {
@Override
public void setContentType(String type) {
this.contentType = type;
super.setContentType(type);
}
public String getContentType() {
@Override
public String getContentType() {
return contentType;
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment