Skip to content

Commit

Permalink
[ISSUE #10734] Implemented the parameter validation utility class (#1…
Browse files Browse the repository at this point in the history
…0737)

* For #10734,Refactor the AbstractConfigRequest ,move common properties from its subclasses to the parent class,to reduce the number of corresponding parameter extractors by .

* For #10734,add ParamCheckRules,ParamCheckUtils, add  ParamExtractor interface and the abstract classes HttpParamExtractor and RpcParamExtractor, implement the corresponding Manager.

* For #10734,fix codestyle

* For #10734,fix codestyle , move extractor and extractorManager to core directory

* For #10734,fix codestyle

* For #10734,fix dependency of common module

* For #10734,fix codestyle and copyright

* For #10734,fix pom codestyle and copyright

* For #10734,fix pom codestyle and copyright

* For #10734,fix  copyright

* For #10734,fix  copyright

* For #10734,fix bug caused by refactor of AbstractConfigRequest ,add ut test of ParamExtractorManager

* For #10734,fix bug caused by refactor of AbstractConfigRequest

---------

Co-authored-by: zhuoguang <[email protected]>
  • Loading branch information
Sunrisea and zhuoguang authored Jul 7, 2023
1 parent a704835 commit ba8e0e2
Show file tree
Hide file tree
Showing 20 changed files with 1,201 additions and 264 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 1999-2018 Alibaba Group Holding Ltd.
* Copyright 1999-2023 Alibaba Group Holding Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -21,11 +21,42 @@

/**
* abstract request of config module request,all config module request should extends this class.
*
* @author liuzunfei
* @version $Id: ConfigCommonRequest.java, v 0.1 2020年07月13日 9:05 PM liuzunfei Exp $
*/
public abstract class AbstractConfigRequest extends Request {


private String dataId;

private String group;

private String tenant;

public String getDataId() {
return dataId;
}

public void setDataId(String dataId) {
this.dataId = dataId;
}

public String getGroup() {
return group;
}

public void setGroup(String group) {
this.group = group;
}

public String getTenant() {
return tenant;
}

public void setTenant(String tenant) {
this.tenant = tenant;
}

@Override
public String getModule() {
return Constants.Config.CONFIG_MODULE;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 1999-2020 Alibaba Group Holding Ltd.
* Copyright 1999-2023 Alibaba Group Holding Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 1999-2020 Alibaba Group Holding Ltd.
* Copyright 1999-2023 Alibaba Group Holding Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -27,12 +27,6 @@
*/
public class ConfigPublishRequest extends AbstractConfigRequest {

String dataId;

String group;

String tenant;

String content;

String casMd5;
Expand All @@ -43,6 +37,13 @@ public ConfigPublishRequest() {

}

public ConfigPublishRequest(String dataId, String group, String tenant, String content) {
this.content = content;
super.setGroup(group);
super.setTenant(tenant);
super.setDataId(dataId);
}

/**
* get additional param.
*
Expand All @@ -66,49 +67,6 @@ public void putAdditionalParam(String key, String value) {
additionMap.put(key, value);
}

public ConfigPublishRequest(String dataId, String group, String tenant, String content) {
this.content = content;
this.dataId = dataId;
this.group = group;
this.tenant = tenant;
}

/**
* Getter method for property <tt>dataId</tt>.
*
* @return property value of dataId
*/
public String getDataId() {
return dataId;
}

/**
* Setter method for property <tt>dataId</tt>.
*
* @param dataId value to be assigned to property dataId
*/
public void setDataId(String dataId) {
this.dataId = dataId;
}

/**
* Getter method for property <tt>group</tt>.
*
* @return property value of group
*/
public String getGroup() {
return group;
}

/**
* Setter method for property <tt>group</tt>.
*
* @param group value to be assigned to property group
*/
public void setGroup(String group) {
this.group = group;
}

/**
* Getter method for property <tt>content</tt>.
*
Expand Down Expand Up @@ -163,21 +121,4 @@ public void setAdditionMap(Map<String, String> additionMap) {
this.additionMap = additionMap;
}

/**
* Getter method for property <tt>tenant</tt>.
*
* @return property value of tenant
*/
public String getTenant() {
return tenant;
}

/**
* Setter method for property <tt>tenant</tt>.
*
* @param tenant value to be assigned to property tenant
*/
public void setTenant(String tenant) {
this.tenant = tenant;
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 1999-2018 Alibaba Group Holding Ltd.
* Copyright 1999-2023 Alibaba Group Holding Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -26,12 +26,6 @@
*/
public class ConfigQueryRequest extends AbstractConfigRequest {

private String dataId;

private String group;

private String tenant;

private String tag;

/**
Expand All @@ -50,60 +44,6 @@ public static ConfigQueryRequest build(String dataId, String group, String tenan
return request;
}

/**
* Getter method for property <tt>dataId</tt>.
*
* @return property value of dataId
*/
public String getDataId() {
return dataId;
}

/**
* Setter method for property <tt>dataId</tt>.
*
* @param dataId value to be assigned to property dataId
*/
public void setDataId(String dataId) {
this.dataId = dataId;
}

/**
* Getter method for property <tt>group</tt>.
*
* @return property value of group
*/
public String getGroup() {
return group;
}

/**
* Setter method for property <tt>group</tt>.
*
* @param group value to be assigned to property group
*/
public void setGroup(String group) {
this.group = group;
}

/**
* Getter method for property <tt>tenant</tt>.
*
* @return property value of tenant
*/
public String getTenant() {
return tenant;
}

/**
* Setter method for property <tt>tenant</tt>.
*
* @param tenant value to be assigned to property tenant
*/
public void setTenant(String tenant) {
this.tenant = tenant;
}

/**
* Getter method for property <tt>tag</tt>.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 1999-2020 Alibaba Group Holding Ltd.
* Copyright 1999-2023 Alibaba Group Holding Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -24,32 +24,17 @@
*/
public class ConfigRemoveRequest extends AbstractConfigRequest {

String dataId;

String group;

String tenant;

String tag;

public ConfigRemoveRequest() {

}

public ConfigRemoveRequest(String dataId, String group, String tenant, String tag) {
this.dataId = dataId;
this.group = group;
super.setDataId(dataId);
super.setGroup(group);
super.setTenant(tenant);
this.tag = tag;
this.tenant = tenant;
}

/**
* Getter method for property <tt>dataId</tt>.
*
* @return property value of dataId
*/
public String getDataId() {
return dataId;
}

/**
Expand All @@ -70,48 +55,4 @@ public void setTag(String tag) {
this.tag = tag;
}

/**
* Setter method for property <tt>dataId</tt>.
*
* @param dataId value to be assigned to property dataId
*/
public void setDataId(String dataId) {
this.dataId = dataId;
}

/**
* Getter method for property <tt>group</tt>.
*
* @return property value of group
*/
public String getGroup() {
return group;
}

/**
* Setter method for property <tt>group</tt>.
*
* @param group value to be assigned to property group
*/
public void setGroup(String group) {
this.group = group;
}

/**
* Getter method for property <tt>tenant</tt>.
*
* @return property value of tenant
*/
public String getTenant() {
return tenant;
}

/**
* Setter method for property <tt>tenant</tt>.
*
* @param tenant value to be assigned to property tenant
*/
public void setTenant(String tenant) {
this.tenant = tenant;
}
}
Loading

0 comments on commit ba8e0e2

Please sign in to comment.