Commit d75dff25 by yuichiro ogawa

#38496 担当グループ参照

parent c2abc033
...@@ -34,6 +34,7 @@ public class ABookKeys { ...@@ -34,6 +34,7 @@ public class ABookKeys {
public static final String CMD_MOVE_PAGE = "movePage"; public static final String CMD_MOVE_PAGE = "movePage";
public static final String CMD_SHOW_RELATED_CONTENT = "showRelatedContent"; public static final String CMD_SHOW_RELATED_CONTENT = "showRelatedContent";
public static final String CMD_PAGE_NUM = "pageNum"; public static final String CMD_PAGE_NUM = "pageNum";
public static final String CMD_GET_GROUP_TREE_INFO = "getGroupTreeInfo";
public static final String GPS_TYPE = "gpsType"; public static final String GPS_TYPE = "gpsType";
public static final String STATUS_CODE = "statusCode"; public static final String STATUS_CODE = "statusCode";
......
package jp.agentec.abook.abv.bl.logic; package jp.agentec.abook.abv.bl.logic;
import org.json.adf.JSONObject;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
...@@ -25,30 +27,31 @@ import jp.agentec.adf.util.StringUtil; ...@@ -25,30 +27,31 @@ import jp.agentec.adf.util.StringUtil;
public class GroupLogic extends AbstractLogic { public class GroupLogic extends AbstractLogic {
private static final java.lang.String TAG = "GroupLogic"; private static final java.lang.String TAG = "GroupLogic";
private GroupDao groupDao = AbstractDao.getDao(GroupDao.class); private GroupDao groupDao = AbstractDao.getDao(GroupDao.class);
private ContentDao contentDao = AbstractDao.getDao(ContentDao.class); private ContentDao contentDao = AbstractDao.getDao(ContentDao.class);
private OperationDao mOperationDao = AbstractDao.getDao(OperationDao.class); private OperationDao mOperationDao = AbstractDao.getDao(OperationDao.class);
public Integer[] getServerUserGroupIds(String sid) throws NetworkDisconnectedException, ABVException { public Integer[] getServerUserGroupIds(String sid) throws NetworkDisconnectedException, ABVException {
AcmsParameters param = new AcmsParameters(sid); AcmsParameters param = new AcmsParameters(sid);
return AcmsClient.getInstance(cache.getUrlPath(), networkAdapter).userGroup(param); return AcmsClient.getInstance(cache.getUrlPath(), networkAdapter).userGroup(param);
} }
/** /**
* グループ情報をサーバから受信し、ローカルに保存します。既存のデータは上書きされます。また、サーバにないグループがローカルにある場合、そのグループは削除されます。 * グループ情報をサーバから受信し、ローカルに保存します。既存のデータは上書きされます。また、サーバにないグループがローカルにある場合、そのグループは削除されます。
* @throws ABVException キャッシュにユーザ情報がありません。再度ログインする必要があります。 *
* @throws AcmsException * @throws ABVException  キャッシュにユーザ情報がありません。再度ログインする必要があります。
* @throws Exception その他、例外です。 * @throws AcmsException
* @since 1.0.0 * @throws Exception その他、例外です。
*/ * @since 1.0.0
public void initializeGroups() throws NetworkDisconnectedException, AcmsException { */
AcmsParameters param = new AcmsParameters(cache.getMemberInfo().sid); public void initializeGroups() throws NetworkDisconnectedException, AcmsException {
List<GroupDto> serverGroups = AcmsClient.getInstance(cache.getUrlPath(), networkAdapter).group(param); AcmsParameters param = new AcmsParameters(cache.getMemberInfo().sid);
ContentGroupDao contentGroupDao = AbstractDao.getDao(ContentGroupDao.class); List<GroupDto> serverGroups = AcmsClient.getInstance(cache.getUrlPath(), networkAdapter).group(param);
ContentGroupDao contentGroupDao = AbstractDao.getDao(ContentGroupDao.class);
if (serverGroups == null || serverGroups.size() == 0) {
if (serverGroups == null || serverGroups.size() == 0) {
Logger.w(TAG, "Group Data is Nothing"); Logger.w(TAG, "Group Data is Nothing");
return; return;
} }
try { try {
groupDao.beginTransaction(); groupDao.beginTransaction();
...@@ -126,32 +129,49 @@ public class GroupLogic extends AbstractLogic { ...@@ -126,32 +129,49 @@ public class GroupLogic extends AbstractLogic {
throw new RuntimeException(e); throw new RuntimeException(e);
} finally { } finally {
} }
} }
//해당 콘텐츠 아이디를 가지고 있는 그룹정보 //해당 콘텐츠 아이디를 가지고 있는 그룹정보
public ArrayList<String>getExistContentsGroupInfo(long contentId) { public ArrayList<String> getExistContentsGroupInfo(long contentId) {
List<GroupDto>groupDtoList = groupDao.getExistContentGroup(contentId); List<GroupDto> groupDtoList = groupDao.getExistContentGroup(contentId);
ArrayList<String>groupList = new ArrayList<String>(); ArrayList<String> groupList = new ArrayList<String>();
for (GroupDto groupDto : groupDtoList) { for (GroupDto groupDto : groupDtoList) {
groupList.add(groupDto.groupName); groupList.add(groupDto.groupName);
} }
return groupList; return groupList;
} }
public Integer[] getLocalUserGroupIds() { public Integer[] getLocalUserGroupIds() {
List<GroupDto> userGroupList = groupDao.getUserGroups(); List<GroupDto> userGroupList = groupDao.getUserGroups();
TreeSet<Integer> userGroupIdSet = new TreeSet<Integer>(); TreeSet<Integer> userGroupIdSet = new TreeSet<Integer>();
for (GroupDto groupDto : userGroupList) { for (GroupDto groupDto : userGroupList) {
userGroupIdSet.add(groupDto.groupId); userGroupIdSet.add(groupDto.groupId);
} }
return userGroupIdSet.toArray(new Integer[userGroupIdSet.size()]); return userGroupIdSet.toArray(new Integer[userGroupIdSet.size()]);
} }
public AcmsMessageJSON addMemberGroup(String groupName) throws AcmsException, NetworkDisconnectedException { public AcmsMessageJSON addMemberGroup(String groupName) throws AcmsException, NetworkDisconnectedException {
AddMemberGroupParameters param = new AddMemberGroupParameters(cache.getMemberInfo().sid, groupName, Locale.getDefault().getLanguage()); AddMemberGroupParameters param = new AddMemberGroupParameters(cache.getMemberInfo().sid, groupName, Locale.getDefault().getLanguage());
return AcmsClient.getInstance(cache.getUrlPath(), networkAdapter).addMemberGroup(param); return AcmsClient.getInstance(cache.getUrlPath(), networkAdapter).addMemberGroup(param);
} }
public List<JSONObject> getAllGroupsJson() {
List<JSONObject> groupList = new ArrayList<JSONObject>();
List<GroupDto> groups = groupDao.getUserGroups();
if (groups != null) {
for (GroupDto groupDto : groups) {
JSONObject group = new JSONObject();
group.put("groupId", groupDto.groupId);
group.put("groupName", groupDto.groupName);
group.put("groupLevel", groupDto.groupLevel);
group.put("parentGroupId", groupDto.parentGroupId);
group.put("contentCount", groupDto.contentCount);
groupList.add(group);
}
}
return groupList;
}
} }
...@@ -13,7 +13,6 @@ import android.provider.MediaStore; ...@@ -13,7 +13,6 @@ import android.provider.MediaStore;
import android.view.Gravity; import android.view.Gravity;
import android.view.KeyEvent; import android.view.KeyEvent;
import android.view.MotionEvent; import android.view.MotionEvent;
import android.view.OrientationEventListener;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.AdapterView; import android.widget.AdapterView;
...@@ -52,6 +51,7 @@ import jp.agentec.abook.abv.bl.dto.OperationDto; ...@@ -52,6 +51,7 @@ import jp.agentec.abook.abv.bl.dto.OperationDto;
import jp.agentec.abook.abv.bl.dto.OperationTaskDto; import jp.agentec.abook.abv.bl.dto.OperationTaskDto;
import jp.agentec.abook.abv.bl.logic.AbstractLogic; import jp.agentec.abook.abv.bl.logic.AbstractLogic;
import jp.agentec.abook.abv.bl.logic.ContentReadingLogLogic; import jp.agentec.abook.abv.bl.logic.ContentReadingLogLogic;
import jp.agentec.abook.abv.bl.logic.GroupLogic;
import jp.agentec.abook.abv.bl.logic.OperationLogic; import jp.agentec.abook.abv.bl.logic.OperationLogic;
import jp.agentec.abook.abv.bl.websocket.MeetingManager; import jp.agentec.abook.abv.bl.websocket.MeetingManager;
import jp.agentec.abook.abv.cl.environment.DeviceInfo; import jp.agentec.abook.abv.cl.environment.DeviceInfo;
...@@ -85,6 +85,8 @@ import jp.agentec.adf.util.StringUtil; ...@@ -85,6 +85,8 @@ import jp.agentec.adf.util.StringUtil;
public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity { public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
protected static GroupLogic groupLogic = AbstractLogic.getLogic(GroupLogic.class);
private static final String TAG ="ABVContentViewActivity"; private static final String TAG ="ABVContentViewActivity";
public final static int ABOOK_CHECK_TASK_IMAGE = 103; public final static int ABOOK_CHECK_TASK_IMAGE = 103;
public final static int ABOOK_CHECK_TASK_VIDEO = 104; public final static int ABOOK_CHECK_TASK_VIDEO = 104;
...@@ -1088,6 +1090,9 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity { ...@@ -1088,6 +1090,9 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
Logger.e(TAG, "startContentActivity failed.", e); Logger.e(TAG, "startContentActivity failed.", e);
ErrorMessage.showErrorMessageToast(getApplicationContext(), ErrorCode.E107); ErrorMessage.showErrorMessageToast(getApplicationContext(), ErrorCode.E107);
} }
} else if (mCmd.equals(ABookKeys.CMD_GET_GROUP_TREE_INFO)) {
List<JSONObject> groups = groupLogic.getAllGroupsJson();
afterABookCheckApi(mCmd, null, 0, "getAllGroups", groups.toString());
} }
} }
......
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