Browse Source

适配FineKit

master 1.0
richie 5 years ago
parent
commit
524fb9ed79
  1. BIN
      lib/finekit-10.0.jar
  2. 9
      pom.xml
  3. 6
      src/main/java/com/fr/conf/db/demo/InputUrlAliasBridge.java
  4. 10
      src/main/java/com/fr/conf/db/demo/fun/http/InputHttpHandler.java
  5. 4
      src/main/java/com/fr/conf/db/demo/fun/http/OutputHttpHandler.java

BIN
lib/finekit-10.0.jar

Binary file not shown.

9
pom.xml

@ -11,6 +11,15 @@
</parent> </parent>
<packaging>jar</packaging> <packaging>jar</packaging>
<artifactId>demo-db-access</artifactId> <artifactId>demo-db-access</artifactId>
<dependencies>
<dependency>
<groupId>com.fanruan.api</groupId>
<artifactId>finekit</artifactId>
<version>10.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/finekit-10.0.jar</systemPath>
</dependency>
</dependencies>
<build> <build>
<!---如果要更改调试插件,改这里的配置就可以了--> <!---如果要更改调试插件,改这里的配置就可以了-->
<outputDirectory>${project.basedir}/../webroot/WEB-INF/plugins/plugin-com.fr.conf.db.demo-1.0/classes</outputDirectory> <outputDirectory>${project.basedir}/../webroot/WEB-INF/plugins/plugin-com.fr.conf.db.demo-1.0/classes</outputDirectory>

6
src/main/java/com/fr/conf/db/demo/InputUrlAliasBridge.java

@ -1,15 +1,15 @@
package com.fr.conf.db.demo; package com.fr.conf.db.demo;
import com.fanruan.api.net.URLAliasKit;
import com.fr.decision.fun.impl.AbstractURLAliasProvider; import com.fr.decision.fun.impl.AbstractURLAliasProvider;
import com.fr.decision.webservice.url.alias.URLAlias; import com.fr.decision.webservice.url.alias.URLAlias;
import com.fr.decision.webservice.url.alias.URLAliasFactory;
public class InputUrlAliasBridge extends AbstractURLAliasProvider { public class InputUrlAliasBridge extends AbstractURLAliasProvider {
@Override @Override
public URLAlias[] registerAlias() { public URLAlias[] registerAlias() {
return new URLAlias[]{ return new URLAlias[]{
URLAliasFactory.createPluginAlias("/db/input", "/db/input", false), URLAliasKit.createPluginAlias("/db/input", "/db/input", false),
URLAliasFactory.createPluginAlias("/db/output", "/db/output", false) URLAliasKit.createPluginAlias("/db/output", "/db/output", false)
}; };
} }
} }

10
src/main/java/com/fr/conf/db/demo/fun/http/InputHttpHandler.java

@ -1,19 +1,18 @@
package com.fr.conf.db.demo.fun.http; package com.fr.conf.db.demo.fun.http;
import com.fanruan.api.web.FlushKit;
import com.fr.conf.db.demo.SystemConfigAccessBridge; import com.fr.conf.db.demo.SystemConfigAccessBridge;
import com.fr.conf.db.demo.fun.SystemConfigDAO; import com.fr.conf.db.demo.fun.SystemConfigDAO;
import com.fr.conf.db.demo.fun.entity.SystemConfigEntity; import com.fr.conf.db.demo.fun.entity.SystemConfigEntity;
import com.fr.data.NetworkHelper;
import com.fr.decision.fun.impl.BaseHttpHandler; import com.fr.decision.fun.impl.BaseHttpHandler;
import com.fr.stable.db.action.DBAction; import com.fr.stable.db.action.DBAction;
import com.fr.stable.db.dao.DAOContext; import com.fr.stable.db.dao.DAOContext;
import com.fr.third.org.apache.commons.lang3.RandomStringUtils;
import com.fr.third.org.apache.commons.lang3.RandomUtils; import com.fr.third.org.apache.commons.lang3.RandomUtils;
import com.fr.third.springframework.web.bind.annotation.RequestMethod; import com.fr.third.springframework.web.bind.annotation.RequestMethod;
import com.fr.third.org.apache.commons.lang3.RandomStringUtils;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.PrintWriter;
import java.util.Date; import java.util.Date;
import java.util.UUID; import java.util.UUID;
@ -49,9 +48,6 @@ public class InputHttpHandler extends BaseHttpHandler {
return entity; return entity;
} }
}); });
PrintWriter writer = NetworkHelper.createPrintWriter(res); FlushKit.printAsString(res, "success insert data:" + result.toString() + " to database table:fine_plugin_system_conf");
writer.println("success insert data:" + result.toString() + " to database table:fine_plugin_system_conf");
writer.flush();
writer.close();
} }
} }

4
src/main/java/com/fr/conf/db/demo/fun/http/OutputHttpHandler.java

@ -1,9 +1,9 @@
package com.fr.conf.db.demo.fun.http; package com.fr.conf.db.demo.fun.http;
import com.fanruan.api.net.NetworkKit;
import com.fr.conf.db.demo.SystemConfigAccessBridge; import com.fr.conf.db.demo.SystemConfigAccessBridge;
import com.fr.conf.db.demo.fun.SystemConfigDAO; import com.fr.conf.db.demo.fun.SystemConfigDAO;
import com.fr.conf.db.demo.fun.entity.SystemConfigEntity; import com.fr.conf.db.demo.fun.entity.SystemConfigEntity;
import com.fr.data.NetworkHelper;
import com.fr.decision.fun.impl.BaseHttpHandler; import com.fr.decision.fun.impl.BaseHttpHandler;
import com.fr.stable.db.action.DBAction; import com.fr.stable.db.action.DBAction;
import com.fr.stable.db.dao.DAOContext; import com.fr.stable.db.dao.DAOContext;
@ -42,7 +42,7 @@ public class OutputHttpHandler extends BaseHttpHandler {
return daoContext.getDAO(SystemConfigDAO.class).find(new QueryConditionImpl().addRestriction(RestrictionFactory.gte("salary", 10000.0))); return daoContext.getDAO(SystemConfigDAO.class).find(new QueryConditionImpl().addRestriction(RestrictionFactory.gte("salary", 10000.0)));
} }
}); });
PrintWriter writer = NetworkHelper.createPrintWriter(httpServletResponse); PrintWriter writer = NetworkKit.createPrintWriter(httpServletResponse);
writer.println("The people who's salary is more than 10000:<br/>"); writer.println("The people who's salary is more than 10000:<br/>");
for (SystemConfigEntity entity : entities) { for (SystemConfigEntity entity : entities) {
writer.println(entity.toString()); writer.println(entity.toString());

Loading…
Cancel
Save