summaryrefslogtreecommitdiffstats
path: root/appmarket-utils/src/main/java/app/market/utils/property
diff options
context:
space:
mode:
Diffstat (limited to 'appmarket-utils/src/main/java/app/market/utils/property')
-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
5 files changed, 392 insertions, 0 deletions
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;
+ }
+
+}