Commit 3ea100c1 by Jeong Gilmo

Merge branch 'feature/1.1.0_#33721' into features/1.0.500_#33721

parents 2119dc38 f819c828
......@@ -22,6 +22,7 @@ import jp.agentec.abook.abv.bl.acms.client.json.ContentVersionsJSON;
import jp.agentec.abook.abv.bl.acms.client.json.GroupsJSON;
import jp.agentec.abook.abv.bl.acms.client.json.LogSendFlagJSON;
import jp.agentec.abook.abv.bl.acms.client.json.NewAppStoreLoginJSON;
import jp.agentec.abook.abv.bl.acms.client.json.OperationGroupMasterJSON;
import jp.agentec.abook.abv.bl.acms.client.json.ApertureMasterDataJSON;
import jp.agentec.abook.abv.bl.acms.client.json.RequirePasswordChangeJSON;
import jp.agentec.abook.abv.bl.acms.client.json.ResultJSON;
......@@ -618,22 +619,29 @@ public class AcmsClient implements AcmsClientResponseListener {
/**
* パノラマで使用するシーンを登録
* @param sid
* @param contentId
* @param FormFile シーンで使用する画像
* @return
* @throws IOException
* @throws AcmsException
*/
public SceneEntryJSON sceneEntry(String sid, File FormFile) throws IOException, AcmsException, NetworkDisconnectedException {
public SceneEntryJSON sceneEntry(String sid, Long contentId, File FormFile) throws IOException, AcmsException, NetworkDisconnectedException {
if (networkAdapter != null && !networkAdapter.isNetworkConnected()) { // NWのチェック
throw new NetworkDisconnectedException();
}
String apiUrl = AcmsApis.getApiUrl(env.acmsAddress, urlPath, AcmsApis.ApiSceneEntry);
HttpMultipart part1 = new HttpMultipart(ABookKeys.SID, sid);
HttpMultipart part2 = new HttpMultipart(ABookKeys.FORM_FILE, FormFile);
HttpResponse result = HttpRequestSender.post(apiUrl, new HttpMultipart[]{part1, part2});
HttpMultipart part2 = new HttpMultipart(ABookKeys.CONTENT_ID, StringUtil.toString(contentId));
HttpMultipart part3 = new HttpMultipart(ABookKeys.FORM_FILE, FormFile);
HttpResponse result = HttpRequestSender.post(apiUrl, new HttpMultipart[]{part1, part2, part3});
SceneEntryJSON json = new SceneEntryJSON(result.httpResponseBody);
if (json.httpStatus != 200) {
throw new AcmsException(ABVExceptionCode.fromResponseCode(result.httpResponseCode), null);
if (json.errorMessage != null) {
if (json.errorMessage[0].equals("P007")) {
throw new AcmsException(ABVExceptionCode.P_E_ACMS_P007, json);
}
}
throw new AcmsException(ABVExceptionCode.fromResponseCode(result.httpResponseCode), new AcmsMessageJSON(result.httpResponseBody));
}
Logger.d(TAG, "sceneEntry res: %s", json.toString());
......@@ -704,6 +712,32 @@ public class AcmsClient implements AcmsClientResponseListener {
return json;
}
/**
* 作業種別の取得API
* @param param
* @return
* @throws NetworkDisconnectedException
* @throws AcmsException
*/
public OperationGroupMasterJSON getOperationGroupMaster(AcmsParameters param) throws NetworkDisconnectedException, AcmsException {
HttpResponse response = send(AcmsApis.ApiOperationGroupMaster, param);
OperationGroupMasterJSON json = new OperationGroupMasterJSON(response.httpResponseBody);
return json;
}
/**
* ACMSから、絞り検索マスタデータ情報を取得します。
* @param param {@link AcmsParameters} オブジェクトです。
* @return 絞り検索マスタデータを格納したリストを返します。
* @throws NetworkDisconnectedException
* @throws AcmsException
*/
public ApertureMasterDataJSON getApertureMasterData(GetApertureMasterDataParameters param) throws NetworkDisconnectedException, AcmsException {
HttpResponse response = send(AcmsApis.ApiGetApertureMasterData, param);
return new ApertureMasterDataJSON(response.httpResponseBody);
}
/**********************************************************************************************/
/** 以下、共用メソッド---------------------------------------------------------------------- **/
/**********************************************************************************************/
......@@ -965,16 +999,4 @@ public class AcmsClient implements AcmsClientResponseListener {
}
}
}
/**
* ACMSから、絞り検索マスタデータ情報を取得します。
* @param param {@link AcmsParameters} オブジェクトです。
* @return 絞り検索マスタデータを格納したリストを返します。
* @throws NetworkDisconnectedException
* @throws AcmsException
*/
public ApertureMasterDataJSON getApertureMasterData(GetApertureMasterDataParameters param) throws NetworkDisconnectedException, AcmsException {
HttpResponse response = send(AcmsApis.ApiGetApertureMasterData, param);
return new ApertureMasterDataJSON(response.httpResponseBody);
}
}
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.exception.AcmsException;
import jp.agentec.abook.abv.bl.common.exception.JSONValidationException;
import jp.agentec.abook.abv.bl.dto.OperationGroupMasterDto;
import jp.agentec.abook.abv.bl.dto.OperationGroupMasterRelationDto;
/**
* Created by leej on 2019/06/24.
*/
public class OperationGroupMasterJSON extends AcmsCommonJSON {
public static final String OperationGroupMasterList = "operationGroupMasterList";
public static final String OperationGroupMasterId = "operationGroupMasterId";
public static final String OperationGroupMasterName = "operationGroupMasterName";
public static final String OperationGroupMasterLevel = "operationGroupMasterLevel";
public static final String ParentOperationGroupMasterId = "parentOperationGroupMasterId";
public Integer[] userGroupIds;
public ArrayList<OperationGroupMasterDto> operationGroupMasterList;
public OperationGroupMasterJSON(String jsonString) throws AcmsException {
super(jsonString);
}
@Override
protected void parse(JSONObject json) throws JSONValidationException {
operationGroupMasterList = new ArrayList<OperationGroupMasterDto>();
if (json.has(OperationGroupMasterList)) {
JSONArray operationGroupMasterJsonList = json.getJSONArray(OperationGroupMasterList);
for (int i = 0; i < operationGroupMasterJsonList.length(); i++) {
OperationGroupMasterDto dto = new OperationGroupMasterDto();
JSONObject operationGroupMasterJson = operationGroupMasterJsonList.getJSONObject(i);
dto.operationGroupMasterId = getInt(operationGroupMasterJson, OperationGroupMasterId);
dto.operationGroupMasterName = getString(operationGroupMasterJson, OperationGroupMasterName);
dto.operationGroupMasterLevel = getInt(operationGroupMasterJson, OperationGroupMasterLevel);
dto.parentOperationGroupMasterId = getInt(operationGroupMasterJson, ParentOperationGroupMasterId);
operationGroupMasterList.add(dto);
}
}
}
}
......@@ -9,6 +9,7 @@ import java.util.List;
import jp.agentec.abook.abv.bl.common.exception.AcmsException;
import jp.agentec.abook.abv.bl.dto.OperationContentDto;
import jp.agentec.abook.abv.bl.dto.OperationDto;
import jp.agentec.abook.abv.bl.dto.OperationGroupMasterRelationDto;
import jp.agentec.abook.abv.bl.dto.PushMessageDto;
import jp.agentec.abook.abv.bl.dto.TaskWorkerGroupDto;
import jp.agentec.adf.util.DateTimeFormat;
......@@ -56,6 +57,9 @@ public class OperationListJSON extends AcmsCommonJSON {
public static final String EnableAddReport = "enableAddReport";
public static final String OperationGroupMasterIdList = "operationGroupMasterIdList";
public List<OperationDto> operationList;
public OperationListJSON(String jsonString) throws AcmsException {
......@@ -73,6 +77,8 @@ public class OperationListJSON extends AcmsCommonJSON {
OperationDto dto = new OperationDto();
dto.operationContentDtoList = new ArrayList<OperationContentDto>();
dto.taskWorkerGroupDtoList = new ArrayList<TaskWorkerGroupDto>();
dto.operationGroupMasterRelationDtoList = new ArrayList<OperationGroupMasterRelationDto>();
dto.operationId = operationJson.getLong(OperationId);
dto.operationType = operationJson.getInt(OperationType);
dto.operationName = operationJson.getString(OperationName);
......@@ -100,7 +106,7 @@ public class OperationListJSON extends AcmsCommonJSON {
if (operationJson.has(ContentId)) {
// プロジェクト用資料の登録
OperationContentDto operationContentDto = new OperationContentDto();
operationContentDto.operationId = operationJson.getLong(OperationId);
operationContentDto.operationId = dto.operationId;
operationContentDto.contentId = operationJson.getLong(ContentId);
operationContentDto.operationContentFlg = true;
dto.operationContentDtoList.add(operationContentDto);
......@@ -111,7 +117,7 @@ public class OperationListJSON extends AcmsCommonJSON {
for (int k = 0; k < relatedContentJsonArray.length(); k++) {
// 関連資料の登録
OperationContentDto operationContentDto = new OperationContentDto();
operationContentDto.operationId = operationJson.getLong(OperationId);
operationContentDto.operationId = dto.operationId;
operationContentDto.contentId = relatedContentJsonArray.getJSONObject(k).getInt(ContentId);
operationContentDto.operationContentFlg = false;
dto.operationContentDtoList.add(operationContentDto);
......@@ -154,6 +160,17 @@ public class OperationListJSON extends AcmsCommonJSON {
}
}
// 作業種別IDリストをセット
if (operationJson.has(OperationGroupMasterIdList)) {
// 作業種別に紐づく作業種別ID、作業IDセット
JSONArray operationGroupMasterIdJsonArray = operationJson.getJSONArray(OperationGroupMasterIdList);
for (int j = 0; j < operationGroupMasterIdJsonArray.length(); j++) {
OperationGroupMasterRelationDto operationGroupMasterRelationDto = new OperationGroupMasterRelationDto();
operationGroupMasterRelationDto.operationId = dto.operationId;
operationGroupMasterRelationDto.operationGroupMasterId = operationGroupMasterIdJsonArray.getInt(j);
dto.operationGroupMasterRelationDtoList.add(operationGroupMasterRelationDto);
}
}
operationList.add(dto);
}
}
......
......@@ -10,7 +10,7 @@ import jp.agentec.abook.abv.bl.common.exception.JSONValidationException;
* Created by leej on 2018/10/26.
*/
public class SceneEntryJSON extends AcmsCommonJSON {
public class SceneEntryJSON extends AcmsMessageJSON {
private static final String ResourceId = "resourceId";
public Integer resourceId;
......
......@@ -152,7 +152,8 @@ public class AcmsApis {
public static final String ApiGetPushMessages = "getPushMessage";
// 定期点検データ送信
public static final String ApiSendRoutineTaskData = "routineTaskData";
// 作業種別データ取得
public static final String ApiOperationGroupMaster = "operationGroupMaster";
// 絞り検索マスタデータ取得
public static final String ApiGetApertureMasterData = "getApertureMasterData";
......@@ -199,7 +200,7 @@ public class AcmsApis {
} else if (methodName.equals(ApiOperationList) || methodName.equals(ApiWorkingGroupList) || methodName.equals(ApiSendTaskData) || methodName.equals(ApiGetOperationData) ||
methodName.equals(ApiGetTaskFile) || methodName.equals(ApiSceneEntry) || methodName.equals(ApiTaskContentEntry) ||
methodName.equals(ApiSendPushMessage) || methodName.equals(ApiGetPushMessages) || methodName.equals(ApiSendRoutineTaskData) ||
methodName.equals(ApiGetApertureMasterData)) { // 絞り検索マスタデータ取得のAPI
methodName.equals(ApiOperationGroupMaster) || methodName.equals(ApiGetApertureMasterData)) {
apiValue = Constant.ApiValue.checkapi;
}
......
......@@ -147,5 +147,10 @@ public interface ServiceOption {
* 報告タイプ:N(通常)、Y(定期点検)
*/
int OperationReportType = 171;
/**
* 作業種別:N(通常)、Y(作業種別毎に絞り込み可能なボタン・画面表示)
*/
int OperationGroupMaster = 175;
}
}
\ No newline at end of file
......@@ -62,6 +62,8 @@ public class ABVEnvironment {
// Serverから取得したcontentVersion時のリソースパターンを一時的に保存するための変数
public int resourcePatternType;
public boolean operationGroupMasterClearFlg;
////////////////////////////// 定数 //////////////////////////////////
private static final String ServerTimeKey = "ABook";
......@@ -234,6 +236,22 @@ public class ABVEnvironment {
return logLevel;
}
/**
* 作業種別のクリア判定フラグをセット
* @param clearFlg
*/
public void setOperationGroupMasterClearFlg(boolean clearFlg) {
this.operationGroupMasterClearFlg = clearFlg;
}
/**
* 作業種別のクリア判定フラグ取得
* @return
*/
public boolean getOperationGroupMasterClearFlg() {
return operationGroupMasterClearFlg;
}
///////////////////////////////////////     以下ファイルパス関係     ///////////////////////////////////////
......
......@@ -224,7 +224,11 @@ public enum ABVExceptionCode {
/**
* 既に作業報告を行う権限がありません。
*/
P_E_ACMS_P006;
P_E_ACMS_P006,
/**
* ロック中である場合
*/
P_E_ACMS_P007;
/**
* HTTPレスポンスコードから対応するコードを返す
......
......@@ -300,10 +300,6 @@ public class ABVDataCache {
return isServiceOptionEnable(ServiceOptionId.CatalogEdition);
}
public boolean isBizEdition() {
return !isServiceOptionEnable(ServiceOptionId.CatalogEdition) && !isServiceOptionEnable(ServiceOptionId.Publisher);
}
public boolean isReportGPS() {
return isServiceOptionEnable(ServiceOptionId.REPORT_GPS);
}
......@@ -340,6 +336,14 @@ public class ABVDataCache {
return isServiceOptionEnable(ServiceOptionId.PanoImage);
}
/**
* 作業種別のサービスオプション情報取得
* @return
*/
public boolean isOperationGroupMaster() {
return isServiceOptionEnable(ServiceOptionId.OperationGroupMaster);
}
public boolean isServiceOptionEnable(int serviceOptionId) {
ServiceOptionDto dto = getServiceOption(serviceOptionId);
if (dto != null) {
......
......@@ -13,12 +13,14 @@ 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.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.MWorkerGroup;
import jp.agentec.abook.abv.bl.data.tables.ROperationContent;
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.ROperationGroupMasterOperation;
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.TContent;
......@@ -94,6 +96,8 @@ public class ABVDataOpenHelper {
iTableScripts.add(new TTaskReportSend());
iTableScripts.add(new TTaskReportItems());
iTableScripts.add(new TPushMessage());
iTableScripts.add(new MOperationGroupMaster());
iTableScripts.add(new ROperationGroupMasterOperation());
return iTableScripts;
}
......
......@@ -19,7 +19,7 @@ import jp.agentec.abook.abv.bl.common.db.SQLiteDatabase;
public class DBConnector {
private static volatile DBConnector dbConnector = null;
public static final String DatabaseName = "ABVJE";
public static final int DatabaseVersion = DatabaseVersions.Ver1_0_0;
public static final int DatabaseVersion = DatabaseVersions.Ver1_1_0;
protected SQLiteDatabase db = null;
......
......@@ -3,5 +3,6 @@ package jp.agentec.abook.abv.bl.data;
// バージョンが上がるごとに+10すること
public class DatabaseVersions {
public static final int Ver1_0_0 = 1;
public static final int Ver1_1_0 = 11;
}
......@@ -210,15 +210,24 @@ public class OperationDao extends AbstractDao {
return count > 0;
}
/**
* 該当作業を削除(関連テーブルを含む)
* @param dto
*/
public void delete(OperationDto dto) {
delete("r_task_worker_group", "operation_id=?", dto.getKeyValues());
delete("r_operation_content", "operation_id=?", dto.getKeyValues());
delete("r_operation_group_master_relation", "operation_id=?", dto.getKeyValues());
delete("t_operation", "operation_id=?", dto.getKeyValues());
}
/**
* 作業リスト全て削除(関連テーブルを含む)
*/
public void deleteAll() {
delete("t_push_message", null, null);
delete("r_operation_content", null, null);
delete("r_operation_group_master_relation", null, null);
delete("r_task_worker_group", null, null);
delete("t_operation", null, null);
delete("t_task", null, null);
......@@ -228,11 +237,28 @@ public class OperationDao extends AbstractDao {
delete("m_worker_group", null, null);
}
/**
* 引数の検索条件で作業情報リストを取得(作業一覧表示用)
* @param searchOperationName
* @param searchStartDateStr
* @param searchEndDateStr
* @param reportTypeStr
* @return
*/
public List<OperationDto> getOperations(String searchOperationName, String searchStartDateStr, String searchEndDateStr, String reportTypeStr) {
String sql = generateGetOperationQuery(searchOperationName, searchStartDateStr, searchEndDateStr, reportTypeStr);
return rawQueryGetDtoList(sql, null, OperationDto.class);
}
/**
* 引数の検索条件で作業情報リストを
* 取得用のsql文作成
* @param searchOperationName
* @param searchStartDateStr
* @param searchEndDateStr
* @param reportTypeStr
* @return
*/
private String generateGetOperationQuery(String searchOperationName, String searchStartDateStr, String searchEndDateStr, String reportTypeStr) {
String curDate = DateTimeUtil.toStringInTimeZone(new Date(), DateTimeFormat.yyyyMMddHHmmss_hyphen, "UTC");
......@@ -336,4 +362,25 @@ public class OperationDao extends AbstractDao {
updateNeedSyncFlg(operationDto.operationId, true);
}
}
/**
* 作業種別IDで関連する作業リストを取得
* @param operationGroupMasterId
* @return
*/
public List<OperationDto> getOperationByOperationGroupMasterId(Integer operationGroupMasterId) {
StringBuffer sql = new StringBuffer();
sql.append(" SELECT * ");
sql.append(" FROM t_operation AS top");
// INNER JOIN r_operation_group_master_relation
sql.append(" INNER JOIN r_operation_group_master_relation AS rog");
sql.append(" ON rog.operation_id = top.operation_id");
// LEFT OUTER JOIN r_operation_content
sql.append(" LEFT OUTER JOIN r_operation_content AS rpc ");
sql.append(" ON top.operation_id = rpc.operation_id ");
sql.append(" AND rpc.operation_content_flg = 1 ");
sql.append(" WHERE rog.operation_group_master_id = ?");
sql.append(" ORDER BY top.operation_start_date DESC, top.operation_id DESC");
return rawQueryGetDtoList(sql.toString(), new String[] { "" + operationGroupMasterId }, OperationDto.class);
}
}
\ No newline at end of file
package jp.agentec.abook.abv.bl.data.dao;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import jp.agentec.abook.abv.bl.acms.type.SearchDivisionType;
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.log.Logger;
import jp.agentec.abook.abv.bl.dto.GroupDto;
import jp.agentec.abook.abv.bl.dto.OperationGroupMasterDto;
import jp.agentec.adf.util.DateTimeFormat;
import jp.agentec.adf.util.DateTimeUtil;
import jp.agentec.adf.util.NumericUtil;
import jp.agentec.adf.util.StringUtil;
/**
* Created by leej on 2019/06/25.
*/
public class OperationGroupMasterDao extends AbstractDao {
private static final String TAG = "OperationGroupMasterDao";
private enum QueryType {GetAllGroups, GetRootGroups, GetGroups}
/*package*/ OperationGroupMasterDao() {
}
@Override
protected OperationGroupMasterDto convert(Cursor cursor) {
OperationGroupMasterDto dto = new OperationGroupMasterDto();
int column = cursor.getColumnIndex("operation_group_master_id");
if (column != -1) {
dto.operationGroupMasterId = cursor.getInt(column);
}
column = cursor.getColumnIndex("operation_group_master_name");
if (column != -1) {
dto.operationGroupMasterName = cursor.getString(column);
}
if (column != -1) {
column = cursor.getColumnIndex("parent_operation_group_master_id");
dto.parentOperationGroupMasterId = cursor.getInt(column);
}
column = cursor.getColumnIndex("operation_group_master_level");
if (column != -1) {
dto.operationGroupMasterLevel = cursor.getInt(column);
}
column = cursor.getColumnIndex("operation_count");
if (column != -1) {
dto.operationCount = cursor.getInt(column);
}
return dto;
}
/**
* 作業種別をDB登録処理
* @param dto
*/
public void insertOperationGroupMaster(OperationGroupMasterDto dto) {
StringBuffer sql = new StringBuffer();
sql.append(" INSERT OR IGNORE INTO m_operation_group_master (operation_group_master_id, operation_group_master_name, parent_operation_group_master_id, operation_group_master_level) ");
sql.append(" VALUES (?,?,?,?) ");
try {
beginTransaction();
insert(sql.toString(), dto.getInsertValues());
commit();
} catch (Exception e) {
rollback();
Logger.e("insertOperationGroupMaster failed.", e);
throw new RuntimeException(e);
}
Logger.v(TAG, "sql=%s", sql);
}
/**
* 作業種別をDB更新処理
* @param dto
*/
public void updateOperationGroupMaster(OperationGroupMasterDto dto) {
StringBuffer sql = new StringBuffer();
sql.append(" UPDATE m_operation_group_master ");
sql.append(" SET operation_group_master_name = ? ");
sql.append(" ,parent_operation_group_master_id = ? ");
sql.append(" ,operation_group_master_level = ? ");
sql.append(" WHERE operation_group_master_id = ? ");
try {
beginTransaction();
update(sql.toString(), dto.getUpdateValues());
commit();
} catch (Exception e) {
rollback();
Logger.e("insertGroup failed.", e);
throw new RuntimeException(e);
}
Logger.v(TAG, "sql=%s", sql);
}
/**
* 親階層のIDで子供の階層を取得
* sort:作業種別名 昇順
* @param parentId
* @return
*/
public List<OperationGroupMasterDto> getOperationGroupMasterChildList(int parentId) {
List<OperationGroupMasterDto> list;
list = rawQueryGetDtoList("select * from m_operation_group_master where parent_operation_group_master_id = ? order by operation_group_master_name ASC", new String[]{""+ parentId}, OperationGroupMasterDto.class);
return list;
}
/**
* 最上位階層を取得
* @return
*/
public OperationGroupMasterDto getTopOperationGroupMaster() {
return rawQueryGetDto("select * from m_operation_group_master where operation_group_master_level = 0", null, OperationGroupMasterDto.class);
}
/**
* 全作業種別を取得
* @return
*/
public List<OperationGroupMasterDto> getAllOperationGroupMaster() {
return rawQueryGetDtoList("select * from m_operation_group_master", null, OperationGroupMasterDto.class);
}
/**
* operationGroupMasterIdで作業種別を取得
* @param operationGroupMasterId
* @return
*/
public OperationGroupMasterDto getOperationGroupMaster(Integer operationGroupMasterId) {
return rawQueryGetDto("select * from m_operation_group_master where operation_group_master_id = ?", new String[]{"" + operationGroupMasterId}, OperationGroupMasterDto.class);
}
/**
* operationGroupMasterIdのデータ存在チェック
* @param operationGroupMasterId
* @return
*/
public boolean isExistOperationGroupMaster(Integer operationGroupMasterId) {
return getOperationGroupMaster(operationGroupMasterId) != null;
}
/**
* 作業種別に関連するテーブルを全て削除
* @param dto
*/
public void delete(OperationGroupMasterDto dto) {
// 作業種別と作業のリレーションテーブル
delete("r_operation_group_master_relation", "operation_group_master_id=?", dto.getKeyValues());
// 作業種別のマスタテーブル
delete("m_operation_group_master", "operation_group_master_id=?", dto.getKeyValues());
}
/**
* 階層の作業種別情報取得(検索結果を元にデータ取得)
* @param searchOperationName
* @param searchStartDateStr
* @param searchEndDateStr
* @param reportTypeStr
* @param level
* @return
*/
public List<OperationGroupMasterDto> getOperationGroupMasterListBylevel(String searchOperationName, String searchStartDateStr, String searchEndDateStr, String reportTypeStr, Integer level) {
StringBuffer sql = new StringBuffer();
sql.append(" SELECT M1.*, count(R1.operation_id) AS operation_count FROM m_operation_group_master AS M1");
sql.append(" LEFT OUTER JOIN r_operation_group_master_relation R1");
sql.append(" ON R1.operation_group_master_id = M1.operation_group_master_id");
sql.append(" AND R1.operation_id IN(");
sql.append(" SELECT operation_id FROM t_operation top");
sql.append(" WHERE top.operation_id IS NOT NULL");
if (!StringUtil.isNullOrEmpty(searchOperationName)) {
sql.append(" AND top.operation_name GLOB " + "'*" + searchOperationName + "*'");
}
if (!StringUtil.isNullOrEmpty(searchStartDateStr)) {
Date startDate = DateTimeUtil.toDate(searchStartDateStr, "UTC", DateTimeFormat.yyyyMMdd_hyphen);
sql.append(" AND top.operation_end_date >= '" + DateTimeUtil.toString(startDate, DateTimeFormat.yyyyMMdd_hyphen) + "'");
}
if (!StringUtil.isNullOrEmpty(searchEndDateStr)) {
Date endDate = DateTimeUtil.toDate(searchEndDateStr, "UTC", DateTimeFormat.yyyyMMdd_hyphen);
sql.append(" AND top.operation_start_date <= '" + DateTimeUtil.toString(endDate, DateTimeFormat.yyyyMMdd_hyphen) + "'");
}
if (reportTypeStr != null) {
sql.append(" AND top.report_type in ("+ reportTypeStr +")");
}
sql.append(" )");
sql.append(" WHERE M1.operation_group_master_level =? ");
sql.append(" GROUP BY M1.operation_group_master_id");
Logger.v(TAG, "sql=%s", sql);
return rawQueryGetDtoList(sql.toString(), new String[]{""+ level}, OperationGroupMasterDto.class);
}
/**
* 最後のOperationGroupMasterレベル取得
* @return
*/
public Integer getLastGroupLevel() {
return rawQueryGetInt("SELECT MAX(operation_group_master_level) FROM m_operation_group_master", null);
}
}
\ No newline at end of file
package jp.agentec.abook.abv.bl.data.dao;
import java.util.List;
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.SQLiteStatement;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.dto.OperationGroupMasterRelationDto;
/**
* Created by leej on 2019/06/26.
*/
public class OperationGroupMasterOperationDao extends AbstractDao {
private static final String TAG = "OperationGroupMasterDao";
private enum QueryType {GetAllGroups, GetRootGroups, GetGroups}
/*package*/ OperationGroupMasterOperationDao() {
}
@Override
protected OperationGroupMasterRelationDto convert(Cursor cursor) {
OperationGroupMasterRelationDto dto = new OperationGroupMasterRelationDto();
int column = cursor.getColumnIndex("operation_group_master_id");
if (column != -1) {
dto.operationGroupMasterId = cursor.getInt(column);
}
column = cursor.getColumnIndex("operation_id");
if (column != -1) {
dto.operationId = cursor.getLong(column);
}
return dto;
}
/**
* 作業種別と作業のリレーションテーブル削除
* @param operationGroupMasterId
*/
public void deleteOperationGroupMasterOperation(Integer operationGroupMasterId, Long operationId) {
delete("r_operation_group_master_relation", "operation_group_master_id=? AND operation_id=?", new String[]{""+ operationGroupMasterId, ""+ operationId});
}
/**
* 作業種別と作業のリレーションテーブルのDB登録処理
* @param dto
*/
public boolean insertOperationGroupMasterOperation(OperationGroupMasterRelationDto dto) {
StringBuffer sql = new StringBuffer();
sql.append(" INSERT OR IGNORE INTO r_operation_group_master_relation ");
sql.append(" SELECT " + dto.operationGroupMasterId);
sql.append(" , " + dto.operationId);
sql.append(" FROM t_operation AS top ");
sql.append(" LEFT OUTER JOIN r_operation_group_master_relation AS rmogm ");
sql.append(" ON rmogm.operation_group_master_id = ? ");
sql.append(" AND top.operation_id <> rmogm.operation_id ");
sql.append(" WHERE top.operation_id = ? ");
sql.append(" GROUP BY rmogm.operation_group_master_id ");
SQLiteStatement stmt = null;
Logger.v(TAG, "sql=%s", sql);
try {
SQLiteDatabase db = getDatabase();
stmt = db.compileStatement(sql.toString());
stmt.bindLong(1, dto.operationGroupMasterId);
stmt.bindLong(2, dto.operationId);
return (stmt.executeInsert() > 0);
} finally {
if (stmt != null) {
stmt.close();
}
}
}
/**
* 作業種別IDで関連する作業のIDを取得
* @param operationId
* @return
*/
public List<Integer> getOperationGroupMasterIds(Long operationId) {
return rawQueryGetIntegerList("select operation_group_master_id from r_operation_group_master_relation where operation_id=?", new String[]{""+ operationId});
}
}
\ No newline at end of file
package jp.agentec.abook.abv.bl.data.tables;
import java.util.ArrayList;
import java.util.List;
import jp.agentec.abook.abv.bl.common.db.SQLiteDatabase;
import jp.agentec.adf.util.StringUtil;
/**
* Created by leej on 2019/06/24.
*/
public class MOperationGroupMaster extends SQLiteTableScript {
public MOperationGroupMaster() {
super();
}
@Override
public List<String> getCreateScript(int version) {
List<String> ddl = new ArrayList<String>();
StringBuffer sql = new StringBuffer();
sql.append(" CREATE TABLE m_operation_group_master ( ");
sql.append(" operation_group_master_id INTEGER NOT NULL ");
sql.append(" , operation_group_master_name VARCHAR(64) NOT NULL ");
sql.append(" , parent_operation_group_master_id INTEGER ");
sql.append(" , operation_group_master_level INTEGER NOT NULL ");
sql.append(" , PRIMARY KEY (operation_group_master_id) ");
sql.append(" ) ");
ddl.add(sql.toString());
StringUtil.clear(sql);
sql.append(" CREATE INDEX idx_group_master_1 ON m_operation_group_master ( ");
sql.append(" parent_operation_group_master_id ");
sql.append(" ) ");
ddl.add(sql.toString());
return ddl;
}
@Override
public List<String> getUpgradeScript(int oldVersion, int newVersion) {
return null;
}
@Override
public List<String> getMigrationScript(SQLiteDatabase databaseConnection, int oldVersion, int newVersion, Object... params) {
return null;
}
}
package jp.agentec.abook.abv.bl.data.tables;
import java.util.ArrayList;
import java.util.List;
import jp.agentec.abook.abv.bl.common.db.SQLiteDatabase;
/**
* Created by leej on 2019/06/25.
*/
public class ROperationGroupMasterOperation extends SQLiteTableScript {
public ROperationGroupMasterOperation() {
super();
}
@Override
public List<String> getCreateScript(int version) {
List<String> ddl = new ArrayList<String>();
StringBuffer sql = new StringBuffer();
sql.append(" CREATE TABLE r_operation_group_master_relation ( ");
sql.append(" operation_group_master_id INTEGER NOT NULL ");
sql.append(" , operation_id BIGINT NOT NULL ");
sql.append(" , PRIMARY KEY (operation_group_master_id, operation_id) ");
sql.append(" , FOREIGN KEY (operation_group_master_id) REFERENCES m_operation_group_master (operation_group_master_id) ");
sql.append(" , FOREIGN KEY (operation_id) REFERENCES t_operation (operation_id)");
sql.append(" ) ");
ddl.add(sql.toString());
return ddl;
}
@Override
public List<String> getUpgradeScript(int oldVersion, int newVersion) {
return null;
}
@Override
public List<String> getMigrationScript(SQLiteDatabase databaseConnection, int oldVersion, int newVersion, Object... params) {
return null;
}
}
\ No newline at end of file
......@@ -344,6 +344,7 @@ public class ContentRefresher {
try {
// サーバー通信でプロジェクト取得
operationLogic.initializeOperations();
} catch (Exception e1) {
Logger.e(TAG, e1);
e = e1;
......
......@@ -32,6 +32,8 @@ public class OperationDto extends AbstractDto {
public int enableReportEdit; // 作業編集可能区分
public int enableAddReport; // 作業追加区分
public List<OperationGroupMasterRelationDto> operationGroupMasterRelationDtoList; // 作業種別に紐づく作業Dto
// 作業担当グループリスト
public List<TaskWorkerGroupDto> taskWorkerGroupDtoList;
......
package jp.agentec.abook.abv.bl.dto;
import java.util.List;
/**
* Created by leej on 2019/06/25.
*/
public class OperationGroupMasterDto extends AbstractDto {
public int operationGroupMasterId; // 作業種別ID
public String operationGroupMasterName; // 作業種別名称
public int parentOperationGroupMasterId; // 作業種別の親階層ID
public int operationGroupMasterLevel; // 作業種別の階層レベル
public int operationCount = 0; // 作業種別に紐づく作業数
public OperationGroupMasterDto() {
}
@Override
public Object[] getInsertValues() {
return new Object[]{operationGroupMasterId, operationGroupMasterName, parentOperationGroupMasterId, operationGroupMasterLevel};
}
@Override
public Object[] getUpdateValues() {
return new Object[]{operationGroupMasterName, parentOperationGroupMasterId, operationGroupMasterLevel, operationGroupMasterId};
}
@Override
public String[] getKeyValues() {
return new String[]{""+ operationGroupMasterId};
}
}
\ No newline at end of file
package jp.agentec.abook.abv.bl.dto;
/**
* Created by leej on 2019/06/25.
*/
public class OperationGroupMasterRelationDto extends AbstractDto {
// 作業種別ID
public Integer operationGroupMasterId;
// 作業ID
public Long operationId;
@Override
public Object[] getInsertValues() {
return new Object[]{operationGroupMasterId, operationId};
}
@Override
public String[] getKeyValues() {
return new String[]{""+ operationGroupMasterId};
}
}
\ No newline at end of file
package jp.agentec.abook.abv.bl.dto.comparator;
import java.util.Comparator;
import jp.agentec.abook.abv.bl.dto.OperationGroupMasterDto;
/**
* Created by leej on 2019/06/28.
*/
public class OperationGroupMasterLevelComparator implements Comparator<OperationGroupMasterDto> {
@Override
public int compare(OperationGroupMasterDto dto1, OperationGroupMasterDto dto2) {
int operationGroupMasterLevel1 = dto1.operationGroupMasterLevel;
int operationGroupMasterLevel2 = dto2.operationGroupMasterLevel;
int result;
if (operationGroupMasterLevel1 > operationGroupMasterLevel2) {
result = 1;
} else if(operationGroupMasterLevel1 == operationGroupMasterLevel2) {
result = 0;
} else {
result = -1;
}
return result;
}
}
\ No newline at end of file
package jp.agentec.abook.abv.bl.logic;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import jp.agentec.abook.abv.bl.acms.client.AcmsClient;
import jp.agentec.abook.abv.bl.acms.client.json.OperationGroupMasterJSON;
import jp.agentec.abook.abv.bl.acms.client.parameters.AcmsParameters;
import jp.agentec.abook.abv.bl.common.ABVEnvironment;
import jp.agentec.abook.abv.bl.common.exception.AcmsException;
import jp.agentec.abook.abv.bl.common.exception.NetworkDisconnectedException;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.data.ABVDataCache;
import jp.agentec.abook.abv.bl.data.dao.AbstractDao;
import jp.agentec.abook.abv.bl.data.dao.OperationDao;
import jp.agentec.abook.abv.bl.data.dao.OperationGroupMasterDao;
import jp.agentec.abook.abv.bl.dto.OperationDto;
import jp.agentec.abook.abv.bl.dto.OperationGroupMasterDto;
import jp.agentec.abook.abv.bl.dto.OperationGroupMasterRelationDto;
import jp.agentec.abook.abv.bl.dto.comparator.OperationGroupMasterLevelComparator;
/**
* Created by leej on 2019/06/26.
*/
public class OperationGroupMasterLogic extends AbstractLogic {
private static final String TAG = "OperationGroupMasterLogic";
private OperationGroupMasterDao mOperationGroupMasterDao = AbstractDao.getDao(OperationGroupMasterDao.class);
private OperationDao mOperationDao = AbstractDao.getDao(OperationDao.class);
/**
* 作業種別・作業種別に紐づいた作業IDを取得して
* DBに登録する
*/
public void setOperationGroupMaster() throws NetworkDisconnectedException, AcmsException {
try {
// サーバー通信で、作業種別情報を取得する
List<OperationGroupMasterDto> serverOperationGroupMasterDtos = getOperationGroupMasterServerData();
// ローカルDBに存在する作業種別情報をDto配列でセット
List<OperationGroupMasterDto> localOperationGroupMasterDtos = mOperationGroupMasterDao.getAllOperationGroupMaster();
List<Integer> localOperationGroupMasterIds = new ArrayList<Integer>();
boolean updateFlg = false;
for (OperationGroupMasterDto serverOperationGroupMasterDto : serverOperationGroupMasterDtos) {
// DB登録フラグ
boolean insertFlg = true;
for (OperationGroupMasterDto localOperationGroupMasterDto : localOperationGroupMasterDtos) {
// サーバーで取得したIDでローカルに存在するか比較して、更新・登録を判定
if (serverOperationGroupMasterDto.operationGroupMasterId == localOperationGroupMasterDto.operationGroupMasterId) {
// DB更新処理(作業種別の親階層が変更されたか、作業種別名が変更されたときのみ)
if (serverOperationGroupMasterDto.parentOperationGroupMasterId != localOperationGroupMasterDto.parentOperationGroupMasterId || !serverOperationGroupMasterDto.operationGroupMasterName.equals(localOperationGroupMasterDto.operationGroupMasterName)) {
Logger.d(TAG, "[UPDATE] OperationGroupMaster operationGroupMasterId=" + serverOperationGroupMasterDto.operationGroupMasterId + " operationGroupMasterName=" + serverOperationGroupMasterDto.operationGroupMasterName);
mOperationGroupMasterDao.updateOperationGroupMaster(serverOperationGroupMasterDto);
updateFlg = true;
}
// 更新処理が終わったら登録フラグをfalseにしてlocalOperationGroupMasterDtosから除外する
insertFlg = false;
localOperationGroupMasterDtos.remove(localOperationGroupMasterDto);
break;
}
}
// 更新されたら以下の処理は行わない
if (insertFlg) {
Logger.d(TAG, "[INSERT] OperationGroupMaster operationGroupMasterId=" + serverOperationGroupMasterDto.operationGroupMasterId + " operationGroupMasterName=" + serverOperationGroupMasterDto.operationGroupMasterName);
// DB登録処理
mOperationGroupMasterDao.insertOperationGroupMaster(serverOperationGroupMasterDto);
}
}
// 作業種別関連テーブルの削除処理
for (OperationGroupMasterDto deleteOperationGroupMasterDto : localOperationGroupMasterDtos) {
updateFlg = true;
mOperationGroupMasterDao.delete(deleteOperationGroupMasterDto);
}
// 作業種別のクリアフラグをセット
ABVEnvironment.getInstance().setOperationGroupMasterClearFlg(updateFlg);
} catch (Exception e) {
Logger.e(e.getMessage());
}
}
/**
* API通信で取得した作業種別情報のリストを返す
* @return
* @throws NetworkDisconnectedException
* @throws AcmsException
*/
private List<OperationGroupMasterDto> getOperationGroupMasterServerData() throws NetworkDisconnectedException, AcmsException {
AcmsParameters param = new AcmsParameters(cache.getMemberInfo().sid);
OperationGroupMasterJSON json = AcmsClient.getInstance(cache.getUrlPath(), networkAdapter).getOperationGroupMaster(param);
return json.operationGroupMasterList;
}
/**
* 作業種別毎に作業数(子グループの作業も含む)を
* operationCountMapにセットする
* @param searchOperationName
* @param searchStartDateStr
* @param searchEndDateStr
* @param reportTypeStr
* @param level
* @param operationCountMap
*/
public void getAllOperationCount(String searchOperationName, String searchStartDateStr, String searchEndDateStr, String reportTypeStr, int level, Map<Integer, Integer> operationCountMap) {
List<OperationGroupMasterDto> operationGroupMasterDtoList;
operationGroupMasterDtoList = mOperationGroupMasterDao.getOperationGroupMasterListBylevel(searchOperationName, searchStartDateStr, searchEndDateStr, reportTypeStr, level);
// ルート階層の場合は以下の処理しない
if (level > 0 && operationGroupMasterDtoList != null) {
for (OperationGroupMasterDto operationGroupMasterDto : operationGroupMasterDtoList) {
if (operationCountMap.containsKey(operationGroupMasterDto.operationGroupMasterId)) {
operationCountMap.put(operationGroupMasterDto.operationGroupMasterId, operationCountMap.get(operationGroupMasterDto.operationGroupMasterId) + operationGroupMasterDto.operationCount);
} else {
operationCountMap.put(operationGroupMasterDto.operationGroupMasterId, operationGroupMasterDto.operationCount);
}
// 値が存在する場合
if (operationCountMap.get(operationGroupMasterDto.operationGroupMasterId) > 0) {
if (operationCountMap.containsKey(operationGroupMasterDto.parentOperationGroupMasterId)) {
// 更新
operationCountMap.put(operationGroupMasterDto.parentOperationGroupMasterId, operationCountMap.get(operationGroupMasterDto.parentOperationGroupMasterId) + operationCountMap.get(operationGroupMasterDto.operationGroupMasterId));
} else {
// 新規
operationCountMap.put(operationGroupMasterDto.parentOperationGroupMasterId, operationCountMap.get(operationGroupMasterDto.operationGroupMasterId));
}
}
}
level--;
getAllOperationCount(searchOperationName, searchStartDateStr, searchEndDateStr, reportTypeStr, level, operationCountMap); // 再帰呼び出し
}
}
/**
* 最後の階層レベル取得
* @return
*/
public Integer getLastGroupLevel() {
return mOperationGroupMasterDao.getLastGroupLevel();
}
/**
* 親の階層パスをリストでセット
* @param operationGroupMasterId
* @return
*/
public List<OperationGroupMasterDto> getParentOperationGroupMasterForPath (Integer operationGroupMasterId) {
List<OperationGroupMasterDto> operationGroupMasterDtoList = new ArrayList<OperationGroupMasterDto>();
// 作業種別DTO取得
OperationGroupMasterDto dto = mOperationGroupMasterDao.getOperationGroupMaster(operationGroupMasterId);
operationGroupMasterDtoList.add(dto);
int parentId = dto.parentOperationGroupMasterId;
for (int i = 0; i < dto.operationGroupMasterLevel; i++) {
OperationGroupMasterDto parentOperationDto = mOperationGroupMasterDao.getOperationGroupMaster(parentId);
parentId = parentOperationDto.parentOperationGroupMasterId;
operationGroupMasterDtoList.add(parentOperationDto);
}
Collections.sort(operationGroupMasterDtoList, new OperationGroupMasterLevelComparator());
return operationGroupMasterDtoList;
}
/**
* 作業種別IDで関連する作業リストを取得
* @param operationGroupMasterId
* @return
*/
public List<OperationDto> getOperationByOperationGroupMasterId(Integer operationGroupMasterId) {
return mOperationDao.getOperationByOperationGroupMasterId(operationGroupMasterId);
}
}
......@@ -38,6 +38,7 @@ import jp.agentec.abook.abv.bl.data.dao.AbstractDao;
import jp.agentec.abook.abv.bl.data.dao.ContentDao;
import jp.agentec.abook.abv.bl.data.dao.OperationContentDao;
import jp.agentec.abook.abv.bl.data.dao.OperationDao;
import jp.agentec.abook.abv.bl.data.dao.OperationGroupMasterOperationDao;
import jp.agentec.abook.abv.bl.data.dao.PushMessageDao;
import jp.agentec.abook.abv.bl.data.dao.TaskDao;
import jp.agentec.abook.abv.bl.data.dao.TaskReportDao;
......@@ -49,6 +50,7 @@ import jp.agentec.abook.abv.bl.dto.CategoryContentDto;
import jp.agentec.abook.abv.bl.dto.ContentDto;
import jp.agentec.abook.abv.bl.dto.OperationContentDto;
import jp.agentec.abook.abv.bl.dto.OperationDto;
import jp.agentec.abook.abv.bl.dto.OperationGroupMasterRelationDto;
import jp.agentec.abook.abv.bl.dto.PushMessageDto;
import jp.agentec.abook.abv.bl.dto.TaskDto;
import jp.agentec.abook.abv.bl.dto.TaskReportDto;
......@@ -76,22 +78,32 @@ public class OperationLogic extends AbstractLogic {
private TaskReportDao mTaskReportDao = AbstractDao.getDao(TaskReportDao.class);
private TaskReportSendDao mTaskReportSendDao = AbstractDao.getDao(TaskReportSendDao.class);
private TaskReportItemsDao mTaskReportItemsDao = AbstractDao.getDao(TaskReportItemsDao.class);
private OperationGroupMasterOperationDao mOperationGroupMasterOperationDao = AbstractDao.getDao(OperationGroupMasterOperationDao.class);
private ContentLogic mContentLogic = AbstractLogic.getLogic(ContentLogic.class);
private OperationGroupMasterLogic mOperationGroupMasterLogic = AbstractLogic.getLogic(OperationGroupMasterLogic.class);
private PushMessageDao mPushMessageDao = AbstractDao.getDao(PushMessageDao.class);
private TaskWorkerGroupDao mTaskWorkerGroupDao = AbstractDao.getDao(TaskWorkerGroupDao.class);
/**
* 作業に関連する情報取得(API通信で取得して、DB保存処理)
* @throws AcmsException
* @throws NetworkDisconnectedException
*/
public void initializeOperations() throws AcmsException, NetworkDisconnectedException {
// 作業グループリスト取得
setWorkingGroupList();
// プロジェクト一覧取得し、登録・更新・削除する
// 作業種別・作業種別に紐づいた作業IDを取得
mOperationGroupMasterLogic.setOperationGroupMaster();
// 作業一覧取得し、登録・更新・削除する
retrieveServerOperation();
}
/**
* プロジェクト一覧取得し、登録・更新・削除する
* 作業一覧取得し、登録・更新・削除する
*
* @throws AcmsException
* @throws NetworkDisconnectedException
......@@ -105,12 +117,11 @@ public class OperationLogic extends AbstractLogic {
for (OperationDto serverOperationDto : serverOperations) {
// 登録フラグ
boolean insertFlg = true;
for (OperationDto localProjcetDto : localOperations) {
if (serverOperationDto.operationId.equals(localProjcetDto.operationId)) {
for (OperationDto localOperationDto : localOperations) {
if (serverOperationDto.operationId.equals(localOperationDto.operationId)) {
//update
serverOperationDto.needSyncFlg = serverOperationDto.equalsLastEdit(localProjcetDto) ? localProjcetDto.needSyncFlg : true;
serverOperationDto.needSyncFlg = serverOperationDto.equalsLastEdit(localOperationDto) ? localOperationDto.needSyncFlg : true;
List<Long> localOperationContentIds = mOperationContentDao.getContentIds(serverOperationDto.operationId);
boolean operationContentFlg = false;
for (OperationContentDto operationContentDto : serverOperationDto.operationContentDtoList) {
if (localOperationContentIds == null || localOperationContentIds.size() == 0) {
// insert
......@@ -129,7 +140,7 @@ public class OperationLogic extends AbstractLogic {
if (localOperationContentIds != null) {
// 関連資料の削除処理
for (Long deleteContentId : localOperationContentIds) {
mOperationContentDao.deleteOperationContent(localProjcetDto.operationId, deleteContentId);
mOperationContentDao.deleteOperationContent(localOperationDto.operationId, deleteContentId);
}
}
......@@ -137,6 +148,31 @@ public class OperationLogic extends AbstractLogic {
serverOperationDto.contentCreatingFlg = false;
}
// ローカルにある作業情報に紐づく全作業IDを取得
List<Integer> localOperationGroupMasterIds = mOperationGroupMasterOperationDao.getOperationGroupMasterIds(serverOperationDto.operationId);
for (OperationGroupMasterRelationDto operationGroupMasterRelationDto : serverOperationDto.operationGroupMasterRelationDtoList) {
if (localOperationGroupMasterIds == null || localOperationGroupMasterIds.size() == 0) {
// 作業IDが存在しなければ、登録する
mOperationGroupMasterOperationDao.insertOperationGroupMasterOperation(operationGroupMasterRelationDto);
} else {
// ローカル(DB)に作業IDが存在するかチェックして更新・登録を判定
int localOperationContentIndex = localOperationGroupMasterIds.indexOf(operationGroupMasterRelationDto.operationGroupMasterId);
if (localOperationContentIndex >= 0) {
// 作業IDが存在するので更新
localOperationGroupMasterIds.remove(localOperationContentIndex);
} else {
// 作業IDが存在しないので登録
mOperationGroupMasterOperationDao.insertOperationGroupMasterOperation(operationGroupMasterRelationDto);
}
}
}
if (localOperationGroupMasterIds != null) {
// ローカルとサーバーの差分は削除と見做し、削除処理を行う。
for (Integer deleteOperationGroupMasterId : localOperationGroupMasterIds) {
mOperationGroupMasterOperationDao.deleteOperationGroupMasterOperation(deleteOperationGroupMasterId, serverOperationDto.operationId);
}
}
mOperationDao.update(serverOperationDto);
// 更新することで登録フラグをfalseにセット
insertFlg = false;
......@@ -164,6 +200,11 @@ public class OperationLogic extends AbstractLogic {
for (OperationContentDto operationContentDto : serverOperationDto.operationContentDtoList) {
mOperationContentDao.insertOperationContent(operationContentDto);
}
// 作業種別・作業のリレーションテーブルにデータ登録
for (OperationGroupMasterRelationDto operationGroupMasterRelationDto : serverOperationDto.operationGroupMasterRelationDtoList) {
mOperationGroupMasterOperationDao.insertOperationGroupMasterOperation(operationGroupMasterRelationDto);
}
}
// 作業担当グループ登録
......@@ -195,7 +236,7 @@ public class OperationLogic extends AbstractLogic {
deleteListDtoArray.add(localProjcetDto);
}
}
// サーバーから取得したプロジェクト情報がローカルに存在しないので削除する
// サーバーから取得した作業情報がローカルに存在しないので削除する
for (OperationDto deleteOperationDto : deleteListDtoArray) {
List<TaskDto> taskDtoList = mTaskDao.selectAllTaskByOperationId(deleteOperationDto.operationId);
List<Long> contentIds = mOperationContentDao.getContentIds(deleteOperationDto.operationId);
......@@ -1337,11 +1378,12 @@ public class OperationLogic extends AbstractLogic {
/**
* シーンの登録
* @param file
* @param contentId
* @throws IOException
* @throws AcmsException
*/
public Integer sendScene(File file) throws IOException, AcmsException, NetworkDisconnectedException {
SceneEntryJSON json = AcmsClient.getInstance(cache.getUrlPath(), networkAdapter).sceneEntry(cache.getMemberInfo().sid, file);
public Integer sendScene(File file, Long contentId) throws IOException, AcmsException, NetworkDisconnectedException {
SceneEntryJSON json = AcmsClient.getInstance(cache.getUrlPath(), networkAdapter).sceneEntry(cache.getMemberInfo().sid, contentId, file);
return json.resourceId;
}
......
......@@ -11,7 +11,7 @@ android {
defaultConfig {
minSdkVersion 15
targetSdkVersion 26
targetSdkVersion 28
//abvEnvironments
resValue("string", "acms_address", "${acms_address}")
resValue("string", "download_server_address", "${download_server_address}")
......
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:state_pressed="true"
android:drawable="@drawable/ic_show_list_off"/>
<item
android:drawable="@drawable/ic_show_list_on"/>
</selector>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:state_checked="true"
android:state_pressed="true"
android:drawable="@drawable/operation_location_segment_on" />
<item
android:state_checked="true"
android:drawable="@drawable/operation_location_segment_on" />
<item
android:state_checked="false"
android:state_pressed="true"
android:drawable="@drawable/operation_location_segment_off" />
<item
android:state_checked="false"
android:drawable="@drawable/operation_location_segment_off" />
</selector>
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<stroke android:width="1dp" android:color="@android:color/white" />
<solid android:color="@color/operation_color"/>
</shape>
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<stroke android:width="1dp" android:color="@android:color/white" />
<solid android:color="@android:color/white"/>
</shape>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@color/operation_color" android:state_checked="true" />
<item android:color="@android:color/white" android:state_checked="false"/>
</selector>
\ No newline at end of file
......@@ -117,6 +117,7 @@
<string name="password_condition">半角英数字,記号(-_)のみ\n6文字以上16文字以下\n英数字両方を利用する\n同じ文字を3文字以上連続して使用しない\n前回パスワードに使った文字は4文字以上使用しない。</string>
<string name="no_content_need_refresh">該当資料は存在しないか、閲覧権限の無い資料です。</string>
<string name="content_num">No.</string>
<string name="no_child">これより下はありません。</string>
<string name="no_content_history">閲覧履歴がありません。</string>
<string name="contractor">事業者</string>
<string name="showPassword">パスワードを表示する</string>
......@@ -517,6 +518,11 @@
<string name="msg_help_list_report_add">新たに報告を追加することができます。</string>
<string name="msg_help_360_move">このボタンを押すと作業コードラベルを移動させることができるようになります。</string>
<string name="msg_help_360_touch">このボタンを押すと作業コードボタンのタップが可能になり、報告できるようになります。</string>
<!-- 1.1.0 -->
<string name="operation_category">カテゴリ</string>
<string name="type_all">全て</string>
<!-- 1.0.1 Resource Pattern 1 -->
<!-- 1.9.0.0-->
<string name="meetingroom_setting_1">会議室設定(1)</string>
......
......@@ -118,6 +118,7 @@
<string name="password_condition">영문, 숫자,기호(-_)만 입력\n6문자이상16문자이하\n영문,숫자 혼합 사용\n동일 문자 3문자 연속 사용금지\n이전 패스워드랑 연속 4문자 이상 같은 문자 사용 금지</string>
<string name="no_content_need_refresh">해당 자료는 존재하지 않거나 열람권한이 없는 자료입니다.</string>
<string name="content_num">No.</string>
<string name="no_child">이 아래로는 데이터가 없습니다.</string>
<string name="no_content_history">열람 이력이 없습니다.</string>
<string name="contractor">사업자</string>
<string name="showPassword">패스워드를 표시</string>
......@@ -520,6 +521,10 @@
<string name="msg_help_360_move">이 버튼을 누르면 작업 코드 버튼의 이동이 가능하게 됩니다.</string>
<string name="msg_help_360_touch">이 버튼을 누르면 작업 코드 버튼의 탭이 가능하게 되므로 보고 화면 표시가 가능하게 됩니다.</string>
<!-- 1.1.0 -->
<string name="operation_category">カテゴリ</string>
<string name="type_all">全て</string>
<!-- 1.0.1 Resource Pattern 1 -->
<!-- 1.9.0.0-->
<string name="meetingroom_setting_1">회의실 설정(1)</string>
......@@ -634,6 +639,7 @@
<string name="msg_help_report_task_director_main_1">지시자가 등록한 내용을 표시합니다.</string>
<string name="msg_help_report_task_director_input_1">작업보고화면을 표시합니다.</string>
<!-- 1.0.1 Resource Pattern 1 -->
<string name="title_permission_dialog_1">애플리케이션권한(1)</string>
<string name="msg_permission_dialog_storage_update_1">앱을 버젼업하기 위해서는 외부스트레지 이용권한이 필요합니다. \n앱설정화면으로 이동합니다.(1)</string>
<string name="msg_permission_dialog_location_1">위치정보이용권한이 필요합니다.\n앱설정화면으로 이동합니다.(1)</string>
......
......@@ -117,6 +117,7 @@
<string name="password_condition">Alphanumeric,-,_ only available\nfrom 6chars to 16chars\nUse both Alphabet and Number\nCannot use same 3 letters continuously\nCannot use more than 4 letters in previous password.</string>
<string name="no_content_need_refresh">Content not found or No authority.</string>
<string name="content_num">No.</string>
<string name="no_child">No more data below.</string>
<string name="no_content_history">No reading history.</string>
<string name="contractor">Company</string>
<string name="showPassword">show password</string>
......@@ -523,6 +524,11 @@
<string name="msg_help_list_report_add">You can add new reports.</string>
<string name="msg_help_360_move">Press this button to move the work code label.</string>
<string name="msg_help_360_touch">If you press this button, you will be able to touch the work code button, so you can report the work.</string>
<!-- 1.1.0 -->
<string name="operation_category">カテゴリ</string>
<string name="type_all">全て</string>
<!-- 1.0.1 Resource Pattern 1 -->
<!-- 1.9.0.0-->
<string name="meetingroom_setting_1">Meeting room setting(1)</string>
......
......@@ -29,7 +29,7 @@ android {
defaultConfig {
minSdkVersion 15
targetSdkVersion 26
targetSdkVersion 28
multiDexEnabled true
}
sourceSets {
......
......@@ -24,31 +24,65 @@
<ImageButton
android:id="@+id/icon_filter"
style="@style/ToolBarIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:layout_marginLeft="15dp"
android:layout_toRightOf="@+id/btn_view_mode"
android:onClick="onClickOperationFilterList"
android:src="@drawable/ic_filter" />
android:background="@drawable/ic_filter" />
<TextView
android:id="@+id/title"
style="@style/DialogToolBarTitle"
<ImageButton
android:id="@+id/btn_search"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text="@string/operation_list"
android:textColor="@color/text_dialog"
android:textSize="15dp"
android:layout_marginLeft="15dp"
android:layout_toRightOf="@+id/icon_filter"
android:background="@drawable/ic_operation_search" />
<RadioGroup
android:id="@+id/segment_group"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_centerVertical="true"
android:layout_marginLeft="15dp"
android:layout_toRightOf="@+id/btn_search"
android:orientation="horizontal"
android:visibility="visible">
<RadioButton
android:id="@+id/operation_location_type_all"
android:layout_width="80dp"
android:layout_height="match_parent"
android:background="@drawable/operation_location_segment_background"
android:button="@null"
android:checked="true"
android:gravity="center"
android:onClick="onClickOperationLocationType"
android:textColor="@drawable/operation_location_text_color"
android:text="@string/type_all"
android:textStyle="bold" />
<RadioButton
android:id="@+id/operation_location_type_group"
android:layout_width="80dp"
android:layout_height="match_parent"
android:background="@drawable/operation_location_segment_background"
android:button="@null"
android:gravity="center"
android:onClick="onClickOperationLocationType"
android:textColor="@drawable/operation_location_text_color"
android:text="@string/operation_category"
android:textStyle="bold" />
</RadioGroup>
<LinearLayout
android:id="@+id/search_result"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginRight="10dp"
android:layout_marginRight="15dp"
android:layout_marginTop="5dp"
android:layout_toLeftOf="@+id/btn_communication_menu"
android:background="@drawable/radius_frame"
......@@ -74,26 +108,16 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginRight="10dp"
android:layout_toLeftOf="@+id/btn_search"
android:background="@drawable/ic_communication_menu" />
<ImageButton
android:id="@+id/btn_search"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginRight="10dp"
android:layout_marginRight="15dp"
android:layout_toLeftOf="@+id/btn_sub_menu"
android:background="@drawable/ic_operation_search"
android:contentDescription="@string/list" />
android:background="@drawable/ic_communication_menu" />
<ImageButton
android:id="@+id/btn_sub_menu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginRight="10dp"
android:layout_marginRight="15dp"
android:layout_toLeftOf="@+id/btn_common_content"
android:background="@drawable/ic_operation_setting"
android:onClick="onClickOperationSubMenu" />
......@@ -103,7 +127,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginRight="10dp"
android:layout_marginRight="15dp"
android:layout_toLeftOf="@+id/btn_help"
android:background="@drawable/ic_common_content_off" />
......@@ -122,6 +146,9 @@
android:id="@+id/operation_list_layout"
style="@style/operation_list_bg"
android:layout_width="match_parent"
android:layout_height="match_parent" />
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true" />
</LinearLayout>
\ No newline at end of file
......@@ -31,25 +31,41 @@
android:onClick="onClickOperationFilterList"
android:src="@drawable/ic_filter" />
<LinearLayout
<RadioGroup
android:id="@+id/segment_group"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true">
<TextView
android:id="@+id/title"
style="@style/DialogToolBarTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/operation_list"
android:layout_marginRight="25dp"
android:layout_height="30dp"
android:layout_centerVertical="true"
android:textColor="@color/text_dialog"
android:visibility="visible"
android:layout_marginLeft="15dp"
android:layout_toRightOf="@+id/icon_filter"
android:orientation="horizontal"
android:visibility="visible">
<RadioButton
android:id="@+id/operation_location_type_all"
android:layout_width="80dp"
android:layout_height="match_parent"
android:background="@drawable/operation_location_segment_background"
android:button="@null"
android:checked="true"
android:gravity="center"
android:onClick="onClickOperationLocationType"
android:textColor="@drawable/operation_location_text_color"
android:text="@string/type_all"
android:textStyle="bold" />
</LinearLayout>
<RadioButton
android:id="@+id/operation_location_type_group"
android:layout_width="80dp"
android:layout_height="match_parent"
android:background="@drawable/operation_location_segment_background"
android:button="@null"
android:gravity="center"
android:onClick="onClickOperationLocationType"
android:textColor="@drawable/operation_location_text_color"
android:text="@string/operation_category"
android:textStyle="bold" />
</RadioGroup>
<ImageButton
android:id="@+id/btn_common_content"
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#ffffff"
android:gravity="center_vertical"
android:orientation="horizontal" >
<Button
android:id="@+id/btn_show_list_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/btn_show_list" />
<HorizontalScrollView
android:id="@+id/bread_crumbs_scroll_view"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" >
<LinearLayout
android:id="@+id/bread_crumbs_layout"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal" >
</LinearLayout>
</HorizontalScrollView>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/LinearLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_alignParentLeft="true"
android:paddingLeft="10dp"
android:paddingBottom="8dp"
android:src="@drawable/icon_folder_empty_on" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<TextView
android:id="@+id/itemText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@+id/imageView1"
android:layout_weight="1"
android:ellipsize="end"
android:maxLines="1"
android:layout_gravity="center"
android:text="@string/dummy_str"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="@color/text_select" />
<TextView
android:id="@+id/itemCountText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_toLeftOf="@+id/nextLevel"
android:layout_gravity="center"
android:textSize="20sp" />
<ImageView
android:id="@+id/nextLevel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:src="@drawable/ic_navigation_next_item"
android:layout_gravity="center"
android:visibility="invisible" />
</LinearLayout>
</LinearLayout>
\ No newline at end of file
......@@ -10,6 +10,15 @@
android:id="@+id/toolbar"
style="@style/DialogToolBarHolo">
<Button
android:id="@+id/popup_left_title"
style="@style/ButtonABookLight"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:visibility="gone" />
<TextView
android:id="@+id/popup_title"
style="@style/DialogToolBarTitle"
......@@ -48,24 +57,24 @@
</LinearLayout>
<LinearLayout
android:id="@+id/left_item"
android:id="@+id/header_item"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/btn_layout"
android:orientation="vertical"
android:paddingLeft="10dp"
android:paddingBottom="8dp"
android:visibility="gone" ><!-- ツールバー背景イメージの影の高さがあるため、8dpほどpaddingを入れる -->
android:paddingLeft="10dp"
android:visibility="gone"><!-- ツールバー背景イメージの影の高さがあるため、8dpほどpaddingを入れる -->
<TextView
android:id="@+id/header_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableLeft="@drawable/blue_arrow_up"
android:gravity="center_vertical"
android:maxLines="1"
android:text="@string/dummy_str"
android:textColor="@color/text_select"
android:textSize="@dimen/app_normal_text_size"
android:maxLines="1" />
android:textSize="@dimen/app_normal_text_size" />
</LinearLayout>
<View
......
......@@ -4,15 +4,18 @@ import java.util.ArrayList;
import jp.agentec.abook.abv.bl.common.Constant.ReportType;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.dto.OperationGroupMasterDto;
import jp.agentec.abook.abv.cl.util.PreferenceUtil;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType.DefPrefKey;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType.UserPrefKey;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType.OperationLocationType;
import jp.agentec.adf.util.DateTimeUtil;
import jp.agentec.adf.util.StringUtil;
import android.content.Context;
import java.util.List;
import java.util.Stack;
public class ABVUIDataCache {
private static final String TAG = "ABVUIDataCache";
......@@ -22,6 +25,9 @@ public class ABVUIDataCache {
// ホーム画面項目
private int viewMode; // パンネル、リスト形式
// 作業種別絞り込み用のスタック
public Stack<OperationGroupMasterDto> operationGroupMasterStack;
private ArrayList<Integer> mReportTypes;
public long lastUpdateTime = -1;
......@@ -50,8 +56,10 @@ public class ABVUIDataCache {
init();
}
// 初期状態
private void init() {
viewMode = loadViewMode();
operationGroupMasterStack = new Stack<>();
}
public long saveLastUpdateTime() {
......@@ -89,6 +97,48 @@ public class ABVUIDataCache {
}
/**
* xmlにファイル書き込みされた
* 通常・作業種別のモード切り替えの値を取得
* @return
*/
public int getOperationGroupMasterMode() {
return PreferenceUtil.getUserPref(context, UserPrefKey.OPERATION_GROUP_MASERT_MODE, 0);
}
/**
* 通常・作業種別のモード切り替えの値をxmlにファイル書き込みする
* @param operationGroupMasterMode
*/
public void setOperationGroupMasterMode(int operationGroupMasterMode) {
PreferenceUtil.putUserPref(context, UserPrefKey.OPERATION_GROUP_MASERT_MODE, operationGroupMasterMode);
}
/**
* xmlに書き込みされた作業種別IDを取得
* @return
*/
public int getOperationGroupMasterId() {
return PreferenceUtil.getUserPref(context, UserPrefKey.OPERATION_GROUP_MASERT_ID, 0);
}
/**
* xmlに作業種別IDをファイル書き込みする
* @param operationGroupMasterId
*/
public void setOperationGroupMasterId(int operationGroupMasterId) {
PreferenceUtil.putUserPref(context, UserPrefKey.OPERATION_GROUP_MASERT_ID, operationGroupMasterId);
}
/**
* 保持していた作業種別のデータをクリアする
*/
public void clearOperationGroupMaster() {
setOperationGroupMasterMode(OperationLocationType.ALL);
setOperationGroupMasterId(0);
operationGroupMasterStack.clear();
}
/**
* コンテンツビューからコンテンツビューへ
* 戻る時のコンテンツIDとページのセット
* @param contentId
......
......@@ -664,24 +664,7 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
@Override
public void onClick(View v) {
if (mXWalkOpenType == Constant.XWalkOpenType.PANO_EDIT) {
ABookAlertDialog alertDialog = AlertDialogUtil.createAlertDialog(ABVContentViewActivity.this, PatternStringUtil.patternToInt(getApplicationContext(),
R.string.pano_edit,
getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0)));
// リソースパターンの適用
alertDialog.setMessage(PatternStringUtil.patternToString(getApplicationContext(),
R.string.msg_confirm_save_pano_edit,
getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0)));
alertDialog.setNegativeButton(R.string.cancel, null);
alertDialog.setPositiveButton(R.string.ok,
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
callUnloadAuth();
dialog.dismiss();
finish();
}
});
alertDialog.show();
showConfirmSavePanoEdit();
} else {
// 作業終了する時、作業ID設定して作業一覧で使用するメソットを行う。
putUserPref(AppDefType.UserPrefKey.SYNC_TARGET_OPERATION_ID, mOperationId);
......@@ -754,6 +737,30 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
});
}
/**
* 編集を終了しますかのダイアログメッセージ表示
*/
public void showConfirmSavePanoEdit() {
ABookAlertDialog alertDialog = AlertDialogUtil.createAlertDialog(ABVContentViewActivity.this, PatternStringUtil.patternToInt(getApplicationContext(),
R.string.pano_edit,
getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0)));
// リソースパターンの適用
alertDialog.setMessage(PatternStringUtil.patternToString(getApplicationContext(),
R.string.msg_confirm_save_pano_edit,
getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0)));
alertDialog.setNegativeButton(R.string.cancel, null);
alertDialog.setPositiveButton(R.string.ok,
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
callUnloadAuth();
dialog.dismiss();
finish();
}
});
alertDialog.show();
}
//以下のメッソドは子ActivityにOverideで使用
protected void finishActivity() {}
protected void webViewLoadUrl(String url){}
......
......@@ -12,6 +12,12 @@ public interface AppDefType {
int LIST = 1;
}
// 作業種別モードフラグ
interface OperationLocationType {
int ALL = 0;
int GROUP = 1;
}
interface DefPrefKey {
String REPEATABLE_PLAY = "repeatablePlay";
String WIFI_ALERT_ENABLE = "wifiAlertEnable";
......@@ -56,8 +62,11 @@ public interface AppDefType {
String OPERATION_REPORT_TYPES = "operationReportTypes";
String RESOURCE_PATTERN_TYPE = "resourcePatternType"; // 文言リソースパターン
String APERTURE_MASTER_DATA_FETCH_DATE = "apertureMasterDataFetchDate"; // 絞り検索マスタデータのFetchDate
String OPERATION_GROUP_MASERT_MODE = "operation_group_master"; // 通常・作業種別モード(画面)
String OPERATION_GROUP_MASERT_ID = "operation_group_master_id"; // 作業種別のID
String APERTURE_MASTER_DATA_FETCH_DATE = "apertureMasterDataFetchDate"; // 絞り検索マスタデータのFetchDate
}
/**
......
......@@ -103,7 +103,7 @@ public class ABVListDialog extends Dialog {
getListView().setOnItemLongClickListener(listener);
}
public void setLeftItemOnClickListener(String itemName, View.OnClickListener l) {
public void setHeaderItemOnClickListener(String itemName, View.OnClickListener l) {
// Button itemButton = (Button) mRoot.findViewById(R.id.popup_title_left);
// if (itemButton != null) {
// itemButton.setVisibility(View.VISIBLE);
......@@ -111,7 +111,7 @@ public class ABVListDialog extends Dialog {
// itemButton.setOnClickListener(l);
// } else {
// 携帯の場合
LinearLayout linearLayout = (LinearLayout) mRoot.findViewById(R.id.left_item);
LinearLayout linearLayout = (LinearLayout) mRoot.findViewById(R.id.header_item);
linearLayout.setOnClickListener(l);
linearLayout.setVisibility(View.VISIBLE);
TextView textView = (TextView) mRoot.findViewById(R.id.header_title);
......@@ -119,6 +119,21 @@ public class ABVListDialog extends Dialog {
textView.setText(String.format(suffixText, itemName));
// }
}
/**
* 左側の要素イベント
* @param itemName
* @param l
*/
public void setLeftItemOnClickListener(String itemName, View.OnClickListener l) {
Button itemButton = (Button) mRoot.findViewById(R.id.popup_left_title);
if (itemButton != null) {
itemButton.setText(itemName);
itemButton.setVisibility(View.VISIBLE);
itemButton.setOnClickListener(l);
}
}
public void setRightItemOnClickListener(int resId, View.OnClickListener l) {
ImageButton itemButton = (ImageButton) mRoot.findViewById(R.id.popup_right_image);
if (itemButton != null) {
......
package jp.agentec.abook.abv.ui.home.adapter;
import java.util.ArrayList;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.launcher.android.R;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
public class HierarchyOperationGroupListAdapter extends BaseAdapter {
private static LayoutInflater mInflater = null;
private ArrayList<String> mNameList = new ArrayList<>();
private boolean[] mHaveChildFlags;
private int[] mOperationCounts;
public HierarchyOperationGroupListAdapter(Context context, ArrayList<String> nameList, boolean[] haveChildFlags, int[] operationCounts) {
mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
mNameList = nameList;
mHaveChildFlags = haveChildFlags;
mOperationCounts = operationCounts;
}
@Override
public int getCount() {
return mNameList.size();
}
@Override
public Object getItem(int position) {
return mNameList.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
public void remove(int position) {
mNameList.remove(position);
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder;
if (null == convertView) {
convertView = mInflater.inflate(R.layout.item_popup_list_item, null);
holder = new ViewHolder();
holder.title = (TextView) convertView.findViewById(R.id.itemText);
holder.nextLevel = (ImageView) convertView.findViewById(R.id.nextLevel);
holder.itemCount = (TextView) convertView.findViewById(R.id.itemCountText);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
// タイトル
holder.title.setText((String)getItem(position));
// 子作業種別がある場合、「>」を表示
if (mHaveChildFlags[position]) {
holder.nextLevel.setVisibility(View.VISIBLE);
} else {
holder.nextLevel.setVisibility(View.INVISIBLE);
}
// 作業数
holder.itemCount.setText("" + mOperationCounts[position]);
return convertView;
}
static class ViewHolder {
TextView title;
ImageView nextLevel;
TextView itemCount;
}
}
package jp.agentec.abook.abv.ui.home.helper;
import android.graphics.Color;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.widget.HorizontalScrollView;
import android.widget.LinearLayout;
import java.util.ArrayList;
import java.util.List;
import java.util.Stack;
import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.home.activity.OperationListActivity;
import jp.agentec.abook.abv.ui.home.view.BreadCrumbButton;
import static jp.agentec.abook.abv.cl.util.PreferenceUtil.getUserPref;
/**
* 階層構造をロジックの共通処理を実装
* @author jang
*
*/
public abstract class HierarchyOperationListHelper<StackObject> extends OperationListHelper implements OnClickListener {
private final int MP = LayoutParams.MATCH_PARENT;
private final int WP = LayoutParams.WRAP_CONTENT;
protected Stack<StackObject> stack;
private LinearLayout mHierarchyContentLayout = null;
private LinearLayout mBreadCrumbsLayout = null;
private ViewGroup mOperationListView = null;
protected ArrayList<BreadCrumbButton> breadCrumbList = null;
private HorizontalScrollView panList;
/**
* 階層構造を持つ親クラス
* @param appActivity
*/
public HierarchyOperationListHelper(OperationListActivity appActivity) {
super(appActivity);
mHierarchyContentLayout = new LinearLayout(appActivity);
mHierarchyContentLayout.setOrientation(LinearLayout.VERTICAL);
View v = new View(appActivity);
v.setBackgroundColor(Color.GRAY);
LinearLayout.LayoutParams vlp = new LinearLayout.LayoutParams(MP, 1);
mHierarchyContentLayout.addView(v, vlp);
LinearLayout panListLayout = (LinearLayout) LayoutInflater.from(appActivity).inflate(R.layout.content_breadcrumb_layout, null);
// 階層構造ビューを表示するボタン
panListLayout.findViewById(R.id.btn_show_list_view).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
mAppActivity.showOperationGroupMasterDialog(true,false);
}
});
// パンくずのスクロールを作成
panList = (HorizontalScrollView) panListLayout.findViewById(R.id.bread_crumbs_scroll_view);
mBreadCrumbsLayout = (LinearLayout) panListLayout.findViewById(R.id.bread_crumbs_layout);
breadCrumbList = new ArrayList<>();
// パンくずリストを追加
mHierarchyContentLayout.addView(panListLayout, new LinearLayout.LayoutParams(MP, WP));
}
public void addBreadCrumbs(String name) {
addBreadCrumbs(name, stack.size() + 1);
}
public void addBreadCrumbs(String name, int level) {
BreadCrumbButton bcb = new BreadCrumbButton(mAppActivity, name);
bcb.level = level;
breadCrumbList.add(bcb);
bcb.setOnClickListener(this);
LayoutParams l = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
mBreadCrumbsLayout.addView(bcb, l);
// 右側へスクロールさせる
panList.post(new Runnable() {
@Override
public void run() {
panList.fullScroll(View.FOCUS_RIGHT);
}
});
}
protected void removeBreadCrumbs(View v) {
mBreadCrumbsLayout.removeView(v);
if (v instanceof BreadCrumbButton) {
breadCrumbList.remove(v);
}
}
/**
* 作業一覧のViewGroup取得
* @return
*/
@Override
public ViewGroup getOperationView() {
if (mOperationListView != null) {
ViewGroup parent = (ViewGroup) mOperationListView.getParent();
if (parent != null) {
parent.removeView(mOperationListView);
}
}
mOperationListView = super.getOperationView();
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(MP, 1);
lp.weight = 1;
mHierarchyContentLayout.addView(mOperationListView, 0, lp);
return mHierarchyContentLayout;
}
/**
* HorizontalScrollViewパンくずボタンをクリック時に呼ばれるメソッド
*/
@Override
public void onClick(View v) {
BreadCrumbButton button = (BreadCrumbButton) v;
int popCount = mBreadCrumbsLayout.getChildCount() - button.level;
if (popCount > 0) {
popList(popCount, true);
}
}
/**
* 階層スタックの現在のサイズを返します
*
* @return
*/
public int getStackSize() {
return stack.size();
}
/**
* 指定した階層分上のリストへ移動する
*
* @param popCount いくつ上の階層を表示するか指定します。
*/
abstract public void popList(int popCount, boolean isReload);
/**
* 一つ下の階層のリストへ移動する
*
* @param stackObject
*/
abstract public void pushList(StackObject stackObject);
/**
* 子階層の一覧を取得します
* @return
*/
abstract public List<StackObject> getChildList();
/**
* 現在の階層の名前を取得します
* @return
*/
abstract public String getPeekName();
/**
* 一つ上の階層の名前を取得します
* @return
*/
abstract public String getPrePeekName();
}
package jp.agentec.abook.abv.ui.home.helper;
import java.util.List;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.dto.ContentDto;
import jp.agentec.abook.abv.bl.dto.OperationDto;
import jp.agentec.abook.abv.bl.logic.AbstractLogic;
import jp.agentec.abook.abv.bl.logic.OperationLogic;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType;
import jp.agentec.abook.abv.ui.home.activity.OperationListActivity;
import static jp.agentec.abook.abv.cl.util.PreferenceUtil.getUserPref;
/**
* Created by leej on 2019/06/24.
*/
public class HomeOperationListHelper extends OperationListHelper {
private static final String TAG = "HomeOperationListHelper";
public HomeOperationListHelper(OperationListActivity activity) {
super(activity);
}
@Override
protected List<OperationDto> findOperationList() throws Exception {
String reportTypeStr = getUserPref(mAppActivity, AppDefType.UserPrefKey.OPERATION_REPORT_TYPES, null);
return operationLogic.getRefreshOperation(mAppActivity.mSearchWord, mAppActivity.mStartDateStr, mAppActivity.mEndDateStr, reportTypeStr);
}
}
package jp.agentec.abook.abv.ui.home.helper;
import java.util.ArrayList;
import java.util.List;
import jp.agentec.abook.abv.bl.common.ABVEnvironment;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.data.dao.AbstractDao;
import jp.agentec.abook.abv.bl.data.dao.OperationGroupMasterDao;
import jp.agentec.abook.abv.bl.dto.OperationDto;
import jp.agentec.abook.abv.bl.dto.OperationGroupMasterDto;
import jp.agentec.abook.abv.bl.logic.AbstractLogic;
import jp.agentec.abook.abv.bl.logic.OperationGroupMasterLogic;
import jp.agentec.abook.abv.launcher.android.ABVApplication;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType;
import jp.agentec.abook.abv.ui.home.activity.OperationListActivity;
import jp.agentec.adf.util.CollectionUtil;
import static jp.agentec.abook.abv.cl.util.PreferenceUtil.getUserPref;
public class OperationGroupMasterListHelper extends HierarchyOperationListHelper<OperationGroupMasterDto> {
private static final String TAG = "OperationGroupMasterListHelper";
private OperationGroupMasterDao mOperationGroupMasterDao = AbstractDao.getDao(OperationGroupMasterDao.class);
private OperationGroupMasterLogic mOperationGroupMasterLogic = AbstractLogic.getLogic(OperationGroupMasterLogic.class);
public OperationGroupMasterListHelper(OperationListActivity appActivity) {
super(appActivity);
// キャッシュのスタックを利用する
stack = ABVApplication.getABVUIDataCache(mAppActivity).operationGroupMasterStack;
if (stack.size() == 0) {
// スタックが空の場合、全体を入れる
OperationGroupMasterDto operationGroupMasterDto;
// 保存されたoperationGroupmasterIdが0または、存在しない場合
if (mAppActivity.getOperationGroupMasterId() == 0 || !mOperationGroupMasterDao.isExistOperationGroupMaster(mAppActivity.getOperationGroupMasterId())) {
// 最上位階層をセット
operationGroupMasterDto = mOperationGroupMasterDao.getTopOperationGroupMaster();
if (operationGroupMasterDto != null) {
pushList(operationGroupMasterDto);
}
} else {
// 前回開いた際のIDでセット
List<OperationGroupMasterDto> operationGroupMasterDtoList = mOperationGroupMasterLogic.getParentOperationGroupMasterForPath(mAppActivity.getOperationGroupMasterId());
if (CollectionUtil.isNotEmpty(operationGroupMasterDtoList)) {
for (OperationGroupMasterDto dto : operationGroupMasterDtoList) {
pushList(dto);
}
}
}
} else {
// スタックに積まれている分だけパンくずボタンを作成
for (int i = 0; i < stack.size(); i++) {
OperationGroupMasterDto groupDto = stack.get(i);
addBreadCrumbs(groupDto.operationGroupMasterName, i + 1);
}
}
}
/**
* データの取得処理(新着更新処理完了後行われる)
* @return
* @throws Exception
*/
@Override
protected List<OperationDto> findOperationList() throws Exception {
OperationGroupMasterDto peekOperationGroupMasterDto = stack.peek();
String reportTypeStr = getUserPref(mAppActivity, AppDefType.UserPrefKey.OPERATION_REPORT_TYPES, null);
Integer operationGroupMasterId = null;
// operationGroupMasterIdのデータが存在、且つクリアフラグがfalseの場合
if (mOperationGroupMasterDao.isExistOperationGroupMaster(peekOperationGroupMasterDto.operationGroupMasterId) && !ABVEnvironment.getInstance().getOperationGroupMasterClearFlg()) {
operationGroupMasterId = peekOperationGroupMasterDto.operationGroupMasterId;
} else {
// 表示する作業種別が既に削除された場合、最上位階層に戻る(リセット)
popList(breadCrumbList.size() - 1, false);
// クリアフラグをfalseにセット
ABVEnvironment.getInstance().setOperationGroupMasterClearFlg(false);
// 作業種別の選択画面を閉じる
mAppActivity.closeOperationGroupMasterDialog();
}
// 作業種別IDで紐づく作業リストを取得
return mOperationGroupMasterLogic.getOperationByOperationGroupMasterId(operationGroupMasterId);
}
/**
* 親階層へ移動処理
* @param popCount いくつ上の階層を表示するか指定します。
* @param isReload リロードする・しない判定
*/
@Override
public void popList(int popCount, boolean isReload) {
for (int i = 0; i < popCount; i++) {
stack.pop();
// パンくずリスト削除
removeBreadCrumbs(breadCrumbList.get(breadCrumbList.size() - 1));
}
// 移動した作業種別のIDセット
mAppActivity.setOperationGroupMasterId(stack.get(getStackSize() - 1).operationGroupMasterId);
breadCrumbList.get(breadCrumbList.size() - 1);
if (isReload) {
// 作業一覧画面を更新する
refreshList();
}
}
@Override
public void pushList(OperationGroupMasterDto operationGroupMasterDto) {
if (operationGroupMasterDto == null) {
Logger.w(TAG, "[pushList] groupDto is null");
return;
}
// パンくずリスト追加
addBreadCrumbs(operationGroupMasterDto.operationGroupMasterName);
// ID保存
mAppActivity.setOperationGroupMasterId(operationGroupMasterDto.operationGroupMasterId);
stack.push(operationGroupMasterDto);
refreshList();
}
@Override
public String getPrePeekName() {
String groupName = "";
if (stack.size() > 1) {
groupName = stack.get(stack.size() - 2).operationGroupMasterName;
}
return groupName;
}
@Override
public String getPeekName() {
String groupName = "";
if (stack.size() > 0) {
groupName = stack.peek().operationGroupMasterName;
}
return groupName;
}
/**
* 親階層の情報で下の階層をリストで取得
* @return List<OperationGroupMasterDto>
*/
@Override
public List<OperationGroupMasterDto> getChildList() {
OperationGroupMasterDto peekOperationGroupMasterDto = stack.peek();
return getChildList(peekOperationGroupMasterDto.operationGroupMasterId);
}
/**
* 親階層のIDで下の階層をリストで取得
* @param operationGroupMasterId
* @return List<OperationGroupMasterDto>
*/
public List<OperationGroupMasterDto> getChildList(Integer operationGroupMasterId) {
return mOperationGroupMasterDao.getOperationGroupMasterChildList(operationGroupMasterId);
}
}
package jp.agentec.abook.abv.ui.home.helper;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.GridView;
import android.widget.ListView;
import android.widget.Toast;
import com.handmark.pulltorefresh.library.PullToRefreshBase;
import com.handmark.pulltorefresh.library.PullToRefreshGridView;
......@@ -14,6 +11,7 @@ import com.handmark.pulltorefresh.library.PullToRefreshListView;
import java.util.ArrayList;
import java.util.List;
import jp.agentec.abook.abv.bl.common.exception.NetworkDisconnectedException;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.dto.OperationDto;
import jp.agentec.abook.abv.bl.logic.AbstractLogic;
......@@ -24,7 +22,6 @@ import jp.agentec.abook.abv.ui.common.appinfo.AppDefType;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType.ViewMode;
import jp.agentec.abook.abv.ui.common.constant.ErrorCode;
import jp.agentec.abook.abv.ui.common.constant.ErrorMessage;
import jp.agentec.abook.abv.ui.common.util.ABVToastUtil;
import jp.agentec.abook.abv.ui.common.util.PatternStringUtil;
import jp.agentec.abook.abv.ui.home.activity.OperationListActivity;
import jp.agentec.abook.abv.ui.home.adapter.AbstractOperationAdapter;
......@@ -38,13 +35,13 @@ import static jp.agentec.abook.abv.cl.util.PreferenceUtil.getUserPref;
* Created by leej on 2019/03/06.
*/
public class OperationListHelper {
public abstract class OperationListHelper {
private static final String TAG = "OperationListHelper";
private OperationListActivity mAppActivity;
protected OperationListActivity mAppActivity;
private AbstractOperationAdapter mAdapter;
private PullToRefreshListView mPullToRefreshListView;
private PullToRefreshGridView mPullToRefreshGridView;
private OperationLogic mOperationLogic = AbstractLogic.getLogic(OperationLogic.class);
protected OperationLogic operationLogic = AbstractLogic.getLogic(OperationLogic.class);
private List<OperationDto> operationDtoList = new ArrayList<>();
// スマートフォンの1行のパンネル数
......@@ -61,10 +58,19 @@ public class OperationListHelper {
mPullToRefreshGridView = new PullToRefreshGridView(activity);
}
/**
* 作業を検索してListを返す
*
* @return
* @throws Exception
* @throws NetworkDisconnectedException
*/
abstract protected List<OperationDto> findOperationList() throws Exception;
private List<OperationDto> filterOperationList() {
try {
String reportTypeStr = getUserPref(mAppActivity, AppDefType.UserPrefKey.OPERATION_REPORT_TYPES, null);
operationDtoList = mOperationLogic.getRefreshOperation(mAppActivity.mSearchWord, mAppActivity.mStartDateStr, mAppActivity.mEndDateStr, reportTypeStr);
operationDtoList = findOperationList();
} catch (Exception e) {
Logger.e(TAG, "findOperationList", e);
ErrorMessage.showErrorMessageToast(mAppActivity.getApplicationContext(), ErrorCode.E107);
......@@ -247,7 +253,7 @@ public class OperationListHelper {
}
/**
* プロジェクトの件数取得
* 作業の件数取得
* @return
*/
public int getOperationCount() {
......@@ -255,7 +261,7 @@ public class OperationListHelper {
}
/**
* プロジェクトリスト取得
* 作業リスト取得
* @return
*/
public List<OperationDto> getOperationList() {
......
package jp.agentec.abook.abv.ui.home.view;
import jp.agentec.abook.abv.launcher.android.R;
import android.content.Context;
import android.graphics.Color;
import android.widget.Button;
/**
* パンくず履歴用のボタン
* @author jang
*
*/
public class BreadCrumbButton extends Button {
private BreadCrumbButton(Context context) {
super(context);
}
public BreadCrumbButton(Context context, String name) {
super(context);
this.name = name;
setText(name);
setTextColor(Color.BLACK);
setBackgroundResource(R.drawable.btn_breadcrumbs);
setPadding(10, 0, 40, 0);
}
public int level;
public String name;
}
......@@ -242,39 +242,6 @@ public class HTMLWebViewActivity extends ParentWebViewActivity {
webView.setWebViewClient(new WebViewClient() {
@Override
public WebResourceResponse shouldInterceptRequest(WebView view, final String url) {
if (mXWalkOpenType == Constant.XWalkOpenType.PANO_EDIT) {
// 360編集画面時に以下の処理でステータスコードのチェックを行う
if (!url.contains("%")) {
new Thread(new Runnable() {
@Override
public void run() {
HttpGet httpGet = new HttpGet(url);
HttpResponse response;
HttpClient client = new DefaultHttpClient();
try {
response = client.execute(httpGet);
final int statusCode = response.getStatusLine().getStatusCode();
Logger.d("shouldInterceptRequest url :" + url + " status code : " + statusCode);
if (statusCode >= 400) {
handler.post(new Runnable() {
@Override
public void run() {
commonOnReceivedResponseHeaders(url, statusCode);
}
});
}
} catch (IOException e) {
Logger.e(TAG, e);
}
}
}).start();
}
}
return null;
}
@Override
public void onLoadResource(WebView view, String url) {
backCheckFlg = view.canGoBack();
forwardCheckFlg = view.canGoForward();
......@@ -540,20 +507,8 @@ public class HTMLWebViewActivity extends ParentWebViewActivity {
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
if (mOperationId != null && mOperationId > -1) {
putUserPref(AppDefType.UserPrefKey.SYNC_TARGET_OPERATION_ID, mOperationId);
}
if (isLinkedContent) {
goToBack();
} else {
finishActivity();
}
} else {
return super.onKeyUp(keyCode, event);
}
return false;
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
......@@ -561,20 +516,6 @@ public class HTMLWebViewActivity extends ParentWebViewActivity {
}
@Override
protected void finishActivity() {
setResult(RESULT_OK, new Intent());
finish();
if (objectId == -1) { // HTMLコンテンツの場合で、KeyUpではない場合、全コンテンツActivityを終了
if (isLinkedContent) {
ActivityHandlingHelper.getInstance().finishAllLinkContentViewActivity();
} else {
ActivityHandlingHelper.getInstance().finishAllContentViewActivity();
}
}
}
@Override
public void onResume() {
Logger.i(TAG, "onResume");
super.onResume();
......
......@@ -252,11 +252,6 @@ public class HTMLXWalkWebViewActivity extends ParentWebViewActivity {
});
webView.setResourceClient(new XWalkResourceClient(webView) {
@Override
public void onReceivedResponseHeaders (XWalkView view, XWalkWebResourceRequest request, XWalkWebResourceResponse response) {
String uri = request.getUrl().toString();
commonOnReceivedResponseHeaders(uri, response.getStatusCode());
}
@Override
public void onReceivedLoadError (XWalkView view, int errorCode, String description, String failingUrl) {
......@@ -579,35 +574,13 @@ public class HTMLXWalkWebViewActivity extends ParentWebViewActivity {
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
if (mOperationId != null && mOperationId > -1) {
putUserPref(AppDefType.UserPrefKey.SYNC_TARGET_OPERATION_ID, mOperationId);
}
if (isLinkedContent) {
goToBack();
} else {
finishActivity();
}
} else {
return super.onKeyUp(keyCode, event);
}
return false;
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
return super.onKeyDown(keyCode, event);
}
@Override
protected void finishActivity() {
setResult(RESULT_OK, new Intent());
finish();
if (isLinkedContent) {
ActivityHandlingHelper.getInstance().finishAllLinkContentViewActivity();
} else {
ActivityHandlingHelper.getInstance().finishAllContentViewActivity();
}
}
@Override
public void onResume() {
......@@ -622,13 +595,13 @@ public class HTMLXWalkWebViewActivity extends ParentWebViewActivity {
protected void onStop() {
super.onStop();
webView.stopLoading();
if (objectLogId != -1) {
ContentLogUtil.getInstance().endObjectLog(getContentId(), objectLogId);
} else {
if (objectLogId == -1) {
if (lastPageStartDate != null) { // 360の場合
ContentLogUtil.getInstance().endContentPageReadLog(contentId, lastPageNo, readingLogId);
AbstractLogic.getLogic(ContentReadingLogLogic.class).endContentReadLog(contentId);
}
} else {
ContentLogUtil.getInstance().endObjectLog(getContentId(), objectLogId);
}
}
......
......@@ -3,7 +3,9 @@ package jp.agentec.abook.abv.ui.viewer.activity;
import android.app.Activity;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import android.view.KeyEvent;
import android.view.View;
import android.widget.Button;
import android.widget.ImageButton;
......@@ -22,6 +24,8 @@ import jp.agentec.abook.abv.bl.common.Callback;
import jp.agentec.abook.abv.bl.common.CommonExecutor;
import jp.agentec.abook.abv.bl.common.Constant;
import jp.agentec.abook.abv.bl.common.constant.ABookKeys;
import jp.agentec.abook.abv.bl.common.exception.ABVExceptionCode;
import jp.agentec.abook.abv.bl.common.exception.AcmsException;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.data.dao.AbstractDao;
import jp.agentec.abook.abv.bl.data.dao.ContentDao;
......@@ -95,33 +99,6 @@ public class ParentWebViewActivity extends ABVContentViewActivity {
}
}
protected void commonOnReceivedResponseHeaders(String uri, int statusCode) {
if (uri.contains("vtour") || uri.contains("authByCheck")) {
if(statusCode >= 400) {
// エラーのため、空のURLをロードさせ、白い画面で表示させる
webViewLoadUrl("");
ABookAlertDialog alertDialog = AlertDialogUtil.createAlertDialog(this, R.string.app_name);
// リソースパターンの適用
alertDialog.setMessage(String.format(PatternStringUtil.patternToString(getApplicationContext(),
R.string.error_msg_open_pano_edit,
getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0)),
statusCode + ""));
// リソースパターンの適用
alertDialog.setPositiveButton(PatternStringUtil.patternToInt(getApplicationContext(),
R.string.ok,
getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0)),
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
finish();
}
});
alertDialog.show();
}
}
}
protected void commonProgressChanged(int progress) {
setVisbilityProgress(true);
if (progress >= 100) {
......@@ -240,6 +217,41 @@ public class ParentWebViewActivity extends ABVContentViewActivity {
}
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
if (mXWalkOpenType == Constant.XWalkOpenType.PANO_EDIT) {
showConfirmSavePanoEdit();
} else {
if (mOperationId != null && mOperationId > -1) {
putUserPref(AppDefType.UserPrefKey.SYNC_TARGET_OPERATION_ID, mOperationId);
}
if (isLinkedContent) {
goToBack();
} else {
finishActivity();
}
}
} else {
return super.onKeyUp(keyCode, event);
}
return false;
}
@Override
protected void finishActivity() {
setResult(RESULT_OK, new Intent());
finish();
if (objectId == -1) { // HTMLコンテンツの場合で、KeyUpではない場合、全コンテンツActivityを終了
if (isLinkedContent) {
ActivityHandlingHelper.getInstance().finishAllLinkContentViewActivity();
} else {
ActivityHandlingHelper.getInstance().finishAllContentViewActivity();
}
}
}
@Override
protected void onDestroy() {
Logger.d(TAG, "onDestroy");
if (mXWalkOpenType == Constant.XWalkOpenType.TASK_REPORT) {
......@@ -278,7 +290,7 @@ public class ParentWebViewActivity extends ABVContentViewActivity {
if (responseUri != null && responseUri.getPath() != null) {
File file = new File(responseUri.getPath());
try {
final Integer resourceId = AbstractLogic.getLogic(OperationLogic.class).sendScene(file);
final Integer resourceId = AbstractLogic.getLogic(OperationLogic.class).sendScene(file, contentId);
if (resourceId != null) {
runOnUiThread(new Runnable() {
@Override
......@@ -319,6 +331,26 @@ public class ParentWebViewActivity extends ABVContentViewActivity {
}
});
}
} catch (AcmsException ex) {
Logger.e(TAG, ex);
if (ex.getCode() == ABVExceptionCode.P_E_ACMS_P007) {
// シーン追加時、ロック状態である場合
runOnUiThread(new Runnable() {
@Override
public void run() {
closeProgressPopup();
webViewLoadUrl(String.format("javascript:EDC.handleError({ 'status' : 400 }, '', {'message' : 'C018'})"));
}
});
} else {
handler.post(new Runnable() {
@Override
public void run() {
closeProgressPopup();
showFailedSceneApiDialog();
}
});
}
} catch (Exception e) {
Logger.e(TAG, e);
handler.post(new Runnable() {
......
......@@ -6,7 +6,7 @@ android {
defaultConfig {
minSdkVersion 16
targetSdkVersion 26
targetSdkVersion 28
}
buildTypes {
......
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