Commit d75dff25 by yuichiro ogawa

#38496 担当グループ参照

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