Commit cd300e10 by Lee Munkyeong

コードレビュー対応。

parent a368af94
......@@ -39,40 +39,39 @@ public class RoomListJSON extends AcmsCommonJSON {
protected void parse(JSONObject json) throws JSONValidationException {
// ルーム一覧情報を取得
if (json.has(Body)) {
JSONArray roomListJsonArray = json.getJSONObject(Body).getJSONArray(ChatRoomInfoList);
if (roomListJsonArray != null) {
roomList = new ArrayList<ChatRoomDto>();
for (int listCount = 0; listCount < roomListJsonArray.length(); listCount++) {
if (roomListJsonArray.getJSONObject(listCount).length() == 0) {
break;
}
ChatRoomDto chatRoomDto = new ChatRoomDto();
ChatMessageDto chatMessageDto = new ChatMessageDto();
if (!json.has(Body)) { return; }
chatRoomDto.chatRoomId = roomListJsonArray.getJSONObject(listCount).getInt(RoomId);
chatRoomDto.chatRoomName = roomListJsonArray.getJSONObject(listCount).getString(RoomName);
chatRoomDto.type = roomListJsonArray.getJSONObject(listCount).getInt(RoomType);
chatRoomDto.unreadCount = roomListJsonArray.getJSONObject(listCount).has(UnreadCount) ? roomListJsonArray.getJSONObject(listCount).getInt(UnreadCount) : 0;
chatRoomDto.userCount = roomListJsonArray.getJSONObject(listCount).getJSONArray(AttendUsers).length();
JSONArray roomListJsonArray = json.getJSONObject(Body).getJSONArray(ChatRoomInfoList);
if (roomListJsonArray == null) { return; }
//最後メッセージ情報がある場合の処理
JSONObject lastMessageInfoJSON = roomListJsonArray.getJSONObject(listCount).has(LastMessageInfo) ? roomListJsonArray.getJSONObject(listCount).getJSONObject(LastMessageInfo) : null;
if (lastMessageInfoJSON != null && lastMessageInfoJSON.has(MessageId)) {
chatMessageDto.chatRoomId = chatRoomDto.chatRoomId;
chatMessageDto.message = lastMessageInfoJSON.getString(Message);
chatMessageDto.messageType = lastMessageInfoJSON.getInt(MessageType);
if (lastMessageInfoJSON.has(InsertDate)) {
chatMessageDto.insertDate = DateTimeUtil.millToDateString(lastMessageInfoJSON.getJSONObject(InsertDate).getLong(Time));
}
chatMessageDto.shopMemberId = lastMessageInfoJSON.getInt(ShopMemberId);
chatMessageDto.chatMessageId = lastMessageInfoJSON.getInt(MessageId);
chatRoomDto.lastMessageInfo = chatMessageDto;
}
roomList = new ArrayList<ChatRoomDto>();
for (int listCount = 0; listCount < roomListJsonArray.length(); listCount++) {
if (roomListJsonArray.getJSONObject(listCount).length() == 0) {
break;
}
ChatRoomDto chatRoomDto = new ChatRoomDto();
ChatMessageDto chatMessageDto = new ChatMessageDto();
chatRoomDto.chatRoomId = roomListJsonArray.getJSONObject(listCount).getInt(RoomId);
chatRoomDto.chatRoomName = roomListJsonArray.getJSONObject(listCount).getString(RoomName);
chatRoomDto.type = roomListJsonArray.getJSONObject(listCount).getInt(RoomType);
chatRoomDto.unreadCount = roomListJsonArray.getJSONObject(listCount).has(UnreadCount) ? roomListJsonArray.getJSONObject(listCount).getInt(UnreadCount) : 0;
chatRoomDto.userCount = roomListJsonArray.getJSONObject(listCount).getJSONArray(AttendUsers).length();
roomList.add(chatRoomDto);
//最後メッセージ情報がある場合の処理
JSONObject lastMessageInfoJSON = roomListJsonArray.getJSONObject(listCount).has(LastMessageInfo) ? roomListJsonArray.getJSONObject(listCount).getJSONObject(LastMessageInfo) : null;
if (lastMessageInfoJSON != null && lastMessageInfoJSON.has(MessageId)) {
chatMessageDto.chatRoomId = chatRoomDto.chatRoomId;
chatMessageDto.message = lastMessageInfoJSON.getString(Message);
chatMessageDto.messageType = lastMessageInfoJSON.getInt(MessageType);
if (lastMessageInfoJSON.has(InsertDate)) {
chatMessageDto.insertDate = DateTimeUtil.millToDateString(lastMessageInfoJSON.getJSONObject(InsertDate).getLong(Time));
}
chatMessageDto.shopMemberId = lastMessageInfoJSON.getInt(ShopMemberId);
chatMessageDto.chatMessageId = lastMessageInfoJSON.getInt(MessageId);
chatRoomDto.lastMessageInfo = chatMessageDto;
}
roomList.add(chatRoomDto);
}
}
}
......
......@@ -15,18 +15,17 @@ public class ChatMessageDto extends AbstractDto {
@Override
public Object[] getInsertValues() {
Object[] test = new Object[]{chatMessageId, chatRoomId, shopMemberId, message, messageType, imageName, downloadFileName, savePath, insertDate};
return new Object[]{chatMessageId, chatRoomId, shopMemberId, message, messageType, imageName, downloadFileName, savePath, insertDate};
return new Object[] { chatMessageId, chatRoomId, shopMemberId, message, messageType, imageName, downloadFileName, savePath, insertDate };
}
@Override
public Object[] getUpdateValues() {
return new Object[]{chatRoomId, shopMemberId, message, messageType, imageName, downloadFileName, savePath, insertDate, chatMessageId};
return new Object[] { chatRoomId, shopMemberId, message, messageType, imageName, downloadFileName, savePath, insertDate, chatMessageId };
}
@Override
public String[] getKeyValues() {
return new String[]{""+ chatMessageId};
return new String[]{ "" + chatMessageId };
}
}
......@@ -18,17 +18,17 @@ public class ChatRoomDto extends AbstractDto {
@Override
public Object[] getInsertValues() {
return new Object[]{chatRoomId, chatRoomName, type, unreadCount, userCount, favoriteRegisterDate};
return new Object[] { chatRoomId, chatRoomName, type, unreadCount, userCount, favoriteRegisterDate };
}
@Override
public Object[] getUpdateValues() {
return new Object[]{favoriteRegisterDate, chatRoomName, type, unreadCount, userCount, chatRoomId};
return new Object[] { favoriteRegisterDate, chatRoomName, type, unreadCount, userCount, chatRoomId };
}
@Override
public String[] getKeyValues() {
return new String[]{""+ chatRoomId};
return new String[] { "" + chatRoomId };
}
}
......@@ -8,17 +8,17 @@ public class CollaborationDetailDto extends AbstractDto {
@Override
public Object[] getInsertValues() {
return new Object[]{collaborationDetialId, collaborationId, collaborationType, collaborationDuration};
return new Object[] { collaborationDetialId, collaborationId, collaborationType, collaborationDuration };
}
@Override
public Object[] getUpdateValues() {
return new Object[]{collaborationDuration, collaborationId, collaborationType, collaborationDetialId};
return new Object[] { collaborationDuration, collaborationId, collaborationType, collaborationDetialId };
}
@Override
public String[] getKeyValues() {
return new String[]{""+ collaborationDetialId};
return new String[]{ "" + collaborationDetialId };
}
}
......@@ -10,17 +10,17 @@ public class ShopMemberDto extends AbstractDto {
@Override
public Object[] getInsertValues() {
return new Object[]{shopMemberId, shopMemberName, profileUrl, favoriteRegisterDate};
return new Object[] { shopMemberId, shopMemberName, profileUrl, favoriteRegisterDate };
}
@Override
public Object[] getUpdateValues() {
return new Object[]{shopMemberName, profileUrl, favoriteRegisterDate, shopMemberId};
return new Object[] { shopMemberName, profileUrl, favoriteRegisterDate, shopMemberId };
}
@Override
public String[] getKeyValues() {
return new String[]{""+ shopMemberId};
return new String[]{ "" + shopMemberId };
}
}
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