-
Notifications
You must be signed in to change notification settings - Fork 173
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #152 from yg3630536/feature/qr-code-down-model
support resources id mode for QrCodeTrransportation
- Loading branch information
Showing
38 changed files
with
1,949 additions
and
991 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
src/main/java/com/webank/weid/suite/api/transportation/params/TransMode.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/* | ||
* Copyright© (2018-2020) WeBank Co., Ltd. | ||
* | ||
* This file is part of weid-java-sdk. | ||
* | ||
* weid-java-sdk is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* weid-java-sdk is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with weid-java-sdk. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package com.webank.weid.suite.api.transportation.params; | ||
|
||
import com.webank.weid.constant.ErrorCode; | ||
import com.webank.weid.exception.WeIdBaseException; | ||
|
||
/** | ||
* Transportation的数据模式, 目前支持二维码的纯数据模式和下载模式 | ||
* 在使用transportation序列化二维码的时候可以通过这个指定二维码包含的是纯数据,还是下载模式. | ||
* 纯数据模式(DATA_MODE):表示序列化出来的数据为实际数据,此模式下的内容会过大,可能无法编码到二维码中. | ||
*下载模式(DOWNLOAD_MODE):将协议数据存储在数据库中,通过短编码进行映射. | ||
* | ||
* @author yanggang | ||
* | ||
*/ | ||
public enum TransMode { | ||
|
||
/** | ||
* 纯数据模式. | ||
*/ | ||
DATA_MODE(0), | ||
|
||
/** | ||
* 下载模式. | ||
*/ | ||
DOWNLOAD_MODE(1), | ||
; | ||
|
||
private Integer code; | ||
|
||
TransMode(Integer code) { | ||
this.code = code; | ||
} | ||
|
||
public Integer getCode() { | ||
return code; | ||
} | ||
|
||
/** | ||
* get TransMode By code. | ||
* | ||
* @param code the TransMode code | ||
* @return TransMode | ||
*/ | ||
public static TransMode getTransModeByCode(Integer code) { | ||
for (TransMode type : TransMode.values()) { | ||
if (type.getCode() == code) { | ||
return type; | ||
} | ||
} | ||
throw new WeIdBaseException(ErrorCode.TRANSPORTATION_TRANSMODE_TYPE_INVALID); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.