精简依赖

This commit is contained in:
zhou-hao
2018-06-11 20:46:25 +08:00
parent a5b9941f04
commit 1859f9b2e1
15 changed files with 2 additions and 357 deletions

View File

@@ -1 +0,0 @@
# 验证器增强。提供重复数据验证等api

View File

@@ -1,39 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2016 http://www.hswebframework.org
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
~
~
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>hsweb-boost-validator</artifactId>
<groupId>org.hswebframework.web</groupId>
<version>3.0.0-RC-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>hsweb-boost-validator-api</artifactId>
<dependencies>
<dependency>
<groupId>org.hswebframework.web</groupId>
<artifactId>hsweb-boost-aop</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</project>

View File

@@ -1,64 +0,0 @@
/*
* Copyright 2016 http://www.hswebframework.org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
*/
package org.hswebframework.web.boost.validator;
import org.hswebframework.web.boost.aop.context.MethodInterceptorContext;
/**
* 重复数据验证器,验证数据是否重复
*
* @author zhouhao
*/
public interface DuplicateValidator {
Result doValidate(DuplicateValidatorConfig validator, MethodInterceptorContext context);
/**
* 验证结果
*/
class Result {
//是否存在重复的数据
boolean exists;
//存在的数据,不存在时值为null
Object data;
public Result() {
}
public Result(boolean exists, Object data) {
this.exists = exists;
this.data = data;
}
public boolean isExists() {
return exists;
}
public void setExists(boolean exists) {
this.exists = exists;
}
public Object getData() {
return data;
}
public void setData(Object data) {
this.data = data;
}
}
}

View File

@@ -1,54 +0,0 @@
/*
* Copyright 2016 http://www.hswebframework.org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
*/
package org.hswebframework.web.boost.validator;
import java.io.Serializable;
/**
* 重复数据验证配置
*
* @author zhouhao
*/
public interface DuplicateValidatorConfig extends Serializable {
/**
* 对数据的操作事件
*
* @return 操作事件
* @see org.hswebframework.web.authorization.Permission#ACTION_UPDATE
* @see org.hswebframework.web.authorization.Permission#ACTION_ADD
*/
String getAction();
/**
* @return 验证未通过时返回的消息
*/
String getErrorMessage();
/**
* @return 验证方式
*/
String getType();
interface DefaultType {
String SCRIPT = "SCRIPT";
String FIELDS = "FIELDS";
String CUSTOM = "CUSTOM";
}
}

View File

@@ -1,36 +0,0 @@
/*
* Copyright 2016 http://www.hswebframework.org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
*/
package org.hswebframework.web.boost.validator;
import java.util.List;
/**
* 根据字段判断是否存在重复的数据
*
* @author zhouhao
* @since 3.0
*/
public interface FiledDuplicateValidatorConfig extends DuplicateValidatorConfig {
@Override
default String getType() {
return DefaultType.FIELDS;
}
List<String> getFields();
}

View File

@@ -1,46 +0,0 @@
/*
* Copyright 2016 http://www.hswebframework.org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
*/
package org.hswebframework.web.boost.validator;
/**
* 通过脚本来控制数据重复
*
* @author zhouhao
*/
public interface ScriptDuplicateValidatorConfig extends DuplicateValidatorConfig {
@Override
default String getType() {
return DefaultType.SCRIPT;
}
/**
* 脚本语言: javascript(js),groovy
*
* @return 语言
*/
String getScriptLanguage();
/**
* 脚本内容,在进行验证的时候会执行脚本,如果存在重复数据脚本应当返回false。否则返回true
*
* @return 脚本
*/
String getScript();
}

View File

@@ -1,50 +0,0 @@
/*
* Copyright 2016 http://www.hswebframework.org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
*/
package org.hswebframework.web.boost.validator.annotation;
import java.lang.annotation.*;
/**
* 重复数据验证
*
* @author zhouhao
*/
@Target({ElementType.TYPE, ElementType.METHOD, ElementType.ANNOTATION_TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface RequiresDuplicate {
/**
* @return permission id
*/
String permission();
/**
* @return action array
*/
String[] action() default {};
/**
* @return 自定义控制器bean名称
*/
String controllerBeanName() default "";
}

View File

@@ -1,21 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>hsweb-boost-validator</artifactId>
<groupId>org.hswebframework.web</groupId>
<version>3.0.0-RC-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>hsweb-boost-validator-group</artifactId>
<dependencies>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
</dependency>
</dependencies>
</project>

View File

@@ -1,38 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2016 http://www.hswebframework.org
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
~
~
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>hsweb-boost</artifactId>
<groupId>org.hswebframework.web</groupId>
<version>3.0.0-RC-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>hsweb-boost-validator</artifactId>
<packaging>pom</packaging>
<modules>
<module>hsweb-boost-validator-api</module>
<module>hsweb-boost-validator-group</module>
</modules>
</project>

View File

@@ -30,7 +30,6 @@
<artifactId>hsweb-boost</artifactId>
<packaging>pom</packaging>
<modules>
<module>hsweb-boost-validator</module>
<module>hsweb-boost-aop</module>
<module>hsweb-boost-ftp</module>
</modules>

View File

@@ -1 +0,0 @@
TODO

View File

@@ -3,9 +3,10 @@
`RequestMapping("/user)`为例
| 功能 | http方法&url | 响应 | 说明 |
| 功能 | http method&url | 响应 | 说明 |
| ------------- | -------------| ------------- | ----|
|查询|GET /user|HTTP Status:200 {"status":200,"result":{"data":[],"total":0}} |可进行[动态查询](#动态查询)|
|不分页查询|GET /user/no-paging|HTTP Status:200 {"status":200,"result":[]} |可进行[动态查询](#动态查询)|
|获取指定id的数据|GET /user/id|HTTP Status:200 {"status":200,"result":{"name":""} |可进行[动态查询](#动态查询)|
|新增|POST /user|HTTP Status:201 {"status":201,"result":"{id}"} |contentType='application/json' |
|更新|PUT /user/{id}|HTTP Status:200 {"status":200} |contentType='application/json'|

View File

@@ -40,11 +40,6 @@
<artifactId>hsweb-easy-orm-rdb</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.hswebframework.web</groupId>
<artifactId>hsweb-boost-validator-group</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.hswebframework</groupId>
<artifactId>hsweb-utils</artifactId>