Commit 2b22734c by Kim Peace

Merge branch 'features/abcomm_sp6' into 'features/1.3.000'

Features/abcomm sp6

See merge request !137
parents 1a198557 ed965e8c
...@@ -111,18 +111,6 @@ public class ABVDataOpenHelper { ...@@ -111,18 +111,6 @@ public class ABVDataOpenHelper {
iTableScripts.add(new ROperationGroupMasterOperation()); iTableScripts.add(new ROperationGroupMasterOperation());
iTableScripts.add(new TTaskReportApproval()); iTableScripts.add(new TTaskReportApproval());
//ABCOMM関連テーブル
iTableScripts.add(new MChatGroup());
iTableScripts.add(new MShopMember());
iTableScripts.add(new TChatRoom());
iTableScripts.add(new TChatMessage());
iTableScripts.add(new TCollaboration());
iTableScripts.add(new TCollaborationDetail());
iTableScripts.add(new TArchive());
iTableScripts.add(new RShopMemberGroup());
iTableScripts.add(new RChatRoomShopMember());
iTableScripts.add(new RCollaborationMember());
return iTableScripts; return iTableScripts;
} }
......
package jp.agentec.abook.abv.bl.data;
import jp.agentec.abook.abv.bl.common.db.SQLiteDatabase;
/**
* DBへの接続を管理するクラス
*
* ActivityのonCreate時に必ず、以下の手順で呼び出すこと。
* もしくはInitilizerの中で行っても良い。
*
* DBConnector conn = DBConnector.getInstance();
* SQLiteOpenHelper sqlLiteOpenHelper = new ...;
* conn.setSqlLiteOpenHelper(sqlLiteOpenHelper);
* conn.init();
*
* @author tsukada
*
*/
public class CommunicationDBConnector {
private static volatile CommunicationDBConnector dbConnector = null;
public static final String DatabaseName = "ABVJE_COMM";
public static final int DatabaseVersion = DatabaseVersions.Ver1_3_000;
protected SQLiteDatabase db = null;
private jp.agentec.abook.abv.bl.common.db.SQLiteOpenHelper sqlLiteOpenHelper = null;
public void setSqlLiteOpenHelper(jp.agentec.abook.abv.bl.common.db.SQLiteOpenHelper sqlLiteOpenHelper) {
this.sqlLiteOpenHelper = sqlLiteOpenHelper;
}
public static CommunicationDBConnector getInstance() {
if (dbConnector == null) {
synchronized (CommunicationDBConnector.class) {
if (dbConnector == null) {
dbConnector = new CommunicationDBConnector();
}
}
}
return dbConnector;
}
public SQLiteDatabase getDatabase() {
if (!isOpen()) {
db = sqlLiteOpenHelper.openDatabase();
}
return db;
}
/**
* データベースコネクションがオープンされているか確認します。
* @return コネクションがオープンされているとtrueを返します。
* @since 1.0.0
*/
public synchronized boolean isOpen() {
return db != null && db.isOpen();
}
}
package jp.agentec.abook.abv.bl.data;
import java.util.ArrayList;
import java.util.List;
import jp.agentec.abook.abv.bl.common.db.SQLiteDatabase;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.data.tables.LContentObjectLog;
import jp.agentec.abook.abv.bl.data.tables.LContentPageReadingLog;
import jp.agentec.abook.abv.bl.data.tables.LContentReadingLog;
import jp.agentec.abook.abv.bl.data.tables.MAcms;
import jp.agentec.abook.abv.bl.data.tables.MAppConfig;
import jp.agentec.abook.abv.bl.data.tables.MCategory;
import jp.agentec.abook.abv.bl.data.tables.MChatGroup;
import jp.agentec.abook.abv.bl.data.tables.MGroup;
import jp.agentec.abook.abv.bl.data.tables.MMemberInfo;
import jp.agentec.abook.abv.bl.data.tables.MOperationGroupMaster;
import jp.agentec.abook.abv.bl.data.tables.MPasswordLockInfo;
import jp.agentec.abook.abv.bl.data.tables.MServiceOption;
import jp.agentec.abook.abv.bl.data.tables.MShopMember;
import jp.agentec.abook.abv.bl.data.tables.MWorkerGroup;
import jp.agentec.abook.abv.bl.data.tables.RChatRoomShopMember;
import jp.agentec.abook.abv.bl.data.tables.RCollaborationMember;
import jp.agentec.abook.abv.bl.data.tables.RContentCategory;
import jp.agentec.abook.abv.bl.data.tables.RContentGroup;
import jp.agentec.abook.abv.bl.data.tables.ROperationContent;
import jp.agentec.abook.abv.bl.data.tables.ROperationGroupMasterOperation;
import jp.agentec.abook.abv.bl.data.tables.RShopMemberGroup;
import jp.agentec.abook.abv.bl.data.tables.RTaskWorkerGroup;
import jp.agentec.abook.abv.bl.data.tables.SQLiteTableScript;
import jp.agentec.abook.abv.bl.data.tables.TArchive;
import jp.agentec.abook.abv.bl.data.tables.TChatMessage;
import jp.agentec.abook.abv.bl.data.tables.TChatRoom;
import jp.agentec.abook.abv.bl.data.tables.TCollaboration;
import jp.agentec.abook.abv.bl.data.tables.TCollaborationDetail;
import jp.agentec.abook.abv.bl.data.tables.TContent;
import jp.agentec.abook.abv.bl.data.tables.TContentBookmark;
import jp.agentec.abook.abv.bl.data.tables.TContentDownloadQueue;
import jp.agentec.abook.abv.bl.data.tables.TContentMarking;
import jp.agentec.abook.abv.bl.data.tables.TContentMemo;
import jp.agentec.abook.abv.bl.data.tables.TContentOldPdf;
import jp.agentec.abook.abv.bl.data.tables.TContentPage;
import jp.agentec.abook.abv.bl.data.tables.TContentResource;
import jp.agentec.abook.abv.bl.data.tables.TContentServerSearched;
import jp.agentec.abook.abv.bl.data.tables.TContentTag;
import jp.agentec.abook.abv.bl.data.tables.TEnquete;
import jp.agentec.abook.abv.bl.data.tables.TMarkingSetting;
import jp.agentec.abook.abv.bl.data.tables.TOperation;
import jp.agentec.abook.abv.bl.data.tables.TPushMessage;
import jp.agentec.abook.abv.bl.data.tables.TTask;
import jp.agentec.abook.abv.bl.data.tables.TTaskReport;
import jp.agentec.abook.abv.bl.data.tables.TTaskReportApproval;
import jp.agentec.abook.abv.bl.data.tables.TTaskReportItems;
import jp.agentec.abook.abv.bl.data.tables.TTaskReportSend;
import jp.agentec.adf.util.StringUtil;
public class CommunicationDataOpenHelper {
private Throwable lastError = null;
private boolean createFailed = false;
private static final String TAG = "DATA";
public Throwable getLastError() {
return lastError;
}
public boolean isCreated() {
return !createFailed;
}
private List<SQLiteTableScript> getTableScripts() {
List<SQLiteTableScript> iTableScripts = new ArrayList<SQLiteTableScript>();
//ABCOMM関連テーブル
iTableScripts.add(new MChatGroup());
iTableScripts.add(new MShopMember());
iTableScripts.add(new TChatRoom());
iTableScripts.add(new TChatMessage());
iTableScripts.add(new TCollaboration());
iTableScripts.add(new TCollaborationDetail());
iTableScripts.add(new TArchive());
iTableScripts.add(new RShopMemberGroup());
iTableScripts.add(new RChatRoomShopMember());
iTableScripts.add(new RCollaborationMember());
return iTableScripts;
}
public void onCreate(SQLiteDatabase db) {
Logger.i(TAG, "create database version " + db.getVersion());
List<SQLiteTableScript> iTableScripts = getTableScripts();
try {
List<String> ddl;
db.beginTransaction();
for (SQLiteTableScript iTableScript : iTableScripts) {
ddl = iTableScript.getCreateScript(db.getVersion());
for (String sql : ddl) {
if (!StringUtil.isNullOrWhiteSpace(sql)) {
Logger.d(TAG, sql);
db.execSQL(sql);
}
}
}
db.setTransactionSuccessful(); // commit
createFailed = false;
} catch (Exception e) {
lastError = e;
createFailed = true;
} finally {
db.endTransaction();
}
}
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
Logger.i(TAG, String.format("upgrade database to version %d from version : %d", newVersion, oldVersion));
List<SQLiteTableScript> iTableScripts = getTableScripts();
try {
List<String> ddl;
List<String> dml;
db.beginTransaction();
for (SQLiteTableScript iTableScript : iTableScripts) {
ddl = iTableScript.getUpgradeScript(oldVersion, newVersion);
if (ddl != null) {
for (String sql : ddl) {
if (!StringUtil.isNullOrWhiteSpace(sql)) {
Logger.d(TAG, sql);
db.execSQL(sql);
}
}
}
dml = iTableScript.getMigrationScript(db, oldVersion, newVersion, null);
if (dml != null) {
for (String sql : dml) {
if (!StringUtil.isNullOrWhiteSpace(sql)) {
Logger.d(TAG, sql);
db.execSQL(sql);
}
}
}
}
db.setTransactionSuccessful(); // commit
createFailed = false;
} catch (Exception e) {
Logger.e(TAG, e);
lastError = e;
createFailed = true;
} finally {
db.endTransaction();
}
}
}
...@@ -11,5 +11,7 @@ public class DatabaseVersions { ...@@ -11,5 +11,7 @@ public class DatabaseVersions {
//チャット機能追加(1.2.360障害対応。) //チャット機能追加(1.2.360障害対応。)
public static final int Ver1_2_362 = 24; public static final int Ver1_2_362 = 24;
// コミュニケーション(1.3.000)
public static final int Ver1_3_000 = 30;
} }
...@@ -11,7 +11,7 @@ import jp.agentec.abook.abv.bl.dto.CollaborationDto; ...@@ -11,7 +11,7 @@ import jp.agentec.abook.abv.bl.dto.CollaborationDto;
import jp.agentec.adf.util.CollectionUtil; import jp.agentec.adf.util.CollectionUtil;
import jp.agentec.adf.util.StringUtil; import jp.agentec.adf.util.StringUtil;
public class ArchiveDao extends AbstractDao { public class ArchiveDao extends AbstractCommunicationDao {
/** /**
* {@link ArchiveDao} のインスタンスを初期化します。 * {@link ArchiveDao} のインスタンスを初期化します。
......
...@@ -10,7 +10,7 @@ import jp.agentec.abook.abv.bl.dto.GroupDto; ...@@ -10,7 +10,7 @@ import jp.agentec.abook.abv.bl.dto.GroupDto;
import jp.agentec.adf.util.CollectionUtil; import jp.agentec.adf.util.CollectionUtil;
import jp.agentec.adf.util.StringUtil; import jp.agentec.adf.util.StringUtil;
public class ChatGroupDao extends AbstractDao { public class ChatGroupDao extends AbstractCommunicationDao {
private static final String TAG = "ChatGroupDao"; private static final String TAG = "ChatGroupDao";
/*package*/ ChatGroupDao() { /*package*/ ChatGroupDao() {
......
...@@ -9,7 +9,7 @@ import jp.agentec.abook.abv.bl.dto.ChatMessageDto; ...@@ -9,7 +9,7 @@ import jp.agentec.abook.abv.bl.dto.ChatMessageDto;
import jp.agentec.abook.abv.bl.dto.ChatRoomDto; import jp.agentec.abook.abv.bl.dto.ChatRoomDto;
import jp.agentec.adf.util.StringUtil; import jp.agentec.adf.util.StringUtil;
public class ChatMessageDao extends AbstractDao { public class ChatMessageDao extends AbstractCommunicationDao {
/** /**
* {@link ChatMessageDao} のインスタンスを初期化します。 * {@link ChatMessageDao} のインスタンスを初期化します。
......
...@@ -11,7 +11,7 @@ import jp.agentec.abook.abv.bl.dto.ShopMemberDto; ...@@ -11,7 +11,7 @@ import jp.agentec.abook.abv.bl.dto.ShopMemberDto;
import jp.agentec.adf.util.CollectionUtil; import jp.agentec.adf.util.CollectionUtil;
import jp.agentec.adf.util.StringUtil; import jp.agentec.adf.util.StringUtil;
public class ChatRoomDao extends AbstractDao { public class ChatRoomDao extends AbstractCommunicationDao {
/** /**
* {@link ChatRoomDao} のインスタンスを初期化します。 * {@link ChatRoomDao} のインスタンスを初期化します。
...@@ -175,6 +175,7 @@ public class ChatRoomDao extends AbstractDao { ...@@ -175,6 +175,7 @@ public class ChatRoomDao extends AbstractDao {
for (ChatRoomDto chatRoomDto : chatRoomDtoList) { for (ChatRoomDto chatRoomDto : chatRoomDtoList) {
roomIdList.add(chatRoomDto.chatRoomId); roomIdList.add(chatRoomDto.chatRoomId);
insertChatRoom(chatRoomDto); insertChatRoom(chatRoomDto);
deleteChatRoomUsers(chatRoomDto.chatRoomId);
insertChatRoomUsers(chatRoomDto.attendUsers, chatRoomDto.chatRoomId); insertChatRoomUsers(chatRoomDto.attendUsers, chatRoomDto.chatRoomId);
} }
update("delete from t_chat_room where chat_room_id NOT IN (" + StringUtil.join(" , ", roomIdList) + ")", null); update("delete from t_chat_room where chat_room_id NOT IN (" + StringUtil.join(" , ", roomIdList) + ")", null);
...@@ -192,6 +193,10 @@ public class ChatRoomDao extends AbstractDao { ...@@ -192,6 +193,10 @@ public class ChatRoomDao extends AbstractDao {
} }
} }
public void deleteChatRoomUsers(Integer chatRoomId) {
update("delete from r_chat_room_shop_member where chat_room_id = ?", new Integer[]{chatRoomId});
}
public boolean updateChatRoom(ChatRoomDto dto) { public boolean updateChatRoom(ChatRoomDto dto) {
long count = update("update t_chat_room set chat_room_name=?, type=?, unread_count=?, user_count=?, favorite_register_date=? where chat_room_id=?", dto.getUpdateValues()); long count = update("update t_chat_room set chat_room_name=?, type=?, unread_count=?, user_count=?, favorite_register_date=? where chat_room_id=?", dto.getUpdateValues());
return count > 0; return count > 0;
......
...@@ -7,7 +7,7 @@ import jp.agentec.abook.abv.bl.common.log.Logger; ...@@ -7,7 +7,7 @@ import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.dto.ChatMessageDto; import jp.agentec.abook.abv.bl.dto.ChatMessageDto;
import jp.agentec.abook.abv.bl.dto.CollaborationDto; import jp.agentec.abook.abv.bl.dto.CollaborationDto;
public class CollaborationDao extends AbstractDao { public class CollaborationDao extends AbstractCommunicationDao {
/** /**
* {@link CollaborationDao} のインスタンスを初期化します。 * {@link CollaborationDao} のインスタンスを初期化します。
......
...@@ -6,7 +6,7 @@ import jp.agentec.abook.abv.bl.common.db.Cursor; ...@@ -6,7 +6,7 @@ import jp.agentec.abook.abv.bl.common.db.Cursor;
import jp.agentec.abook.abv.bl.common.log.Logger; import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.dto.CollaborationDetailDto; import jp.agentec.abook.abv.bl.dto.CollaborationDetailDto;
public class CollaborationDetailDao extends AbstractDao { public class CollaborationDetailDao extends AbstractCommunicationDao {
/** /**
* {@link CollaborationDetailDao} のインスタンスを初期化します。 * {@link CollaborationDetailDao} のインスタンスを初期化します。
......
...@@ -8,7 +8,6 @@ import jp.agentec.abook.abv.bl.common.db.Cursor; ...@@ -8,7 +8,6 @@ import jp.agentec.abook.abv.bl.common.db.Cursor;
import jp.agentec.abook.abv.bl.common.db.SQLiteDatabase; import jp.agentec.abook.abv.bl.common.db.SQLiteDatabase;
import jp.agentec.abook.abv.bl.common.log.Logger; import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.dto.GroupDto; import jp.agentec.abook.abv.bl.dto.GroupDto;
import jp.agentec.adf.util.CollectionUtil;
import jp.agentec.adf.util.NumericUtil; import jp.agentec.adf.util.NumericUtil;
import jp.agentec.adf.util.StringUtil; import jp.agentec.adf.util.StringUtil;
...@@ -60,10 +59,7 @@ public class GroupDao extends AbstractDao { ...@@ -60,10 +59,7 @@ public class GroupDao extends AbstractDao {
if (column != -1) { if (column != -1) {
dto.userGroupFlg = toBool(cursor.getInt(column)); dto.userGroupFlg = toBool(cursor.getInt(column));
} }
column = cursor.getColumnIndex("favorite_register_date");
if (column != -1) {
dto.favoriteRegisterDate = cursor.getString(column);
}
return dto; return dto;
} }
...@@ -76,38 +72,6 @@ public class GroupDao extends AbstractDao { ...@@ -76,38 +72,6 @@ public class GroupDao extends AbstractDao {
return rawQueryGetDtoList("select * from m_group where group_relation_id in (select group_relation_id from r_content_group where content_id = " + contentId + ") order by group_id", null, GroupDto.class); return rawQueryGetDtoList("select * from m_group where group_relation_id in (select group_relation_id from r_content_group where content_id = " + contentId + ") order by group_id", null, GroupDto.class);
} }
public List<String> getMyGroupPathList() {
StringBuffer sql = new StringBuffer();
sql.append(" SELECT ");
sql.append(" CASE WHEN (grandparentgroup.group_name IS NOT NULL) THEN grandparentgroup.group_name || ' / ' || parentgroup.group_name || ' / ' || mygroup.group_name ");
sql.append(" WHEN (parentgroup.group_name IS NOT NULL) THEN parentgroup.group_name || ' / ' || mygroup.group_name ");
sql.append(" ELSE mygroup.group_name ");
sql.append(" END AS group_path_list ");
sql.append(" FROM m_group mygroup ");
sql.append(" LEFT JOIN m_group parentgroup on mygroup.parent_group_id = parentgroup.group_id ");
sql.append(" LEFT JOIN m_group grandparentgroup on parentgroup.parent_group_id = grandparentgroup.group_id ");
sql.append(" WHERE mygroup.user_group_flg = 1 ");
return rawQueryGetStringList(sql.toString(), null);
}
public List<GroupDto> getUserGroupPathList(Integer shopMemberId) {
StringBuffer sql = new StringBuffer();
sql.append(" SELECT ");
sql.append(" CASE WHEN (grandparentgroup.group_name IS NOT NULL) THEN grandparentgroup.group_name || ' / ' || parentgroup.group_name || ' / ' || usergroup.group_name ");
sql.append(" WHEN (parentgroup.group_name IS NOT NULL) THEN parentgroup.group_name || ' / ' || usergroup.group_name ");
sql.append(" ELSE usergroup.group_name ");
sql.append(" END AS group_path, usergroup.group_id ");
sql.append(" FROM m_group usergroup ");
sql.append(" LEFT JOIN m_group parentgroup on usergroup.parent_group_id = parentgroup.group_id ");
sql.append(" LEFT JOIN m_group grandparentgroup on parentgroup.parent_group_id = grandparentgroup.group_id ");
sql.append(" WHERE usergroup.group_id IN ");
sql.append(" (SELECT group_id ");
sql.append(" FROM m_shop_member sm INNER JOIN r_shop_member_group rsmg on sm.shop_member_id = rsmg.shop_member_id ");
sql.append(" WHERE sm.shop_member_id = ? ) ");
return rawQueryGetDtoList(sql.toString(), new String[] { "" + shopMemberId}, GroupDto.class);
}
private String generateGetGroupsQuery(QueryType queryType, int[] groupRelationids, int[] parentGroupIds, Boolean downloaded, String searchKeyword, SearchDivisionType searchDivisionType, boolean isOnlineSearched) { private String generateGetGroupsQuery(QueryType queryType, int[] groupRelationids, int[] parentGroupIds, Boolean downloaded, String searchKeyword, SearchDivisionType searchDivisionType, boolean isOnlineSearched) {
StringBuffer sql = new StringBuffer(); StringBuffer sql = new StringBuffer();
...@@ -515,75 +479,24 @@ public class GroupDao extends AbstractDao { ...@@ -515,75 +479,24 @@ public class GroupDao extends AbstractDao {
return rawQueryGetDto("select * from m_group where group_id = " + groupId, null, GroupDto.class); return rawQueryGetDto("select * from m_group where group_id = " + groupId, null, GroupDto.class);
} }
public List<GroupDto> getFavoriteGroup() {
return rawQueryGetDtoList("select * from m_group where favorite_register_date IS NOT NULL ORDER BY favorite_register_date ", null, GroupDto.class);
}
public List<GroupDto> getGroupByName(String[] keywords) {
StringBuffer sql = new StringBuffer();
sql.append(" SELECT * ");
sql.append(" FROM m_group ");
ArrayList<String> whereSqlList = new ArrayList<String>();
for (String keyword : keywords) {
if(StringUtil.isNullOrEmpty(keyword)){
continue;
}
String whereSql = "group_name LIKE '%"+keyword+"%'";
whereSqlList.add(whereSql);
}
if (CollectionUtil.isNotEmpty(whereSqlList)) {
sql.append("WHERE " + StringUtil.join(" AND ", whereSqlList));
}
sql.append(" ORDER BY group_name ASC ");
return rawQueryGetDtoList(sql.toString(), null, GroupDto.class);
}
public List<GroupDto> getGroupSpareList(int baseId, int parentId) { public List<GroupDto> getGroupSpareList(int baseId, int parentId) {
List<GroupDto> list; List<GroupDto> list;
list = rawQueryGetDtoList("select * from m_group mg where (mg.group_id = ?) UNION select * from m_group mg where (mg.parent_group_id = ?)", new String[]{""+ baseId, ""+ parentId}, GroupDto.class); list = rawQueryGetDtoList("select * from m_group mg where (mg.group_id = ?) UNION select * from m_group mg where (mg.parent_group_id = ?)", new String[]{""+ baseId, ""+ parentId}, GroupDto.class);
return list; return list;
} }
public List<GroupDto> getGroupTree(Integer groupId) {
List<GroupDto> list;
StringBuffer sql = new StringBuffer();
sql.append(" WITH group_loop AS ");
sql.append(" ( ");
sql.append(" SELECT 1 rownum,group_id,group_name,parent_group_id,user_group_flg from m_group where group_id = ? ");
sql.append(" UNION ALL ");
sql.append(" SELECT rownum+1 rownum,parent.group_id,parent. group_name,parent.parent_group_id,parent.user_group_flg ");
sql.append(" FROM group_loop inner join m_group parent on parent.group_id = group_loop.parent_group_id ");
sql.append(" ) ");
sql.append(" SELECT * FROM group_loop ORDER BY group_loop.rownum DESC ");
list = rawQueryGetDtoList(sql.toString(), new String[]{""+ groupId}, GroupDto.class);
return list;
}
public List<GroupDto> getGroupChildList(int parentId) { public List<GroupDto> getGroupChildList(int parentId) {
List<GroupDto> list; List<GroupDto> list;
list = rawQueryGetDtoList("select * from m_group mg where (mg.parent_group_id = ?) ORDER BY group_name ASC", new String[]{""+ parentId}, GroupDto.class); list = rawQueryGetDtoList("select * from m_group mg where (mg.parent_group_id = ?)", new String[]{""+ parentId}, GroupDto.class);
return list; return list;
} }
public GroupDto getRootGroup() {
return rawQueryGetDto("select * from m_group mg where (mg.parent_group_id = 0)",null, GroupDto.class);
}
public GroupDto getParentGroup(Integer childGroupId) {
return rawQueryGetDto("select parent.* from m_group parent inner join m_group child on child.parent_group_id = parent.group_id where child.group_id = ?", new String[]{""+ childGroupId}, GroupDto.class);
}
public boolean isExistParent(int baseId) { public boolean isExistParent(int baseId) {
return rawQueryGetInt("select * from m_group where parent_group_id = " + baseId, null) > 0; return rawQueryGetInt("select * from m_group where parent_group_id = " + baseId, null) > 0;
} }
public List<GroupDto> getUserGroups() { public List<GroupDto> getUserGroups() {
return rawQueryGetDtoList("select * from m_group where user_group_flg = 1 ORDER BY group_name", null, GroupDto.class); return rawQueryGetDtoList("select * from m_group where user_group_flg = 1", null, GroupDto.class);
}
public List<GroupDto> getMyGroups() {
return rawQueryGetDtoList("select * from m_group where group_id IN (select group_id from m_shop_member sm inner join r_shop_member_group rmg on sm.shop_member_id = rmg.shop_member_id where sm.self_flg = 1) ORDER BY group_name ASC", null, GroupDto.class);
} }
/** /**
...@@ -599,95 +512,4 @@ public class GroupDao extends AbstractDao { ...@@ -599,95 +512,4 @@ public class GroupDao extends AbstractDao {
return userGroupList.get(0).groupId; return userGroupList.get(0).groupId;
} }
public void insertGroupList(List<GroupDto> groupList) {
StringBuffer sql = new StringBuffer();
sql.append(" INSERT INTO m_group (group_id, parent_group_id, group_name, group_path, group_level, user_group_flg) ");
sql.append(" VALUES (?,?,?,?,?,?) ");
try {
beginTransaction();
for (GroupDto groupDto : groupList) {
insert(sql.toString(), new Object[] { groupDto.groupId, groupDto.parentGroupId, groupDto.groupName, ""+ groupDto.groupId, 0, 0 });
}
commit();
} catch (Exception e) {
rollback();
Logger.e("insertGroupList failed.", e);
throw new RuntimeException(e);
}
}
public void updateGroupList(List<GroupDto> groupList) {
StringBuffer sql = new StringBuffer();
sql.append(" UPDATE m_group ");
sql.append(" SET group_name = ? ");
sql.append(" , parent_group_id = ? ");
sql.append(" WHERE group_id = ? ");
try {
beginTransaction();
for (GroupDto groupDto : groupList) {
update(sql.toString(), new Object[] { groupDto.groupName, groupDto.parentGroupId, groupDto.groupId });
}
commit();
} catch (Exception e) {
rollback();
Logger.e("updateGroupList failed.", e);
throw new RuntimeException(e);
}
}
public void updateUserGroupList(List<Integer> groupIds) {
StringBuffer sql = new StringBuffer();
sql.append(" UPDATE m_group ");
sql.append(" SET user_group_flg = 1 ");
sql.append(" WHERE group_id = ? ");
try {
beginTransaction();
for (Integer groupId : groupIds) {
update(sql.toString(), new Object[] { groupId });
}
commit();
} catch (Exception e) {
rollback();
Logger.e("updateGroupList failed.", e);
throw new RuntimeException(e);
}
}
public void updateFavoriteGroupList(List<GroupDto> groupList) {
StringBuffer sql = new StringBuffer();
sql.append(" UPDATE m_group ");
sql.append(" SET favorite_register_date = ? ");
sql.append(" WHERE group_id = ? ");
try {
beginTransaction();
for (GroupDto groupDto : groupList) {
update(sql.toString(), new Object[] { groupDto.favoriteRegisterDate, groupDto.groupId });
}
commit();
} catch (Exception e) {
rollback();
Logger.e("updateFavoriteGroupList failed.", e);
throw new RuntimeException(e);
}
}
public void deleteGroupList(List<GroupDto> groupList) {
StringBuffer sql = new StringBuffer();
sql.append(" delete from m_group ");
sql.append(" WHERE group_id = ? ");
try {
beginTransaction();
for (GroupDto groupDto : groupList) {
update(sql.toString(), new Object[] { groupDto.groupId });
}
commit();
} catch (Exception e) {
rollback();
Logger.e("deleteGroupList failed.", e);
throw new RuntimeException(e);
}
}
} }
...@@ -14,7 +14,7 @@ import jp.agentec.adf.util.DateTimeFormat; ...@@ -14,7 +14,7 @@ import jp.agentec.adf.util.DateTimeFormat;
import jp.agentec.adf.util.DateTimeUtil; import jp.agentec.adf.util.DateTimeUtil;
import jp.agentec.adf.util.StringUtil; import jp.agentec.adf.util.StringUtil;
public class ShopMemberDao extends AbstractDao { public class ShopMemberDao extends AbstractCommunicationDao {
/** /**
* {@link ShopMemberDao} のインスタンスを初期化します。 * {@link ShopMemberDao} のインスタンスを初期化します。
......
...@@ -34,7 +34,6 @@ public class MGroup extends SQLiteTableScript { ...@@ -34,7 +34,6 @@ public class MGroup extends SQLiteTableScript {
sql.append(" , group_name VARCHAR(64) NOT NULL "); sql.append(" , group_name VARCHAR(64) NOT NULL ");
sql.append(" , group_path TEXT NOT NULL "); // path enumaerationパターンを適用する。since DatabaseVersions.Ver1_5_0 sql.append(" , group_path TEXT NOT NULL "); // path enumaerationパターンを適用する。since DatabaseVersions.Ver1_5_0
sql.append(" , user_group_flg BOOLEAN NOT NULL DEFAULT 0 "); // since DatabaseVersions.Plus_1_1_0 sql.append(" , user_group_flg BOOLEAN NOT NULL DEFAULT 0 "); // since DatabaseVersions.Plus_1_1_0
sql.append(" , favorite_register_date VARCHAR2(64) ");
sql.append(" , PRIMARY KEY (group_relation_id) "); sql.append(" , PRIMARY KEY (group_relation_id) ");
sql.append(" ) "); sql.append(" ) ");
......
...@@ -4,6 +4,7 @@ import java.util.ArrayList; ...@@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import jp.agentec.abook.abv.bl.common.db.SQLiteDatabase; import jp.agentec.abook.abv.bl.common.db.SQLiteDatabase;
import jp.agentec.abook.abv.bl.data.DatabaseVersions;
public class MShopMember extends SQLiteTableScript { public class MShopMember extends SQLiteTableScript {
...@@ -32,7 +33,11 @@ public class MShopMember extends SQLiteTableScript { ...@@ -32,7 +33,11 @@ public class MShopMember extends SQLiteTableScript {
@Override @Override
public List<String> getUpgradeScript(int oldVersion, int newVersion) { public List<String> getUpgradeScript(int oldVersion, int newVersion) {
return null; List<String> ddl = new ArrayList<String>();
if (oldVersion < DatabaseVersions.Ver1_3_000) {
ddl.addAll(getCreateScript(newVersion));
}
return ddl;
} }
@Override @Override
......
...@@ -3,6 +3,7 @@ package jp.agentec.abook.abv.bl.data.tables; ...@@ -3,6 +3,7 @@ package jp.agentec.abook.abv.bl.data.tables;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import jp.agentec.abook.abv.bl.common.db.SQLiteDatabase; import jp.agentec.abook.abv.bl.common.db.SQLiteDatabase;
import jp.agentec.abook.abv.bl.data.DatabaseVersions;
public class RChatRoomShopMember extends SQLiteTableScript { public class RChatRoomShopMember extends SQLiteTableScript {
public RChatRoomShopMember() { public RChatRoomShopMember() {
...@@ -23,7 +24,11 @@ public class RChatRoomShopMember extends SQLiteTableScript { ...@@ -23,7 +24,11 @@ public class RChatRoomShopMember extends SQLiteTableScript {
@Override @Override
public List<String> getUpgradeScript(int oldVersion, int newVersion) { public List<String> getUpgradeScript(int oldVersion, int newVersion) {
return null; List<String> ddl = new ArrayList<String>();
if (oldVersion < DatabaseVersions.Ver1_3_000) {
ddl.addAll(getCreateScript(newVersion));
}
return ddl;
} }
@Override @Override
......
...@@ -4,6 +4,7 @@ import java.util.ArrayList; ...@@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import jp.agentec.abook.abv.bl.common.db.SQLiteDatabase; import jp.agentec.abook.abv.bl.common.db.SQLiteDatabase;
import jp.agentec.abook.abv.bl.data.DatabaseVersions;
public class RCollaborationMember extends SQLiteTableScript { public class RCollaborationMember extends SQLiteTableScript {
...@@ -29,7 +30,11 @@ public class RCollaborationMember extends SQLiteTableScript { ...@@ -29,7 +30,11 @@ public class RCollaborationMember extends SQLiteTableScript {
@Override @Override
public List<String> getUpgradeScript(int oldVersion, int newVersion) { public List<String> getUpgradeScript(int oldVersion, int newVersion) {
return null; List<String> ddl = new ArrayList<String>();
if (oldVersion < DatabaseVersions.Ver1_3_000) {
ddl.addAll(getCreateScript(newVersion));
}
return ddl;
} }
@Override @Override
......
...@@ -4,6 +4,7 @@ import java.util.ArrayList; ...@@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import jp.agentec.abook.abv.bl.common.db.SQLiteDatabase; import jp.agentec.abook.abv.bl.common.db.SQLiteDatabase;
import jp.agentec.abook.abv.bl.data.DatabaseVersions;
public class RShopMemberGroup extends SQLiteTableScript { public class RShopMemberGroup extends SQLiteTableScript {
...@@ -29,7 +30,11 @@ public class RShopMemberGroup extends SQLiteTableScript { ...@@ -29,7 +30,11 @@ public class RShopMemberGroup extends SQLiteTableScript {
@Override @Override
public List<String> getUpgradeScript(int oldVersion, int newVersion) { public List<String> getUpgradeScript(int oldVersion, int newVersion) {
return null; List<String> ddl = new ArrayList<String>();
if (oldVersion < DatabaseVersions.Ver1_3_000) {
ddl.addAll(getCreateScript(newVersion));
}
return ddl;
} }
@Override @Override
......
...@@ -4,6 +4,7 @@ import java.util.ArrayList; ...@@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import jp.agentec.abook.abv.bl.common.db.SQLiteDatabase; import jp.agentec.abook.abv.bl.common.db.SQLiteDatabase;
import jp.agentec.abook.abv.bl.data.DatabaseVersions;
public class TChatMessage extends SQLiteTableScript { public class TChatMessage extends SQLiteTableScript {
...@@ -37,7 +38,11 @@ public class TChatMessage extends SQLiteTableScript { ...@@ -37,7 +38,11 @@ public class TChatMessage extends SQLiteTableScript {
@Override @Override
public List<String> getUpgradeScript(int oldVersion, int newVersion) { public List<String> getUpgradeScript(int oldVersion, int newVersion) {
return null; List<String> ddl = new ArrayList<String>();
if (oldVersion < DatabaseVersions.Ver1_3_000) {
ddl.addAll(getCreateScript(newVersion));
}
return ddl;
} }
@Override @Override
......
...@@ -4,6 +4,7 @@ import java.util.ArrayList; ...@@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import jp.agentec.abook.abv.bl.common.db.SQLiteDatabase; import jp.agentec.abook.abv.bl.common.db.SQLiteDatabase;
import jp.agentec.abook.abv.bl.data.DatabaseVersions;
public class TChatRoom extends SQLiteTableScript { public class TChatRoom extends SQLiteTableScript {
...@@ -33,7 +34,11 @@ public class TChatRoom extends SQLiteTableScript { ...@@ -33,7 +34,11 @@ public class TChatRoom extends SQLiteTableScript {
@Override @Override
public List<String> getUpgradeScript(int oldVersion, int newVersion) { public List<String> getUpgradeScript(int oldVersion, int newVersion) {
return null; List<String> ddl = new ArrayList<String>();
if (oldVersion < DatabaseVersions.Ver1_3_000) {
ddl.addAll(getCreateScript(newVersion));
}
return ddl;
} }
@Override @Override
......
...@@ -4,6 +4,7 @@ import java.util.ArrayList; ...@@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import jp.agentec.abook.abv.bl.common.db.SQLiteDatabase; import jp.agentec.abook.abv.bl.common.db.SQLiteDatabase;
import jp.agentec.abook.abv.bl.data.DatabaseVersions;
public class TCollaboration extends SQLiteTableScript { public class TCollaboration extends SQLiteTableScript {
...@@ -28,7 +29,11 @@ public class TCollaboration extends SQLiteTableScript { ...@@ -28,7 +29,11 @@ public class TCollaboration extends SQLiteTableScript {
@Override @Override
public List<String> getUpgradeScript(int oldVersion, int newVersion) { public List<String> getUpgradeScript(int oldVersion, int newVersion) {
return null; List<String> ddl = new ArrayList<String>();
if (oldVersion < DatabaseVersions.Ver1_3_000) {
ddl.addAll(getCreateScript(newVersion));
}
return ddl;
} }
@Override @Override
......
...@@ -4,6 +4,7 @@ import java.util.ArrayList; ...@@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import jp.agentec.abook.abv.bl.common.db.SQLiteDatabase; import jp.agentec.abook.abv.bl.common.db.SQLiteDatabase;
import jp.agentec.abook.abv.bl.data.DatabaseVersions;
public class TCollaborationDetail extends SQLiteTableScript { public class TCollaborationDetail extends SQLiteTableScript {
...@@ -31,7 +32,11 @@ public class TCollaborationDetail extends SQLiteTableScript { ...@@ -31,7 +32,11 @@ public class TCollaborationDetail extends SQLiteTableScript {
@Override @Override
public List<String> getUpgradeScript(int oldVersion, int newVersion) { public List<String> getUpgradeScript(int oldVersion, int newVersion) {
return null; List<String> ddl = new ArrayList<String>();
if (oldVersion < DatabaseVersions.Ver1_3_000) {
ddl.addAll(getCreateScript(newVersion));
}
return ddl;
} }
@Override @Override
......
package jp.agentec.abook.abv.bl.dto; package jp.agentec.abook.abv.bl.dto;
import java.util.List;
/** /**
* グループ情報を格納します。m_groupのPKであるgroup_relation_idはこのdtoの扱いません。内部的なキーはgetKyeValuesメソッドで定義してあります。 * グループ情報を格納します。m_groupのPKであるgroup_relation_idはこのdtoの扱いません。内部的なキーはgetKyeValuesメソッドで定義してあります。
* @author Taejin Hong * @author Taejin Hong
...@@ -17,12 +15,7 @@ public class GroupDto extends AbstractDto { ...@@ -17,12 +15,7 @@ public class GroupDto extends AbstractDto {
public int contentCount = 0; public int contentCount = 0;
public String displayCount; public String displayCount;
public String groupPath; public String groupPath;
public String favoriteRegisterDate = "";
public boolean userGroupFlg; public boolean userGroupFlg;
public int delFlg;
public List<ShopMemberDto> groupMembers;
public List<String> groupPathList;
public String updateDate;
public GroupDto() { public GroupDto() {
} }
......
...@@ -14,6 +14,7 @@ import java.util.stream.Collectors; ...@@ -14,6 +14,7 @@ import java.util.stream.Collectors;
import jp.agentec.abook.abv.bl.common.constant.ABookCommConstants; import jp.agentec.abook.abv.bl.common.constant.ABookCommConstants;
import jp.agentec.abook.abv.bl.common.log.Logger; import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.common.util.JsonUtil; import jp.agentec.abook.abv.bl.common.util.JsonUtil;
import jp.agentec.abook.abv.bl.data.dao.AbstractCommunicationDao;
import jp.agentec.abook.abv.bl.data.dao.AbstractDao; import jp.agentec.abook.abv.bl.data.dao.AbstractDao;
import jp.agentec.abook.abv.bl.data.dao.ArchiveDao; import jp.agentec.abook.abv.bl.data.dao.ArchiveDao;
import jp.agentec.abook.abv.bl.data.dao.ChatGroupDao; import jp.agentec.abook.abv.bl.data.dao.ChatGroupDao;
...@@ -31,7 +32,6 @@ import jp.agentec.adf.util.ArrayUtil; ...@@ -31,7 +32,6 @@ import jp.agentec.adf.util.ArrayUtil;
import jp.agentec.adf.util.CollectionUtil; import jp.agentec.adf.util.CollectionUtil;
import jp.agentec.adf.util.DateTimeUtil; import jp.agentec.adf.util.DateTimeUtil;
import jp.agentec.adf.util.StringUtil; import jp.agentec.adf.util.StringUtil;
import sun.rmi.runtime.Log;
/** /**
* @author Lee-mk * @author Lee-mk
...@@ -39,14 +39,14 @@ import sun.rmi.runtime.Log; ...@@ -39,14 +39,14 @@ import sun.rmi.runtime.Log;
public class CommunicationLogic extends AbstractLogic { public class CommunicationLogic extends AbstractLogic {
private static final String TAG = "CommunicationLogic"; private static final String TAG = "CommunicationLogic";
private ChatRoomDao chatRoomDao = AbstractDao.getDao(ChatRoomDao.class); private ChatRoomDao chatRoomDao = AbstractCommunicationDao.getDao(ChatRoomDao.class);
private ChatMessageDao chatMessageDao = AbstractDao.getDao(ChatMessageDao.class); private ChatMessageDao chatMessageDao = AbstractCommunicationDao.getDao(ChatMessageDao.class);
private ShopMemberDao shopMemberDao = AbstractDao.getDao(ShopMemberDao.class); private ShopMemberDao shopMemberDao = AbstractCommunicationDao.getDao(ShopMemberDao.class);
private ChatGroupDao chatGroupDao = AbstractDao.getDao(ChatGroupDao.class); private ChatGroupDao chatGroupDao = AbstractCommunicationDao.getDao(ChatGroupDao.class);
private ContentDao contentDao = AbstractDao.getDao(ContentDao.class); private ContentDao contentDao = AbstractDao.getDao(ContentDao.class);
private String localFilePath; private String localFilePath;
private ArchiveDao archiveDao = AbstractDao.getDao(ArchiveDao.class); private ArchiveDao archiveDao = AbstractCommunicationDao.getDao(ArchiveDao.class);
/** /**
* {@link CommunicationLogic} クラスのインスタンスを初期化します。 * {@link CommunicationLogic} クラスのインスタンスを初期化します。
......
Subproject commit d0dd14b2cf0da5b2623cc416710429bfd85ad6ee Subproject commit de7a33d34ccf3a0307abe0c4bfbb0be2f233b54f
package jp.agentec.abook.abv.bl.common.db.impl;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import jp.agentec.abook.abv.bl.common.exception.ABVRuntimeException;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.data.ABVDataOpenHelper;
import jp.agentec.abook.abv.bl.data.CommunicationDataOpenHelper;
public class CommunicationSQLiteOpenHelper extends SQLiteOpenHelper implements jp.agentec.abook.abv.bl.common.db.SQLiteOpenHelper {
private static final String TAG = "CommunicationSQLiteOpenHelper";
public static CommunicationDataOpenHelper abhelper;
private Context context;
public CommunicationSQLiteOpenHelper(Context context, String name, int version) {
super(context, name, null, version);
this.context = context;
}
@Override
public void onCreate(SQLiteDatabase db) {
abhelper.onCreate(new StandardSQLiteDatabase(db));
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
abhelper.onUpgrade(new StandardSQLiteDatabase(db), oldVersion, newVersion);
}
public boolean isCreated() {
return abhelper.isCreated();
}
public Throwable getLastError() {
return abhelper.getLastError();
}
@Override
public StandardSQLiteDatabase openDatabase() {
if (context == null) {
throw new ABVRuntimeException("Android context is null. You must call init()");
}
abhelper = new CommunicationDataOpenHelper();
Logger.i(TAG, "open communication database start.");
StandardSQLiteDatabase db = new StandardSQLiteDatabase(getWritableDatabase()); // このタイミングでDBが生成され、onCreateが呼び出される
Logger.i(TAG, "open communication database completed.");
if (!isCreated()) {
throw new ABVRuntimeException("Can't open or create database.", getLastError());
}
return db;
}
}
...@@ -6,10 +6,12 @@ import jp.agentec.abook.abv.bl.common.Constant; ...@@ -6,10 +6,12 @@ import jp.agentec.abook.abv.bl.common.Constant;
import jp.agentec.abook.abv.bl.common.Constant.AspectType; import jp.agentec.abook.abv.bl.common.Constant.AspectType;
import jp.agentec.abook.abv.bl.common.db.SQLiteDatabase; import jp.agentec.abook.abv.bl.common.db.SQLiteDatabase;
import jp.agentec.abook.abv.bl.common.db.SQLiteOpenHelper; import jp.agentec.abook.abv.bl.common.db.SQLiteOpenHelper;
import jp.agentec.abook.abv.bl.common.db.impl.CommunicationSQLiteOpenHelper;
import jp.agentec.abook.abv.bl.common.db.impl.StandardSQLiteOpenHelper; import jp.agentec.abook.abv.bl.common.db.impl.StandardSQLiteOpenHelper;
import jp.agentec.abook.abv.bl.common.exception.ABVException; import jp.agentec.abook.abv.bl.common.exception.ABVException;
import jp.agentec.abook.abv.bl.common.log.LogLevel; import jp.agentec.abook.abv.bl.common.log.LogLevel;
import jp.agentec.abook.abv.bl.common.log.Logger; import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.data.CommunicationDBConnector;
import jp.agentec.abook.abv.bl.data.DBConnector; import jp.agentec.abook.abv.bl.data.DBConnector;
import jp.agentec.abook.abv.cl.environment.DeviceInfo; import jp.agentec.abook.abv.cl.environment.DeviceInfo;
import jp.agentec.abook.abv.cl.environment.NetworkAdapter; import jp.agentec.abook.abv.cl.environment.NetworkAdapter;
...@@ -148,6 +150,7 @@ public class Initializer { ...@@ -148,6 +150,7 @@ public class Initializer {
public void initDB() { public void initDB() {
// DBを開く。マイグレーションがあれば実行されるようにする。 // DBを開く。マイグレーションがあれば実行されるようにする。
DBConnector conn = DBConnector.getInstance(); DBConnector conn = DBConnector.getInstance();
CommunicationDBConnector communicationConn = CommunicationDBConnector.getInstance();
if (!conn.isOpen()) { if (!conn.isOpen()) {
Logger.i(TAG, "initDB start"); Logger.i(TAG, "initDB start");
SQLiteOpenHelper sqlLiteOpenHelper = new StandardSQLiteOpenHelper(context, DBConnector.DatabaseName, DBConnector.DatabaseVersion); SQLiteOpenHelper sqlLiteOpenHelper = new StandardSQLiteOpenHelper(context, DBConnector.DatabaseName, DBConnector.DatabaseVersion);
...@@ -156,6 +159,15 @@ public class Initializer { ...@@ -156,6 +159,15 @@ public class Initializer {
db.execSQL("PRAGMA foreign_keys=ON;journal_mode=WAL;synchronous=OFF;"); // foreign keyを有効,ジャーナルモードをWAL,書き込み非同期にする db.execSQL("PRAGMA foreign_keys=ON;journal_mode=WAL;synchronous=OFF;"); // foreign keyを有効,ジャーナルモードをWAL,書き込み非同期にする
Logger.i(TAG, "initDB end"); Logger.i(TAG, "initDB end");
} }
if (!communicationConn.isOpen()) {
Logger.i(TAG, "Comm initDB start");
SQLiteOpenHelper commSqlLiteOpenHelper = new CommunicationSQLiteOpenHelper(context, CommunicationDBConnector.DatabaseName, DBConnector.DatabaseVersion);
communicationConn.setSqlLiteOpenHelper(commSqlLiteOpenHelper);
SQLiteDatabase commDb = conn.getDatabase();
commDb.execSQL("PRAGMA foreign_keys=ON;journal_mode=WAL;synchronous=OFF;"); // foreign keyを有効,ジャーナルモードをWAL,書き込み非同期にする
Logger.i(TAG, "Comm initDB end");
}
} }
protected String s(int id) { protected String s(int id) {
......
...@@ -132,6 +132,7 @@ public class ChatWebviewActivity extends ParentWebViewActivity { ...@@ -132,6 +132,7 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
private boolean isOnline; private boolean isOnline;
private Long roomId; private Long roomId;
private String roomType; private String roomType;
private String groupId;
private String beforeRoomType; private String beforeRoomType;
private Integer shopMemberId; private Integer shopMemberId;
private String selectedUserIdList; private String selectedUserIdList;
...@@ -161,13 +162,12 @@ public class ChatWebviewActivity extends ParentWebViewActivity { ...@@ -161,13 +162,12 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
private void initializeWebView() { private void initializeWebView() {
initiateDatas(getIntent()); initiateDatas(getIntent());
setupDefaultChatWebViewURL();
setupChatWebView(); setupChatWebView();
registChatRoomPageLoader();
registJSReactor(); registJSReactor();
addDownloadListener(); addDownloadListener();
observeNetworkChange(); observeNetworkChange();
loadWebViewResource(); loadWebViewResource();
setupDefaultChatWebViewURL();
} }
private void initiateDatas(Intent intent) { private void initiateDatas(Intent intent) {
...@@ -188,6 +188,7 @@ public class ChatWebviewActivity extends ParentWebViewActivity { ...@@ -188,6 +188,7 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
} }
chatWebviewUrl = NETWORK_ERROR_PLACE_HOLDER; chatWebviewUrl = NETWORK_ERROR_PLACE_HOLDER;
if (!ABVEnvironment.getInstance().networkAdapter.isNetworkConnected()) { if (!ABVEnvironment.getInstance().networkAdapter.isNetworkConnected()) {
registChatRoomPageLoader();
Logger.d("DEVICE_NOT_CONNECTED_NETWORK:"); Logger.d("DEVICE_NOT_CONNECTED_NETWORK:");
return; return;
} }
...@@ -212,6 +213,16 @@ public class ChatWebviewActivity extends ParentWebViewActivity { ...@@ -212,6 +213,16 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
updateAllGroupInfo(); updateAllGroupInfo();
updateFavoriteInfo(); updateFavoriteInfo();
shopMemberId = communicationLogic.getMyShopMemberDto().shopMemberId; shopMemberId = communicationLogic.getMyShopMemberDto().shopMemberId;
runOnUiThread(new Runnable() {
@Override
public void run() {
try {
registChatRoomPageLoader();
} catch (Exception e) {
Logger.d("registChatRoomPageLoader Error");
}
}
});
closeProgressPopup(); closeProgressPopup();
} catch (Exception e) { } catch (Exception e) {
Logger.d("Update error"); Logger.d("Update error");
...@@ -224,6 +235,7 @@ public class ChatWebviewActivity extends ParentWebViewActivity { ...@@ -224,6 +235,7 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
mChatWebView = findViewById(R.id.chatWebview2); mChatWebView = findViewById(R.id.chatWebview2);
mChatWebView.setOverScrollMode(View.OVER_SCROLL_NEVER); //オーバースクロールしない。 mChatWebView.setOverScrollMode(View.OVER_SCROLL_NEVER); //オーバースクロールしない。
mChatWebView.setVerticalScrollBarEnabled(false); //スクロールバーを消す。 mChatWebView.setVerticalScrollBarEnabled(false); //スクロールバーを消す。
mChatWebView.addJavascriptInterface(jsInf, "android");
WebSettings settings = mChatWebView.getSettings(); WebSettings settings = mChatWebView.getSettings();
settings.setJavaScriptEnabled(true); //Javascriptを有効にする。 settings.setJavaScriptEnabled(true); //Javascriptを有効にする。
settings.setAppCacheEnabled(true); settings.setAppCacheEnabled(true);
...@@ -250,7 +262,6 @@ public class ChatWebviewActivity extends ParentWebViewActivity { ...@@ -250,7 +262,6 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
// 最後のチャットのルーム // 最後のチャットのルーム
String lastRoomId = PreferenceUtil.getUserPref(getApplicationContext(), AppDefType.UserPrefKey.CHAT_LAST_ROOMID, ""); String lastRoomId = PreferenceUtil.getUserPref(getApplicationContext(), AppDefType.UserPrefKey.CHAT_LAST_ROOMID, "");
mChatWebView.addJavascriptInterface(jsInf, "android");
String fixedParam = "&platform=android&isMobile=true&chatServerUrl=" + ABVEnvironment.getInstance().websocketServerHttpUrl; String fixedParam = "&platform=android&isMobile=true&chatServerUrl=" + ABVEnvironment.getInstance().websocketServerHttpUrl;
//ページをロード //ページをロード
if (roomId != 0 && roomName != null) { // by push message if (roomId != 0 && roomName != null) { // by push message
...@@ -1325,6 +1336,16 @@ public class ChatWebviewActivity extends ParentWebViewActivity { ...@@ -1325,6 +1336,16 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
} }
@JavascriptInterface @JavascriptInterface
public String getToMoveGroupId() {
return groupId;
}
@JavascriptInterface
public void setToMoveGroupId(String moveToGroupId) {
groupId = moveToGroupId;
}
@JavascriptInterface
public String getContentList() { public String getContentList() {
return communicationLogic.getContentList(); return communicationLogic.getContentList();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment