Commit a2036236 by Lee Jaebin

使用しないt_contentテーブルのカラム削除

parent 71313bbc
......@@ -23,12 +23,9 @@ public class ContentVersionsJSON extends AcmsCommonJSON {
public static final String ResourceVersion = "resourceVersion";
public static final String ContentNameKana = "contentNameKana";
public static final String ContentType = "contentType";
public static final String ReaderShare = "readerShare";
public static final String ContentListForAdmin = "contentListForAdmin";
public static final String FetchDate = "fetchDate";
public ArrayList<ContentDto> contentVersions;
public ArrayList<Long> contentListForAdmins;
public String fetchDate;
public ContentVersionsJSON(String jsonString) throws AcmsException {
......@@ -37,16 +34,6 @@ public class ContentVersionsJSON extends AcmsCommonJSON {
@Override
protected void parse(JSONObject json) throws JSONValidationException {
// 管理者用コンテンツIDリスト
contentListForAdmins = new ArrayList<Long>();
if (json.has(ContentListForAdmin)) {
JSONArray arr = json.getJSONArray(ContentListForAdmin);
for (int j = 0; j < arr.length(); j++) {
JSONObject obj = arr.getJSONObject(j);
long contentIdForAdmin = getLong(obj, ContentId);
contentListForAdmins.add(contentIdForAdmin);
}
}
if (json.has(FetchDate)) {
fetchDate = json.getString(FetchDate);
}
......@@ -63,10 +50,8 @@ public class ContentVersionsJSON extends AcmsCommonJSON {
int resourceVersion = getInt(version, ResourceVersion);
String contentNameKana = getString(version, ContentNameKana, null);
int contentType = getInt(version, ContentType, 0);
boolean readerShareFlg = (JsonUtil.getInt(version, ReaderShare) > 0);
boolean signageDisableDl = (contentListForAdmins.contains(contentId));
contentVersions.add(new ContentDto(contentId, metaVersion, resourceVersion, contentNameKana, contentType, readerShareFlg, signageDisableDl));
contentVersions.add(new ContentDto(contentId, metaVersion, resourceVersion, contentNameKana, contentType));
}
} else {
throw new JSONValidationException(json.toString(), ContentList + " property not found.");
......
......@@ -42,14 +42,8 @@ public class DownloadedContentInfoJSON extends AcmsJSONParser {
public static final String ContractContentId = "contractContentId";
public static final String AlertMessageLevel = "alertMessageLevel";
public static final String AlertMessage = "alertMessage";
public static final String PrintFlg = "printFlg";
public static final String HideFlg = "hideFlg";
public static final String ShareUrl = "shareUrl";
public static final String ReaderShare = "readerShare";
public static final String PayFlg = "payFlg";
public static final String ProductIdAndroid = "productIdAndroid";
public static final String DeliveryType = "deliveryType";
public static final String Signage = "signage";
public static final String DisableSwipe = "disableSwipe";
public static final String BrowserType = "browserType";
public static final String PdfPassword = "pdfPassword";
......@@ -83,14 +77,8 @@ public class DownloadedContentInfoJSON extends AcmsJSONParser {
public Date lastDeliveryDate;
public int alertMessageLevel;
public String alertMessage;
public boolean printFlg;
public boolean hideFlg;
public String shareUrl;
public boolean readerContentFlg;
public boolean payFlg;
public String productId;
public int deliveryType;
public int signage;
public boolean disableSwipe;
public int browserType;
public String pdfPassword;
......@@ -172,14 +160,8 @@ public class DownloadedContentInfoJSON extends AcmsJSONParser {
alertMessageLevel= getInt(json, AlertMessageLevel, 0);
alertMessage= getString(json, AlertMessage, "");
printFlg = (getInt(json, PrintFlg) != 0);
hideFlg = (JsonUtil.getInt(json, HideFlg, 0) != 0); // 日比谷花壇のみのため、なければ0
shareUrl = JsonUtil.getString(json, ShareUrl);
readerContentFlg = (JsonUtil.getInt(json, ReaderShare, 0) != 0);
payFlg = (JsonUtil.getInt(json, PayFlg, 0) != 0);
productId = JsonUtil.getString(json, ProductIdAndroid);
deliveryType = JsonUtil.getInt(json, DeliveryType, 0);
signage = JsonUtil.getInt(json, Signage, 0);
disableSwipe = (JsonUtil.getInt(json, DisableSwipe) != 0);
browserType = getInt(json, BrowserType, 0);
......@@ -254,14 +236,8 @@ public class DownloadedContentInfoJSON extends AcmsJSONParser {
dto.lastDeliveryDate = lastDeliveryDate;
dto.alertMessageLevel = alertMessageLevel;
dto.alertMessage = alertMessage;
dto.printFlg = printFlg;
dto.hideFlg = hideFlg;
dto.shareUrl = shareUrl;
dto.readerShareFlg = readerContentFlg;
dto.payFlg = payFlg;
dto.productId = productId;
dto.deliveryType = deliveryType;
dto.signage = signage;
dto.disableSwipe = disableSwipe;
dto.browserType = browserType;
dto.commonContentFlg = commonContentFlg;
......
......@@ -160,30 +160,10 @@ public class ContentDao extends AbstractDao {
if (column != -1) {
dto.alertMessage = cursor.getString(column);
}
column = cursor.getColumnIndex("print_flg");
if (column != -1) {
dto.printFlg = toBool(cursor.getInt(column));
}
column = cursor.getColumnIndex("hide_flg");
if (column != -1) {
dto.hideFlg = toBool(cursor.getInt(column));
}
column = cursor.getColumnIndex("share_url");
if (column != -1) {
dto.shareUrl = cursor.getString(column);
}
column = cursor.getColumnIndex("reader_share_flg");
if (column != -1) {
dto.readerShareFlg = toBool(cursor.getInt(column));
}
column = cursor.getColumnIndex("disable_auto_dl");
if (column != -1) {
dto.disableAutoDl = toBool(cursor.getInt(column));
}
column = cursor.getColumnIndex("pay_flg");
if (column != -1) {
dto.payFlg = toBool(cursor.getInt(column));
}
column = cursor.getColumnIndex("product_id");
if (column != -1) {
dto.productId = cursor.getString(column);
......@@ -204,10 +184,6 @@ public class ContentDao extends AbstractDao {
if (column != -1) {
dto.deliveryType = cursor.getInt(column);
}
column = cursor.getColumnIndex("signage");
if (column != -1) {
dto.signage = cursor.getInt(column);
}
column = cursor.getColumnIndex("disable_swipe");
if (column != -1) {
dto.disableSwipe = toBool(cursor.getInt(column));
......@@ -238,11 +214,6 @@ public class ContentDao extends AbstractDao {
dto.status = cursor.getString(column);
}
column = cursor.getColumnIndex("signage_disable_dl");
if (column != -1) {
dto.signageDisableDl = toBool(cursor.getInt(column));
}
column = cursor.getColumnIndex("unauthorized_content_flg");
if (column != -1) {
dto.isUnAuthorizedContent = toBool(cursor.getInt(column));
......@@ -334,7 +305,7 @@ public class ContentDao extends AbstractDao {
}
public void insertContent(ContentDto dto) {
insert("insert into t_content (content_id, content_name, content_name_kana, content_detail, all_page_num, orientation, updated_flg, downloaded_flg, downloading_flg, meta_version, resource_version, delivery_start_date, delivery_end_date, favorite_flg, content_protected_flg, thumbnail_normal_path, thumbnail_big_path, page_path, resource_path, content_groups, new_flg, contract_content_id, reading_date, last_viewed_page, content_size, reading_count, content_type, last_delivery_date, content_alert_level, content_alert_message, print_flg, hide_flg, share_url, reader_share_flg, disable_auto_dl, pay_flg, product_id, delivery_type, signage, disable_swipe, signage_disable_dl, unauthorized_content_flg, common_content_flg) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", dto.getInsertValues());
insert("insert into t_content (content_id, content_name, content_name_kana, content_detail, all_page_num, orientation, updated_flg, downloaded_flg, downloading_flg, meta_version, resource_version, delivery_start_date, delivery_end_date, favorite_flg, content_protected_flg, thumbnail_normal_path, thumbnail_big_path, page_path, resource_path, content_groups, new_flg, contract_content_id, reading_date, last_viewed_page, content_size, reading_count, content_type, last_delivery_date, content_alert_level, content_alert_message, disable_auto_dl, product_id, delivery_type, disable_swipe, unauthorized_content_flg, common_content_flg) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", dto.getInsertValues());
}
public boolean updateContent(ContentDto dto, boolean initialize) {
......@@ -346,7 +317,7 @@ public class ContentDao extends AbstractDao {
delete("t_content_tag", "content_id=?", keyValues);
}
long count = update("update t_content set content_name=?, content_name_kana=?, content_detail=?, all_page_num=?, orientation=?, updated_flg=?, downloaded_flg=?, downloading_flg=?, meta_version=?, resource_version=?, delivery_start_date=?, delivery_end_date=?, favorite_flg=?, content_protected_flg=?, thumbnail_normal_path=?, thumbnail_big_path=?, page_path=?, resource_path=?, content_groups=?, new_flg=?, contract_content_id=?,reading_date=?, last_viewed_page=?, content_size=?, reading_count=?, content_type=?, last_delivery_date=?, content_alert_level=?, content_alert_message=?, print_flg=?, hide_flg=?, share_url=?, reader_share_flg=?, disable_auto_dl=?, pay_flg=?, product_id=?, delivery_type=?, signage=?, disable_swipe=?, download_start_date=?, status=?, signage_disable_dl=?, common_content_flg=? where content_id=?", dto.getUpdateValues());
long count = update("update t_content set content_name=?, content_name_kana=?, content_detail=?, all_page_num=?, orientation=?, updated_flg=?, downloaded_flg=?, downloading_flg=?, meta_version=?, resource_version=?, delivery_start_date=?, delivery_end_date=?, favorite_flg=?, content_protected_flg=?, thumbnail_normal_path=?, thumbnail_big_path=?, page_path=?, resource_path=?, content_groups=?, new_flg=?, contract_content_id=?,reading_date=?, last_viewed_page=?, content_size=?, reading_count=?, content_type=?, last_delivery_date=?, content_alert_level=?, content_alert_message=?, disable_auto_dl=?, product_id=?, delivery_type=?, disable_swipe=?, download_start_date=?, status=?, common_content_flg=? where content_id=?", dto.getUpdateValues());
return count > 0;
}
......@@ -617,35 +588,6 @@ public class ContentDao extends AbstractDao {
return list;
}
public void removeReadingContent(long contentId) {
update("update t_content set reading_date = null where content_id = ?", new Object[] { contentId });
}
public int getLastViewedPageNum(long contentId) {
return rawQueryGetInt("select last_viewed_page from t_content where content_id = " + contentId, null);
}
public ContentDto getContentByProductId(String productId) {
return rawQueryGetDto("select * from t_content where product_id=?", new String[]{"" + productId}, ContentDto.class);
}
public ContentDto findNearest(Long startTimeMillis) {
String startTime = DateTimeUtil.toStringInTimeZone(new Date(startTimeMillis), DateTimeFormat.yyyyMMddHHmmss_hyphen, "UTC");
return rawQueryGetDto("select * from t_content where delivery_start_date < ? order by delivery_start_date desc limit 1", new String[]{startTime}, ContentDto.class);
}
/**
* DL済みのサイネージPDFのコンテンツIDを返す
* @return
*/
public List<Long> getDownloadedPdf() {
return rawQueryGetLongList("select content_id from t_content where downloaded_flg=1 and content_type='pdf' and signage=1", null);
}
public List<ContentDto> getAllContentDownloaded() {
return rawQueryGetDtoList("select * from t_content where downloaded_flg=1", null, ContentDto.class);
}
public List<ContentDto> getUnfinishedDownloadAll() {
String sql = String.format(" select * from t_content where downloaded_flg=0 and (status is null or status IN ('%s', '%s', '%s', '%s', '%s')) "
, DownloadStatusType.Waiting.type(), DownloadStatusType.Downloading.type()
......@@ -674,14 +616,9 @@ public class ContentDao extends AbstractDao {
sql.append(" updated_flg = 1 ");
sql.append(" or downloaded_flg = 0 ");
sql.append(" ) ");
sql.append("and hide_flg = 0 ");
return rawQueryGetDtoList(sql.toString(), null, ContentDto.class);
}
public void clearSignageDisableDl(){
update("update t_content set signage_disable_dl=0", null);
}
public List<ContentDto> getProjectRelatedContent(Long projectId) {
......
......@@ -3,15 +3,7 @@ package jp.agentec.abook.abv.bl.data.tables;
import java.util.ArrayList;
import java.util.List;
import jp.agentec.abook.abv.bl.acms.client.json.DownloadedContentInfoJSON;
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.common.util.ContentFileUtil;
import jp.agentec.abook.abv.bl.data.DatabaseVersions;
import jp.agentec.abook.abv.bl.data.dao.AbstractDao;
import jp.agentec.abook.abv.bl.data.dao.ContentDao;
import jp.agentec.abook.abv.bl.dto.ContentDto;
import jp.agentec.adf.util.StringUtil;
......@@ -59,18 +51,12 @@ public class TContent extends SQLiteTableScript {
sql.append(" , last_delivery_date DATETIME "); // since ABook+
sql.append(" , content_alert_level INTEGER "); // since ABook+
sql.append(" , content_alert_message TEXT "); // since ABook+
sql.append(" , print_flg BOOLEAN "); // since ABook+
sql.append(" , hide_flg BOOLEAN "); // since ABook+1.1
sql.append(" , share_url TEXT "); // since ABook+1.2
sql.append(" , reader_share_flg BOOLEAN "); // since ABook+1.3
sql.append(" , disable_auto_dl BOOLEAN default 0 "); // since ABook+1.4
sql.append(" , pay_flg BOOLEAN default 0 "); // since ABook+1.5
sql.append(" , product_id TEXT "); // since ABook+1.5
sql.append(" , price TEXT "); // since ABook+1.5
sql.append(" , purchase_state INTEGER default -1 "); // since ABook+1.5
sql.append(" , purchase_token TEXT "); // since ABook+1.5
sql.append(" , delivery_type INTEGER default 0 "); // since ABook+1.5.2
sql.append(" , signage INTEGER default 0 "); // since ABook+1.6.0
sql.append(" , disable_swipe BOOLEAN default 0 "); // since ABook+1.6.0
sql.append(" , download_start_date DATETIME "); // since ABook+1.6.3 (from t_content_download_queue)
......@@ -79,7 +65,6 @@ public class TContent extends SQLiteTableScript {
sql.append(" , download_end_date DATETIME "); // since ABook+1.6.3 (from t_content_download_queue)
sql.append(" , log_sended_flg BOOLEAN default 0"); // since ABook+1.6.3 (from t_content_download_queue)
sql.append(" , status VARCHAR(2) "); // since ABook+1.6.3 (from t_content_download_queue)
sql.append(" , signage_disable_dl BOOLEAN default 0 "); // since ABook+1.6.3
sql.append(" , unauthorized_content_flg BOOLEAN default 0"); //since ABook See 1.7.2
sql.append(" , project_content_flg BOOLEAN default 0"); //since ABook Check 1.9.3
sql.append(" , common_content_flg BOOLEAN default 0"); //since ABook Check 1.9.4
......
......@@ -88,9 +88,6 @@ public class ContentDownloader {
// 新着ZIPのダウンロード失敗した場合、lastFetchDate保存しない
private boolean downloadSucceededFlag = true;
//サイネージ管理者用コンテンツリスト(新規)
private List<Long> adminIdList ;
private ContentDownloader() {
}
......@@ -690,15 +687,7 @@ public class ContentDownloader {
private GetContentParameters getContentParameter(ContentDto contentDto) {
GetContentParameters param;
if (contentDto.payFlg) {
// 単品の場合// purchaseTokenがない場合にdummy文字を入れて
param = new GetContentParameters(contentDto.contentId, cache.getMemberInfo().sid, ContentZipType.ContentDownload, contentDto.productId, StringUtil.isNullOrEmpty(contentDto.purchaseToken)? "dummy": contentDto.purchaseToken);
} else {
param = new GetContentParameters(contentDto.contentId, cache.getMemberInfo().sid, ContentZipType.ContentDownload);
}
if (contentDto.payFlg) {
param.loginId = cache.getMemberInfo().loginId;
}
param = new GetContentParameters(contentDto.contentId, cache.getMemberInfo().sid, ContentZipType.ContentDownload);
return param;
}
......@@ -948,16 +937,7 @@ public class ContentDownloader {
contentFileExtractor.removeContentCash(contentId);
contentFileExtractor.extractZipFile(contentId, notification.getOutputFileName(), contentPath);
contentLogic.saveContentInfo(contentPath);
// サイネージの場合は、自動ダウンロード対象から外すため「管理者用コンテンツ」はフラグを付ける
if (adminIdList != null && adminIdList.size() > 0) {
for (long adminContentId : adminIdList) {
ContentDto adminContentDto = contentDao.getContent(adminContentId);
if (adminContentDto != null) {
adminContentDto.signageDisableDl = true;
contentDao.updateContent(adminContentDto, false);
}
}
}
updateRefreshContentListState(HttpDownloadState.finished, contentId, null);
} catch (Exception e) {
downloadSucceededFlag = false;
......@@ -1023,9 +1003,4 @@ public class ContentDownloader {
public boolean isDownloadSucceeded() {
return this.downloadSucceededFlag;
}
public void setAdminIdList( List<Long> adminidlist) {
this.adminIdList = adminidlist;
}
}
......@@ -272,25 +272,6 @@ public class ContentRefresher {
List<ContentDto> serverContents = json.contentVersions;
// DTO Info:contentId, metaVersion, resourceVersion, contentNameKana, readerShareFlg
//サイネージ管理者用コンテンツ処理
contentDao.clearSignageDisableDl();
List<Long> adminIdList = new ArrayList<Long>();
if (json.contentListForAdmins != null && json.contentListForAdmins.size() > 0) {
for (long adminContentId : json.contentListForAdmins) {
ContentDto adminContentDto = contentDao.getContent(adminContentId);
if (adminContentDto != null) {
//既に存在するコンテンツ更新
// サイネージの場合は、自動ダウンロード対象から外すため「管理者用コンテンツ」はフラグを付ける
adminContentDto.signageDisableDl = true;
contentDao.updateContent(adminContentDto, false);
}else{
//新規コンテンツ(DB登録後更新)
adminIdList.add(adminContentId);
}
}
}
contentDownloader.setAdminIdList(adminIdList);
for (ContentDto serverContentDto : serverContents) {
while (isBusyRefreshingContent()) {
if (interrupt) {
......
......@@ -45,17 +45,10 @@ public class ContentDto extends AbstractDto implements Serializable {
public Date lastDeliveryDate;
public int alertMessageLevel;
public String alertMessage;
public boolean printFlg;
public boolean hideFlg;
public String shareUrl;
public boolean readerShareFlg;
public boolean disableAutoDl;
public boolean payFlg;
public String productId;
public int signage;
public int deliveryType;
public boolean disableSwipe;
public boolean signageDisableDl;
public boolean commonContentFlg;
// DBにあるがinsertにはなし
......@@ -87,24 +80,22 @@ public class ContentDto extends AbstractDto implements Serializable {
//ABookSee用:権限のないコンテンツのフラグ
public boolean isUnAuthorizedContent;
public ContentDto(long contentId, int metaVersion, int resourceVersion, String contentNamaKana, int contentType, boolean readerShare, boolean signageDisableDl) {
public ContentDto(long contentId, int metaVersion, int resourceVersion, String contentNamaKana, int contentType) {
this.contentId = contentId;
this.metaVersion = metaVersion;
this.resourceVersion = resourceVersion;
this.contentNameKana = contentNamaKana;
setContentType(contentType);
this.readerShareFlg = readerShare;
this.signageDisableDl = signageDisableDl;
}
@Override
public Object[] getInsertValues() {
return new Object[]{contentId, contentName, contentNameKana, contentDetail, allPageNum, orientation, updatedFlg, downloadedFlg, downloadingFlg, metaVersion, resourceVersion, deliveryStartDate, deliveryEndDate, favoriteFlg, contentProtectedFlg, thumbnailNormalPath, thumbnailBigPath, pagePath, resourcePath, contentGroups, newFlg, contractContentId, readingDate, lastViewedPage, contentSize, readingCount, contentType, lastDeliveryDate, alertMessageLevel, alertMessage, printFlg, hideFlg, shareUrl, readerShareFlg, disableAutoDl, payFlg, productId, deliveryType, signage, disableSwipe, signageDisableDl, isUnAuthorizedContent, commonContentFlg};
return new Object[]{contentId, contentName, contentNameKana, contentDetail, allPageNum, orientation, updatedFlg, downloadedFlg, downloadingFlg, metaVersion, resourceVersion, deliveryStartDate, deliveryEndDate, favoriteFlg, contentProtectedFlg, thumbnailNormalPath, thumbnailBigPath, pagePath, resourcePath, contentGroups, newFlg, contractContentId, readingDate, lastViewedPage, contentSize, readingCount, contentType, lastDeliveryDate, alertMessageLevel, alertMessage, disableAutoDl, productId, deliveryType, disableSwipe, isUnAuthorizedContent, commonContentFlg};
}
@Override
public Object[] getUpdateValues() {
return new Object[]{contentName, contentNameKana, contentDetail, allPageNum, orientation, updatedFlg, downloadedFlg, downloadingFlg, metaVersion, resourceVersion, deliveryStartDate, deliveryEndDate, favoriteFlg, contentProtectedFlg, thumbnailNormalPath, thumbnailBigPath, pagePath, resourcePath, contentGroups, newFlg, contractContentId, readingDate, lastViewedPage, contentSize, readingCount, contentType, lastDeliveryDate, alertMessageLevel, alertMessage, printFlg, hideFlg, shareUrl, readerShareFlg, disableAutoDl, payFlg, productId, deliveryType, signage, disableSwipe, downloadStartDate, status, signageDisableDl, commonContentFlg, contentId};
return new Object[]{contentName, contentNameKana, contentDetail, allPageNum, orientation, updatedFlg, downloadedFlg, downloadingFlg, metaVersion, resourceVersion, deliveryStartDate, deliveryEndDate, favoriteFlg, contentProtectedFlg, thumbnailNormalPath, thumbnailBigPath, pagePath, resourcePath, contentGroups, newFlg, contractContentId, readingDate, lastViewedPage, contentSize, readingCount, contentType, lastDeliveryDate, alertMessageLevel, alertMessage, disableAutoDl, productId, deliveryType, disableSwipe, downloadStartDate, status, commonContentFlg, contentId};
}
public ContentDto() {
......@@ -216,7 +207,7 @@ public class ContentDto extends AbstractDto implements Serializable {
}
public boolean isDownloadable(boolean checkDisableAutoDl) {
return !hideFlg && (!checkDisableAutoDl || !disableAutoDl) && deliveryType != DeliveryType.STREAMING;
return (!checkDisableAutoDl || !disableAutoDl) && deliveryType != DeliveryType.STREAMING;
}
public boolean isPdf() {
......
......@@ -174,14 +174,8 @@ public class ContentLogic extends AbstractLogic {
dto.contentSize = json.contentSize;
dto.alertMessageLevel = json.alertMessageLevel;
dto.alertMessage = json.alertMessage;
dto.printFlg = json.printFlg;
dto.hideFlg = json.hideFlg;
dto.shareUrl = json.shareUrl;
dto.readerShareFlg = json.readerContentFlg;
dto.payFlg = json.payFlg;
dto.productId = json.productId;
dto.deliveryType = json.deliveryType;
dto.signage = json.signage;
dto.disableSwipe = json.disableSwipe;
dto.browserType = json.browserType;
dto.commonContentFlg = json.commonContentFlg;
......
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