本文整理汇总了Java中com.jfinal.kit.StrKit.isBlank方法的典型用法代码示例。如果您正苦于以下问题:Java StrKit.isBlank方法的具体用法?Java StrKit.isBlank怎么用?Java StrKit.isBlank使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jfinal.kit.StrKit
的用法示例。
在下文中一共展示了StrKit.isBlank方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: modify
import com.jfinal.kit.StrKit; //导入方法依赖的package包/类
public void modify(){
ResultData result = new ResultData();
String parentPath=getPara("parentPath");
if(StrKit.isBlank(parentPath)){
parentPath="/";
}
String nodeData=getPara("nodeData");
try{
ZkClient zkClient=getSessionAttr("zk-client");
ZKPlugin zkPlugin=new ZKPlugin(zkClient);
if(zkClient.exists(parentPath)) {
zkPlugin.edit(parentPath, nodeData.getBytes());
result.setMessage("数据修改成功");
}else{
result.setSuccess(false);
result.setMessage("节点路径不存在失败");
}
}catch (Exception e){
result.setSuccess(false);
result.setMessage("数据修改失败");
log.error("数据修改失败,错误",e);
}
renderJson(result);
}
示例2: generateMappingModel
import com.jfinal.kit.StrKit; //导入方法依赖的package包/类
public void generateMappingModel(Object projectId, String templatePath) {
if ( StrKit.isBlank(templatePath) ) templatePath = MAVEN_BASE + "gen/config/4jfinalmappingmodel.btl";
Template t_pojo = gt.getTemplate(templatePath);
List<Record> list = Db.find("select a.*, b.name primary_name, b.java_type, c.package, c.module_name from w_db_model a, w_db_model_item b, w_generate c where a.id = b.w_model_id and c.w_model_id = a.id and b.is_primary = 1 and a.project_id = ?", projectId);
t_pojo.binding("models", list);
File file = getConfigGenerateFile(
File.separator + "org" +
File.separator + "hacker" +
File.separator + "core" +
File.separator + "config",
"MappingModel.java");
System.out.println(file.getAbsolutePath());
try {
FileKit.write(t_pojo.render(), file);
} catch ( FileNotFoundException | BeetlException e ) {
e.printStackTrace();
}
System.out.println("############getGenerateConfig success############");
}
示例3: generateMappingRoute
import com.jfinal.kit.StrKit; //导入方法依赖的package包/类
public void generateMappingRoute(Object projectId, String templatePath) {
if ( StrKit.isBlank(templatePath) ) templatePath = MAVEN_BASE + "gen/config/4jfinalmappingroute.btl";
Template t_pojo = gt.getTemplate(templatePath);
List<Record> list = Db.find("select a.*, b.name primary_name, b.java_type, c.package, c.module_name from w_db_model a, w_db_model_item b, w_generate c where a.id = b.w_model_id and c.w_model_id = a.id and b.is_primary = 1 and a.project_id = ?", projectId);
t_pojo.binding("models", list);
File file = getConfigGenerateFile(
File.separator + "org" +
File.separator + "hacker" +
File.separator + "core" +
File.separator + "config",
"MappingRoute.java");
System.out.println(file.getAbsolutePath());
try {
FileKit.write(t_pojo.render(), file);
} catch ( FileNotFoundException | BeetlException e ) {
e.printStackTrace();
}
System.out.println("############getGenerateConfig success############");
}
示例4: create
import com.jfinal.kit.StrKit; //导入方法依赖的package包/类
public void create(){
ResultData result = new ResultData();
String parentPath=getPara("parentPath");
if(StrKit.isBlank(parentPath)){
parentPath="/";
}
String nodeName=getPara("nodeName");
nodeName= StringUtil.rtrim(nodeName,new char[]{'/'});
String nodeData=getPara("nodeData");
Integer mode=getParaToInt("nodeType");
try{
ZkClient zkClient=getSessionAttr("zk-client");
ZKPlugin zkPlugin=new ZKPlugin(zkClient);
if(!parentPath.equals("/")) {
nodeName = parentPath + "/" + nodeName;
}else{
nodeName = "/" + nodeName;
}
zkPlugin.create(nodeName,nodeData.getBytes(),mode);
result.setMessage("创建成功");
} catch (Exception e) {
result.setSuccess(false);
result.setMessage("创建失败");
}
renderJson(result);
}
示例5: logFromConfig
import com.jfinal.kit.StrKit; //导入方法依赖的package包/类
private void logFromConfig(Controller c, LogConfig log) {
SysLog sysLog = new SysLog();
sysLog.ip = ServletKit.getIp(c.getRequest());
sysLog.user = logProcesser.getUsername(c);
Map<String, String[]> parameterMap = c.getRequest().getParameterMap();
Set<Entry<String, String[]>> entrySet = parameterMap.entrySet();
Map<String, String> paraMap = Maps.newHashMap();
for (Entry<String, String[]> entry : entrySet) {
String key = entry.getKey();
String value = entry.getValue()[0];
String result = log.params.get(key);
if (StrKit.isBlank(result))
continue;
paraMap.put(result, value);
}
sysLog.message = logProcesser.formatMessage(log.title, paraMap);
logProcesser.process(sysLog);
}
示例6: checkSignature
import com.jfinal.kit.StrKit; //导入方法依赖的package包/类
/**
* 检测签名
*/
private boolean checkSignature(Controller controller) {
String signature = controller.getPara("signature");
String timestamp = controller.getPara("timestamp");
String nonce = controller.getPara("nonce");
if (StrKit.isBlank(signature) || StrKit.isBlank(timestamp) || StrKit.isBlank(nonce)) {
controller.renderText("check signature failure");
return false;
}
if (SignatureCheckKit.me.checkSignature(signature, timestamp, nonce)) {
return true;
}
else {
logger.error("check signature failure: " +
" signature = " + controller.getPara("signature") +
" timestamp = " + controller.getPara("timestamp") +
" nonce = " + controller.getPara("nonce"));
return false;
}
}
示例7: loadJobsFromProperties
import com.jfinal.kit.StrKit; //导入方法依赖的package包/类
private void loadJobsFromProperties() {
if (StrKit.isBlank(jobConfig)) {
return;
}
jobProp = ResourceKit.readProperties(jobConfig);
Set<Map.Entry<String, String>> entries = jobProp.entrySet();
for (Map.Entry<String, String> entry : entries) {
String key = entry.getKey();
if (!key.endsWith(JOB) || !isEnableJob(enable(key))) {
continue;
}
String jobClassName = jobProp.get(key) + "";
String jobCronExp = jobProp.get(cronKey(key)) + "";
Class<Job> job = Reflect.on(jobClassName).get();
try {
jobs.put(job.newInstance(), jobCronExp);
} catch (Exception e) {
Throwables.propagate(e);
}
}
}
示例8: validateOptionalParameters
import com.jfinal.kit.StrKit; //导入方法依赖的package包/类
@Override
public void validateOptionalParameters(T request) throws OAuthProblemException {
final Set<String> missingParameters = new HashSet<String>();
for (Map.Entry<String, String[]> requiredParam : optionalParams.entrySet()) {
final String paramName = requiredParam.getKey();
String val = request.getParameter(paramName);
if (StrKit.notBlank(val)) {
String[] dependentParams = requiredParam.getValue();
if (StrKit.notBlank(dependentParams)) {
for (String dependentParam : dependentParams) {
val = request.getParameter(dependentParam);
if (StrKit.isBlank(val)) {
missingParameters.add(dependentParam);
}
}
}
}
}
if (!missingParameters.isEmpty()) {
throw OAuthKit.handleMissingParameters(missingParameters);
}
}
示例9: toXml
import com.jfinal.kit.StrKit; //导入方法依赖的package包/类
/**
* 微信下单,map to xml
* @param params 参数
* @return String
*/
public static String toXml(Map<String, String> params) {
StringBuilder xml = new StringBuilder();
xml.append("<xml>");
for (Entry<String, String> entry : params.entrySet()) {
String key = entry.getKey();
String value = entry.getValue();
// 略过空值
if (StrKit.isBlank(value)) continue;
xml.append("<").append(key).append(">");
xml.append(entry.getValue());
xml.append("</").append(key).append(">");
}
xml.append("</xml>");
return xml.toString();
}
示例10: getPath
import com.jfinal.kit.StrKit; //导入方法依赖的package包/类
private String getPath(String property) {
if (StrKit.isBlank(property) || (!"downloads".equals(property) && !"uploads".equals(property))) {
throw new IllegalArgumentException("property is invalid, property just use `downloads` or `uploads`");
}
this.loadPropertyFile();
String app = this.getAppName();
String baseDir = this.getProperty(String.format("app.%s.basedir", property));
if (baseDir.endsWith("/")) {
if (!baseDir.endsWith(property+"/")) {
baseDir += (property+"/");
}
}else{
if (!baseDir.endsWith(property)) {
baseDir += ("/"+property+"/");
}else{
baseDir += "/";
}
}
return (new StringBuilder(baseDir).append(app).toString());
}
示例11: checkSignature
import com.jfinal.kit.StrKit; //导入方法依赖的package包/类
/**
* 检测签名
*/
private boolean checkSignature(Controller c) {
String signature = c.getPara("signature");
String timestamp = c.getPara("timestamp");
String nonce = c.getPara("nonce");
if (StrKit.isBlank(signature) || StrKit.isBlank(timestamp) || StrKit.isBlank(nonce)) {
c.renderText("check signature failure");
return false;
}
if (SignatureCheckUtil.checkSignature(WcCache.getWxBase("").getToken(), signature, timestamp, nonce)) {
return true;
} else {
logger.error("check signature failure: " +
" signature = " + c.getPara("signature") +
" timestamp = " + c.getPara("timestamp") +
" nonce = " + c.getPara("nonce"));
return false;
}
}
示例12: appendMultipleGraphs
import com.jfinal.kit.StrKit; //导入方法依赖的package包/类
private static StringBuffer appendMultipleGraphs(StringBuffer strXML, List<List<String>> values) {
if (values == null) {
return strXML;
}
strXML.append(space(1)).append("<graphs>");
for (int i = 0, size = values.size(); i < size; i++) {
strXML.append(newLine()).append(space(2)).append("<graph gid ='").append(i + 1).append("'>");
List<String> value = values.get(i);
for (int j = 0; j < value.size(); j++) {
String val = value.get(j);
if (StrKit.isBlank(val)) {
val = "0";
}
strXML.append(newLine()).append(space(3)).append("<value xid='").append(j).append("'>").append(val)
.append("</value>");
}
strXML.append(newLine()).append(space(2)).append("</graph>");
}
strXML.append(newLine()).append(space(1)).append("</graphs>");
return strXML;
}
示例13: invoke
import com.jfinal.kit.StrKit; //导入方法依赖的package包/类
@Deprecated
public void invoke() {
Integer interfaceId = getParaToInt("interface.id");
checkNotNull(interfaceId, "interface.id");
Interface interfaces = Interface.dao.findById(interfaceId);
if ( interfaces == null ) {
Error(500, "Oop! interface not exist.");
return;
}
// http-client 因为接口调度会比较频繁,所以使用conntion-pool来操作
/**
* 使用连接池可以根据以往接口的调用频率来决策,因为连接池采取的都是长连接
*/
String url = interfaces.getRelativeUrl();
if ( StrKit.isBlank(url) ) {
Error(500, "Oop! interface url not exist.");
return;
}
if ( interfaces.get("data") == null ) {
Error(500, "Oop! interface data not exist.");
return;
}
// 使用baseUrl瓶装真实的接口url
if ( !url.startsWith("http") ) {
String baseUrl = Project.dao.findById(interfaces.getWProjectId()).getBaseUrl();
if ( StrKit.notBlank(baseUrl) ) {
if ( url.startsWith("/") )
url = baseUrl + url;
else
url = baseUrl + "/" + url;
}
}
String result = HttpKit.post(url, interfaces.get("data").toString());
LOG.info(String.format("ID[%n]-interface:[%s (%s)] invoke result:[%s]", interfaces.getId(), interfaces.getName(), interfaces.getCode(), result));
OK(JSON.parse(result));
}
示例14: save
import com.jfinal.kit.StrKit; //导入方法依赖的package包/类
@Before(Tx.class)
public void save() {
DbModel dbmodel = getModel(DbModel.class, "dbmodel");
Generate generate = getModel(Generate.class, "generate");
List<DbModelItem> dbmodelItems = getModels(DbModelItem.class, "model");
if(StrKit.isBlank(dbmodel.getClassName())) {
dbmodel.setClassName(camelNameConvert(dbmodel.getName()));
}
if(StrKit.isBlank(generate.getModuleName())) {
generate.setModuleName(dbmodel.getClassName().toLowerCase());
}
if(dbmodel.save()) {
generate.setWModelId(dbmodel.getId());
generate.save();
int serial = 0;
for(DbModelItem item : dbmodelItems) {
// 根据type设置java_type
item.setJavaType(mysqlAndJavaType.get(item.getType()));
item.setWModelId(dbmodel.getId());
item.save();
serial = item.getSerial();
}
createDateTime("create_date", "创建时间", dbmodel.getId(), serial++).save();
createDateTime("modify_date", "更新时间", dbmodel.getId(), serial++).save();
}
OK();
}
示例15: getTempletGenerate
import com.jfinal.kit.StrKit; //导入方法依赖的package包/类
private TempletGenerate getTempletGenerate(Object projectId) {
Project project = Project.dao.findById(projectId);
if (project == null) throw new ApiException(String.format("Oop! project[%s] not exits.", projectId));
String rootPath = project.getRootPath();
if (StrKit.isBlank(rootPath)) throw new ApiException(String.format("Oop! project[%s] root path is null.", projectId));
TempletGenerate tg = new TempletGenerate(rootPath, rootPath, null);
return tg;
}