summaryrefslogtreecommitdiffstats
path: root/appmarket-utils/src/main/java/app/market/utils/webservice
diff options
context:
space:
mode:
Diffstat (limited to 'appmarket-utils/src/main/java/app/market/utils/webservice')
-rw-r--r--appmarket-utils/src/main/java/app/market/utils/webservice/ApiParam.java196
-rw-r--r--appmarket-utils/src/main/java/app/market/utils/webservice/ErrorCode.java50
-rw-r--r--appmarket-utils/src/main/java/app/market/utils/webservice/ErrorCodeEnum.java41
-rw-r--r--appmarket-utils/src/main/java/app/market/utils/webservice/WebServiceURI.java77
4 files changed, 364 insertions, 0 deletions
diff --git a/appmarket-utils/src/main/java/app/market/utils/webservice/ApiParam.java b/appmarket-utils/src/main/java/app/market/utils/webservice/ApiParam.java
new file mode 100644
index 0000000..fb54618
--- /dev/null
+++ b/appmarket-utils/src/main/java/app/market/utils/webservice/ApiParam.java
@@ -0,0 +1,196 @@
+/*
+ * Copyright (c) 2019 TOYOTA MOTOR CORPORATION
+ *
+ * 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 app.market.utils.webservice;
+
+import java.util.HashMap;
+
+public class ApiParam {
+ public static final String API_PARAM_SORT = "sort";
+ public static final String API_PARAM_ORDER = "order";
+ public static final String API_PARAM_OFFSET = "offset";
+ public static final String API_PARAM_LIMIT = "limit";
+
+ /**
+ *
+ */
+ public static final String API_PARAM_VALUE_ORDER_ASC = "ASC";
+ public static final String API_PARAM_VALUE_ORDER_DESC = "DESC";
+ public static final String API_PARAM_VALUE_DICTIONARY_CATEGORY = "0100";
+ public static final String API_PARAM_VALUE_DICTIONARY_DEVICETYPE = "0101";
+ public static final String API_PARAM_VALUE_DICTIONARY_ISPUBLIC = "0102";
+
+ /**
+ * パラメータの
+ */
+ public static final String API_PARAM_DEFAULT_OFFSET = "0";
+ public static final String API_PARAM_DEFAULT_LIMIT = "10";
+ public static final int API_PARAM_CRITICAL_OFFSET = 0;
+ public static final int API_PARAM_CRITICAL_LIMIT = 0;
+
+ public static final String API_PARAM_DEFAULT_IS_PUBLIC = "1";
+ public static final String API_PARAM_DEFAULT_NOT_PUBLIC = "0";
+
+ public static final String API_PARAM_DEFAULT_SORT_NAME = "createDate";
+ public static final String API_PARAM_DEFAULT_DEL = "0";
+
+ /**
+ *
+ */
+ public static final String API_PARAM_CRITICAL_LIMIT_MIN = "1";
+ public static final String API_PARAM_CRITICAL_TYPE_MIN = "0";
+ public static final String API_PARAM_CRITICAL_TYPE_MAX = "9";
+ public static final String API_PARAM_CRITICAL_DEVICETYPE_MIN = "0";
+ public static final String API_PARAM_CRITICAL_DEVICETYPE_MAX = "5";
+
+ /**
+ *
+ */
+ public static final int API_PARAM_APPNAME_LENGTH = 32;
+ public static final int API_PARAM_USERNAME_LENGTH = 32;
+ public static final int API_PARAM_VERSIONNAME_LENGTH = 32;
+ public static final int API_PARAM_VERFILEPATH_LENGTH = 200;
+ public static final int API_PARAM_APPABSTRACT_LENGTH = 800;
+ public static final int API_PARAM_USERPASSMIN_LENGTH = 6;
+ public static final int API_PARAM_USERPASSMAX_LENGTH = 32;
+ public static final int API_PARAM_MAILADDRESS_LENGTH = 32;
+
+ /**
+ *
+ */
+ public static final String API_APP_PARAM_LOGINID = "loginId";
+ public static final String API_APP_PARAM_REFRESHTOKEN = "refreshToken";
+ public static final String API_APP_PARAM_PASSWORD = "password";
+ public static final String API_APP_PARAM_MULTIPARTFILE = "multipartFile";
+ public static final String API_APP_PARAM_FILE_HASH = "hashcode";
+ public static final String API_APP_PARAM_APPTYPEID = "appTypeId";
+ public static final String API_APP_PARAM_APPID = "appId";
+ public static final String API_APP_PARAM_FILE_NAME = "fileName";
+ public static final String API_APP_PARAM_FILE_PATH = "filePath";
+ public static final String API_APP_PARAM_APPNAME = "appName";
+ public static final String API_APP_PARAM_DEVELOPER = "appDeveloper";
+ public static final String API_APP_PARAM_APPDEVICETYPEID = "appDeviceTypeId";
+ public static final String API_APP_PARAM_APPDEVICETYPE = "appDeviceType";
+ public static final String API_APP_PARAM_APPISPUBLIC = "appIsPublic";
+ public static final String API_APP_PARAM_DICTIONARY_TYPEID = "dictionaryTypeId";
+ public static final String API_APP_PARAM_DICTIONARY_VALUE = "dictionaryValue";
+ public static final String API_APP_PARAM_DICTIONARY_LABEL = "dictionaryLabel";
+ public static final String API_APP_PARAM_KEYWORD = "keyWord";
+ public static final String API_APP_PARAM_APPID_CUSTOM = "appIdCustom";
+
+ /**
+ *
+ */
+ public static final String API_USER_PARAM_USERNAME = "userName";
+ public static final String API_USER_PARAM_MAIL = "mail";
+ public static final String API_USER_PARAM_CREATEDATE = "createDate";
+ public static final String API_USER_PARAM_AUID = "auId";
+
+ /**
+ *
+ */
+ public static final String API_RESPONSE_TOKEN = "token";
+ public static final String API_RESPONSE_REFRESHTOKEN = "refreshToken";
+ public static final String API_RESPONSE_APPID = "appId";
+ public static final String API_RESPONSE_APPVERSIONID = "appVersionId";
+ public static final String API_RESPONSE_USERID = "userId";
+
+ public static final HashMap<String, String> AppQueryParam=new HashMap<String, String>();
+ static
+ {
+ AppQueryParam.put("appId" , "APP_ID");
+ AppQueryParam.put("appName" , "APP_NAME");
+ AppQueryParam.put("appAbstract" , "APP_ABSTRACT");
+ AppQueryParam.put("typeId" , "APP_TYPE_ID");
+ AppQueryParam.put("typeName" , "TYPE_NAME");
+ AppQueryParam.put("appDeviceTypeId" , "APP_DEVICE_TYPE_ID");
+ AppQueryParam.put("appDeviceTypeName" , "APP_DEVICE_TYPE_NAME");
+ AppQueryParam.put("developer" , "DEVELOPER");
+ AppQueryParam.put("developerName" , "USER_NAME");
+ AppQueryParam.put("versionName" , "VERSION_NAME");
+ AppQueryParam.put("verFileSize" , "SIZE");
+ AppQueryParam.put("verCreateDate" , "VERSION_CREATE_DATE");
+ AppQueryParam.put("createDate" , "APP_CREATE_DATE");
+ AppQueryParam.put("updateDate" , "APP_UPDATE_DATE");
+ AppQueryParam.put("hashcode" , "MD5");
+
+ }
+
+ public static final HashMap<String, String> UserQueryParam=new HashMap<String, String>();
+ static
+ {
+ UserQueryParam.put("userId" , "USER_ID");
+ UserQueryParam.put("userName" , "USER_NAME");
+ UserQueryParam.put("mailAddress" , "MAIL_ADDRESS");
+ UserQueryParam.put("createDate" , "CREATE_DATE");
+ UserQueryParam.put("updateDate" , "UPDATE_DATE");
+ UserQueryParam.put("auId" , "A_AU_ID");
+ UserQueryParam.put("auName" , "AU_NAME");
+ }
+
+ public enum UserQueryParamWeb {
+ USERNAME("userName", 1)
+ , USERMAILADDRESS("mailAddress", 2)
+ , USERCREATEDATE("createDate", 3);
+
+ private String fieldName;
+ private int paramId;
+
+ private UserQueryParamWeb(String fieldName, int paramId) {
+ this.fieldName = fieldName;
+ this.paramId = paramId;
+ }
+
+ public static String getFieldNameById(int id) {
+ for (UserQueryParamWeb c : UserQueryParamWeb.values()) {
+ if (c.getId() == id) {
+ return c.fieldName;
+ }
+ }
+ return null;
+ }
+
+ public int getId() {
+ return paramId;
+ }
+ }
+
+ public enum UserAuId {
+ ADIMIN("ADIMIN", 1)
+ , DEVELOPER("DEVELOPER", 2)
+ , NORMAL("NORMAL", 3);
+
+ private String fieldName;
+ private int paramId;
+
+ private UserAuId(String fieldName, int paramId) {
+ this.fieldName = fieldName;
+ this.paramId = paramId;
+ }
+
+ public static String getFieldNameById(int id) {
+ for (UserAuId c : UserAuId.values()) {
+ if (c.getId() == id) {
+ return c.fieldName;
+ }
+ }
+ return null;
+ }
+
+ public int getId() {
+ return paramId;
+ }
+ }
+}
diff --git a/appmarket-utils/src/main/java/app/market/utils/webservice/ErrorCode.java b/appmarket-utils/src/main/java/app/market/utils/webservice/ErrorCode.java
new file mode 100644
index 0000000..cf067ae
--- /dev/null
+++ b/appmarket-utils/src/main/java/app/market/utils/webservice/ErrorCode.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2019 TOYOTA MOTOR CORPORATION
+ *
+ * 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 app.market.utils.webservice;
+
+import app.market.utils.property.MessageUtil;
+
+public class ErrorCode {
+
+ private ErrorCodeEnum codeStr=null;
+ private String message = "";
+
+ /**
+ *
+ * @param codeStr
+ * @param messageKey
+ */
+ public ErrorCode(ErrorCodeEnum codeStr, String messageKey) {
+ super();
+ this.codeStr = codeStr;
+
+ String message = MessageUtil.getPropertites( messageKey );
+ this.message = message;
+ }
+
+ public ErrorCodeEnum getCodeStr() {
+ return codeStr;
+ }
+ public void setCodeStr(ErrorCodeEnum codeStr) {
+ this.codeStr = codeStr;
+ }
+ public String getMessage() {
+ return message;
+ }
+ public void setMessage(String message) {
+ this.message = message;
+ }
+}
diff --git a/appmarket-utils/src/main/java/app/market/utils/webservice/ErrorCodeEnum.java b/appmarket-utils/src/main/java/app/market/utils/webservice/ErrorCodeEnum.java
new file mode 100644
index 0000000..c1cecbd
--- /dev/null
+++ b/appmarket-utils/src/main/java/app/market/utils/webservice/ErrorCodeEnum.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2019 TOYOTA MOTOR CORPORATION
+ *
+ * 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 app.market.utils.webservice;
+
+public enum ErrorCodeEnum{
+
+ //●400リ request error
+ INVALID_BODY,INVALID_QUERYPARAM,MISSING_NECESSARY_QUERYPARAM,MISSING_RESOURCE,BAD_FAILED,ALREADY_UPDATED,
+
+ //●401 authorized error
+ UNAUTHORIZED_API,EXPIRED_TOKEN,EXPIRED_REFRESH_TOKEN,LOGIN_FAILD,
+
+ //●402 MD5 error
+ MD5_FAILED,
+
+ //●403 forbidden
+ FORBIDDEN_RESOURCE,
+
+ //●409 already exist
+ RESOURCE_ALREADY_EXISTS,CORRELATION_RESOURCE_ALREADY_EXISTS,TYPENAME_ALREADY_EXISTS,
+
+ //●415 unsupport file
+ UNSUPPORT_FILE,
+
+ //●503 system maintenance
+ UNDER_MAINTENANCE,
+
+}
diff --git a/appmarket-utils/src/main/java/app/market/utils/webservice/WebServiceURI.java b/appmarket-utils/src/main/java/app/market/utils/webservice/WebServiceURI.java
new file mode 100644
index 0000000..40cb025
--- /dev/null
+++ b/appmarket-utils/src/main/java/app/market/utils/webservice/WebServiceURI.java
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2019 TOYOTA MOTOR CORPORATION
+ *
+ * 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 app.market.utils.webservice;
+
+public class WebServiceURI {
+
+ /** token expire */
+ public static final String REST_TOKEN_VALIDATETOKENEXPIRE_LF = "/api/v1/validateTokenRest/validateTokenExpire";
+
+ public static final String REST_TOKEN_VALIDATETOKENAUTHORTICATION_LF = "/api/v1/validateTokenRest/validateTokenAuthortication";
+
+ public static final String REST_TOKEN_LF = "/api/v1/token/{refreshToken}";
+
+ /** ▼▼▼▼▼▼▼▼▼▼ user ▼▼▼▼▼▼▼▼▼▼ */
+ /** login */
+ public static final String REST_USER_SELECTLOGINUSER_LF = "/api/v1/login";
+ /** user collection */
+ public static final String REST_USER_SELECTPAGINATIONDATABYEXAMPLE_LF = "/api/v1/user/collection";
+ /** user search */
+ public static final String REST_USER_BY_USERNAME_LF = "/api/v1/user/{userName}";
+ /** get current user */
+ public static final String REST_USER_SELECT_CURRENT_LF = "/api/v1/user/currentUser";
+ /** save user */
+ public static final String REST_USER_LF = "/api/v1/user";
+ /** delete user */
+ public static final String REST_USER_BY_USERID_LF = "/api/v1/user/{userId}";
+ /** ▲▲▲▲▲▲▲▲▲▲ user ▲▲▲▲▲▲▲▲▲▲ */
+
+ /** ▼▼▼▼▼▼▼▼▼▼ application ▼▼▼▼▼▼▼▼▼▼ */
+ /** get application collection */
+ public static final String REST_APP_COLLECTION_APP_LF = "/api/v1/app/collection";
+ /** get application information */
+ public static final String REST_APP_INFO_LF = "/api/v1/app/info";
+
+ public static final String REST_APP_INFO_PARM_ID_LF = "/api/v1/app/info/{appId}";
+ /** get application authority */
+ public static final String REST_APP_INFO_PARM_CUSTOMID_LF = "/api/v1/app/info/dev/{appIdCustom}";
+
+ public static final String REST_APP_VERSION_INFO_LF = "/api/v1/app/info/version";
+
+ /** application upload */
+ public static final String REST_APP_FILE_LF = "/api/v1/app/file";
+
+ public static final String REST_APP_FILE_PARM_FILENAME_TYPEID_APPID_LF = "/api/v1/app/file/{fileName}/{appDeviceTypeId}/{appId}";
+
+ public static final String REST_APP_FILE_PARM_FILEPATH_LF = "/api/v1/app/file";
+
+ public static final String REST_APP_IMAGE_LF = "/api/v1/app/image";
+ /** ▲▲▲▲▲▲▲▲▲▲ application ▲▲▲▲▲▲▲▲▲▲ */
+
+ /** ▼▼▼▼▼▼▼▼▼▼ authority ▼▼▼▼▼▼▼▼▼▼ */
+ /** get authority list */
+ public static final String REST_AUTHORITY_GET_LIST_OPTION_LF = "/api/v1/authority/collection";
+ /** ▲▲▲▲▲▲▲▲▲▲ authority ▲▲▲▲▲▲▲▲▲▲ */
+
+ /** ▼▼▼▼▼▼▼▼▼▼ resource ▼▼▼▼▼▼▼▼▼▼ */
+ public static final String REST_RESOURCE_GET_MENU_RESOURCES_BY_LOGINID_LF = "/api/v1/resource/menuResource/collection";
+ /** ▲▲▲▲▲▲▲▲▲▲ resource ▲▲▲▲▲▲▲▲▲▲ */
+
+ /** ▼▼▼▼▼▼▼▼▼▼ dictionary ▼▼▼▼▼▼▼▼▼▼ */
+ public static final String REST_DICTIONARY_COLLECTION_LF = "/api/v1/dictionary/collection/{dictionaryTypeId}";
+ public static final String REST_DICTIONARY_INFO_LF = "/api/v1/dictionary/info";
+ /** ▲▲▲▲▲▲▲▲▲▲ dictionary ▲▲▲▲▲▲▲▲▲▲ */
+}