Commit 712afa1f by Lee Munkyeong

ルーム名更新

parent 349ec5cb
...@@ -18,6 +18,7 @@ import jp.agentec.abook.abv.bl.acms.client.json.ApertureMasterDataJSON; ...@@ -18,6 +18,7 @@ import jp.agentec.abook.abv.bl.acms.client.json.ApertureMasterDataJSON;
import jp.agentec.abook.abv.bl.acms.client.json.AppLatestVersionJSON; import jp.agentec.abook.abv.bl.acms.client.json.AppLatestVersionJSON;
import jp.agentec.abook.abv.bl.acms.client.json.AuthLevelJSON; import jp.agentec.abook.abv.bl.acms.client.json.AuthLevelJSON;
import jp.agentec.abook.abv.bl.acms.client.json.CategoriesJSON; import jp.agentec.abook.abv.bl.acms.client.json.CategoriesJSON;
import jp.agentec.abook.abv.bl.acms.client.json.ChangeRoomNameJSON;
import jp.agentec.abook.abv.bl.acms.client.json.ChatPushDataJSON; import jp.agentec.abook.abv.bl.acms.client.json.ChatPushDataJSON;
import jp.agentec.abook.abv.bl.acms.client.json.ContentCheckDeliverableJSON; import jp.agentec.abook.abv.bl.acms.client.json.ContentCheckDeliverableJSON;
import jp.agentec.abook.abv.bl.acms.client.json.ContentVersionsJSON; import jp.agentec.abook.abv.bl.acms.client.json.ContentVersionsJSON;
...@@ -47,6 +48,7 @@ import jp.agentec.abook.abv.bl.acms.client.parameters.AcmsContentParameters; ...@@ -47,6 +48,7 @@ import jp.agentec.abook.abv.bl.acms.client.parameters.AcmsContentParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.AcmsParameters; import jp.agentec.abook.abv.bl.acms.client.parameters.AcmsParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.AddMemberGroupParameters; import jp.agentec.abook.abv.bl.acms.client.parameters.AddMemberGroupParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.AppStoreNewLoginParameters; import jp.agentec.abook.abv.bl.acms.client.parameters.AppStoreNewLoginParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.ChangeRoomNameParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.CheckSendLogParameters; import jp.agentec.abook.abv.bl.acms.client.parameters.CheckSendLogParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.ContentReadingLogParameters; import jp.agentec.abook.abv.bl.acms.client.parameters.ContentReadingLogParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.DeleteProcessParameters; import jp.agentec.abook.abv.bl.acms.client.parameters.DeleteProcessParameters;
...@@ -615,6 +617,22 @@ public class AcmsClient implements AcmsClientResponseListener { ...@@ -615,6 +617,22 @@ public class AcmsClient implements AcmsClientResponseListener {
} }
/** /**
* ルーム名更新。
*
* @param sid
* @param newRoomName
* @param roomId
* @return
* @throws NetworkDisconnectedException
* @throws AcmsException
*/
public ChangeRoomNameJSON changeRoomName(String sid, String newRoomName, Integer roomId) throws NetworkDisconnectedException, AcmsException {
HttpResponse response = send(AcmsApis.ApigetChatRooms, new ChangeRoomNameParameters(sid, AcmsApis.RoomCmds.changeRoomName, newRoomName, roomId));
ChangeRoomNameJSON json = new ChangeRoomNameJSON(response.httpResponseBody);
return json;
}
/**
* ルーム作成。 * ルーム作成。
* *
* @param sid * @param sid
......
package jp.agentec.abook.abv.bl.acms.client.json;
import org.json.adf.JSONArray;
import org.json.adf.JSONObject;
import java.util.ArrayList;
import jp.agentec.abook.abv.bl.common.constant.ABookCommConstants;
import jp.agentec.abook.abv.bl.common.exception.AcmsException;
import jp.agentec.abook.abv.bl.common.exception.JSONValidationException;
import jp.agentec.abook.abv.bl.dto.ShopMemberDto;
public class ChangeRoomNameJSON extends AcmsCommonJSON {
public Integer status;
public ChangeRoomNameJSON(String jsonString) throws AcmsException {
super(jsonString);
}
@Override
protected void parse(JSONObject json) throws JSONValidationException {
if (!json.has(ABookCommConstants.KEY.HTTP_STATUS)) { return; }
status = json.getInt(ABookCommConstants.KEY.HTTP_STATUS);
}
}
package jp.agentec.abook.abv.bl.acms.client.parameters;
import jp.agentec.adf.net.http.HttpParameterObject;
/**
* ACMSのAPIに渡す共通的なパラメータを格納します。ACMSのAPIのパラメータ用クラスを作成するときはこのクラスを継承してください。<br>
* ただし、このクラスはログイン状態の確認用として使われる {@link ChangeRoomNameParameters#sid} を持っているため、ログイン用のパラメータ {@link MobileLoginParameters} は、このクラスを継承する必要はありません。
* @author lee-mk
* @version 1.0.0
*/
public class ChangeRoomNameParameters extends HttpParameterObject {
/**
* セッションID
* @since 1.0.0
*/
private String sid;
private String cmd;
private String newRoomName;
private Integer roomId;
/**
* {@link ChangeRoomNameParameters} のインスタンスを初期化します。
* @param sid ログインした時のセッションIDです。
* @param newRoomName ルーム名。
* @param roomId ルームID。
* @since 1.0.0
*/
public ChangeRoomNameParameters(String sid, String cmd, String newRoomName, Integer roomId) {
this.sid = sid;
this.cmd = cmd;
this.newRoomName = newRoomName;
this.roomId = roomId;
}
/**
* セッションIDを返します。
* @return ログインした時のセッションIDです。
* @since 1.0.0
*/
public String getSid() {
return sid;
}
/**
* アクションコマンドを返します。
* @return APIのアクションコマンドです。
* @since 1.0.0
*/
public String getCmd() {
return cmd;
}
/**
* ルーム名を返します。
* @return ルーム名です。
* @since 1.0.0
*/
public String getNewRoomName() {
return newRoomName;
}
/**
* ルームIDを返します。
* @return 変更対象のルームIDです。
* @since 1.0.0
*/
public Integer getRoomId() {
return roomId;
}
}
...@@ -184,6 +184,7 @@ public class AcmsApis { ...@@ -184,6 +184,7 @@ public class AcmsApis {
public static final class RoomCmds { public static final class RoomCmds {
public static final String getRoomList = "5"; public static final String getRoomList = "5";
public static final String createRoom = "2"; public static final String createRoom = "2";
public static final String changeRoomName = "6";
} }
public static final class MessageCmds { public static final class MessageCmds {
......
...@@ -58,7 +58,7 @@ public interface ABookCommConstants { ...@@ -58,7 +58,7 @@ public interface ABookCommConstants {
String ROOT_GROUP_ID = "rootGroupId"; String ROOT_GROUP_ID = "rootGroupId";
String HTTP_STATUS = "httpStatus";
interface API_KIND { interface API_KIND {
String USER = "user"; String USER = "user";
String ROOM = "room"; String ROOM = "room";
......
...@@ -148,6 +148,10 @@ public class ChatRoomDao extends AbstractDao { ...@@ -148,6 +148,10 @@ public class ChatRoomDao extends AbstractDao {
insert("insert or replace into t_chat_room (chat_room_id, chat_room_name, type, unread_count, user_count, favorite_register_date) values (?,?,?,?,?,?)", dto.getInsertValues()); insert("insert or replace into t_chat_room (chat_room_id, chat_room_name, type, unread_count, user_count, favorite_register_date) values (?,?,?,?,?,?)", dto.getInsertValues());
} }
public void updateChatRoomName(String roomName, Integer roomId) {
update("update t_chat_room set chat_room_name = ? where chat_room_id = ?", new Object[]{roomName, roomId});
}
public void insertChatRoom(List<ChatRoomDto> chatRoomDtoList) { public void insertChatRoom(List<ChatRoomDto> chatRoomDtoList) {
try { try {
beginTransaction(); beginTransaction();
......
...@@ -546,7 +546,7 @@ public class GroupDao extends AbstractDao { ...@@ -546,7 +546,7 @@ public class GroupDao extends AbstractDao {
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 = ?)", new String[]{""+ parentId}, GroupDto.class); list = rawQueryGetDtoList("select * from m_group mg where (mg.parent_group_id = ?) ORDER BY group_name", new String[]{""+ parentId}, GroupDto.class);
return list; return list;
} }
...@@ -563,7 +563,7 @@ public class GroupDao extends AbstractDao { ...@@ -563,7 +563,7 @@ public class GroupDao extends AbstractDao {
} }
public List<GroupDto> getUserGroups() { public List<GroupDto> getUserGroups() {
return rawQueryGetDtoList("select * from m_group where user_group_flg = 1", null, GroupDto.class); return rawQueryGetDtoList("select * from m_group where user_group_flg = 1 ORDER BY group_name", null, GroupDto.class);
} }
/** /**
......
...@@ -437,6 +437,10 @@ public class CommunicationLogic extends AbstractLogic { ...@@ -437,6 +437,10 @@ public class CommunicationLogic extends AbstractLogic {
chatRoomDao.insertChatRoom(chatRoomDto); chatRoomDao.insertChatRoom(chatRoomDto);
} }
public void updateChatRoomName(String roomName, Integer roomId) {
chatRoomDao.updateChatRoomName(roomName, roomId);
}
public void insertShopMember(ShopMemberDto shopMemberDto) { public void insertShopMember(ShopMemberDto shopMemberDto) {
ShopMemberDto myInfo = shopMemberDao.getMyInfo(); ShopMemberDto myInfo = shopMemberDao.getMyInfo();
if (myInfo.shopMemberId.equals(shopMemberDto.shopMemberId)) { if (myInfo.shopMemberId.equals(shopMemberDto.shopMemberId)) {
......
...@@ -29,6 +29,8 @@ import android.widget.ImageView; ...@@ -29,6 +29,8 @@ import android.widget.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.Toast; import android.widget.Toast;
import org.json.adf.HTTP;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
...@@ -36,6 +38,7 @@ import java.util.Map; ...@@ -36,6 +38,7 @@ import java.util.Map;
import java.util.Objects; import java.util.Objects;
import jp.agentec.abook.abv.bl.acms.client.AcmsClient; import jp.agentec.abook.abv.bl.acms.client.AcmsClient;
import jp.agentec.abook.abv.bl.acms.client.json.ChangeRoomNameJSON;
import jp.agentec.abook.abv.bl.acms.client.json.CreatedRoomJSON; import jp.agentec.abook.abv.bl.acms.client.json.CreatedRoomJSON;
import jp.agentec.abook.abv.bl.acms.client.json.GetFavoriteGroupJSON; import jp.agentec.abook.abv.bl.acms.client.json.GetFavoriteGroupJSON;
import jp.agentec.abook.abv.bl.acms.client.json.GetFavoriteUserJSON; import jp.agentec.abook.abv.bl.acms.client.json.GetFavoriteUserJSON;
...@@ -747,6 +750,15 @@ public class ChatWebviewActivity extends ParentWebViewActivity { ...@@ -747,6 +750,15 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
} }
@JavascriptInterface @JavascriptInterface
public void changeRoomName(String changeRoomName) throws NetworkDisconnectedException, AcmsException {
ChangeRoomNameJSON resultJson = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).changeRoomName(sid, changeRoomName, roomId.intValue());
if (resultJson.status != 200) { return; }
communicationLogic.updateChatRoomName(changeRoomName, roomId.intValue());
joinRoom(roomId.toString(), changeRoomName);
}
@JavascriptInterface
public void joinRoom(String joinRoomId, String joinRoomName) { public void joinRoom(String joinRoomId, String joinRoomName) {
ChatRoomDto chatRoom = communicationLogic.getChatRoom(Integer.parseInt(joinRoomId)); ChatRoomDto chatRoom = communicationLogic.getChatRoom(Integer.parseInt(joinRoomId));
roomId = Long.parseLong(joinRoomId); roomId = Long.parseLong(joinRoomId);
......
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