summaryrefslogtreecommitdiffstats
path: root/appmarket-utils
diff options
context:
space:
mode:
authorzheng_wenlong <wenlong_zheng@nexty-ele.com>2019-04-16 11:20:38 +0900
committerzheng_wenlong <wenlong_zheng@nexty-ele.com>2019-05-13 17:50:04 +0900
commit3b55d06b89bf64873e685c3d78fce5affbba3d17 (patch)
tree2adcff0087f4757107d2bf1e50c85ea649f04f94 /appmarket-utils
[Patch Set 2] Add ReadMe.md Change-Id: I6ade52d2490f5ca4ba107c1a27ed6d5b39048725 Signed-off-by: zheng_wenlong <wenlong_zheng@nexty-ele.com>
Diffstat (limited to 'appmarket-utils')
-rw-r--r--appmarket-utils/pom.xml47
-rw-r--r--appmarket-utils/src/main/java/app/market/utils/Md5Util.java39
-rw-r--r--appmarket-utils/src/main/java/app/market/utils/RuntimeUtil.java66
-rw-r--r--appmarket-utils/src/main/java/app/market/utils/SpringWebUtil.java80
-rw-r--r--appmarket-utils/src/main/java/app/market/utils/Utils.java136
-rw-r--r--appmarket-utils/src/main/java/app/market/utils/constants/Constants.java158
-rw-r--r--appmarket-utils/src/main/java/app/market/utils/constants/ProjectUserRoleEnum.java71
-rw-r--r--appmarket-utils/src/main/java/app/market/utils/datatable/DataTableMap.java99
-rw-r--r--appmarket-utils/src/main/java/app/market/utils/datetime/DateTimeUtils.java78
-rw-r--r--appmarket-utils/src/main/java/app/market/utils/exception/ExceptionEnum.java32
-rw-r--r--appmarket-utils/src/main/java/app/market/utils/json/JsonMapperUtils.java228
-rw-r--r--appmarket-utils/src/main/java/app/market/utils/json/JsonMessage.java49
-rw-r--r--appmarket-utils/src/main/java/app/market/utils/json/JsonResult.java60
-rw-r--r--appmarket-utils/src/main/java/app/market/utils/property/KeysConstants.java110
-rw-r--r--appmarket-utils/src/main/java/app/market/utils/property/MessageUtil.java55
-rw-r--r--appmarket-utils/src/main/java/app/market/utils/property/Option.java78
-rw-r--r--appmarket-utils/src/main/java/app/market/utils/property/PropertyContants.java22
-rw-r--r--appmarket-utils/src/main/java/app/market/utils/property/PropertyUtil.java127
-rw-r--r--appmarket-utils/src/main/java/app/market/utils/rest/RestTemplateUtil.java209
-rw-r--r--appmarket-utils/src/main/java/app/market/utils/token/DeleteModel.java52
-rw-r--r--appmarket-utils/src/main/java/app/market/utils/token/TokenModel.java100
-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
-rw-r--r--appmarket-utils/src/main/resources/message.ja.JP.properties98
-rw-r--r--appmarket-utils/src/main/resources/message.ja.en.properties98
-rw-r--r--appmarket-utils/src/test/java/app/market/utils/AppTest.java53
28 files changed, 2509 insertions, 0 deletions
diff --git a/appmarket-utils/pom.xml b/appmarket-utils/pom.xml
new file mode 100644
index 0000000..af06bc1
--- /dev/null
+++ b/appmarket-utils/pom.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0"?>
+<project
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+ xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>app.market</groupId>
+ <artifactId>appmarket-root</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ </parent>
+ <artifactId>appmarket-utils</artifactId>
+ <packaging>jar</packaging>
+ <name>appmarket-utils</name>
+ <url>http://maven.apache.org</url>
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>javax.servlet-api</artifactId>
+ <version>3.1.0</version>
+ </dependency>
+ <!-- json -->
+ <dependency>
+ <groupId>org.codehaus.jackson</groupId>
+ <artifactId>jackson-core-asl</artifactId>
+ <version>1.9.13</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.jackson</groupId>
+ <artifactId>jackson-mapper-asl</artifactId>
+ <version>1.9.13</version>
+ </dependency>
+ <dependency>
+ <groupId>com.alibaba</groupId>
+ <artifactId>fastjson</artifactId>
+ <version>1.2.28</version>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/appmarket-utils/src/main/java/app/market/utils/Md5Util.java b/appmarket-utils/src/main/java/app/market/utils/Md5Util.java
new file mode 100644
index 0000000..29edef8
--- /dev/null
+++ b/appmarket-utils/src/main/java/app/market/utils/Md5Util.java
@@ -0,0 +1,39 @@
+/*
+ * 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;
+
+import java.math.BigInteger;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+/**
+ *
+ * @author huangxin
+ *
+ */
+public class Md5Util {
+ /**
+ * @param userPw
+ * @return
+ * @throws NoSuchAlgorithmException
+ */
+ public static String md5(String userPw) throws NoSuchAlgorithmException{
+ MessageDigest md = MessageDigest.getInstance("MD5");
+ md.update(userPw.getBytes());
+ String userPwMd = new BigInteger(1,md.digest()).toString(16);
+ return userPwMd;
+ }
+
+}
diff --git a/appmarket-utils/src/main/java/app/market/utils/RuntimeUtil.java b/appmarket-utils/src/main/java/app/market/utils/RuntimeUtil.java
new file mode 100644
index 0000000..195b7cc
--- /dev/null
+++ b/appmarket-utils/src/main/java/app/market/utils/RuntimeUtil.java
@@ -0,0 +1,66 @@
+/*
+ * 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;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+
+public class RuntimeUtil {
+/**
+ * Execute Command of Linux Shell
+ * @param cmd
+ * @return Execute's result
+ */
+ public static boolean linuxCmdExec(String cmd) {
+ boolean ret = false;
+
+ try {
+ Process process = Runtime.getRuntime().exec(cmd);
+ BufferedReader stdoutReader = new BufferedReader(new InputStreamReader(process.getInputStream()));
+ BufferedReader stderrReader = new BufferedReader(new InputStreamReader(process.getErrorStream()));
+ String line;
+
+ while ((line = stdoutReader.readLine()) != null) {
+ System.out.println(line);
+ }
+
+ while ((line = stderrReader.readLine()) != null) {
+ System.out.println(line);
+ }
+
+ int exitVal = process.waitFor();
+
+ System.out.println("Process exit value is " + exitVal);
+ if(exitVal != 0) {
+ return ret;
+ }
+
+ ret = true;
+ } catch (IOException e) {
+ e.printStackTrace();
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ } catch (SecurityException e) {
+ e.printStackTrace();
+ } catch (NullPointerException e) {
+ e.printStackTrace();
+ } catch (IndexOutOfBoundsException e) {
+ e.printStackTrace();
+ }
+ return ret;
+ }
+}
diff --git a/appmarket-utils/src/main/java/app/market/utils/SpringWebUtil.java b/appmarket-utils/src/main/java/app/market/utils/SpringWebUtil.java
new file mode 100644
index 0000000..02eaf37
--- /dev/null
+++ b/appmarket-utils/src/main/java/app/market/utils/SpringWebUtil.java
@@ -0,0 +1,80 @@
+/*
+ * 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;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.context.request.ServletRequestAttributes;
+
+public class SpringWebUtil {
+
+ public static HttpServletRequest getRequest() {
+ ServletRequestAttributes requestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
+ return requestAttributes == null ? null : requestAttributes.getRequest();
+ }
+
+ public static HttpSession getSession() {
+ return getRequest().getSession( false );
+ }
+
+ public static String getRealRootPath() {
+ return getRequest().getServletContext().getRealPath( "/" );
+ }
+
+ public static String getIp() {
+ ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
+ if ( servletRequestAttributes != null ) {
+ HttpServletRequest request = servletRequestAttributes.getRequest();
+ return request.getRemoteAddr();
+ }
+ return null;
+ }
+
+ public static Object getSessionAttribute(String name) {
+ HttpServletRequest request = getRequest();
+ return request == null ? null : request.getSession().getAttribute( name );
+ }
+
+ public static void setSessionAttribute(String name, Object value) {
+ HttpServletRequest request = getRequest();
+ if ( request != null ) {
+ request.getSession().setAttribute( name, value );
+ }
+ }
+
+ public static Object getRequestAttribute(String name) {
+ HttpServletRequest request = getRequest();
+ return request == null ? null : request.getAttribute( name );
+ }
+
+ public static void setRequestAttribute(String name, Object value) {
+ HttpServletRequest request = getRequest();
+ if ( request != null ) {
+ request.setAttribute( name, value );
+ }
+ }
+
+ public static String getContextPath() {
+ return getRequest().getContextPath();
+ }
+
+ public static void removeSessionAttribute(String name) {
+ getRequest().getSession().removeAttribute( name );
+ }
+
+} \ No newline at end of file
diff --git a/appmarket-utils/src/main/java/app/market/utils/Utils.java b/appmarket-utils/src/main/java/app/market/utils/Utils.java
new file mode 100644
index 0000000..c0a1474
--- /dev/null
+++ b/appmarket-utils/src/main/java/app/market/utils/Utils.java
@@ -0,0 +1,136 @@
+/*
+ * 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;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.UUID;
+
+import org.apache.commons.lang3.StringUtils;
+
+import app.market.utils.constants.Constants;
+import app.market.utils.datetime.DateTimeUtils;
+
+/**
+ * tools
+ *
+ * @author Toyota
+ * @date 2017/10/10
+ */
+public class Utils {
+
+ /**
+ * Entity converter
+ *
+ * @see set in/out class
+ *
+ * @param org
+ * @param dest
+ * @throws NoSuchFieldException
+ * @throws SecurityException
+ * @throws IllegalArgumentException
+ * @throws IllegalAccessException
+ */
+ public static void reflect(Object org, Object dest) throws Exception {
+ Class<?> orgClass = org.getClass();
+ Class<?> destClass = dest.getClass();
+
+ for (Field orgField : orgClass.getDeclaredFields()) {
+ orgField.setAccessible( true );
+ String orgFieldName = orgField.getName();
+ if ( "serialVersionUID".equals( orgFieldName ) ) {
+ continue;
+ }
+ Field destField;
+ try {
+ destField = destClass.getDeclaredField( orgFieldName );
+ } catch ( NoSuchFieldException e ) {
+ continue;
+ }
+ destField.setAccessible( true );
+ if ( ( orgField.getType().getName().equals( "java.lang.Integer" )
+ || orgField.getType().getName().equals( "int" ) ) && orgField.get( org ) != null ) {
+ if ( destField.getType().getName().equals( "java.lang.String" ) ) {
+ destField.set( dest, String.valueOf( orgField.get( org ) ) );
+ } else {
+ destField.set( dest, orgField.get( org ) );
+ }
+ } else if ( orgField.getType().getName().equals( "java.util.Date" ) && orgField.get( org ) != null ) {
+ // to string
+ if ( destField.getType().getName().equals( "java.lang.String" ) ) {
+ destField.set( dest, DateTimeUtils.getDate( DateTimeUtils.DATE_FORMAT_YYYYMMDDHHMMSS,
+ (Date) orgField.get( org ) ) );
+ } else {
+ destField.set( dest, (Date) orgField.get( org ) );
+ }
+ } else if ( orgField.getType().getName().equals( "java.util.List" ) ) {
+ for (int i = 0; i < ( (ArrayList<?>) orgField.get( org ) ).size(); i++) {
+ Object orgItem = ( (ArrayList<?>) orgField.get( org ) ).get( i );
+ Type destItemType = ( (ParameterizedType) destField.getGenericType() ).getActualTypeArguments()[0];
+ Object destItem = ( Class.forName( destItemType.getTypeName() ) ).newInstance();
+ reflect( orgItem, destItem );
+ ( (ArrayList<Object>) destField.get( dest ) ).add( destItem );
+ }
+ } else {
+ if ( destField.getType().getName().equals( "java.util.Date" ) && orgField.get( org ) != null
+ && StringUtils.isNotEmpty( orgField.get( org ).toString() ) ) {
+ destField.set( dest, DateTimeUtils.getDate( DateTimeUtils.DATE_FORMAT_YYYYMMDD,
+ orgField.get( org ).toString() ) );
+ } else {
+ if ( destField.getType().getName().equals( orgField.getType().getName() ) ) {
+ destField.set( dest, orgField.get( org ) );
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Get UUID
+ *
+ * @return
+ */
+ public static String generatorUUID() {
+ return UUID.randomUUID().toString();
+ }
+
+ public static boolean strIsEmpty(String s) {
+ if (s == null || "".equals(s)) {
+ return true;
+ }
+ return false;
+ }
+
+ /***
+ * Get file name from path
+ * @param filePath
+ * @return succeed, return file name
+ * failed, return null
+ */
+ public static String getFileNameFromPath(String filePath) {
+ String ret = "";
+ try{
+ ret = filePath.substring(filePath.lastIndexOf(Constants.PATH_SEPARATOR) + 1);
+ }catch (Exception e){
+ e.printStackTrace();
+ return null;
+ }
+ return ret;
+ }
+}
diff --git a/appmarket-utils/src/main/java/app/market/utils/constants/Constants.java b/appmarket-utils/src/main/java/app/market/utils/constants/Constants.java
new file mode 100644
index 0000000..fef120a
--- /dev/null
+++ b/appmarket-utils/src/main/java/app/market/utils/constants/Constants.java
@@ -0,0 +1,158 @@
+/*
+ * 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.constants;
+
+import org.springframework.http.HttpStatus;
+
+public class Constants {
+
+ public static final String CHARACTER_UTF8 = "UTF-8";
+ public static final String CHARACTER_ISO = "ISO-8859-1";
+
+ /** success */
+ public static final int STATUS_SUCCESS = HttpStatus.OK.value();
+ /** unauthorized */
+ public static final int STATUS_UNAUTHORIZED = 401;
+
+ public static final int STATUS_REFRESH_TOKEN = 220;
+
+ public static final int STATUS_BAD_FILE = 402;
+ /** forbidden */
+ public static final int STATUS_FORBIDDEN = 403;
+ /** already exists */
+ public static final int STATUS_ALREADY_EXISTS = 409;
+ /** unsupport media type */
+ public static final int STATUS_UNSUPPORT = 415;
+ /** too many connections */
+ public static final int STATUS_TOO_MANY_CONNECTIONS = 421;
+ /** bad request */
+ public static final int STATUS_BAD_REQUEST = HttpStatus.BAD_REQUEST.value();
+ /** error */
+ public static final int STATUS_ERROR = HttpStatus.INTERNAL_SERVER_ERROR.value();
+
+ public static final int NOT_FOUND = HttpStatus.NOT_FOUND.value();
+
+ public static final int STATUS_CONFLICT = HttpStatus.CONFLICT.value();
+
+ public static final int STATUS_SERVER_ERROR = 500;
+ /** If parameter is blank, replace restful parameter. */
+ public static final String EMPTY_STRING_FALG = "%22%22";
+ /** Usefull deta flag */
+ public static final String DETA_ENABLE_FLAG = "0";
+
+ /** token */
+ public static final String GUEST_ID = "appMarketGuestAuthorizationUser";
+ public static final String ADMID_ID = "super_user";
+
+ public static final String TOKEN_AUTHORIZATION = "authorization_token";
+ public static final String TOKEN_AUTHORIZATION_REFRESH = "authorization_refreshtoken";
+ public static final String TOKEN_AUTHORIZATION_RESOURCE = "authorization_servlet_path";
+ public static final String AUTHORIZATION_CLIENT = "authorization_client";
+ public static final String AUTHORIZATION_CLIENT_VALUE_TOOL = "tool";
+
+ public static final String PAGINATION_COUNTER = "pagination_counter";
+ public static final String PAGINATION_DATA = "pagination_data";
+
+ public static final String USER_SESSION_KEY = "USER_SESSION_KEY";
+ public static final String I18N_JA_JP = "ja.JP";
+
+ /** uploading */
+ public static final int BUFFER_SIZE = 1024;
+ public static final String FILE_TYPE = ".wgt";
+ public static final long IMAGE_SIZE = 1024*500;
+ public static final String IMAGE_TYPE = "image";
+ public static final int IMAGE_INT = 0;
+ public static final String IMAGE_SVG = ".svg";
+ public static final String IMAGE_PNG = ".PNG";
+
+ /** distinct modify or create app*/
+ public static final int APP_CREATE_DETAIL = 0;
+ public static final int APP_MODIFY = 1;
+ public static final int APP_DETAIL_MODIFY = 2;
+
+ //database delete flad
+ public static final String DATA_INVALID = "1";
+ public static final String DATA_VALID = "0";
+
+ public static final String TOKEN_SEPARATOR = ":";
+
+ public static final String PROPERTIES_FILE_NAME_PROPERTIES = "config/properties.properties";
+
+ /**
+ * webservice Utils
+ */
+ public static final String PROPERTIES_FILE_NAME_REDIS = "redis.properties";
+ public static final String PROPERTIES_FILE_NAME_FILE = "fileManager.properties";
+ public static final String PROPERTIES_FILE_NAME_DEFAULT = "properties.properties";
+
+ public static final String UPLOAD_PATH_DEFAULT="/var/lib/tomcat8/appFile/appMarket/appFile/";
+ public static final String UPLOAD_PATH_TYPE_DEFAULT="appType/";
+ public static final String UPLOAD_PATH_APP_DEFAULT="appId/";
+
+ public static final String PATH_SEPARATOR="/";
+
+ public static final String FILE_SEPARATOR = "_";
+
+ public static final String FILE_DOT = ".";
+
+ //public static final String SERVER_PATH = "http://localhost:8080/resource";
+ public static final String UPLOAD_APP_FILE_PATH = "/appFile";
+ public static final String UPLOAD_APP_RES_PATH_ICON = "/appIcon";
+ public static final String UPLOAD_APP_UNCOMPRESS_PATH = "/uncompress";
+
+ public static final String UPLOAD_APP_UNCOMPRESS_FILE_CONFIG = "/config.xml";
+
+
+ /**
+ * wgt/config.xml
+ */
+ public static final String CONFIG_APP_PARAM_ID = "id";
+ public static final String CONFIG_APP_PARAM_VERSION = "version";
+ public static final String CONFIG_APP_PARAM_NAME = "name";
+ public static final String CONFIG_APP_PARAM_ICON = "icon";
+ public static final String CONFIG_APP_PARAM_SRC = "src";
+ public static final String CONFIG_APP_PARAM_DESCRIPTION = "description";
+
+ /***
+ * local app list
+ */
+ public static final String APP_ID_SEPARATOR = "@";
+ public static final String APP_ID_LAUNCHER = "launcher@0.1";
+ public static final String APP_ID_HOMESCREEN = "homescreen@0.1";
+ public static final String APP_ID_WAREHOUSE = "warehouse@1.0";
+
+ /**
+ * download app
+ */
+ public static final String APP_HEADER_KEY = "Content-Disposition";
+ public static final String APP_HEADER_VALUE = "attachment;filename=";
+
+ /**
+ * session
+ */
+ public static final String SESSION_TOKEN = "session_token";
+ public static final String SESSION_REFRESH_TOKEN = "session_refresh_token";
+ public static final String SESSION_PORT = "session_port";
+ public static final String SESSION_SYSTEM_TOKEN = "session_system_token";
+ public static final String SESSION_INSTALL_PATH = "session_install_path";
+
+ /**
+ * access url parameter/
+ */
+ public static final String ACCESS_PORT = "port";
+ public static final String ACCESS_SYSTEM_TOKEN = "systemToken";
+ public static final String ACCESS_INSTALL_PATH = "installPath";
+}
diff --git a/appmarket-utils/src/main/java/app/market/utils/constants/ProjectUserRoleEnum.java b/appmarket-utils/src/main/java/app/market/utils/constants/ProjectUserRoleEnum.java
new file mode 100644
index 0000000..fc3cb3f
--- /dev/null
+++ b/appmarket-utils/src/main/java/app/market/utils/constants/ProjectUserRoleEnum.java
@@ -0,0 +1,71 @@
+/*
+ * 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.constants;
+
+import org.apache.commons.lang3.StringUtils;
+
+/**
+ * User define in project
+ *
+ * @author Toyota
+ */
+public enum ProjectUserRoleEnum {
+
+ MANAGER("pm", "0"), LEADER("leader", "1"), MEMBER("member", "2"), ALL("all", "99");
+
+ private String name;
+ private String value;
+
+ private ProjectUserRoleEnum(String name, String value) {
+ this.name = name;
+ this.value = value;
+ }
+
+ public static String getName(String value) {
+ for (ProjectUserRoleEnum c : ProjectUserRoleEnum.values()) {
+ if ( StringUtils.equalsIgnoreCase( c.getValue(), value ) ) {
+ return c.name;
+ }
+ }
+ return null;
+ }
+
+ public static String getValue(String name) {
+ for (ProjectUserRoleEnum c : ProjectUserRoleEnum.values()) {
+ if ( StringUtils.equalsIgnoreCase( c.getName(), name ) ) {
+ return c.value;
+ }
+ }
+ return null;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+}
diff --git a/appmarket-utils/src/main/java/app/market/utils/datatable/DataTableMap.java b/appmarket-utils/src/main/java/app/market/utils/datatable/DataTableMap.java
new file mode 100644
index 0000000..d6de5d2
--- /dev/null
+++ b/appmarket-utils/src/main/java/app/market/utils/datatable/DataTableMap.java
@@ -0,0 +1,99 @@
+/*
+ * 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.datatable;
+
+import java.io.Serializable;
+import java.util.LinkedHashMap;
+import java.util.List;
+
+/**
+ * datatable data struction
+ *
+ * @author Toyota
+ */
+public class DataTableMap implements Serializable {
+
+ private static final long serialVersionUID = 4334941724837603916L;
+
+ private LinkedHashMap<String, Object> map;
+
+ public DataTableMap() {
+ map = new LinkedHashMap<String, Object>();
+ }
+
+ /**
+ * Init data table
+ *
+ * @param draw
+ * @param list
+ */
+ public DataTableMap(String draw, List<?> list) {
+ map = new LinkedHashMap<String, Object>();
+ map.put( "draw", draw );
+ map.put( "recordsTotal", 0 );
+ map.put( "recordsFiltered", 0 );
+ map.put( "data", list );
+ }
+
+ /**
+ * Set page count
+ *
+ * @param total
+ */
+ public void setTotal(int total) {
+ map.put( "recordsTotal", total );
+ map.put( "recordsFiltered", total );
+ }
+
+ /**
+ * Add data
+ *
+ * @param list
+ */
+ @SuppressWarnings("unchecked")
+ public void addData(List<?> list) {
+ ( (List<Object>) map.get( "data" ) ).addAll( list );
+ }
+
+ /**
+ * Reset data
+ *
+ * @param list
+ */
+ public void resetData(List<?> list) {
+ map.put( "data", list );
+ }
+
+ /**
+ * Set error message
+ *
+ * @param errorCode
+ * @param errorText
+ */
+ public void setErrorMsg(int errorCode, String errorText) {
+ map.put( "statusCode", errorCode );
+ map.put( "statusText", errorText );
+ }
+
+ /**
+ * get data map
+ *
+ * @return
+ */
+ public LinkedHashMap<String, Object> getMapData() {
+ return this.map;
+ }
+}
diff --git a/appmarket-utils/src/main/java/app/market/utils/datetime/DateTimeUtils.java b/appmarket-utils/src/main/java/app/market/utils/datetime/DateTimeUtils.java
new file mode 100644
index 0000000..f7971e3
--- /dev/null
+++ b/appmarket-utils/src/main/java/app/market/utils/datetime/DateTimeUtils.java
@@ -0,0 +1,78 @@
+/*
+ * 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.datetime;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+/**
+ * date
+ *
+ * @author Toyota
+ * @date 2017/10/10
+ */
+public class DateTimeUtils {
+
+ /** yyyy */
+ public static final String DATE_FORMAT_YYYY = "yyyy";
+ /** yyyy/MM/dd */
+ public static final String DATE_FORMAT_YYYYMMDD = "yyyy/MM/dd";
+ /** yyyy/MM/dd hh:mm:ss */
+ public static final String DATE_FORMAT_YYYYMMDDHHMMSS_SLASH = "yyyy/MM/dd hh:mm:ss";
+ /** yyyy-MM-dd hh:mm:ss */
+ public static final String DATE_FORMAT_YYYYMMDDHHMMSS_DASH = "yyyy-MM-dd hh:mm:ss";
+ /** yyyyMMddhhmmss */
+ public static final String DATE_FORMAT_YYYYMMDDHHMMSS = "yyyyMMddhhmmss";
+ /** yyyyMMddhhmmssSSS */
+ public static final String DATE_FORMAT_YYYYMMDDHHMMSSSSS = "yyyyMMddhhmmssSSS";
+
+ public static String getCurrectDate(String format) {
+ return new SimpleDateFormat( format ).format( new Date() );
+ }
+
+ public static String getDate(String format, Date date) {
+ return new SimpleDateFormat( format ).format( date );
+ }
+
+ public static Date getDate(String format, String date) {
+ try {
+ return new SimpleDateFormat( format ).parse( date );
+ } catch ( ParseException e ) {
+ throw new RuntimeException();
+ }
+ }
+
+ /**
+ * @param date
+ * @return
+ */
+ public static String betweenTime(String date){
+ String strDate=date.replace("/","");
+ int intDate = Integer.parseInt(strDate);
+ String end = String.valueOf(intDate+1);
+ StringBuilder sbOne = new StringBuilder(end);
+ String StrDateOne = sbOne.insert(4, "/").toString();
+ StringBuilder sbTwo = new StringBuilder(StrDateOne);
+ String StrDateTwo = sbTwo.insert(7, "/").toString();
+ return StrDateTwo;
+
+ }
+ public static void main(String[] args) {
+ String s = DateTimeUtils.getDate( DATE_FORMAT_YYYYMMDDHHMMSS, new Date() );
+ System.out.println( s );
+ }
+}
diff --git a/appmarket-utils/src/main/java/app/market/utils/exception/ExceptionEnum.java b/appmarket-utils/src/main/java/app/market/utils/exception/ExceptionEnum.java
new file mode 100644
index 0000000..0440cbc
--- /dev/null
+++ b/appmarket-utils/src/main/java/app/market/utils/exception/ExceptionEnum.java
@@ -0,0 +1,32 @@
+/*
+ * 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.exception;
+
+public enum ExceptionEnum {
+
+ EMPTY_DATA {
+ @Override
+ public String toString() {
+ return "exception_empty_data";
+ }
+ },
+ MULTIPLE_DATA {
+ @Override
+ public String toString() {
+ return "exception_multiple_data";
+ }
+ }
+}
diff --git a/appmarket-utils/src/main/java/app/market/utils/json/JsonMapperUtils.java b/appmarket-utils/src/main/java/app/market/utils/json/JsonMapperUtils.java
new file mode 100644
index 0000000..7d0664a
--- /dev/null
+++ b/appmarket-utils/src/main/java/app/market/utils/json/JsonMapperUtils.java
@@ -0,0 +1,228 @@
+/*
+ * 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.json;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.commons.lang3.StringUtils;
+import org.codehaus.jackson.JsonGenerationException;
+import org.codehaus.jackson.JsonNode;
+import org.codehaus.jackson.JsonParseException;
+import org.codehaus.jackson.JsonProcessingException;
+import org.codehaus.jackson.map.JsonMappingException;
+import org.codehaus.jackson.map.ObjectMapper;
+import org.codehaus.jackson.type.JavaType;
+import org.codehaus.jackson.type.TypeReference;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+
+import app.market.utils.constants.Constants;
+
+/**
+ * JSON Tool
+ *
+ * @author Toyota
+ */
+public class JsonMapperUtils {
+ private static Logger logger = LoggerFactory.getLogger( JsonMapperUtils.class );
+
+ private static ObjectMapper mapper = new ObjectMapper();
+
+ public JsonMapperUtils() {
+ super();
+ }
+
+ public static ObjectMapper getInstance() {
+ return mapper;
+ }
+
+ /**
+ * write object value
+ *
+ * @param object
+ * @return
+ */
+ public static String writeValueAsString(Object object) {
+ String json = null;
+ try {
+ json = mapper.writeValueAsString( object );
+ } catch ( JsonGenerationException e ) {
+ logger.info( e.getMessage() );
+ e.printStackTrace();
+ } catch ( JsonMappingException e ) {
+ logger.info( e.getMessage() );
+ e.printStackTrace();
+ } catch ( IOException e ) {
+ logger.info( e.getMessage() );
+ e.printStackTrace();
+ }
+ return json;
+ }
+
+ /**
+ * read object value
+ *
+ * @see #constructParametricType(Class, Class...)
+ */
+ @SuppressWarnings("unchecked")
+ public static <T> T readValue(String jsonString, Class<T> clazz) {
+ if ( StringUtils.isEmpty( jsonString ) ) {
+ return null;
+ }
+ Object obj = null;
+ try {
+ obj = mapper.readValue( jsonString, clazz );
+ } catch ( JsonParseException e ) {
+ logger.info( e.getMessage() );
+ e.printStackTrace();
+ } catch ( JsonMappingException e ) {
+ logger.info( e.getMessage() );
+ e.printStackTrace();
+ } catch ( IOException e ) {
+ logger.info( e.getMessage() );
+ e.printStackTrace();
+ }
+ return (T) obj;
+ }
+
+ /**
+ * read object value
+ *
+ * @see #constructParametricType(Class, Class...)
+ */
+ @SuppressWarnings("unchecked")
+ public static <T> T readValue(String jsonString, JavaType javaType) {
+ if ( StringUtils.isEmpty( jsonString ) ) {
+ return null;
+ }
+ Object obj = null;
+ try {
+ obj = mapper.readValue( jsonString, javaType );
+ } catch ( JsonParseException e ) {
+ logger.info( e.getMessage() );
+ e.printStackTrace();
+ } catch ( JsonMappingException e ) {
+ logger.info( e.getMessage() );
+ e.printStackTrace();
+ } catch ( IOException e ) {
+ logger.info( e.getMessage() );
+ e.printStackTrace();
+ }
+ return (T) obj;
+ }
+
+ /**
+ * read object value
+ *
+ * @see #constructParametricType(Class, Class...)
+ */
+ @SuppressWarnings("unchecked")
+ public static <T> T readValue(String jsonString, TypeReference<T> typeReference) {
+ if ( StringUtils.isEmpty( jsonString ) ) {
+ return null;
+ }
+ Object obj = null;
+ try {
+ obj = mapper.readValue( jsonString, typeReference );
+ } catch ( JsonParseException e ) {
+ logger.info( e.getMessage() );
+ e.printStackTrace();
+ } catch ( JsonMappingException e ) {
+ logger.info( e.getMessage() );
+ e.printStackTrace();
+ } catch ( IOException e ) {
+ logger.info( e.getMessage() );
+ e.printStackTrace();
+ }
+ return (T) obj;
+ }
+
+ /**
+ * String to tree
+ *
+ * @param content
+ * @return
+ * @throws JsonProcessingException
+ * @throws IOException
+ */
+ public static JsonNode readTree(String content) throws JsonProcessingException, IOException {
+ return mapper.readTree( content );
+ }
+
+ /**
+ * Get JSON information
+ *
+ * @param type
+ * @param forward
+ * @param msg
+ * @return
+ */
+ public static String getJsonString(Object type, String forward, Object msg) {
+ Map<String, Object> map = new LinkedHashMap<String, Object>();
+ map.put( "result", type );
+ map.put( "forward", forward );
+ if ( msg != null ) {
+ map.put( "message", msg );
+ } else {
+ }
+ String jsonStr = JsonMapperUtils.writeValueAsString( map );
+ logger.info( jsonStr );
+ return jsonStr;
+ }
+
+ public static boolean getResult(String jsonStr) {
+ boolean ret = false;
+ Map<String, Object> map = JsonMapperUtils.readValue(jsonStr, Map.class);
+ if ((int) map.get("result") == Constants.STATUS_SUCCESS) {
+ ret = true;
+ }
+ return ret;
+ }
+
+ public static Object getMessage(String jsonStr) {
+ Map<String, Object> map = JsonMapperUtils.readValue(jsonStr, Map.class);
+ return (Object)map.get("message");
+ }
+
+ /**
+ * get json boject
+ * @param jsonStr
+ * @return
+ */
+ public static JSONObject getJsonObject(String jsonStr)
+ {
+ JSONObject jsonObject = JSONObject.parseObject(jsonStr);
+ return jsonObject;
+ }
+
+ public static List getJsonList(String jsonstring, Class cls) {
+ List list = new ArrayList();
+ try {
+ list = JSON.parseArray(jsonstring, cls);
+ } catch (Exception e) {
+ // TODO: handle exception
+ }
+ return list;
+ }
+
+} \ No newline at end of file
diff --git a/appmarket-utils/src/main/java/app/market/utils/json/JsonMessage.java b/appmarket-utils/src/main/java/app/market/utils/json/JsonMessage.java
new file mode 100644
index 0000000..83e7dc1
--- /dev/null
+++ b/appmarket-utils/src/main/java/app/market/utils/json/JsonMessage.java
@@ -0,0 +1,49 @@
+/*
+ * 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.json;
+
+public class JsonMessage {
+
+ private String name;
+ private Object value;
+
+ public JsonMessage() {
+ super();
+ }
+
+ public JsonMessage(String name, Object value) {
+ super();
+ this.name = name;
+ this.value = value;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Object getValue() {
+ return value;
+ }
+
+ public void setValue(Object value) {
+ this.value = value;
+ }
+
+}
diff --git a/appmarket-utils/src/main/java/app/market/utils/json/JsonResult.java b/appmarket-utils/src/main/java/app/market/utils/json/JsonResult.java
new file mode 100644
index 0000000..9aba3fa
--- /dev/null
+++ b/appmarket-utils/src/main/java/app/market/utils/json/JsonResult.java
@@ -0,0 +1,60 @@
+/*
+ * 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.json;
+
+import java.io.Serializable;
+
+import app.market.utils.constants.Constants;
+import app.market.utils.datetime.DateTimeUtils;
+
+public class JsonResult implements Serializable {
+
+ private static final long serialVersionUID = -6156654045350234343L;
+
+ private int status;
+ private String timestamp;
+ private Object data;
+
+ public JsonResult() {
+ this.status = Constants.STATUS_SUCCESS;
+ this.timestamp = DateTimeUtils.getCurrectDate( DateTimeUtils.DATE_FORMAT_YYYYMMDDHHMMSS );
+ }
+
+ public int getStatus() {
+ return status;
+ }
+
+ public void setStatus(int status) {
+ this.status = status;
+ }
+
+ public String getTimestamp() {
+ return timestamp;
+ }
+
+ public void setTimestamp(String timestamp) {
+ this.timestamp = timestamp;
+ }
+
+ public Object getData() {
+ return data;
+ }
+
+ public void setData(Object data) {
+ this.data = data;
+ }
+
+}
diff --git a/appmarket-utils/src/main/java/app/market/utils/property/KeysConstants.java b/appmarket-utils/src/main/java/app/market/utils/property/KeysConstants.java
new file mode 100644
index 0000000..c739762
--- /dev/null
+++ b/appmarket-utils/src/main/java/app/market/utils/property/KeysConstants.java
@@ -0,0 +1,110 @@
+/*
+ * 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.property;
+
+public class KeysConstants {
+ public static final String PROJECT_ERROR = "project_error";
+ public static final String STATUS_UNAUTHORIZED = "status_unauthorized";
+ public static final String STATUS_TOO_MANY_CONNECTIONS = "status_too_many_connections";
+ public static final String STATUS_FORBIDDEN = "status_forbidden";
+ public static final String STATUS_BAD_REQUEST = "bad_request";
+ public static final String INVALID_QUERYPARAM = "invalid_query_param";
+ public static final String INVALID_BODY = "invalid_body";
+ public static final String ALREADY_EXIST = "already_exist";
+ public static final String USER_NOT_DELETE = "user_not_delete";
+ public static final String EXPIRED_REFRESH_TOKEN = "expired_refresh_token";
+ /** ▼▼▼▼▼▼▼▼▼▼ ErrorCode Message ▼▼▼▼▼▼▼▼▼▼ */
+ public static final String MISSING_NECESSARY_QUERYPARAM = "missing_necessary_queryparam";
+ public static final String THE_PICTURE_SIZES = "the_picture_sizes_should_not_exceed_500KB";
+ public static final String UPLOAD_PICTURES_ONLY = "you_can_upload_pictures_only";
+ public static final String INVALID_OPERATION = "invalid_operation";
+ public static final String RESOURCE_ALREADY_EXISTS = "resource_already_exists";
+ public static final String RESOURCE_APP_ALREADY_EXISTS = "resource_app_already_exists";
+ public static final String DEVELOPER_IS_NOT_EXIST = "developer_is_not_exist";
+ public static final String TYPENAME_ALREADY_EXISTS = "typename_already_exists";
+ /** ▲▲▲▲▲▲▲▲▲▲ ErrorCode Message ▲▲▲▲▲▲▲▲▲▲ */
+
+ /** ▼▼▼▼▼▼▼▼▼▼ login ▼▼▼▼▼▼▼▼▼▼ */
+ public static final String LOGIN_LOGINID_IS_NOT_EXIST = "login_loginId_is_not_exist";
+ public static final String LOGIN_LOGINID_IS_NOT_EMPTY = "login_loginId_is_not_empty";
+ public static final String LOGIN_PASSWORD_IS_NOT_EMPTY = "login_password_is_not_empty";
+ /** ▲▲▲▲▲▲▲▲▲▲ login ▲▲▲▲▲▲▲▲▲▲ */
+
+ /** ▼▼▼▼▼▼▼▼▼▼ user ▼▼▼▼▼▼▼▼▼▼ */
+ public static final String USER_PASSWORD_IS_NOT_EMPTY = "user_password_is_not_empty";
+ public static final String USER_PASSWORD_IS_NOT_SPACES = "no_spaces_can_be_found_in_the_password";
+ public static final String USER_REPASSWORD_IS_NOT_EMPTY = "user_repassword_is_not_empty";
+ public static final String USER_USERNAME_IS_NOT_EMPTY = "user_username_is_not_empty";
+ public static final String USER_USERNAME_MAX_ERROR = "user_username_max_error";
+ public static final String USER_PASSWORD_MAX_ERROR = "user_password_max_error";
+ public static final String USER_REPASSWORD_MAX_ERROR = "user_repassword_max_error";
+ public static final String USER_MAILADDRESS_MAX_ERROR = "user_mailaddress_max_error";
+ public static final String USER_USERNAME_IS_NOT_REPEATED = "user_username_is_not_repeated";
+ public static final String USER_MAILADDRESS_IS_NOT_EMPTY = "user_mailaddress_is_not_empty";
+ public static final String USER_USERID_IS_NOT_EMPTY = "user_userid_is_not_empty";
+ public static final String USER_OLD_PASSWORD_IS_NOT_EMPTY = "user_old_password_is_not_empty";
+ public static final String USER_NEW_PASSWORD_IS_NOT_EMPTY = "user_new_password_is_not_empty";
+ public static final String USER_NEW_REPASSWORD_IS_NOT_EMPTY = "user_new_repassword_is_not_empty";
+ public static final String USER_NEW_REPASSWORD_IS_NOT_EQUALS = "user_new_repassword_is_not_equals";
+ public static final String USER_SAVE_IS_FAILED = "user_save_is_failed";
+ public static final String USER_SAVE_IS_SUCCESS = "user_save_is_success";
+ public static final String USER_SAVE_IS_EXIST = "user_is_exist";
+ public static final String USER_LOGINID_IS_FAILED = "user_loginid_is_failed";
+ public static final String USER_INFO_CHANGE_SUCCESS = "user_info_change_success";
+ public static final String USER_IS_SUCCESS = "user_is_success";
+ public static final String USER_TITLE_NAME_INSERT = "user_title_name_insert";
+ public static final String USER_TITLE_NAME_MODIFY = "user_title_name_modify";
+ public static final String USER_NAME_IS_NOT_EMPTY = "user_name_is_not_empty";
+ public static final String USER_GET_LIST_IS_FAILED = "user_get_list_is_failed";
+ public static final String USER_DELETE_FAILED = "user_delete_failed";
+ public static final String USER_MAILADDRESS_IS_NOT_EQUALS = "user_mailaddress_is_not_equals";
+ public static final String USER_REPASSWORD_ERROR = "user_repassword_error";
+ public static final String USER_PASSWORD_ERROR = "user_password_error";
+ /** ▲▲▲▲▲▲▲▲▲▲ user ▲▲▲▲▲▲▲▲▲▲ */
+
+ /** ▼▼▼▼▼▼▼▼▼▼ app ▼▼▼▼▼▼▼▼▼▼ */
+ public static final String APP_APPNAME_IS_NOT_EMPTY = "app_appname_is_not_empty";
+ public static final String APP_DEVICETYPE_IS_NOT_EMPTY = "app_DeviceType_is_not_empty";
+ public static final String APP_VERSIONNAME_IS_NOT_EMPTY = "app_versionname_is_not_empty";
+ public static final String APP_TYPEID_IS_NOT_EMPTY = "app_typeid_is_not_empty";
+ public static final String APP_FILEPATH_IS_NOT_EMPTY = "app_filepath_is_not_empty";
+ public static final String APP_ABSTRACT_IS_NOT_EMPTY = "app_abstract_is_not_empty";
+ public static final String APP_IMAGRPATH_IS_NOT_EMPTY = "app_imagepath_is_not_empty";
+ public static final String APP_SAVE_IS_FAILED = "app_save_is_failed";
+ public static final String APP_SAVE_IS_SUCCESS = "app_save_is_success";
+ public static final String APP_UPLOAD_PARAM_FILE_IS_NULL = "app_upload_param_file_is_null";
+ public static final String APP_UPLOAD_MD5 = "md5_failed";
+ public static final String APP_TITLE_NAME_MODIFY = "app_title_name_modify";
+ public static final String APP_TITLE_NAME_INSERT = "app_title_name_insert";
+ public static final String APP_APPNAME_MAX_ERROR = "app_appname_max_error";
+ public static final String APP_FILEPATH_MAX_ERROR = "app_filepath_max_error";
+ public static final String APP_VERSIONNAME_MAX_ERROR = "app_versionname_max_error";
+ public static final String APP_ABSTRACT_MAX_ERROR = "app_abstract_max_error";
+ public static final String APP_FILE_TYPE_IS_UNSUPPORTED = "app_file_type_is_unsupported";
+ public static final String APP_FILE_READ_FAILED = "app_file_read_failed";
+ public static final String APP_FILE_UNCOMPRESS_FAILED = "app_file_uncompress_failed";
+ /** ▲▲▲▲▲▲▲▲▲▲ app ▲▲▲▲▲▲▲▲▲▲ */
+
+ /** ▼▼▼▼▼▼▼▼▼▼ authority ▼▼▼▼▼▼▼▼▼▼ */
+ public static final String AUTHORITY_ID_IS_NOT_EMPTY = "authority_id_is_not_empty";
+ /** ▼▼▼▼▼▼▼▼▼▼ authority ▼▼▼▼▼▼▼▼▼▼ */
+
+ /** ▼▼▼▼▼▼▼▼▼▼ system ▼▼▼▼▼▼▼▼▼▼ */
+ public static final String SYS_ERROR_SAVE_SUCCESS = "sys_error_save_success";
+ /** ▼▼▼▼▼▼▼▼▼▼ system ▼▼▼▼▼▼▼▼▼▼ */
+
+
+}
diff --git a/appmarket-utils/src/main/java/app/market/utils/property/MessageUtil.java b/appmarket-utils/src/main/java/app/market/utils/property/MessageUtil.java
new file mode 100644
index 0000000..e3bdfc2
--- /dev/null
+++ b/appmarket-utils/src/main/java/app/market/utils/property/MessageUtil.java
@@ -0,0 +1,55 @@
+/*
+ * 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.property;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.util.Properties;
+
+import app.market.utils.constants.Constants;
+
+public class MessageUtil {
+
+ public static Properties prop = null;
+ public static String i18n = Constants.I18N_JA_JP;
+
+ private static Properties getPropertyInstance() {
+ if ( prop == null ) {
+ prop = new Properties();
+ try {
+ prop.load( new InputStreamReader( MessageUtil.class.getClassLoader().getResourceAsStream( "message." + i18n + ".properties" ), "UTF-8" ) );
+ } catch ( FileNotFoundException e ) {
+ throw new RuntimeException();
+ } catch ( IOException e ) {
+ throw new RuntimeException();
+ }
+ }
+ return MessageUtil.prop;
+ }
+
+ /**
+ * Get propertites
+ *
+ * @param type
+ * @return String
+ */
+ public static String getPropertites(String type) {
+ prop = getPropertyInstance();
+ return prop.getProperty( type );
+ }
+
+}
diff --git a/appmarket-utils/src/main/java/app/market/utils/property/Option.java b/appmarket-utils/src/main/java/app/market/utils/property/Option.java
new file mode 100644
index 0000000..eb8413e
--- /dev/null
+++ b/appmarket-utils/src/main/java/app/market/utils/property/Option.java
@@ -0,0 +1,78 @@
+/*
+ * 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.property;
+
+import java.io.Serializable;
+
+/**
+ * Page select's option
+ *
+ * @author Toyota
+ */
+public class Option implements Serializable, Comparable<Option> {
+
+ private static final long serialVersionUID = 3717357659129461807L;
+
+ private String label;
+ private String value;
+
+ public Option() {
+ }
+
+ public Option(String label, String value) {
+ this.label = label;
+ this.value = value;
+ }
+
+ /**
+ * @return the label
+ */
+ public String getLabel() {
+ return label == null ? "" : label;
+ }
+
+ /**
+ * @param label
+ * the label to set
+ */
+ public void setLabel(String label) {
+ this.label = label;
+ }
+
+ /**
+ * @return the value
+ */
+ public String getValue() {
+ return value;
+ }
+
+ /**
+ * @param value
+ * the value to set
+ */
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ @Override
+ public int compareTo(Option o) {
+ int b = Integer.valueOf( o.getValue() );
+ int n = ( this.getValue() == null || "".equals( this.getValue().trim() ) ) ? 0
+ : Integer.valueOf( this.getValue() );
+ return b > n ? -1 : 1;
+ }
+
+}
diff --git a/appmarket-utils/src/main/java/app/market/utils/property/PropertyContants.java b/appmarket-utils/src/main/java/app/market/utils/property/PropertyContants.java
new file mode 100644
index 0000000..920e5f5
--- /dev/null
+++ b/appmarket-utils/src/main/java/app/market/utils/property/PropertyContants.java
@@ -0,0 +1,22 @@
+/*
+ * 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.property;
+
+public class PropertyContants {
+
+ public static final String WEBAPP_REDIRECT_URI = "webapp_redirect_uri";
+
+}
diff --git a/appmarket-utils/src/main/java/app/market/utils/property/PropertyUtil.java b/appmarket-utils/src/main/java/app/market/utils/property/PropertyUtil.java
new file mode 100644
index 0000000..0be4d44
--- /dev/null
+++ b/appmarket-utils/src/main/java/app/market/utils/property/PropertyUtil.java
@@ -0,0 +1,127 @@
+/*
+ * 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.property;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.Properties;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+public class PropertyUtil {
+
+ public static final String DEFAULLABEL = "please choose";
+
+ private static final String ESCAPE_COLON = "&col&";
+
+ public static Properties prop;
+
+ private static Properties getPropertyInstance() {
+ if ( prop == null ) {
+ prop = new Properties();
+ try {
+ prop.load( new InputStreamReader(
+ PropertyUtil.class.getClassLoader().getResourceAsStream( "property.properties" ), "UTF-8" ) );
+ } catch ( FileNotFoundException e ) {
+ throw new RuntimeException();
+ } catch ( IOException e ) {
+ throw new RuntimeException();
+ }
+ }
+ return PropertyUtil.prop;
+ }
+
+ /**
+ * Get propertites
+ *
+ * @param type
+ * @return String
+ */
+ public static String getPropertites(String type) {
+ prop = getPropertyInstance();
+ return prop.getProperty( type );
+ }
+
+ /**
+ * Get dropdown list
+ *
+ * @param type
+ * @param hasSpace
+ * @return List<Option>
+ */
+ public static List<Option> getPropertites(String type, boolean hasSpace) {
+ prop = getPropertyInstance();
+ Pattern pattern = Pattern.compile( type + "[0-9]" );
+ Matcher matcher = null;
+
+ final List<Option> selectList = new ArrayList<Option>();
+ Option option = null;
+ if ( hasSpace ) {
+ option = new Option( DEFAULLABEL, "" );
+ selectList.add( option );
+ }
+ Enumeration<?> keys = prop.keys();
+ while ( keys.hasMoreElements() ) {
+ String key = (String) keys.nextElement();
+ matcher = pattern.matcher( key );
+ if ( matcher.matches() ) {
+ String value = prop.getProperty( key );
+ String[] split = value.split( ":" );
+ String escapeLabel = split[1].trim();
+ if ( -1 != escapeLabel.lastIndexOf( ESCAPE_COLON ) ) {
+ escapeLabel = escapeLabel.replace( ESCAPE_COLON, ":" );
+ }
+ option = new Option( escapeLabel, split[0] );
+ selectList.add( option );
+ }
+ }
+ return selectList;
+ }
+
+ /**
+ * Get label
+ *
+ * @param type
+ * @param value
+ * @return
+ */
+ public static String getPropertites(String type, String value) {
+ prop = getPropertyInstance();
+ Pattern pattern = Pattern.compile( type + "[0-9]" );
+ Matcher matcher = null;
+
+ String str = "";
+ Enumeration<?> keys = prop.keys();
+ while ( keys.hasMoreElements() ) {
+ String key = (String) keys.nextElement();
+ matcher = pattern.matcher( key );
+ if ( matcher.matches() ) {
+ String sValue = prop.getProperty( key );
+ String[] split = sValue.split( ":" );
+ if ( value.equals( split[0] ) ) {
+ str = split[1];
+ break;
+ }
+ }
+ }
+ return str;
+ }
+
+}
diff --git a/appmarket-utils/src/main/java/app/market/utils/rest/RestTemplateUtil.java b/appmarket-utils/src/main/java/app/market/utils/rest/RestTemplateUtil.java
new file mode 100644
index 0000000..4f97aa0
--- /dev/null
+++ b/appmarket-utils/src/main/java/app/market/utils/rest/RestTemplateUtil.java
@@ -0,0 +1,209 @@
+/*
+ * 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.rest;
+
+import java.util.Map;
+
+import javax.servlet.ServletRequest;
+import javax.servlet.http.HttpSession;
+
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.util.MultiValueMap;
+import org.springframework.web.client.HttpClientErrorException;
+import org.springframework.web.client.RestTemplate;
+
+import app.market.utils.SpringWebUtil;
+import app.market.utils.constants.Constants;
+import app.market.utils.json.JsonResult;
+import app.market.utils.property.KeysConstants;
+import app.market.utils.property.MessageUtil;
+import app.market.utils.webservice.ApiParam;
+
+public class RestTemplateUtil {
+
+ private RestTemplate restTemplate;
+
+ public RestTemplateUtil() {
+ this.restTemplate = new RestTemplate();
+ }
+
+ /**
+ *
+ * @param url
+ * @param model
+ * @return
+ * @throws Exception
+ */
+ public String post(String url, Object model, HttpSession session) throws Exception {
+ HttpHeaders requestHeaders = new HttpHeaders();
+ Class<?> clx = model.getClass();
+ //String token = SpringWebUtil.getRequest().getParameter( "token" );
+ String token = (String) session.getAttribute(Constants.SESSION_TOKEN);
+ String servletPath = SpringWebUtil.getRequest().getServletPath();
+ if ( StringUtils.isEmpty( token ) || StringUtils.isEmpty( servletPath ) )
+ throw new HttpClientErrorException( HttpStatus.UNAUTHORIZED,
+ MessageUtil.getPropertites( KeysConstants.STATUS_UNAUTHORIZED ) );
+ requestHeaders.add( Constants.TOKEN_AUTHORIZATION, token );
+ //requestHeaders.add( Constants.TOKEN_AUTHORIZATION_RESOURCE, servletPath );
+
+ HttpEntity<Object> requestEntity = new HttpEntity<Object>( clx.getClass().forName( clx.getName() ).cast( model ), requestHeaders );
+ String result = restTemplate.postForObject( url, requestEntity, String.class );
+ return result;
+ }
+
+
+
+ /**
+ * Restful GET
+ * @param url
+ * @param params
+ * @return
+ * @throws Exception
+ */
+ public String get(String url,HttpSession session, String... params) throws Exception {
+ HttpEntity<Object> requestEntity = getRequestEntity(null, session);
+
+ ResponseEntity<String> result = restTemplate.exchange( url, HttpMethod.GET, requestEntity, String.class, params );
+ return result.getBody();
+ }
+
+ /**
+ * getQueryParam
+ * @param url
+ * @param queryParams
+ * @return
+ * @throws Exception
+ */
+ public String getByQueryParam(String url, Map<String, Object> queryParams, HttpSession session) throws Exception {
+ HttpEntity<Object> requestEntity = getRequestEntity(null, session);
+ url = addParamURL(url, queryParams);
+ ResponseEntity<String> result = restTemplate.exchange(url, HttpMethod.GET, requestEntity, String.class, queryParams);
+ return result.getBody();
+ }
+
+ /**
+ * Restful GET (download)
+ * @param url
+ * @param param
+ * @return
+ * @throws Exception
+ */
+ public ResponseEntity<byte[]> download(String url, Map<String, Object> queryParams, HttpSession session) throws Exception {
+ HttpEntity<Object> requestEntity = getRequestEntity(null, session);
+
+ url = addParamURL(url, queryParams);
+
+ ResponseEntity<byte[]> exchange = restTemplate.exchange(url, HttpMethod.GET, requestEntity, byte[].class);
+ return exchange;
+ }
+
+ /**
+ * Restful Post
+ * @param restUserSelectloginuser
+ * @param postData
+ * @return
+ * @throws Exception
+ */
+ public ResponseEntity<String> Post(String restUserSelectloginuser, Object postData, HttpSession session) throws Exception {
+ ResponseEntity<String> rEntity = restTemplate.postForEntity( restUserSelectloginuser, postData, String.class);
+ return rEntity;
+ }
+
+ /**
+ * Restful POST(update)
+ * @param url
+ * @param param
+ * @param class1
+ * @return
+ * @throws ClassNotFoundException
+ */
+ public String post(String url, MultiValueMap<String, Object> queryParam, Class<String> classz, String[] pathParam, HttpSession session)
+ throws ClassNotFoundException {
+ HttpEntity<Object> requestEntity = getRequestEntity(queryParam, session);
+
+ String result = null;
+
+ if(pathParam == null){
+ result = restTemplate.postForObject( url, requestEntity, String.class);
+ }else{
+ result = restTemplate.postForObject( url, requestEntity, String.class, pathParam);
+ }
+
+ return result;
+ }
+
+ /**
+ * Restful DELETE
+ * @param url
+ * @param id
+ * @return
+ * @throws Exception
+ */
+ public String delete(String url, String id, HttpSession session) throws Exception {
+ String json = "";
+ HttpEntity<Object> requestEntity = getRequestEntity(id, session);
+ ResponseEntity<String> exchange = restTemplate.exchange(url, HttpMethod.DELETE, requestEntity, String.class, id);
+ json = exchange.getBody();
+ return json;
+ }
+
+/*===========================================================================================================================
+ * PRIVATE METHOD
+===========================================================================================================================*/
+
+ /**
+ * getRequestEntity
+ * @param body
+ * @param session
+ * @return
+ */
+ private HttpEntity<Object> getRequestEntity(Object body, HttpSession session)
+ {
+ HttpHeaders requestHeaders = new HttpHeaders();
+ //String token = SpringWebUtil.getRequest().getParameter(ApiParam.API_RESPONSE_TOKEN);
+ String token = (String) session.getAttribute(Constants.SESSION_TOKEN);
+ if(token == null) token = "";
+ String servletPath = SpringWebUtil.getRequest().getServletPath();
+ if (StringUtils.isEmpty(servletPath)) {
+ throw new HttpClientErrorException(HttpStatus.UNAUTHORIZED,
+ MessageUtil.getPropertites(KeysConstants.STATUS_UNAUTHORIZED));
+ }
+ requestHeaders.add(Constants.TOKEN_AUTHORIZATION, token);
+ //requestHeaders.add(Constants.TOKEN_AUTHORIZATION_RESOURCE, servletPath);
+
+ HttpEntity<Object> requestEntity = new HttpEntity<Object>( body, requestHeaders );
+ return requestEntity;
+ }
+
+ private String addParamURL(String url, Map<String, Object> queryParams ){
+ url += "?";
+ for (String key : queryParams.keySet()) {
+ if (!url.endsWith("?")) {
+ url += "&";
+ }
+ Object val = queryParams.get(key);
+ if(val != null){
+ url += key + "=" + val.toString();
+ }
+ }
+ return url;
+ }
+}
diff --git a/appmarket-utils/src/main/java/app/market/utils/token/DeleteModel.java b/appmarket-utils/src/main/java/app/market/utils/token/DeleteModel.java
new file mode 100644
index 0000000..23bd856
--- /dev/null
+++ b/appmarket-utils/src/main/java/app/market/utils/token/DeleteModel.java
@@ -0,0 +1,52 @@
+/*
+ * 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.token;
+
+import java.io.Serializable;
+
+public class DeleteModel implements Serializable {
+
+ private static final long serialVersionUID = -7060343784298377805L;
+
+ private String id;
+
+ private String token;
+
+ public DeleteModel() {
+ }
+
+ public DeleteModel(String id, String token) {
+ this.id = id;
+ this.token = token;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getToken() {
+ return token;
+ }
+
+ public void setToken(String token) {
+ this.token = token;
+ }
+
+}
diff --git a/appmarket-utils/src/main/java/app/market/utils/token/TokenModel.java b/appmarket-utils/src/main/java/app/market/utils/token/TokenModel.java
new file mode 100644
index 0000000..3c53d11
--- /dev/null
+++ b/appmarket-utils/src/main/java/app/market/utils/token/TokenModel.java
@@ -0,0 +1,100 @@
+/*
+ * 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.token;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+public class TokenModel implements Serializable {
+
+ private static final long serialVersionUID = 2544696323418911040L;
+
+ private String loginId;
+ private String token; //accessToken
+ private String refreshToken; //refreshToken
+ private String ipAddress;
+ private Object userEntity;
+ private List<Object> apiList = new ArrayList<>();
+ private List<Object> resourceList = new ArrayList<>();
+
+ public TokenModel() {
+
+ }
+
+ public TokenModel(String loginId, Object user, String token) {
+ this.loginId = loginId;
+ this.userEntity = user;
+ this.token = token;
+ }
+
+ public String getLoginId() {
+ return loginId;
+ }
+
+ public void setLoginId(String loginId) {
+ this.loginId = loginId;
+ }
+
+ public String getToken() {
+ return token;
+ }
+
+ public void setToken(String token) {
+ this.token = token;
+ }
+
+ public String getRefreshToken() {
+ return refreshToken;
+ }
+
+ public void setRefreshToken(String refreshToken) {
+ this.refreshToken = refreshToken;
+ }
+
+ public String getIpAddress() {
+ return ipAddress;
+ }
+
+ public void setIpAddress(String ipAddress) {
+ this.ipAddress = ipAddress;
+ }
+
+ public Object getUserEntity() {
+ return userEntity;
+ }
+
+ public void setUserEntity(Object userEntity) {
+ this.userEntity = userEntity;
+ }
+
+ public List<Object> getResourceList() {
+ return resourceList;
+ }
+
+ public void setResourceList(List<Object> resourceList) {
+ this.resourceList = resourceList;
+ }
+
+ public List<Object> getApiList() {
+ return apiList;
+ }
+
+ public void setApiList(List<Object> apiList) {
+ this.apiList = apiList;
+ }
+
+}
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 ▲▲▲▲▲▲▲▲▲▲ */
+}
diff --git a/appmarket-utils/src/main/resources/message.ja.JP.properties b/appmarket-utils/src/main/resources/message.ja.JP.properties
new file mode 100644
index 0000000..cdb7b8c
--- /dev/null
+++ b/appmarket-utils/src/main/resources/message.ja.JP.properties
@@ -0,0 +1,98 @@
+project_error=A server error has occurred. Please contact the administrator.
+status_unauthorized=Your session has timed out, please log in again.
+status_forbidden=Have no permission to read the records of this application.
+status_too_many_connections=The account has been registered.
+bad_request=Request parameter is wrong!
+md5_failed=Failed to check file on md5!
+app_upload_param_file_is_null = Upload file is required.
+invalid_query_param=Invalid query parameter!
+invalid_body=Invalid body
+already_exist = Data has already existed!
+user_not_delete = Users with data connections can not be deleted.
+expired_refresh_token=Refresh token has timed out.
+
+###################### login message ######################
+login_loginId_is_not_exist=Invalid User name or Password.
+login_loginId_is_not_empty=User name is required.
+login_password_is_not_empty=Password is required.
+###################### /login message ######################
+
+###################### user message ######################
+user_old_password_is_not_empty=Old password is required.
+user_new_password_is_not_empty=New password is required.
+user_password_is_not_empty = Password is required.
+no_spaces_can_be_found_in_the_password = Password can not contain space.
+user_username_is_not_empty=User name is required.
+user_username_is_not_repeated=User name has already existed.
+user_username_max_error=Maximum length of user name is 32 characters.
+user_password_max_error=Maximum length of password is 32 characters.
+user_repassword_max_error=Maximum length of password is 32 characters.
+user_mailaddress_max_error=Maximum length of mail address is 32 characters.
+user_repassword_is_not_empty = Confirm password is required.
+user_mailaddress_is_not_empty=Mail address is required.
+user_userid_is_not_empty=User id is required.
+user_save_is_failed=Save user failed.
+
+user_is_exist= User name has already been registered.
+user_delete_failed=Delete user failed.
+user_name_is_not_empty=Name is required.
+user_get_list_is_failed=Get user list failed.
+user_new_repassword_is_not_empty=Confirm password is required.
+user_new_repassword_is_not_equals=Password doesn't match.
+user_save_is_success = Update account successfully.
+user_repassword_error = Minimum length of password is 6 characters.
+user_password_error = Minimum length of confirm password is 6 characters.
+user_mailaddress_is_not_equals = Enter the email address in the format:mail@example.com.
+
+user_loginid_is_failed = Login Id is wrong.
+user_info_change_success= Change the information successfully.
+user_title_name_insert=User/Create
+user_title_name_modify=User/Detail
+###################### /user message ######################
+
+###################### /app message ######################
+app_title_name_insert=App/Create
+app_title_name_modify=App/Detail
+app_save_is_failed=Update App failed.
+app_appname_is_not_empty=App name is required.
+app_DeviceType_is_not_empty=App devicetype can not be empty.
+app_versionname_is_not_empty=Version is required.
+app_typeid_is_not_empty=Type Id is required.
+app_filepath_is_not_empty=File path is required.
+app_abstract_is_not_empty=App description is required.
+app_imagepath_is_not_empty=App Icon is required.
+
+app_save_is_success=App updated successfully.
+app_appname_max_error=Maximum length of App name is 32 characters.
+app_versionname_max_error=Maximum length of version is 32 characters.
+app_abstract_max_error=Maximum length of description is 1000 characters.
+app_filepath_max_error=Maximum length of file path is 200 characters.
+
+app_file_read_failed=Read App file failed.
+app_file_uncompress_failed=Uncompress App file failed.
+
+###################### app message ######################
+
+###################### errorcode message ######################
+the_picture_sizes_should_not_exceed_500KB = The size of picture can not exceed 500KB.
+you_can_upload_pictures_only = You can upload pictures only.
+missing_necessary_queryparam=Query parameter is empty or wrong.
+invalid_operation=Invalid operation
+app_file_type_is_unsupported=Unsupported APP file type.
+developer_is_not_exist=Developer does not exist.
+resource_already_exists=User name has already existed.
+resource_app_already_exists=Application identify has already existed.
+
+###################### errorcode message ######################
+
+###################### /authority message ######################
+authority_id_is_not_empty = Authority Id is required.
+###################### /authority message ######################
+
+###################### project message ######################
+user_is_success= Create user successfully.
+###################### /project message ######################
+
+###################### system message ######################
+
+###################### /system message ###################### \ No newline at end of file
diff --git a/appmarket-utils/src/main/resources/message.ja.en.properties b/appmarket-utils/src/main/resources/message.ja.en.properties
new file mode 100644
index 0000000..cdb7b8c
--- /dev/null
+++ b/appmarket-utils/src/main/resources/message.ja.en.properties
@@ -0,0 +1,98 @@
+project_error=A server error has occurred. Please contact the administrator.
+status_unauthorized=Your session has timed out, please log in again.
+status_forbidden=Have no permission to read the records of this application.
+status_too_many_connections=The account has been registered.
+bad_request=Request parameter is wrong!
+md5_failed=Failed to check file on md5!
+app_upload_param_file_is_null = Upload file is required.
+invalid_query_param=Invalid query parameter!
+invalid_body=Invalid body
+already_exist = Data has already existed!
+user_not_delete = Users with data connections can not be deleted.
+expired_refresh_token=Refresh token has timed out.
+
+###################### login message ######################
+login_loginId_is_not_exist=Invalid User name or Password.
+login_loginId_is_not_empty=User name is required.
+login_password_is_not_empty=Password is required.
+###################### /login message ######################
+
+###################### user message ######################
+user_old_password_is_not_empty=Old password is required.
+user_new_password_is_not_empty=New password is required.
+user_password_is_not_empty = Password is required.
+no_spaces_can_be_found_in_the_password = Password can not contain space.
+user_username_is_not_empty=User name is required.
+user_username_is_not_repeated=User name has already existed.
+user_username_max_error=Maximum length of user name is 32 characters.
+user_password_max_error=Maximum length of password is 32 characters.
+user_repassword_max_error=Maximum length of password is 32 characters.
+user_mailaddress_max_error=Maximum length of mail address is 32 characters.
+user_repassword_is_not_empty = Confirm password is required.
+user_mailaddress_is_not_empty=Mail address is required.
+user_userid_is_not_empty=User id is required.
+user_save_is_failed=Save user failed.
+
+user_is_exist= User name has already been registered.
+user_delete_failed=Delete user failed.
+user_name_is_not_empty=Name is required.
+user_get_list_is_failed=Get user list failed.
+user_new_repassword_is_not_empty=Confirm password is required.
+user_new_repassword_is_not_equals=Password doesn't match.
+user_save_is_success = Update account successfully.
+user_repassword_error = Minimum length of password is 6 characters.
+user_password_error = Minimum length of confirm password is 6 characters.
+user_mailaddress_is_not_equals = Enter the email address in the format:mail@example.com.
+
+user_loginid_is_failed = Login Id is wrong.
+user_info_change_success= Change the information successfully.
+user_title_name_insert=User/Create
+user_title_name_modify=User/Detail
+###################### /user message ######################
+
+###################### /app message ######################
+app_title_name_insert=App/Create
+app_title_name_modify=App/Detail
+app_save_is_failed=Update App failed.
+app_appname_is_not_empty=App name is required.
+app_DeviceType_is_not_empty=App devicetype can not be empty.
+app_versionname_is_not_empty=Version is required.
+app_typeid_is_not_empty=Type Id is required.
+app_filepath_is_not_empty=File path is required.
+app_abstract_is_not_empty=App description is required.
+app_imagepath_is_not_empty=App Icon is required.
+
+app_save_is_success=App updated successfully.
+app_appname_max_error=Maximum length of App name is 32 characters.
+app_versionname_max_error=Maximum length of version is 32 characters.
+app_abstract_max_error=Maximum length of description is 1000 characters.
+app_filepath_max_error=Maximum length of file path is 200 characters.
+
+app_file_read_failed=Read App file failed.
+app_file_uncompress_failed=Uncompress App file failed.
+
+###################### app message ######################
+
+###################### errorcode message ######################
+the_picture_sizes_should_not_exceed_500KB = The size of picture can not exceed 500KB.
+you_can_upload_pictures_only = You can upload pictures only.
+missing_necessary_queryparam=Query parameter is empty or wrong.
+invalid_operation=Invalid operation
+app_file_type_is_unsupported=Unsupported APP file type.
+developer_is_not_exist=Developer does not exist.
+resource_already_exists=User name has already existed.
+resource_app_already_exists=Application identify has already existed.
+
+###################### errorcode message ######################
+
+###################### /authority message ######################
+authority_id_is_not_empty = Authority Id is required.
+###################### /authority message ######################
+
+###################### project message ######################
+user_is_success= Create user successfully.
+###################### /project message ######################
+
+###################### system message ######################
+
+###################### /system message ###################### \ No newline at end of file
diff --git a/appmarket-utils/src/test/java/app/market/utils/AppTest.java b/appmarket-utils/src/test/java/app/market/utils/AppTest.java
new file mode 100644
index 0000000..bb7d52b
--- /dev/null
+++ b/appmarket-utils/src/test/java/app/market/utils/AppTest.java
@@ -0,0 +1,53 @@
+/*
+ * 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;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+/**
+ * Unit test for simple App.
+ */
+public class AppTest
+ extends TestCase
+{
+ /**
+ * Create the test case
+ *
+ * @param testName name of the test case
+ */
+ public AppTest( String testName )
+ {
+ super( testName );
+ }
+
+ /**
+ * @return the suite of tests being tested
+ */
+ public static Test suite()
+ {
+ return new TestSuite( AppTest.class );
+ }
+
+ /**
+ * Rigourous Test :-)
+ */
+ public void testApp()
+ {
+ assertTrue( true );
+ }
+}