Commit ac2bc7f4 by Lee Jaebin

ソース分離(未使用のリソース削除)

parent 40f44ee0
package jp.agentec.abook.abv.bl.acms.client.json;
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.common.util.JsonUtil;
import jp.agentec.abook.abv.bl.dto.SubscriptionDto;
import org.json.adf.JSONArray;
import org.json.adf.JSONObject;
public class ContentSetJSON extends AcmsCommonJSON {
public ArrayList<SubscriptionDto> SubscriptionDtoList;
public ContentSetJSON(String jsonString) throws AcmsException {
super(jsonString);
}
@Override
protected void parse(JSONObject json) throws JSONValidationException {
if (json.has("allSubscriptionList")) {
JSONArray array = json.getJSONArray("allSubscriptionList");
SubscriptionDtoList = new ArrayList<SubscriptionDto>();
for (int i = 0; i < array.length(); i++) {
JSONObject subJson = array.getJSONObject(i);
SubscriptionDto dto = new SubscriptionDto();
dto.productId = getString(subJson, "productId", null);
dto.delFlg = JsonUtil.getInt(subJson, "delFlg");
JSONArray historyList = JsonUtil.getJSONArray(subJson, "historyList");
if (historyList != null) {
for (int j = 0; j < historyList.length(); j++) {
JSONObject history = historyList.getJSONObject(j);
dto.addPeriod(JsonUtil.getLong(history, "start"), JsonUtil.getLong(history, "end"), JsonUtil.getString(history, "purchaseToken"));
}
}
SubscriptionDtoList.add(dto);
}
} else {
throw new JSONValidationException(json.toString(), "allSubscriptionList property not found.");
}
}
}
package jp.agentec.abook.abv.bl.acms.client.json;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import jp.agentec.abook.abv.bl.common.exception.AcmsException;
import jp.agentec.abook.abv.bl.common.exception.JSONValidationException;
import jp.agentec.abook.abv.bl.common.util.JsonUtil;
import jp.agentec.abook.abv.bl.dto.SubscriptionHistoryDto;
import org.json.adf.JSONArray;
import org.json.adf.JSONObject;
public class SubscriptionHistoryJSON extends AcmsJSONParser {
public static final String HttpStatus = "httpStatus";
public static final String PurchaseHistoryId = "purchaseHistoryId";
public static final String PurchaseHistoryList = "purchaseHistoryList";
public static final String ContentSetId = "contentSetId";
// public static final String ContentSetName = "contentSetName";
public static final String AllFlg = "allFlg";
public static final String ProductId = "productId";
public static final String OrderId = "orderId";
public static final String PackageName = "packageName";
public static final String PurchaseTime = "purchaseTime";
public static final String PurchaseState = "purchaseState";
public static final String DeveloperPayload = "developerPayload";
public static final String PurchaseToken = "purchaseToken";
public static final String AutoRenewing = "autoRenewing";
public static final String StartTimeMillis = "startTimeMillis";
public static final String ExpiryTimeMillis = "expiryTimeMillis";
public static final String SentFlg = "sentFlg";
public static final String DelFlg = "delFlg";
public static final String InsertDate = "insertDate";
public static final String UpdateDate = "updateDate";
public static final String ErrorMessage = "errorMessage";
public static final String LoginErrorMessage = "loginErrorMessage";
public List<SubscriptionHistoryDto> dtoList;
public boolean isSuccess;
public String errorMessage;
public SubscriptionHistoryJSON(String jsonString) throws AcmsException {
super(jsonString);
}
@Override
protected void parse(JSONObject json) throws JSONValidationException {
if (json.getInt(HttpStatus) == 200) {
dtoList = new ArrayList<SubscriptionHistoryDto>();
JSONArray purchaseHistoryList = json.getJSONArray(PurchaseHistoryList);
for (int i = 0; i < purchaseHistoryList.length(); i++) {
JSONObject purchaseHistoryJson = purchaseHistoryList.getJSONObject(i);
SubscriptionHistoryDto dto = new SubscriptionHistoryDto();
dto.purchaseHistoryId = purchaseHistoryJson.getLong(PurchaseHistoryId);
dto.contentSetId = purchaseHistoryJson.getInt(ContentSetId);
// dto.contentSetName = json.getString(contentSetName);
dto.allFlg = purchaseHistoryJson.getInt(AllFlg);
dto.productId = purchaseHistoryJson.getString(ProductId);
dto.orderId = purchaseHistoryJson.getString(OrderId);
dto.packageName = purchaseHistoryJson.getString(PackageName);
dto.purchaseTime = purchaseHistoryJson.getLong(PurchaseTime);
dto.purchaseState = purchaseHistoryJson.getInt(PurchaseState);
dto.developerPayload = purchaseHistoryJson.getString(DeveloperPayload);
dto.purchaseToken = purchaseHistoryJson.getString(PurchaseToken);
dto.autoRenewing = JsonUtil.getBoolean(purchaseHistoryJson, AutoRenewing);
dto.startTimeMillis = JsonUtil.getLong(purchaseHistoryJson, StartTimeMillis);
dto.expiryTimeMillis = JsonUtil.getLong(purchaseHistoryJson, ExpiryTimeMillis);
dto.sentFlg = 1;
dto.delFlg = purchaseHistoryJson.getInt(DelFlg);
dto.insertDate = new Date();
dto.updateDate = new Date();
dtoList.add(dto);
}
isSuccess = true;
} else {
errorMessage = json.getString(LoginErrorMessage); // Localeに合わせたメッセージ
}
}
}
package jp.agentec.abook.abv.bl.acms.client.parameters;
import java.sql.Timestamp;
import jp.agentec.adf.util.DateTimeFormat;
import jp.agentec.adf.util.DateTimeUtil;
/**
* サイネージ再生時の下敷き画像ダウンロード用のパラメータです。
* @author jang
* @version 1.6.0
*/
public class BackgroundPicParameters extends AcmsParameters {
private String type;
private Timestamp lastFetchDate;
public BackgroundPicParameters(String sid, String type, Timestamp lastFetchDate) {
super(sid);
this.type = type;
this.lastFetchDate = lastFetchDate;
}
public String getType() {
return type;
}
public String getLastFetchDate() {
if (lastFetchDate == null) {
return null;
}
return DateTimeUtil.toStringInTimeZone(lastFetchDate, DateTimeFormat.yyyyMMddHHmmss_hyphen, "GMT") + ",GMT";
}
}
package jp.agentec.abook.abv.bl.acms.client.parameters;
import java.util.Date;
/**
* コンテンツの公開開始日が正しいか確認するためのパラメータです。
* @author Taejin Hong
* @version 1.0.0
*/
public class ContentCheckDeliveryStartDateParameters extends AcmsContentParameters {
private Date deliveryStartDate;
/**
* {@link ContentCheckDeliveryStartDateParameters} クラスのインスタンスを初期化します。
* @param sid ログインした時のセッションIDです。
* @param contentId 確認するコンテンツのIDです。
* @param deliveryStartDate コンテンツの公開開始日です。
* @since 1.0.0
*/
public ContentCheckDeliveryStartDateParameters(String sid, long contentId, Date deliveryStartDate) {
super(sid, contentId);
this.deliveryStartDate = deliveryStartDate;
}
/**
* コンテンツの公開開始日を返します。
* @return コンテンツの公開開始日です。
* @since 1.0.0
*/
public Date getDeliveryStartDate() {
return deliveryStartDate;
}
}
package jp.agentec.abook.abv.bl.acms.client.parameters;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import jp.agentec.abook.abv.bl.acms.type.SearchDivisionType;
import jp.agentec.abook.abv.bl.common.exception.ABVRuntimeException;
import jp.agentec.adf.util.StringUtil;
/**
* コンテンツ検索用のパラメータです。
* @author Taejin Hong
* @version 1.1.0
*/
public class ContentSearchParameters extends AcmsParameters {
private String searchText;
private SearchDivisionType searchDivision;
/**
* @since 1.1.0
*/
private int groupId;
/**
* @since 1.1.0
*/
private int categoryId;
public static int None = -1;
/**
* {@link ContentSearchParameters} クラスのインスタンスを初期化します。
* @param sid ログインした時のセッションIDです。
* @param searchText 検索キーワードです。
* @param searchDivision 検索をかける項目です。
* @since 1.0.0
*/
public ContentSearchParameters(String sid, String searchText, SearchDivisionType searchDivision) {
super(sid);
this.searchText = searchText;
this.searchDivision = searchDivision;
this.groupId = None;
this.categoryId = None;
}
/**
* 検索キーワードを返します。
* @return 検索キーワードです。
* @since 1.0.0
*/
public String getSearchText() {
return searchText;
}
/**
* 検索をかける項目を返します。
*
* @return 検索をかける項目です。
* @since 1.0.0
*/
public int getSearchDivision() {
return searchDivision.type();
}
public int getGroupId() {
return groupId;
}
public void setGroupId(int groupId) {
this.groupId = groupId;
}
public int getCategoryId() {
return categoryId;
}
public void setCategoryId(int categoryId) {
this.categoryId = categoryId;
}
@Override
public String toHttpParameterString(String encoding) {
try {
StringBuffer sb = new StringBuffer();
sb.append(URLEncoder.encode("sid", encoding));
sb.append(DelimiterKeyValue);
if (!StringUtil.isNullOrEmpty(getSid())) {
sb.append(URLEncoder.encode(getSid(), encoding));
}
sb.append(DelimiterKeyKey);
sb.append(URLEncoder.encode("searchText", encoding));
sb.append(DelimiterKeyValue);
if (!StringUtil.isNullOrEmpty(searchText)) {
sb.append(URLEncoder.encode(getSearchText(), encoding));
}
sb.append(DelimiterKeyKey);
sb.append(URLEncoder.encode("searchDivision", encoding));
sb.append(DelimiterKeyValue);
//noinspection VariableNotUsedInsideIf
if (searchDivision != null) {
sb.append(getSearchDivision());
}
if (groupId != None) {
sb.append(DelimiterKeyKey);
sb.append(URLEncoder.encode("groupId", encoding));
sb.append(DelimiterKeyValue);
sb.append(getGroupId());
}
if (categoryId != None) {
sb.append(DelimiterKeyKey);
sb.append(URLEncoder.encode("categoryId", encoding));
sb.append(DelimiterKeyValue);
sb.append(getCategoryId());
}
return sb.toString();
} catch (UnsupportedEncodingException e) {
throw new ABVRuntimeException(e);
}
}
}
\ No newline at end of file
package jp.agentec.abook.abv.bl.acms.client.parameters;
/**
* グループ取得用のパラメータです。
* @author Taejin Hong
* @version 1.0.0
*/
public class GetBackupFileParameters extends AcmsParameters {
private String fileType;
/**
* {@link GetBackupFileParameters} のインスタンスを初期化します。
* @param sid ログインした時のセッションIDです。
* @since 1.0.0
*/
public GetBackupFileParameters(String sid, String fileType) {
super(sid);
this.fileType=fileType;
}
public String getFileType() {
return fileType;
}
}
package jp.agentec.abook.abv.bl.acms.client.parameters;
/**
* コンテンツ(PDF)の全ページのサムネイルのダウンロード用のパラメータです。
* @author Taejin Hong
* @version 1.0.0
*/
public class GetContentPageImageParameters extends AcmsContentParameters {
private String resolution;
/**
* {@link GetContentPageImageParameters} のインスタンスを初期化します。
* @param contentId ダウンロードするコンテンツのIDです。
* @param sid ログインした時のセッションIDです。
* @param resolution 端末の解像度を800x600のように指定します。
* @since 1.0.0
*/
public GetContentPageImageParameters(long contentId, String sid, String resolution) {
super(sid, contentId);
this.resolution = resolution;
}
/**
* 端末の解像度を取得します。
* @return 端末の解像度を返します。
* @since 1.0.0
*/
public String getResolution() {
return resolution;
}
}
package jp.agentec.abook.abv.bl.acms.client.parameters;
import java.util.Date;
import jp.agentec.adf.util.DateTimeFormat;
import jp.agentec.adf.util.DateTimeUtil;
public class ReaderShareParameters extends AcmsParameters {
private long contentId;
private Date validStartDate;
private Date validEndDate;
private int maxDlCount;
private String password;
private String language;
public ReaderShareParameters(String sid, long contentId, Date validStartDate, Date validEndDate, int maxDlCount, String password, String language) {
super(sid);
this.contentId = contentId;
this.validStartDate = validStartDate;
this.validEndDate = validEndDate;
this.maxDlCount = maxDlCount;
this.password = password;
this.language = language;
}
public long getContentId() {
return contentId;
}
public String getValidStartDate() {
if (validStartDate != null) {
return DateTimeUtil.toStringInTimeZone(validStartDate, DateTimeFormat.yyyyMMddHHmmss_hyphen, "GMT") + ",GMT";
}
return null;
}
public String getValidEndDate() {
if (validEndDate != null) {
return DateTimeUtil.toStringInTimeZone(validEndDate, DateTimeFormat.yyyyMMddHHmmss_hyphen, "GMT") + ",GMT";
}
return null;
}
public int getMaxDlCount() {
return maxDlCount;
}
public String getPassword() {
return password;
}
public String getLanguage() {
return language;
}
}
package jp.agentec.abook.abv.bl.acms.client.parameters;
import jp.agentec.adf.net.http.HttpParameterObject;
import jp.agentec.adf.util.StringUtil;
/**
* 端末登録用のパラメータです。
* @author Taejin Hong
* @version 1.0.0
*/
public class ReceiveDeviceTokenParameters extends HttpParameterObject {
private String udid;
private String deviceToken;
private int appId;
private String appVersion;
private int deviceTypeId;
/**
* {@link ReceiveDeviceTokenParameters} クラスのインスタンスを初期化します。
* @param udid 端末のUDIDです。
* @param deviceToken デバイストークンです。
* @param appId アプリケーションIDです。
* @param appVersion アプリケーションの現在バージョンです。
* @param deviceTypeId 端末タイプです。
* @since 1.0.0
*/
public ReceiveDeviceTokenParameters(String udid, String deviceToken, int appId, String appVersion, int deviceTypeId) {
if (StringUtil.isNullOrWhiteSpace(udid)) {
throw new IllegalArgumentException("argument udid not allowed null or white space.");
}
if (StringUtil.isNullOrWhiteSpace(deviceToken)) {
throw new IllegalArgumentException("argument deviceToken not allowed null or white space.");
}
if (StringUtil.isNullOrWhiteSpace(appVersion)) {
throw new IllegalArgumentException("argument appVersion not allowed null or white space.");
}
this.udid = udid;
this.deviceToken = deviceToken;
this.appId = appId;
this.appVersion = appVersion;
this.deviceTypeId = deviceTypeId;
}
/**
* 端末のUDIDを返します。
* @return 端末のUDIDです。
* @since 1.0.0
*/
public String getUdid() {
return udid;
}
/**
* デバイストークンを返します。
* @return デバイストークンです。
* @since 1.0.0
*/
public String getDeviceToken() {
return deviceToken;
}
/**
* アプリケーションIDを返します。
* @return アプリケーションIDです。
* @since 1.0.0
*/
public int getAppId() {
return appId;
}
/**
* アプリケーションの現在バージョンを返します。
* @return アプリケーションの現在バージョンです。
* @since 1.0.0
*/
public String getAppVersion() {
return appVersion;
}
/**
* 端末タイプを返します。
* @return 端末タイプです。
* @since 1.0.0
*/
public int getDeviceTypeId() {
return deviceTypeId;
}
}
package jp.agentec.abook.abv.bl.acms.client.parameters;
import java.sql.Timestamp;
import jp.agentec.adf.util.DateTimeFormat;
import jp.agentec.adf.util.DateTimeUtil;
/**
* サイネージ待ち受け画面ダウンロード用のパラメータです。
* @author tauchi
* @version 1.6.0
*/
public class StandByPicParameters extends AcmsParameters {
private String type;
private Timestamp lastFetchDate;
public StandByPicParameters(String sid, String type, Timestamp lastFetchDate) {
super(sid);
this.type = type;
this.lastFetchDate = lastFetchDate;
}
public String getType() {
return type;
}
public String getLastFetchDate() {
if (lastFetchDate == null) {
return null;
}
return DateTimeUtil.toStringInTimeZone(lastFetchDate, DateTimeFormat.yyyyMMddHHmmss_hyphen, "GMT") + ",GMT";
}
}
package jp.agentec.abook.abv.bl.acms.client.parameters;
/**
* 定期購読の履歴を取得するパラメータ
* @version 1.5.0
*/
public class SubscriptionHistoryParameters extends AcmsParameters {
private String account;
public SubscriptionHistoryParameters(String sid, String account) {
super(sid);
this.account = account;
}
public String getAccount() {
return account;
}
}
package jp.agentec.abook.abv.bl.acms.client.parameters;
import jp.agentec.abook.abv.bl.dto.SubscriptionHistoryDto;
/**
* 定期購読の履歴を送信するパラメータ
* @version 1.5.0
*/
public class SubscriptionHistorySendParameters extends AcmsParameters {
private String account;
private String productId;
private Integer productType;
private String purchaseToken;
private String orderId;
private Long purchaseTime;
private Integer purchaseState;
private String developerPayload;
public SubscriptionHistorySendParameters(String sid, String account, SubscriptionHistoryDto subscriptionHistoryDto) {
super(sid);
this.account = account;
this.productId = subscriptionHistoryDto.productId;
this.productType = 2;
this.purchaseToken = subscriptionHistoryDto.purchaseToken;
this.orderId = subscriptionHistoryDto.orderId;
this.purchaseTime = subscriptionHistoryDto.purchaseTime;
this.purchaseState = subscriptionHistoryDto.purchaseState;
this.developerPayload = subscriptionHistoryDto.developerPayload;
}
public String getProductId() {
return productId;
}
public Integer getProductType() {
return productType;
}
public String getPurchaseToken() {
return purchaseToken;
}
public String getOrderId() {
return orderId;
}
public Long getPurchaseTime() {
return purchaseTime;
}
public Integer getPurchaseState() {
return purchaseState;
}
public String getDeveloperPayload() {
return developerPayload;
}
public String getAccount() {
return account;
}
}
package jp.agentec.abook.abv.bl.acms.client.parameters;
import java.io.File;
/**
* グループ取得用のパラメータです。
* @author Taejin Hong
* @version 1.0.0
*/
public class UploadBackupFileParameters extends AcmsParameters {
private final File file;
/**
* {@link UploadBackupFileParameters} のインスタンスを初期化します。
* @param sid ログインした時のセッションIDです。
* @since 1.0.0
*/
public UploadBackupFileParameters(String sid, File file) {
super(sid);
this.file = file;
}
public File getFile() {
return file;
}
}
package jp.agentec.abook.abv.bl.acms.client.parameters.reader;
/**
* Readerユーザアカウント登録パラメータです
* @author tauchi
* @version 1.4.0
*/
public class UserAccountParameters {
public String loginId;
public String command;
public String deviceToken;
public Integer deviceTypeId;
public String appVersion;
public String siteContractIds;
public String language;
public UserAccountParameters(String loginId, String command, String deviceToken, Integer deviceTypeId, String appVersion, String siteContractIds, String language) {
this.loginId = loginId;
this.command = command;
this.deviceToken = deviceToken;
this.deviceTypeId = deviceTypeId;
this.appVersion = appVersion;
this.siteContractIds = siteContractIds;
this.language = language;
}
}
...@@ -34,11 +34,6 @@ public class AcmsApis { ...@@ -34,11 +34,6 @@ public class AcmsApis {
public static final String CheckApiUrlFormat = "%s/%s/checkapi/%s/"; public static final String CheckApiUrlFormat = "%s/%s/checkapi/%s/";
/** /**
* モバイルデバイスからのログイン
* @since 1.0.0
*/
public static final String ApiUrlMobileLogin = "mobileLogin";
/**
* モバイルデバイスからのログインで、初ログインの際に使う<br> * モバイルデバイスからのログインで、初ログインの際に使う<br>
* ACMS1.6に対応 * ACMS1.6に対応
* @since 1.1.0 * @since 1.1.0
...@@ -101,11 +96,6 @@ public class AcmsApis { ...@@ -101,11 +96,6 @@ public class AcmsApis {
*/ */
public static final String ApiUrlServiceOption = "serviceOption"; public static final String ApiUrlServiceOption = "serviceOption";
/** /**
* コンテンツを検索
* @since 1.0.0
*/
public static final String ApiUrlContentSearch = "contentSearch";
/**
* ログインしたユーザが所属する事業者のアプリ最新バージョンを取得 * ログインしたユーザが所属する事業者のアプリ最新バージョンを取得
* @since 1.0.0 * @since 1.0.0
*/ */
...@@ -116,18 +106,6 @@ public class AcmsApis { ...@@ -116,18 +106,6 @@ public class AcmsApis {
*/ */
public static final String ApiUrlContentCheckDeliverable = "contentCheckDeliverable"; public static final String ApiUrlContentCheckDeliverable = "contentCheckDeliverable";
/** /**
* アカウントの初期化。ユーザIDとUDIDの関連性を削除
* @since 1.0.0
*/
public static final String ApiUrlAccountInitialize = "accoundInitialize";
/**
* 着せ替え画像(トップ縦横/起動縦横)を取得
* TODO: later Androidでは対応予定がない
* @since 1.0.0
*/
@Deprecated
public static final String ApiUrlReplacementPic = "replacementPic";
/**
* パスワード変更が必要かどうかを取得 * パスワード変更が必要かどうかを取得
* @since 1.0.0 * @since 1.0.0
*/ */
...@@ -148,22 +126,12 @@ public class AcmsApis { ...@@ -148,22 +126,12 @@ public class AcmsApis {
public static final String ApiUrlUploadLogFile = "uploadLogFile"; public static final String ApiUrlUploadLogFile = "uploadLogFile";
public static final String ApiUrlContentRegist = "contentRegist";
public static final String ApiUrlGetAuthLevel = "getAuthLevel"; public static final String ApiUrlGetAuthLevel = "getAuthLevel";
public static final String ApiUrlAddMemberGroup = "addMemberGroup"; public static final String ApiUrlAddMemberGroup = "addMemberGroup";
public static final String ApiUrlContentSet = "contentSet";
public static final String ApiUrlGetSubscriptionHistory = "purchaseHistory/restore";
public static final String ApiUrlSendSubscriptionHistory = "purchaseHistory/register";
// デバイストークン更新 // デバイストークン更新
public static final String ApiUrlUpdateDeviceToken = "updateDeviceToken"; public static final String ApiUrlUpdateDeviceToken = "updateDeviceToken";
//ユーザ・グループ通信対象取得
public static final String ApiUrlGetUserGroupList = "userGroupList";
// プロジェクト一覧取得 // プロジェクト一覧取得
public static final String ApiProjectList = "projectList"; public static final String ApiProjectList = "projectList";
// 作業者グループ取得 // 作業者グループ取得
...@@ -200,23 +168,8 @@ public class AcmsApis { ...@@ -200,23 +168,8 @@ public class AcmsApis {
public static final String DownloadContentZipFileUrlFormat = "%s/%s/dl/contentZipFile/getContentForAndroid/%d/%s/%d"; public static final String DownloadContentZipFileUrlFormat = "%s/%s/dl/contentZipFile/getContentForAndroid/%d/%s/%d";
//public static final String DownloadContentZipFileUrlFormat = "%s/%s/dl/contentZipFile/getContent/%d/%s/%d"; //public static final String DownloadContentZipFileUrlFormat = "%s/%s/dl/contentZipFile/getContent/%d/%s/%d";
/**
* コンテンツ(PDF)の全ページのサムネイルを取得します。<br>
* 以下のフォーマットになります。<br>
* {host}/{url_path}/dl/contentZipFile/getPageImage/{contentId}/{sid}/{解像度}<br>
* 解像度は 800x600 のように表記します。
* @since 1.0.0
*/
public static final String DownloadContentPageImageUrlFormat = "%s/%s/dl/contentZipFile/getPageImage/%d/%s/%s";
public static final String DownloadApplicationAPKFile = "%s/%s/appdl/downloadApp/android/3/%s/%s"; public static final String DownloadApplicationAPKFile = "%s/%s/appdl/downloadApp/android/3/%s/%s";
public static final String DownloadStandByPicUrlFormat = "%s/%s/abvapi/standByPic/";
public static final String GetBackupFileUrlFormat = "%s/%s/abvapi/getBackupFile/";
public static final String DownloadBackgroundPicUrlFormat = "%s/%s/abvapi/backgroundPic/";
/** /**
* 端末からログ取得要求があるかどうかを判定する * 端末からログ取得要求があるかどうかを判定する
* @since 1.8.4 * @since 1.8.4
...@@ -286,51 +239,6 @@ public class AcmsApis { ...@@ -286,51 +239,6 @@ public class AcmsApis {
return url; return url;
} }
/**
* サイネージ待ち受け画面ダウンロードURLを完成します。
* @since 1.6.0
*/
public static String getGetBackupFileUrl(String host, String urlPath) {
return String.format(GetBackupFileUrlFormat, StringUtil.trimLastSlashOrSpace(host), StringUtil.trimLastSlashOrSpace(urlPath));
}
/**
* サイネージ待ち受け画面ダウンロードURLを完成します。
* @since 1.6.0
*/
public static String getDownloadStandByPicUrl(String host, String urlPath) {
return String.format(DownloadStandByPicUrlFormat, StringUtil.trimLastSlashOrSpace(host), StringUtil.trimLastSlashOrSpace(urlPath));
}
/**
* サイネージ再生時の下敷き画像ダウンロードURLを完成します。
* @since 1.6.0
*/
public static String getDownloadBackgroundPicUrl(String host, String urlPath) {
return String.format(DownloadBackgroundPicUrlFormat, StringUtil.trimLastSlashOrSpace(host), StringUtil.trimLastSlashOrSpace(urlPath));
}
/**
* コンテンツ(PDF)の全ページのサムネイルのZIPファイルのダウンロードURLを完成します。
* @param host ACMSのFQDNです。
* @param urlPath 事業者のurl_pathです。
* @param contentId ダウンロードするZIPファイルのコンテンツIDです。
* @param sid セッションIDです。
* @param resolution 端末の解像度を800x600のような文字列を指定します。
* @return 完成されたURLを返します。引数に誤りがあると空文字を返します。
* @since 1.0.0
*/
public static String getDownloadPageImageUrl(String host, String urlPath, long contentId, String sid, String resolution) {
String url = StringUtil.Empty;
if (!StringUtil.isNullOrWhiteSpace(host) && !StringUtil.isNullOrWhiteSpace(urlPath) && !StringUtil.isNullOrWhiteSpace(sid)
&& !StringUtil.isNullOrWhiteSpace(resolution)) {
url = String.format(DownloadContentPageImageUrlFormat, StringUtil.trimLastSlashOrSpace(host), StringUtil.trimLastSlashOrSpace(urlPath), contentId, sid, resolution);
}
return url;
}
public static String getDownloadApplicationFileUrl(String host, String urlPath, String sid, String currentDate) { public static String getDownloadApplicationFileUrl(String host, String urlPath, String sid, String currentDate) {
String url = StringUtil.Empty; String url = StringUtil.Empty;
if (!StringUtil.isNullOrWhiteSpace(host) && !StringUtil.isNullOrWhiteSpace(urlPath) && !StringUtil.isNullOrWhiteSpace(sid)) { if (!StringUtil.isNullOrWhiteSpace(host) && !StringUtil.isNullOrWhiteSpace(urlPath) && !StringUtil.isNullOrWhiteSpace(sid)) {
......
...@@ -107,14 +107,6 @@ public class ABVEnvironment { ...@@ -107,14 +107,6 @@ public class ABVEnvironment {
public static final String TimeFileDirectoryFormat = "%s/ABook/time"; public static final String TimeFileDirectoryFormat = "%s/ABook/time";
public static final String CommonDirectoryFormat = "%s/ABook/common"; public static final String CommonDirectoryFormat = "%s/ABook/common";
public static final String StandByPicFileFormat = "standby_%s.jpg";
public static final String BacgroundPicFileFormat = "backPic_%s.jpg";
public static final String ScheduleJsonFileFormat = "%s/ABook/schedule.json";
//1.6.4から追加
public static final String WeatherJsonFormat = CommonDirectoryFormat + "/weather/weather.json";
public static final String TelopDirectoryFormat = "%s/ABook/telop";
public static final String PlaylistIDDirectoryFormat = TelopDirectoryFormat + "/%d";
public static final String ListOrderDirectoryFormat = PlaylistIDDirectoryFormat + "/%d";
public static final String ProjectDirFormat = "%s/ABook/projects/%d"; public static final String ProjectDirFormat = "%s/ABook/projects/%d";
public static final String ProjectTaskKeyDirFormat = "%s/ABook/projects/%d/%s"; public static final String ProjectTaskKeyDirFormat = "%s/ABook/projects/%d/%s";
...@@ -426,18 +418,6 @@ public class ABVEnvironment { ...@@ -426,18 +418,6 @@ public class ABVEnvironment {
return path; return path;
} }
public String getStandByPicFilePath(String type) {
return getCommonDirectoryPath() + File.separator + String.format(StandByPicFileFormat, type);
}
public String getBackgroundPicFilePath() {
return getCommonDirectoryPath() + File.separator + String.format(BacgroundPicFileFormat, aspectType);
}
public String getScheduleJsonFilePath() {
return String.format(ScheduleJsonFileFormat, rootDirectory);
}
public String getContentDownloadPath(long contentId) { public String getContentDownloadPath(long contentId) {
return String.format("%s/%s_%s.zip", getContentDownloadsDirectoryPath(), ContentZipType.ContentDownload, contentId); return String.format("%s/%s_%s.zip", getContentDownloadsDirectoryPath(), ContentZipType.ContentDownload, contentId);
} }
...@@ -558,22 +538,6 @@ public class ABVEnvironment { ...@@ -558,22 +538,6 @@ public class ABVEnvironment {
} }
} }
public String getWeatherJsonFile() {
return String.format(WeatherJsonFormat, rootDirectory);
}
public String getPlaylistIDDirectory(int playlistID) {
String path = String.format(PlaylistIDDirectoryFormat, rootDirectory, playlistID);
FileUtil.createNewDirectory(path);
return path;
}
public String getListOrderDirectory(int playlistId, int listOrder) {
String path = String.format(ListOrderDirectoryFormat, rootDirectory, playlistId, listOrder);
FileUtil.createNewDirectory(path);
return path;
}
public String getWebCacheDirectory() { public String getWebCacheDirectory() {
String webCacheDir = String.format(WebCacheDirectoryFormat, cacheDirectory); String webCacheDir = String.format(WebCacheDirectoryFormat, cacheDirectory);
FileUtil.createNewDirectory(webCacheDir); FileUtil.createNewDirectory(webCacheDir);
......
...@@ -32,7 +32,6 @@ public class ABVDataCache { ...@@ -32,7 +32,6 @@ public class ABVDataCache {
private MemberInfoDto memberInfoDto = null; private MemberInfoDto memberInfoDto = null;
private List<ServiceOptionDto> serviceOptionDtoList = null; private List<ServiceOptionDto> serviceOptionDtoList = null;
public ArrayList<DashboardDto> dashboardList = null;
private String urlPath; private String urlPath;
private Integer diffMinFromUTC; // ACMSサーバ時間におけるUTCから差分 deliveryStartDateUTCを含まない旧コンテンツ用に必要 private Integer diffMinFromUTC; // ACMSサーバ時間におけるUTCから差分 deliveryStartDateUTCを含まない旧コンテンツ用に必要
...@@ -64,36 +63,6 @@ public class ABVDataCache { ...@@ -64,36 +63,6 @@ public class ABVDataCache {
} }
/** /**
* 指定したログインIDとパスワードと一致するユーザ情報をキャッシュから返します。<br>
* 該当ユーザが存在しないとnullを返します。<br>
* このメソッドはユーザ認証を行う時に利用します。
* @param loginId ユーザのログインIDです。
* @param password ユーザのログインパスワードです。
* @return ユーザ情報を格納した {@link MemberInfoDto} のインスタンスを返します。
* @since 1.0.0
*/
public MemberInfoDto getMemberInfo(String loginId, String password) {
if (!StringUtil.isNullOrWhiteSpace(loginId) && !StringUtil.isNullOrWhiteSpace(password)
&& memberInfoDto != null && memberInfoDto.loginId.equals(loginId) && memberInfoDto.password.equals(password)) {
return memberInfoDto;
}
return null;
}
/**
* サービスオプションの数を返します。
* @return サービスオプションの数です。
* @since 1.0.0
*/
public int getServiceOptionCount() {
if (serviceOptionDtoList != null) {
return serviceOptionDtoList.size();
} else {
return 0;
}
}
/**
* 指定したserviceOptionIdに当てはまるサービスオプション情報を返します。 * 指定したserviceOptionIdに当てはまるサービスオプション情報を返します。
* @param serviceOptionId サービスオプションリストから取り出す情報の番号です。 * @param serviceOptionId サービスオプションリストから取り出す情報の番号です。
* @return サービスオプション情報です。指定したserviceOptionIdがサービスオプションリストに存在しない場合はnullを返します。 * @return サービスオプション情報です。指定したserviceOptionIdがサービスオプションリストに存在しない場合はnullを返します。
...@@ -123,16 +92,6 @@ public class ABVDataCache { ...@@ -123,16 +92,6 @@ public class ABVDataCache {
return memberInfoDto; return memberInfoDto;
} }
/**
* ログイン中か否かを返します。
*
* @return
*/
public boolean isLogin() {
MemberInfoDto dto = getMemberInfo() ;
return dto != null && dto.sid != null;
}
public int getDefaultCategoryId() { public int getDefaultCategoryId() {
return defaultCategoryId; return defaultCategoryId;
} }
...@@ -274,12 +233,6 @@ public class ABVDataCache { ...@@ -274,12 +233,6 @@ public class ABVDataCache {
defaultCategoryId = -1; defaultCategoryId = -1;
defaultGroupId = -1; defaultGroupId = -1;
urlPath = null; urlPath = null;
dashboardList = null;
}
public Date getLastPresentTime() {
return lastPresentTime;
} }
public void setLastPresentTime(Date lasttime) { public void setLastPresentTime(Date lasttime) {
...@@ -414,20 +367,4 @@ public class ABVDataCache { ...@@ -414,20 +367,4 @@ public class ABVDataCache {
} }
return null; return null;
} }
/**
* 端末のシステム日付と前回サーバアクセス日付のチェックを行う
*/
public boolean checkSysDateDiff() {
//前後の期間の判定
Calendar srvAcessdate = Calendar.getInstance();
srvAcessdate.setTime(lastPresentTime);
Calendar beforeDate = Calendar.getInstance();
Calendar afterDate = Calendar.getInstance();
beforeDate.add(Calendar.MINUTE, -1 * SEVER_ALERT_INTERVAL);
afterDate.add(Calendar.MINUTE, 1 * SEVER_ALERT_INTERVAL);
//範囲期間チェック True:範囲外(警告対象)
return srvAcessdate.compareTo(beforeDate) < 0 || srvAcessdate.compareTo(afterDate) > 0;
}
} }
...@@ -18,7 +18,6 @@ import jp.agentec.abook.abv.bl.data.tables.MServiceOption; ...@@ -18,7 +18,6 @@ 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.MWorkerGroup;
import jp.agentec.abook.abv.bl.data.tables.RProjectContent; import jp.agentec.abook.abv.bl.data.tables.RProjectContent;
import jp.agentec.abook.abv.bl.data.tables.RContentCategory; import jp.agentec.abook.abv.bl.data.tables.RContentCategory;
import jp.agentec.abook.abv.bl.data.tables.RContentFolder;
import jp.agentec.abook.abv.bl.data.tables.RContentGroup; import jp.agentec.abook.abv.bl.data.tables.RContentGroup;
import jp.agentec.abook.abv.bl.data.tables.SQLiteTableScript; import jp.agentec.abook.abv.bl.data.tables.SQLiteTableScript;
import jp.agentec.abook.abv.bl.data.tables.TContent; import jp.agentec.abook.abv.bl.data.tables.TContent;
...@@ -32,7 +31,6 @@ import jp.agentec.abook.abv.bl.data.tables.TContentResource; ...@@ -32,7 +31,6 @@ import jp.agentec.abook.abv.bl.data.tables.TContentResource;
import jp.agentec.abook.abv.bl.data.tables.TContentServerSearched; import jp.agentec.abook.abv.bl.data.tables.TContentServerSearched;
import jp.agentec.abook.abv.bl.data.tables.TContentTag; import jp.agentec.abook.abv.bl.data.tables.TContentTag;
import jp.agentec.abook.abv.bl.data.tables.TEnquete; import jp.agentec.abook.abv.bl.data.tables.TEnquete;
import jp.agentec.abook.abv.bl.data.tables.TFolder;
import jp.agentec.abook.abv.bl.data.tables.TInspectTaskReport; import jp.agentec.abook.abv.bl.data.tables.TInspectTaskReport;
import jp.agentec.abook.abv.bl.data.tables.TMarkingSetting; import jp.agentec.abook.abv.bl.data.tables.TMarkingSetting;
import jp.agentec.abook.abv.bl.data.tables.TProject; import jp.agentec.abook.abv.bl.data.tables.TProject;
...@@ -67,10 +65,8 @@ public class ABVDataOpenHelper { ...@@ -67,10 +65,8 @@ public class ABVDataOpenHelper {
iTableScripts.add(new MMemberInfo()); iTableScripts.add(new MMemberInfo());
iTableScripts.add(new MGroup()); iTableScripts.add(new MGroup());
iTableScripts.add(new MCategory()); iTableScripts.add(new MCategory());
iTableScripts.add(new TFolder());
iTableScripts.add(new RContentCategory()); iTableScripts.add(new RContentCategory());
iTableScripts.add(new RContentGroup()); iTableScripts.add(new RContentGroup());
iTableScripts.add(new RContentFolder());
iTableScripts.add(new TContentDownloadQueue()); iTableScripts.add(new TContentDownloadQueue());
iTableScripts.add(new TContentTag()); iTableScripts.add(new TContentTag());
iTableScripts.add(new LContentReadingLog()); iTableScripts.add(new LContentReadingLog());
......
package jp.agentec.abook.abv.bl.data.dao;
import jp.agentec.abook.abv.bl.common.db.Cursor;
import jp.agentec.abook.abv.bl.dto.ContentFolderDto;
import jp.agentec.adf.util.DateTimeFormat;
import jp.agentec.adf.util.DateTimeUtil;
public class ContentFolderDao extends AbstractDao {
/*package*/ ContentFolderDao() {
}
@Override
public ContentFolderDto convert(Cursor cursor) {
ContentFolderDto dto = new ContentFolderDto();
int colnum = cursor.getColumnIndex("content_id");
if (colnum != -1) {
dto.contentId = cursor.getLong(colnum);
}
colnum = cursor.getColumnIndex("folder_id");
if (colnum != -1) {
dto.folderId = cursor.getInt(colnum);
}
colnum = cursor.getColumnIndex("insert_date");
if (colnum != -1) {
dto.insertDate = DateTimeUtil.toDate(cursor.getString(colnum), "UTC", DateTimeFormat.yyyyMMddHHmmss_hyphen);
}
colnum = cursor.getColumnIndex("update_date");
if (colnum != -1) {
dto.updateDate = DateTimeUtil.toDate(cursor.getString(colnum), "UTC", DateTimeFormat.yyyyMMddHHmmss_hyphen);
}
return dto;
}
public ContentFolderDto getContentFolder(long contentId) {
return rawQueryGetDto("select * from r_content_folder where content_id=?", new String[]{""+ contentId}, ContentFolderDto.class);
}
public boolean getContentFolderCheck(int folderId, long contentId) {
int ret = rawQueryGetInt("select COUNT(content_id) AS content_count from r_content_folder where folder_id=? AND content_id=?", new String[]{""+ folderId, ""+ contentId});
return ret > 0;
}
public void insertContentFolder(ContentFolderDto dto) {
insert("insert into r_content_folder (folder_id, content_id, insert_date, update_date) values (?,?,?,?)", dto.getInsertValues());
}
public void deleteContentFolder(long contentId) {
delete("r_content_folder", "content_id=?", new String[]{""+ contentId});
}
}
...@@ -74,20 +74,6 @@ public class GroupDao extends AbstractDao { ...@@ -74,20 +74,6 @@ public class GroupDao extends AbstractDao {
private String generateGetGroupsQuery(QueryType queryType, int[] groupRelationids, int[] parentGroupIds, Boolean downloaded, String searchKeyword, SearchDivisionType searchDivisionType, boolean isOnlineSearched) { private String generateGetGroupsQuery(QueryType queryType, int[] groupRelationids, int[] parentGroupIds, Boolean downloaded, String searchKeyword, SearchDivisionType searchDivisionType, boolean isOnlineSearched) {
StringBuffer sql = new StringBuffer(); StringBuffer sql = new StringBuffer();
//
// int[] copyParentGroupIds = null;
//
// if (parentGroupIds != null) {
// copyParentGroupIds = new int[parentGroupIds.length + 1];
// copyParentGroupIds[0] = 0;
// for (int id = 0; id < parentGroupIds.length ; id++) {
// copyParentGroupIds[id+1] = parentGroupIds[id];
// }
// }else{
// copyParentGroupIds = new int[ 1];
// copyParentGroupIds[0] = 0;
// }
//
switch (queryType) { switch (queryType) {
/* /*
......
...@@ -143,8 +143,6 @@ public class MemberInfoDao extends AbstractDao { ...@@ -143,8 +143,6 @@ public class MemberInfoDao extends AbstractDao {
delete("t_content_bookmark", null, null); delete("t_content_bookmark", null, null);
delete("t_content_memo", null, null); delete("t_content_memo", null, null);
update("update r_content_folder set folder_id=0", null);
delete("t_folder", "folder_id <> 0", null);
update("update t_content set favorite_flg=0", null); update("update t_content set favorite_flg=0", null);
if (isAllDelete) { if (isAllDelete) {
......
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;
public class RContentFolder extends SQLiteTableScript {
public RContentFolder() {
}
@Override
public List<String> getCreateScript(int version) {
List<String> ddl = new ArrayList<String>();
StringBuffer sql = new StringBuffer();
// since 1.0.0
sql.append(" CREATE TABLE r_content_folder ( ");
sql.append(" folder_id INTEGER NOT NULL ");
sql.append(" , content_id BIGINT NOT NULL ");
sql.append(" , insert_date DATETIME NOT NULL ");
sql.append(" , update_date DATETIME NOT NULL ");
sql.append(" , PRIMARY KEY (folder_id, content_id) ");
sql.append(" , FOREIGN KEY (folder_id) REFERENCES t_folder (folder_id) ");
sql.append(" , FOREIGN KEY (content_id) REFERENCES t_content (content_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.ABVEnvironment;
import jp.agentec.abook.abv.bl.common.db.Cursor;
import jp.agentec.abook.abv.bl.common.db.SQLiteDatabase;
import jp.agentec.abook.abv.bl.data.DatabaseVersions;
import jp.agentec.adf.util.StringUtil;
public class TFolder extends SQLiteTableScript {
public static final int RootFolderId = 0;
public TFolder() {
}
@Override
public List<String> getCreateScript(int version) {
List<String> ddl = new ArrayList<String>();
StringBuffer sql = new StringBuffer();
ABVEnvironment env = ABVEnvironment.getInstance();
// since 1.0.0
sql.append(" CREATE TABLE t_folder ( ");
sql.append(" folder_id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT ");
sql.append(" , folder_name VARCHAR(64) NOT NULL ");
sql.append(" , parent_folder_id INTEGER NOT NULL ");
sql.append(" , disp_order SMALLINT NOT NULL DEFAULT 1 ");
sql.append(" , folder_path TEXT NOT NULL "); // path enumaerationパターンを適用する。since DatabaseVersions.Ver1_5_2_01
sql.append(" , insert_date DATETIME NOT NULL ");
sql.append(" , update_date DATETIME NOT NULL ");
sql.append(" ) ");
ddl.add(sql.toString());
StringUtil.clear(sql);
sql.append(" CREATE INDEX idx_folder_1 ON t_folder ( ");
sql.append(" parent_folder_id ");
sql.append(" ) ");
ddl.add(sql.toString());
StringUtil.clear(sql);
// since DatabaseVersions.Ver1_5_2_01
// sql.append(" CREATE UNIQUE INDEX udx_folder_1 ON t_folder ( "); // 不要
// sql.append(" folder_id, parent_folder_id ");
// sql.append(" ) ");
//
// ddl.add(sql.toString());
// StringUtil.clear(sql);
// since DatabaseVersions.Ver1_5_2_01
sql.append(" CREATE UNIQUE INDEX udx_folder_2 ON t_folder ( ");
sql.append(" folder_path ");
sql.append(" ) ");
ddl.add(sql.toString());
StringUtil.clear(sql);
sql.append(" INSERT INTO t_folder (folder_id, folder_name, parent_folder_id, disp_order, folder_path, insert_date, update_date) ");
sql.append(" VALUES (" + RootFolderId + ", '"+ env.mainFolderName +"', -1, 0, '" + RootFolderId + "', DATETIME('NOW'), DATETIME('NOW')) ");
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;
}
}
...@@ -912,8 +912,8 @@ public class ContentDownloader { ...@@ -912,8 +912,8 @@ public class ContentDownloader {
GetContentParameters param = getContentInforParameters(contentId); GetContentParameters param = getContentInforParameters(contentId);
String filename = getContentInfoZipFilePath(param); String filename = getContentInfoZipFilePath(param);
ContentRefresher.getInstance().addRefreshingContentId(contentId); ContentRefresher.getInstance().addRefreshingContentId(contentId);
Thread thread = AcmsClient.getInstance(cache.getUrlPath(), networkAdapter).getContentInfoAsync(param,filename, contentInforDownloadObserver, contentId);
try { try {
Thread thread = AcmsClient.getInstance(cache.getUrlPath(), networkAdapter).getContentInfoAsync(param,filename, contentInforDownloadObserver, contentId);
thread.join(); thread.join();
} catch (InterruptedException e) { } catch (InterruptedException e) {
Logger.e(TAG,e); Logger.e(TAG,e);
...@@ -1016,55 +1016,6 @@ public class ContentDownloader { ...@@ -1016,55 +1016,6 @@ public class ContentDownloader {
AcmsClient.getInstance(cache.getUrlPath(), networkAdapter).getContentInfoAsync(param,fileName, contentInforDownloadObserver, contentId); AcmsClient.getInstance(cache.getUrlPath(), networkAdapter).getContentInfoAsync(param,fileName, contentInforDownloadObserver, contentId);
} }
/// ContentDetail ///
public void downloadContentDetail(final long contentId) throws NetworkDisconnectedException {
if (!networkAdapter.isNetworkConnected()) {
throw new NetworkDisconnectedException();
}
CommonExecutor.execute(new Runnable(){
@Override
public void run() {
HttpDownloadSimpleNotification notification = new HttpDownloadSimpleNotification(HttpDownloadState.downloading, contentId);
String fileName = null;
String outputFileName = null;
try {
GetContentParameters param = new GetContentParameters(contentId, cache.getMemberInfo().sid, ContentZipType.ContentDetail);
fileName = String.format("%s/%s_%s.zip", ABVEnvironment.getInstance().getContentDownloadsDirectoryPath(), param.getContentType(), param.getContentId());
outputFileName = AcmsClient.getInstance(cache.getUrlPath(), networkAdapter).getContentDetail(param, fileName); // CMSからcontentDetail.zipを取得
String contentPath = ABVEnvironment.getInstance().getContentDetailDirectoryPath(contentId, false);
FileUtil.delete(contentPath);
contentFileExtractor.extractZipFile(contentId, outputFileName, contentPath);
contentLogic.saveContentDetail(contentId, contentPath);
notification.setDownloadState(HttpDownloadState.finished);
} catch (Exception e) {
Logger.e(TAG, "DownloadContentDetailWorker run failed", e);
if (!StringUtil.isNullOrWhiteSpace(fileName)) {
FileUtil.delete(fileName);
}
if (!StringUtil.isNullOrWhiteSpace(outputFileName)) {
try {
FileUtil.delete(outputFileName);
} catch (Exception e2) {
}
}
notification.setDownloadState(HttpDownloadState.failed);
} finally {
for (ContentDownloadListener listener : contentDownloadListenerSet) { // Listenerへ通知
listener.onDownloadedContentDetail(notification);
}
}
}
});
}
public void setDownloadSucceededFlag(boolean flag) { public void setDownloadSucceededFlag(boolean flag) {
this.downloadSucceededFlag = flag; this.downloadSucceededFlag = flag;
} }
......
...@@ -32,26 +32,21 @@ import jp.agentec.abook.abv.bl.common.exception.ABVExceptionCode; ...@@ -32,26 +32,21 @@ import jp.agentec.abook.abv.bl.common.exception.ABVExceptionCode;
import jp.agentec.abook.abv.bl.common.log.Logger; import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.common.util.ContentFileUtil; import jp.agentec.abook.abv.bl.common.util.ContentFileUtil;
import jp.agentec.abook.abv.bl.common.util.SecurityUtil; import jp.agentec.abook.abv.bl.common.util.SecurityUtil;
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.AbstractDao;
import jp.agentec.abook.abv.bl.data.dao.ContentDao; import jp.agentec.abook.abv.bl.data.dao.ContentDao;
import jp.agentec.abook.abv.bl.data.dao.ContentFolderDao;
import jp.agentec.abook.abv.bl.data.dao.ContentMarkingDao; import jp.agentec.abook.abv.bl.data.dao.ContentMarkingDao;
import jp.agentec.abook.abv.bl.data.dao.ContentMemoDao; import jp.agentec.abook.abv.bl.data.dao.ContentMemoDao;
import jp.agentec.abook.abv.bl.data.dao.ContentOldPdfDao; import jp.agentec.abook.abv.bl.data.dao.ContentOldPdfDao;
import jp.agentec.abook.abv.bl.data.dao.ContentPageDao; import jp.agentec.abook.abv.bl.data.dao.ContentPageDao;
import jp.agentec.abook.abv.bl.data.dao.ContentResourceDao; import jp.agentec.abook.abv.bl.data.dao.ContentResourceDao;
import jp.agentec.abook.abv.bl.data.tables.TFolder;
import jp.agentec.abook.abv.bl.dto.AbstractDto; import jp.agentec.abook.abv.bl.dto.AbstractDto;
import jp.agentec.abook.abv.bl.dto.ContentDto; import jp.agentec.abook.abv.bl.dto.ContentDto;
import jp.agentec.abook.abv.bl.dto.ContentFolderDto;
import jp.agentec.abook.abv.bl.dto.ContentMemoDto; import jp.agentec.abook.abv.bl.dto.ContentMemoDto;
import jp.agentec.abook.abv.bl.dto.ContentOldPdfDto; import jp.agentec.abook.abv.bl.dto.ContentOldPdfDto;
import jp.agentec.abook.abv.bl.dto.ContentPageDto; import jp.agentec.abook.abv.bl.dto.ContentPageDto;
import jp.agentec.abook.abv.bl.dto.ContentResourceDto; import jp.agentec.abook.abv.bl.dto.ContentResourceDto;
import jp.agentec.abook.abv.bl.logic.AbstractLogic; import jp.agentec.abook.abv.bl.logic.AbstractLogic;
import jp.agentec.abook.abv.bl.logic.ContentLogic; import jp.agentec.abook.abv.bl.logic.ContentLogic;
import jp.agentec.adf.util.DateTimeUtil;
import jp.agentec.adf.util.FileUtil; import jp.agentec.adf.util.FileUtil;
import jp.agentec.adf.util.RuntimeUtil; import jp.agentec.adf.util.RuntimeUtil;
import jp.agentec.adf.util.StringUtil; import jp.agentec.adf.util.StringUtil;
...@@ -70,7 +65,6 @@ public class ContentFileExtractor { ...@@ -70,7 +65,6 @@ public class ContentFileExtractor {
private ContentDao contentDao = AbstractDao.getDao(ContentDao.class); private ContentDao contentDao = AbstractDao.getDao(ContentDao.class);
private ContentResourceDao contentResourceDao = AbstractDao.getDao(ContentResourceDao.class); private ContentResourceDao contentResourceDao = AbstractDao.getDao(ContentResourceDao.class);
private ContentFolderDao contentFolderDao = AbstractDao.getDao(ContentFolderDao.class);
private ContentOldPdfDao contentOldPdfDao = AbstractDao.getDao(ContentOldPdfDao.class); private ContentOldPdfDao contentOldPdfDao = AbstractDao.getDao(ContentOldPdfDao.class);
public static ContentFileExtractor getInstance() { public static ContentFileExtractor getInstance() {
...@@ -921,18 +915,6 @@ public class ContentFileExtractor { ...@@ -921,18 +915,6 @@ public class ContentFileExtractor {
contentDto.updatedFlg = false; contentDto.updatedFlg = false;
contentDto.newFlg = false; contentDto.newFlg = false;
contentDao.updateContent(contentDto, false); contentDao.updateContent(contentDto, false);
ContentFolderDto contentFolderDto = contentFolderDao.getContentFolder(contentId);
if (contentFolderDto == null) {
contentFolderDto = new ContentFolderDto();
contentFolderDto.contentId = contentDto.contentId;
contentFolderDto.folderId = TFolder.RootFolderId;
contentFolderDto.insertDate = DateTimeUtil.getCurrentSqlDate();
contentFolderDto.updateDate = DateTimeUtil.getCurrentSqlDate();
contentFolderDao.insertContentFolder(contentFolderDto);
}
} }
} }
......
package jp.agentec.abook.abv.bl.dto;
import java.util.Date;
/**
* グループ情報を格納します。
* @author Taejin Hong
* @version 1.0.0
*/
public class ContentFolderDto extends AbstractDto {
public long contentId;
public int folderId;
public Date insertDate;
public Date updateDate;
@Override
public Object[] getInsertValues() {
return new Object[]{folderId, contentId, insertDate, updateDate};
}
@Override
public String[] getKeyValues() {
return new String[]{""+ folderId};
}
}
package jp.agentec.abook.abv.bl.dto;
/**
* コンテンツとジャンルの紐付きがあるかを示します。<br>
* DatabaseVersion 1 -> 2 アップグレードのマイグレーション用のメソッドです。
* @author Taejin Hong
* @version 1.0.0
*/
public class ContentHasCategoryDto extends AbstractDto {
public long contentId;
public int contentCount;
@Override
public Object[] getInsertValues() {
return new Object[]{};
}
@Override
public String[] getKeyValues() {
return new String[] {"contentId"};
}
}
package jp.agentec.abook.abv.bl.dto;
import java.util.Date;
public class ContentIdConvDto extends AbstractDto {
public long contentId;
public int siteId;
public int contractId;
public long cmsContentId;
public int contractContentId;
public String downloadUrl;
// 初期バージョン未使用(abkで使用)
public String targetAppVersion;
public Date exportDate;
public String cmsContentUpdateId;
public String shortUrl;
public Date insertDate;
public Date updateDate;
public ContentIdConvDto() {
}
public ContentIdConvDto(long contentId, int siteId, int contractId, long cmsContentId, int contractContentId, String downloadUrl, String targetAppVersion, Date exportDate, String cmsContentUpdateId, String shortUrl) {
super();
this.contentId = contentId;
this.siteId = siteId;
this.contractId = contractId;
this.cmsContentId = cmsContentId;
this.contractContentId = contractContentId;
this.downloadUrl = downloadUrl;
this.targetAppVersion = targetAppVersion;
this.exportDate = exportDate;
this.cmsContentUpdateId = cmsContentUpdateId;
this.shortUrl = shortUrl;
}
public ContentIdConvDto(long contentId, int siteId, int contractId, long cmsContentId, int contractContentId, String downloadUrl, String shortUrl) {
super();
this.contentId = contentId;
this.siteId = siteId;
this.contractId = contractId;
this.cmsContentId = cmsContentId;
this.contractContentId = contractContentId;
this.downloadUrl = downloadUrl;
this.shortUrl = shortUrl;
}
@Override
public String[] getKeyValues() {
return new String[]{""+contentId};
}
@Override
public Object[] getInsertValues() {
return new Object[]{contentId, siteId, contractId, cmsContentId, contractContentId, downloadUrl, targetAppVersion, exportDate, cmsContentUpdateId, shortUrl};
}
@Override
public Object[] getUpdateValues() {
return new Object[]{siteId, contractId, cmsContentId, contractContentId, downloadUrl, targetAppVersion, exportDate, cmsContentUpdateId, shortUrl, contentId};
}
}
package jp.agentec.abook.abv.bl.dto;
import jp.agentec.abook.abv.bl.acms.type.ContentGroupingType;
import jp.agentec.abook.abv.bl.acms.type.ContentSortingType;
import jp.agentec.abook.abv.bl.acms.type.SearchDivisionType;
import jp.agentec.abook.abv.bl.data.SortDirection;
public class ContentSearchDto {
public Boolean downloaded;
public String searchKeyword;
public SearchDivisionType searchDivisionType;
public ContentGroupingType contentGroupingType;
public Object contentGroupingId;
public Object contentSubGroupingId;
public ContentSortingType contentSortingType;
public SortDirection sortDirection;
public int startContent;
public int listCount;
public boolean isOnlineSearched;
public String[] contentTypes;
public boolean removeNoPrice;
}
package jp.agentec.abook.abv.bl.dto;
import java.util.Date;
public class ContractDto extends AbstractDto {
public Integer siteId;
public Integer contractId;
public String companyName;
public String urlPath;
public String undeliverableDelete;
public String usablePushMessage;
public String usableReadinglogGps;
public String usableReadinglogObject;
public Integer delFlg;
public Date insertDate;
public Date updateDate;
public Integer receivePushMessage;
public Date userUpdateDate;
public ContractDto() {
}
public ContractDto(Integer siteId, Integer contractId, String companyName, String urlPath, String undeliverableDelete, String usablePushMessage, String usableReadinglogGps, String usableReadinglogObject, Integer delFlg, Date insertDate, Date updateDate, Integer receivePushMessage ,Date userUpdateDate ) {
super();
this.siteId = siteId;
this.contractId = contractId;
this.companyName = companyName;
this.urlPath = urlPath;
this.undeliverableDelete = undeliverableDelete;
this.usablePushMessage = usablePushMessage;
this.usableReadinglogGps = usableReadinglogGps;
this.usableReadinglogObject = usableReadinglogObject;
this.delFlg = delFlg;
this.insertDate = insertDate;
this.updateDate = updateDate;
this.receivePushMessage = receivePushMessage;
this.userUpdateDate = userUpdateDate;
}
@Override
public String[] getKeyValues() {
return new String[]{""+siteId, ""+contractId};
}
@Override
public Object[] getInsertValues() {
return new Object[]{siteId, contractId, companyName, urlPath, undeliverableDelete, usablePushMessage, usableReadinglogGps, usableReadinglogObject, delFlg, insertDate, updateDate, receivePushMessage, userUpdateDate};
}
@Override
public Object[] getUpdateValues() {
return new Object[]{companyName, urlPath, undeliverableDelete, usablePushMessage, usableReadinglogGps, usableReadinglogObject, delFlg, insertDate, updateDate, receivePushMessage, userUpdateDate, siteId, contractId};
}
}
package jp.agentec.abook.abv.bl.dto;
import java.util.Date;
/**
* フォルダ情報を格納します。
* @author Taejin Hong
* @version 1.0.1
*/
public class FolderDto extends AbstractDto {
public int folderId;
public String folderName;
public int parentFolderId;
public Date insertDate;
public Date updateDate;
public int contentCount;
public short dispOrder;
public boolean editFlg;
public String displayCount;
public String folderPath;
@Override
public Object[] getInsertValues() {
return new Object[]{folderId, folderName, parentFolderId, insertDate, updateDate, contentCount, dispOrder, editFlg, displayCount};
}
@Override
public String[] getKeyValues() {
return new String[]{""+ folderId};
}
}
package jp.agentec.abook.abv.bl.dto;
import java.util.Date;
public class SearchHistoryDto extends AbstractDto {
public String searchText;
public Date insertDate;
@Override
public String[] getKeyValues() {
return new String[] {searchText};
}
@Override
public Object[] getInsertValues() {
return new Object[] {searchText, insertDate};
}
@Override
public Object[] getUpdateValues() {
return new Object[] {insertDate, searchText};
}
}
package jp.agentec.abook.abv.bl.dto;
import java.util.ArrayList;
import java.util.List;
public class SubscriptionDto {
public String productId;
public int delFlg;
public List<Period> historyList = new ArrayList<Period>();
public class Period {
public long start;
public long end;
public String purchaseToken;
public Period(long start, long end, String purchaseToken) {
this.start = start;
this.end = end;
this.purchaseToken = purchaseToken;
}
}
public void addPeriod(long start, long end, String purchaseToken) {
historyList.add(new Period(start, end, purchaseToken));
}
@Override
public String toString() {
StringBuffer sb = new StringBuffer();
sb.append("productId:" + productId);
sb.append(" delFlg:" + delFlg);
for (Period period : historyList) {
sb.append("[start:" + period.start + " end:" + period.end + " purchaseToken:" + period.purchaseToken + "] ");
}
return sb.toString();
}
}
package jp.agentec.abook.abv.bl.dto;
import java.util.Date;
public class SubscriptionHistoryDto extends AbstractDto {
public Integer subscriptionHistoryId;
public Long purchaseHistoryId;
public Integer contentSetId;
public String contentSetName;
public Integer allFlg;
public String productId;
public String orderId;
public String packageName;
public Long purchaseTime;
public Integer purchaseState;
public String developerPayload;
public String purchaseToken;
public Boolean autoRenewing;
public Long startTimeMillis;
public Long expiryTimeMillis;
public Integer sentFlg;
public Integer delFlg;
public Date insertDate;
public Date updateDate;
public SubscriptionHistoryDto() {
}
@Override
public String[] getKeyValues() {
return new String[]{""+subscriptionHistoryId};
}
@Override
public Object[] getInsertValues() {
return new Object[]{subscriptionHistoryId, purchaseHistoryId, contentSetId, contentSetName, allFlg, productId, orderId, packageName, purchaseTime, purchaseState, developerPayload, purchaseToken, autoRenewing, startTimeMillis, expiryTimeMillis, sentFlg, delFlg};
}
@Override
public Object[] getUpdateValues() {
return new Object[]{purchaseHistoryId, contentSetId, contentSetName, allFlg, productId, orderId, packageName, purchaseTime, purchaseState, developerPayload, purchaseToken, autoRenewing, startTimeMillis, expiryTimeMillis, sentFlg, delFlg, insertDate, subscriptionHistoryId};
}
}
...@@ -17,16 +17,6 @@ import jp.agentec.adf.util.StringUtil; ...@@ -17,16 +17,6 @@ import jp.agentec.adf.util.StringUtil;
public class CategoryLogic extends AbstractLogic { public class CategoryLogic extends AbstractLogic {
private CategoryDao categoryDao = AbstractDao.getDao(CategoryDao.class); private CategoryDao categoryDao = AbstractDao.getDao(CategoryDao.class);
//해당 콘텐츠 아이디를 가지고 있는 장르정보
public ArrayList<String>getExistContentsCategoryInfo(long contentId) {
List<CategoryDto>categoryDtoList = categoryDao.getExistContentCategory(contentId);
ArrayList<String>categoryList = new ArrayList<String>();
for (CategoryDto dto : categoryDtoList) {
categoryList.add(dto.categoryName);
}
return categoryList;
}
/** /**
* ジャンル情報をサーバから受信し、ローカルに保存します。既存のデータは上書きされます。また、サーバにないジャンルがローカルにある場合、そのジャンルは削除されます。 * ジャンル情報をサーバから受信し、ローカルに保存します。既存のデータは上書きされます。また、サーバにないジャンルがローカルにある場合、そのジャンルは削除されます。
* @throws ABVException キャッシュにユーザ情報がありません。再度ログインする必要があります。 * @throws ABVException キャッシュにユーザ情報がありません。再度ログインする必要があります。
......
...@@ -29,7 +29,6 @@ import jp.agentec.abook.abv.bl.data.dao.ContentTagDao; ...@@ -29,7 +29,6 @@ import jp.agentec.abook.abv.bl.data.dao.ContentTagDao;
import jp.agentec.abook.abv.bl.dto.ContentDto; import jp.agentec.abook.abv.bl.dto.ContentDto;
import jp.agentec.abook.abv.bl.dto.ContentPageDto; import jp.agentec.abook.abv.bl.dto.ContentPageDto;
import jp.agentec.abook.abv.bl.dto.ContentTagDto; import jp.agentec.abook.abv.bl.dto.ContentTagDto;
import jp.agentec.abook.abv.bl.dto.SubscriptionHistoryDto;
import jp.agentec.abook.abv.bl.dto.comparator.ContentPageDtoComparator; import jp.agentec.abook.abv.bl.dto.comparator.ContentPageDtoComparator;
import jp.agentec.adf.util.FileUtil; import jp.agentec.adf.util.FileUtil;
import jp.agentec.adf.util.StringUtil; import jp.agentec.adf.util.StringUtil;
......
...@@ -9,15 +9,12 @@ import java.util.Locale; ...@@ -9,15 +9,12 @@ import java.util.Locale;
import jp.agentec.abook.abv.bl.acms.client.json.AcmsMessageJSON; import jp.agentec.abook.abv.bl.acms.client.json.AcmsMessageJSON;
import jp.agentec.abook.abv.bl.acms.client.json.AuthLevelJSON; import jp.agentec.abook.abv.bl.acms.client.json.AuthLevelJSON;
import jp.agentec.abook.abv.bl.acms.client.json.SubscriptionHistoryJSON;
import jp.agentec.abook.abv.bl.acms.client.parameters.AcmsParameters; import jp.agentec.abook.abv.bl.acms.client.parameters.AcmsParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.AddMemberGroupParameters; import jp.agentec.abook.abv.bl.acms.client.parameters.AddMemberGroupParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.ContentDownloadLogParameters; import jp.agentec.abook.abv.bl.acms.client.parameters.ContentDownloadLogParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.ContentReadingLogParameters; import jp.agentec.abook.abv.bl.acms.client.parameters.ContentReadingLogParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.EnterpriseLoginParameters; import jp.agentec.abook.abv.bl.acms.client.parameters.EnterpriseLoginParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.ServerTimeParameters; import jp.agentec.abook.abv.bl.acms.client.parameters.ServerTimeParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.SubscriptionHistoryParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.SubscriptionHistorySendParameters;
import jp.agentec.abook.abv.bl.acms.type.DownloadStatusType; import jp.agentec.abook.abv.bl.acms.type.DownloadStatusType;
import jp.agentec.abook.abv.bl.acms.type.InstallType; import jp.agentec.abook.abv.bl.acms.type.InstallType;
import jp.agentec.abook.abv.bl.common.ABVEnvironment; import jp.agentec.abook.abv.bl.common.ABVEnvironment;
...@@ -30,8 +27,6 @@ import jp.agentec.abook.abv.bl.common.nw.PCNetworkAdapter; ...@@ -30,8 +27,6 @@ import jp.agentec.abook.abv.bl.common.nw.PCNetworkAdapter;
import jp.agentec.abook.abv.bl.data.DBConnector; import jp.agentec.abook.abv.bl.data.DBConnector;
import jp.agentec.abook.abv.bl.data.dao.AbstractDao; import jp.agentec.abook.abv.bl.data.dao.AbstractDao;
import jp.agentec.abook.abv.bl.dto.MemberInfoDto; import jp.agentec.abook.abv.bl.dto.MemberInfoDto;
import jp.agentec.abook.abv.bl.dto.SubscriptionDto;
import jp.agentec.abook.abv.bl.dto.SubscriptionHistoryDto;
import jp.agentec.adf.net.http.HttpRequestSender; import jp.agentec.adf.net.http.HttpRequestSender;
import jp.agentec.adf.util.StringUtil; import jp.agentec.adf.util.StringUtil;
...@@ -156,51 +151,4 @@ public class AcmsClientTest { ...@@ -156,51 +151,4 @@ public class AcmsClientTest {
System.out.println(" result=" + result); System.out.println(" result=" + result);
} }
@Test
public void restoreSubscriptionHistory() throws AcmsException, NetworkDisconnectedException, JSONValidationException, IOException {
HttpRequestSender.testUserAgent = "Android";
ABVEnvironment.getInstance().isReader = false;
ABVEnvironment.getInstance().acmsAddress = "http://localhost:28080/acms";
SubscriptionHistoryParameters param = new SubscriptionHistoryParameters("5fe9baeeeb51e51b639a0f5c568a071a", "agt.android06@gmail.com");
SubscriptionHistoryJSON result = AcmsClient.getInstance("billgates", new PCNetworkAdapter()).getSubscriptionHistory(param);
System.out.println(" result=" + result);
for (SubscriptionHistoryDto dto : result.dtoList) {
System.out.println(dto.purchaseToken);
}
}
@Test
public void contentSet() throws AcmsException, NetworkDisconnectedException, JSONValidationException, IOException {
HttpRequestSender.testUserAgent = "Android";
ABVEnvironment.getInstance().isReader = false;
ABVEnvironment.getInstance().acmsAddress = "http://localhost:28080/acms";
SubscriptionHistoryParameters param = new SubscriptionHistoryParameters("5fe9baeeeb51e51b639a0f5c568a071a", "agentec@gmail.com");
ArrayList<SubscriptionDto> dtoList = AcmsClient.getInstance("billgates", new PCNetworkAdapter()).contentSet(param);
for (SubscriptionDto dto : dtoList) {
System.out.println(dto);
AbstractDao.getDao(SubscriptionHistoryDao.class).update(dto);
}
}
@Test
public void sendHistory() throws AcmsException, NetworkDisconnectedException, JSONValidationException, IOException {
HttpRequestSender.testUserAgent = "Android";
ABVEnvironment.getInstance().isReader = false;
ABVEnvironment.getInstance().acmsAddress = "http://localhost:28080/acms";
List<SubscriptionHistoryDto> list = AbstractDao.getDao(SubscriptionHistoryDao.class).getUnsentList();
for (SubscriptionHistoryDto subscriptionHistoryDto : list) {
AcmsClient acmsClient = AcmsClient.getInstance("billgates", new PCNetworkAdapter());
SubscriptionHistorySendParameters subParam = new SubscriptionHistorySendParameters("5fe9baeeeb51e51b639a0f5c568a071a", "agentec@gmail.com", subscriptionHistoryDto);
acmsClient.sendHistory(subParam);
AbstractDao.getDao(SubscriptionHistoryDao.class).updateAsSent(subscriptionHistoryDto.subscriptionHistoryId);
}
}
} }
package jp.agentec.abook.abv.bl.data.dao;
import jp.agentec.abook.abv.bl.common.db.SQLiteOpenHelper;
import jp.agentec.abook.abv.bl.common.db.impl.JDBCSQLiteOpenHelper;
import jp.agentec.abook.abv.bl.data.DBConnector;
import jp.agentec.abook.abv.bl.dto.ContentIdConvDto;
import junit.framework.TestCase;
import junit.framework.TestSuite;
public class ContentIdConvDaoTest extends TestCase {
ContentIdConvDao contractDao = AbstractDao.getDao(ContentIdConvDao.class);
public ContentIdConvDaoTest(String string) {
super(string);
}
@Override
protected void setUp() throws Exception {
super.setUp();
DBConnector conn = DBConnector.getInstance();
SQLiteOpenHelper sqlLiteOpenHelper = new JDBCSQLiteOpenHelper("test.db", 0);
conn.setSqlLiteOpenHelper(sqlLiteOpenHelper);
((JDBCSQLiteOpenHelper)sqlLiteOpenHelper).onCreate(conn.getDatabase());
}
@Override
protected void tearDown() throws Exception {
super.tearDown();
}
public static TestSuite suite() {
TestSuite suite = new TestSuite("ContentIdConvDaoTest");
suite.addTest(new ContentIdConvDaoTest("testInsert"));
suite.addTest(new ContentIdConvDaoTest("testUpdate"));
suite.addTest(new ContentIdConvDaoTest("testExists"));
return suite;
}
public void testInsert() throws Exception {
ContentIdConvDto dto = new ContentIdConvDto(1, 1, 2, 3, 4, "http://dl", null, null, null, "http://st.agentec.jp/0000");
contractDao.insert(dto);
System.out.println(contractDao.getDto(1).downloadUrl);
}
public void testUpdate() throws Exception {
ContentIdConvDto dto = new ContentIdConvDto(1, 1, 2, 3, 4, "http://dl/u", null, null, null, "http://st.agentec.jp/0000");
contractDao.update(dto);
System.out.println(contractDao.getDto(1).downloadUrl);
}
public void testExists() throws Exception {
System.out.println(contractDao.exists(0));
System.out.println(contractDao.exists(1));
}
public void testGetDtoByCmsContentId() throws Exception {
System.out.println(contractDao.getDtoByCmsContentId(1, 3).downloadUrl);
}
}
package jp.agentec.abook.abv.bl.data.dao;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import jp.agentec.abook.abv.bl.common.db.SQLiteOpenHelper;
import jp.agentec.abook.abv.bl.common.db.impl.JDBCSQLiteOpenHelper;
import jp.agentec.abook.abv.bl.data.DBConnector;
import jp.agentec.abook.abv.bl.dto.SearchHistoryDto;
import junit.framework.TestCase;
public class SearchHistoryDaoTest extends TestCase {
private static String[] searchText = new String[] {"aaaa", "bbbb", "cccc", "dddd", "aaaa"};
@Override
protected void setUp() throws Exception {
super.setUp();
DBConnector conn = DBConnector.getInstance();
SQLiteOpenHelper sqlLiteOpenHelper = new JDBCSQLiteOpenHelper("test.db", 0);
conn.setSqlLiteOpenHelper(sqlLiteOpenHelper);
((JDBCSQLiteOpenHelper)sqlLiteOpenHelper).onCreate(conn.getDatabase());
}
@Override
protected void tearDown() throws Exception {
super.tearDown();
}
public void testInsertUpdateSearchHistory() throws Exception {
SearchHistoryDao dao = AbstractDao.getDao(SearchHistoryDao.class);
for (int i = 0; i < searchText.length; i++) {
String string = searchText[i];
SearchHistoryDto dto = new SearchHistoryDto();
dto.searchText = string;
dto.insertDate = new Date(System.currentTimeMillis());
dao.insertUpdateSearchHistory(dto);
Thread.sleep(1000);
}
}
public void testGetSearchHistoryDtoList() throws Exception {
List<SearchHistoryDto> list = new SearchHistoryDao().getSearchHistoryDtoList();
for (Iterator<SearchHistoryDto> iterator = list.iterator(); iterator.hasNext();) {
SearchHistoryDto searchHistoryDto = iterator.next();
System.out.println("searchHistoryDto:searchText=" + searchHistoryDto.searchText + ", inserDate=" + searchHistoryDto.insertDate.toString());
}
}
}
package jp.agentec.abook.abv.bl.logic;
import jp.agentec.abook.abv.bl.common.db.SQLiteOpenHelper;
import jp.agentec.abook.abv.bl.common.db.impl.JDBCSQLiteOpenHelper;
import jp.agentec.abook.abv.bl.data.DBConnector;
import jp.agentec.abook.abv.bl.dto.ContentMemoDto;
import jp.agentec.adf.util.DateTimeUtil;
import junit.framework.TestCase;
public class DashboardLogicTest extends TestCase {
private DashboardLogic memoLogic = AbstractLogic.getLogic(DashboardLogic.class);
@Override
protected void setUp() throws Exception {
super.setUp();
DBConnector conn = DBConnector.getInstance();
SQLiteOpenHelper sqlLiteOpenHelper = new JDBCSQLiteOpenHelper("test.db", 0);
conn.setSqlLiteOpenHelper(sqlLiteOpenHelper);
((JDBCSQLiteOpenHelper) sqlLiteOpenHelper).onCreate(conn.getDatabase());
}
@Override
protected void tearDown() throws Exception {
super.tearDown();
}
}
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