Commit 40f44ee0 by Lee Jaebin

ソース分離

parent 65919394
......@@ -24,7 +24,6 @@ public class ActionInfoJSON extends AbstractJSON {
public static final int CONTENTLINK_ACTION = 10;
public static final int HTML_ACTION = 11;
public static final int ENQUETE_ACTION = 12;
public static final int BEACON_ACTION = 13;
public static final int EXAM_ACTION = 14;
public static final int QUIZ_ACTION = 15; // TBD
......@@ -231,6 +230,30 @@ public class ActionInfoJSON extends AbstractJSON {
// return JsonUtil.getLong(root, "contractContentId");
// }
// public String getObjectName() { // null可
// return JsonUtil.getString(root, "objectName", "");
// }
// public String getContentName() {
// return JsonUtil.getString(root, "contentName");
// }
//
// public int getContractContentId() {
// return root.getInt("contractContentId");
// }
//
// public String getContentURL() {
// return JsonUtil.getString(root, "contentURL");
// }
//
// public long getMajor() {
// return JsonUtil.getLong(root, "major");
// }
//
// public long getMinor() {
// return JsonUtil.getLong(root, "minor");
// }
/**
* ENQUETE_ACTION(12)
* @return
......@@ -255,10 +278,6 @@ public class ActionInfoJSON extends AbstractJSON {
return JsonUtil.getLong(root, "objectId", 0);
}
public String getObjectName() { // null可
return JsonUtil.getString(root, "objectName", "");
}
public String getEnquete() {
String fileName = root.getString("enquete"); // 空は不可
if (fileName.equals("")) {
......@@ -272,30 +291,6 @@ public class ActionInfoJSON extends AbstractJSON {
return JsonUtil.getString(root, "questionNo", "0");
}
/**
* BEACON_ACTION(13)
* @return
*/
public String getContentName() {
return JsonUtil.getString(root, "contentName");
}
public int getContractContentId() {
return root.getInt("contractContentId");
}
public String getContentURL() {
return JsonUtil.getString(root, "contentURL");
}
public long getMajor() {
return JsonUtil.getLong(root, "major");
}
public long getMinor() {
return JsonUtil.getLong(root, "minor");
}
public int getShowResult() {
return root.getInt("showResult");
}
......
......@@ -6,7 +6,6 @@ import java.util.Collections;
import java.util.Date;
import java.util.List;
import jp.agentec.abook.abv.bl.acms.type.DeliveryType;
import jp.agentec.abook.abv.bl.acms.type.LoginStatus;
import jp.agentec.abook.abv.bl.acms.type.SecurityPolicyType;
import jp.agentec.abook.abv.bl.acms.type.ServiceOption.ServiceOptionId;
......@@ -16,7 +15,6 @@ import jp.agentec.abook.abv.bl.data.dao.AbstractDao;
import jp.agentec.abook.abv.bl.data.dao.AcmsDao;
import jp.agentec.abook.abv.bl.data.dao.MemberInfoDao;
import jp.agentec.abook.abv.bl.data.dao.ServiceOptionDao;
import jp.agentec.abook.abv.bl.dto.DashboardDto;
import jp.agentec.abook.abv.bl.dto.MemberInfoDto;
import jp.agentec.abook.abv.bl.dto.ServiceOptionDto;
import jp.agentec.abook.abv.bl.logic.ContractLogic;
......
package jp.agentec.abook.abv.bl.dto;
import java.util.Date;
public class BeaconHistoryDto extends AbstractDto {
public int beaconHistoryId;
public int major;
public int minor;
public Date insertDate;
public Date updateDate;
@Override
public String[] getKeyValues() {
return new String[] { "" + beaconHistoryId };
}
@Override
public Object[] getInsertValues() {
return new Object[] { beaconHistoryId, major, minor, insertDate, updateDate };
}
@Override
public Object[] getUpdateValues() {
return new Object[] { updateDate, major, minor };
}
}
\ No newline at end of file
package jp.agentec.abook.abv.bl.dto;
import java.util.List;
/**
* DashBaordList 저장
* @author Chae
* @version 1.0.0
*/
public class DashBoardListDto {
public int listId;
public String listName;
public String item;
public boolean checked;
public List<List<ContentDto>> contentList;
public int lastViewPage = 0;
}
package jp.agentec.abook.abv.bl.dto;
/**
* 대쉬보드 dto
* @author cym
* @version 1.0.0
*/
public class DashboardDto {
public String type;
public int status;
public int dispOrder;
public int genreId;
public DashboardDto() {
}
public DashboardDto(String type, int status, int dispOrder, int genreId) {
this.type = type;
this.status = status;
this.dispOrder = dispOrder;
this.genreId = genreId;
}
}
package jp.agentec.abook.abv.bl.dto;
import java.util.Date;
/**
* ロック情報を格納します。
* @author Minhyuk Seok
* @version 1.0.0
*/
public class LockDto extends AbstractDto {
public int folderId;
public int folderPosition;
public byte[] prevFolderList;
public Date insertDate;
@Override
public Object[] getInsertValues() {
return new Object[]{folderId, folderPosition, prevFolderList, insertDate};
}
@Override
public String[] getKeyValues() {
return new String[]{""+ folderId};
}
}
package jp.agentec.abook.abv.bl.dto;
import java.util.Date;
public class SiteDto extends AbstractDto {
public Integer siteId;
public String siteUrl;
public String siteName;
public String downloadUrl;
public String logSendUrl;
public String enqueteSendUrl;
public Integer delFlg;
public Date insertDate;
public Date updateDate;
public SiteDto() {
}
public SiteDto(Integer siteId, String siteUrl, String siteName, String downloadUrl, String logSendUrl, String enqueteSendUrl, Integer delFlg, Date insertDate, Date updateDate) {
super();
this.siteId = siteId;
this.siteUrl = siteUrl;
this.siteName = siteName;
this.downloadUrl = downloadUrl;
this.logSendUrl = logSendUrl;
this.enqueteSendUrl = enqueteSendUrl;
this.delFlg = delFlg;
this.insertDate = insertDate;
this.updateDate = updateDate;
}
@Override
public String[] getKeyValues() {
return new String[]{""+siteId};
}
@Override
public Object[] getInsertValues() {
return new Object[]{siteId, siteUrl, siteName, downloadUrl, logSendUrl, enqueteSendUrl, delFlg, insertDate, updateDate};
}
@Override
public Object[] getUpdateValues() {
return new Object[]{siteUrl, siteName, downloadUrl, logSendUrl, enqueteSendUrl, delFlg, insertDate, updateDate, siteId};
}
}
......@@ -150,9 +150,6 @@ public class ContentObjectLogLogic extends AbstractLogic {
case ActionInfoJSON.HTML_ACTION:
actionValue = actionInfoJSON.getHtml() + ".zip";
break;
case ActionInfoJSON.BEACON_ACTION:
actionValue = "" + actionInfoJSON.getContentURL();
break;
case ActionInfoJSON.CONTENTLINK_ACTION:
actionValue = "" + actionInfoJSON.getContentId();
break;
......
......@@ -45,7 +45,7 @@ public class PushMessageLogic extends AbstractLogic {
AcmsMessageJSON json = AcmsClient.getInstance(cache.getUrlPath(), networkAdapter).sendPushMessageRequest(param);
Logger.d(TAG, " status=" + json.httpStatus);
if (json.httpStatus == ABookKeys.HTTP_STATUS_SUCCESS) {
Logger.e(TAG, "sendPushMessageRequest httpStatus=" + json.httpStatus);
Logger.v(TAG, "sendPushMessageRequest httpStatus=" + json.httpStatus);
return true;
}
return false;
......
package jp.agentec.adf.net.socket;
import java.net.InetAddress;
public class ReceivePacketNotification {
public InetAddress address;
public int port;
public String msg;
public ReceivePacketNotification(InetAddress address, int port, String msg) {
this.address = address;
this.port = port;
this.msg = msg;
}
@Override
public String toString() {
return address + ":" + port + " : " + msg;
}
@Override
public boolean equals(Object o) {
ReceivePacketNotification target = (ReceivePacketNotification)o;
return (address + ":" + msg).equals(target.address + ":" + target.msg); // 発信側ポートは常に変わるので無視
}
}
package jp.agentec.adf.net.socket;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.Observable;
import jp.agentec.abook.abv.bl.common.CommonExecutor;
import jp.agentec.abook.abv.bl.common.log.Logger;
/**
* ServerSocketをラップしたクラス
* 特徴:
* ・String(1行の文字列)ベースでSocket通信を行うことを想定
* ・来た文字列はそのままReceivePacketNotificationにラップしてObserverに通知する
* 例外が発生した場合、ExceptionをObserverに通知する。
* ・Threadで常時起動
*
* @author tsukada
*
*/
public class ServerService extends Observable {
private static final String TAG = "ServerService";
private ServerSocket serverSocket = null;
private boolean keep = true;
private int port;
private Thread thread;
public ServerService(int port) {
this.port = port;
}
private Runnable runnable = new Runnable() {
@Override
public void run() {
try {
serverSocket = new ServerSocket(port);
Logger.i(TAG, SocketUtil.getDebugInfo(serverSocket));
} catch (IOException e) {
Logger.e(TAG, "new ServerSocket failed. " + port, e);
setChanged();
notifyObservers(e);
return;
}
while (keep) {
try {
final Socket socket = serverSocket.accept();
Logger.i(TAG, SocketUtil.getDebugInfo(socket));
CommonExecutor.execute(new Runnable() {
@Override
public void run() {
try {
BufferedReader input = new BufferedReader(new InputStreamReader(socket.getInputStream()));
setChanged();
notifyObservers(new ReceivePacketNotification(socket.getInetAddress(), socket.getPort(), input.readLine()));
} catch (IOException e) {
Logger.e(TAG, "socket read failed.", e);
}
}
});
} catch (IOException e) {
if (keep) {
setChanged();
notifyObservers(e);
Logger.e(TAG, "serverSocket.accept failed.", e);
}
if (serverSocket.isClosed()) {
break;
}
}
}
}
};
public boolean isRunning() {
return thread != null && thread.isAlive() && serverSocket != null && !serverSocket.isClosed();
}
public void stopAll() {
keep = false;
try {
if (thread != null) {
thread.interrupt();
}
} catch (Exception e) {
}
try {
if (serverSocket != null) {
serverSocket.close();
}
} catch (Exception e) {
}
deleteObservers();
}
public void startThread() {
if (thread == null || !thread.isAlive()) {
keep = true;
thread = new Thread(runnable);
}
try {
thread.start();
} catch (IllegalThreadStateException e) {
// ignore
}
}
}
package jp.agentec.adf.net.socket;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.InterfaceAddress;
import java.net.NetworkInterface;
import java.net.ServerSocket;
import java.net.Socket;
import java.net.SocketException;
import java.net.UnknownHostException;
import java.util.Enumeration;
import jp.agentec.abook.abv.bl.common.log.Logger;
public class SocketUtil {
private static final String TAG = "SocketUtil";
private static InetAddress ALL_BROADCAST_ADDRESS;
static {
try {
System.setProperty("java.net.preferIPv4Stack", "true");
ALL_BROADCAST_ADDRESS = InetAddress.getByName("255.255.255.255");
} catch (UnknownHostException e) {
Logger.e(TAG, "set ALL_BROADCAST_ADDRESS failed.", e);
}
}
/**
* UDPパケットをブロードキャストする
*
* @param port ポート番号
* @param msg メッセージ
* @param isSameNetwork 同一ネットワークのみか全てか(ルータが対応していればルータ越え可能)
* @throws IOException
*/
public static void sendUdpBroadcast(int port, String msg, boolean isSameNetwork) throws IOException {
InetAddress address = isSameNetwork? getLocalIpAddress(true): ALL_BROADCAST_ADDRESS;
sendUdpPacket(address, port, msg, true);
}
/**
* UDPパケットを送信する
*
* @param address
* @param port
* @param msg
* @param isBroadcast
* @throws IOException
*/
public static void sendUdpPacket(InetAddress address, int port, String msg, boolean isBroadcast) throws IOException {
DatagramSocket socket = null;
try {
socket = new DatagramSocket(null);
socket.setReuseAddress(true);
socket.setBroadcast(isBroadcast);
socket.bind(new InetSocketAddress(0));
byte []buf = msg.getBytes();
DatagramPacket packet= new DatagramPacket(buf,buf.length, address, port);
socket.send(packet);
} finally {
if (socket != null) {
try {
socket.close();
} catch (Exception e) {
}
}
}
}
/**
* UDPソケットを作成する。
*
* @param port
* @return
*/
public static DatagramSocket createDatagramSocket(int port) {
try {
DatagramSocket socket = new DatagramSocket(null);
socket.setReuseAddress(true);
socket.setBroadcast(true);
socket.bind(new InetSocketAddress(port));
return socket;
} catch (SocketException e) {
Logger.e(TAG, "createDatagramSocket failed.", e);
}
return null;
}
/**
* IPアドレスを取得します。(最初に見つかったアドレスを返す)
*
* @param isBroadcast trueにするとブロードキャストアドレスを、falseにするとローカルアドレスを返します。
* @return ブロードキャストアドレスを返します。nullの場合もあります。
* @throws SocketException
*/
public static InetAddress getLocalIpAddress(boolean isBroadcast) throws SocketException {
Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces();
while (interfaces.hasMoreElements()) {
NetworkInterface networkInterface = interfaces.nextElement();
if (!networkInterface.isLoopback()) {
for (InterfaceAddress address : networkInterface.getInterfaceAddresses()) {
if (address.getBroadcast() != null) {
if (isBroadcast) {
return address.getBroadcast();
} else {
return address.getAddress();
}
}
}
}
}
return null;
}
/**
* 宛先にメッセージを送信する(TCP)
*
* @param address
* @param port
* @param msg
* @throws IOException
*/
public static void sendTcpMessage(InetAddress address, int port, String msg) throws IOException {
Socket socket = null;
PrintWriter out = null;
try {
socket = new Socket(address, port);
if (socket.isConnected()) {
out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(socket.getOutputStream())), true);
out.println(msg);
}
} finally {
if (out != null) {
out.close();
}
if (socket != null) {
try {
socket.close();
} catch (IOException e) {
}
}
}
}
public static String getDebugInfo(DatagramSocket socket) {
if (socket == null) {
return null;
}
try {
return String.format("Socket Info: inetAddress=%s, localSocketAddress=%s, remoteSocketAddress=%s, soTimeout=%s",
socket.getInetAddress(), socket.getLocalSocketAddress(), socket.getRemoteSocketAddress(), socket.getSoTimeout());
} catch (SocketException e) {
Logger.e(TAG, "getDebugInfo error.", e);
return null;
}
}
public static String getDebugInfo(ServerSocket socket) {
if (socket == null) {
return null;
}
try {
return String.format("Socket Info: inetAddress=%s, localSocketAddress=%s, soTimeout=%s",
socket.getInetAddress(), socket.getLocalSocketAddress(), socket.getSoTimeout());
} catch (IOException e) {
Logger.e(TAG, "getDebugInfo error.", e);
}
return null;
}
public static String getDebugInfo(Socket socket) {
if (socket == null) {
return null;
}
try {
return String.format("Socket Info: inetAddress=%s, localSocketAddress=%s, remoteSocketAddress=%s, soTimeout=%s",
socket.getInetAddress(), socket.getLocalSocketAddress(), socket.getRemoteSocketAddress(), socket.getSoTimeout());
} catch (IOException e) {
Logger.e(TAG, "getDebugInfo error.", e);
}
return null;
}
}
package jp.agentec.adf.net.socket;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.SocketException;
import java.util.Observable;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.adf.util.StringUtil;
/**
* UDPレシーバクラス
*
* 特徴:
* ・StringベースでSocket通信を行うことを想定
* ・来た文字列はそのままReceivePacketNotificationにラップしてObserverに通知する
* 例外が発生した場合、ExceptionをObserverに通知する。
* ・Threadで常時起動
*
* @author tsukada
*
*/
public class UdpReceiver extends Observable {
private static final String TAG = "UdpReceiver";
private DatagramSocket socket = null;
private boolean keep = true;
private int port;
private Thread thread;
public UdpReceiver(int port) {
this.port = port;
}
private Runnable runnable = new Runnable() {
@Override
public void run() {
byte[] buf = new byte[256];
try {
socket = SocketUtil.createDatagramSocket(port);
DatagramPacket packet = new DatagramPacket(buf, buf.length);
Logger.i(TAG, "UdpReceiver started. " + SocketUtil.getDebugInfo(socket));
while (keep) {
packet.setLength(buf.length);
socket.receive(packet);
String msg = new String(packet.getData(), 0, packet.getLength());
Logger.d(TAG, "receive message. from=%s, msg=%s", packet.getSocketAddress(), msg);
if (StringUtil.isNullOrWhiteSpace(msg)) {
continue;
} else {
setChanged();
notifyObservers(new ReceivePacketNotification(packet.getAddress(), packet.getPort(), msg));
}
}
} catch (SocketException e) {
if (keep) {
Logger.e("UdpReceiver encounter error.", e);
setChanged();
notifyObservers(e);
} else {
Logger.i("UdpReceiver already closed.");
}
} catch (Exception e) {
Logger.e("UdpReceiver encounter error.", e);
setChanged();
notifyObservers(e);
}
finally {
closeSocket();
}
}
};
public boolean isRunning() {
return thread != null && thread.isAlive() && socket != null && !socket.isClosed();
}
public void stopAll() {
keep = false;
try {
if (thread != null) {
thread.interrupt();
}
} catch (Exception e) {
}
closeSocket();
deleteObservers();
}
private void closeSocket() {
try {
if (socket != null) {
socket.close();
}
} catch (Exception e) {
}
}
public void startThread() {
if (thread == null || !thread.isAlive()) {
keep = true;
thread = new Thread(runnable);
}
try {
thread.start();
} catch (IllegalThreadStateException e) {
// ignore
}
}
}
package jp.agentec.abook.abv.bl.data.dao;
import jp.agentec.abook.abv.bl.common.ABVEnvironment;
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.BeaconHistoryDto;
import junit.framework.TestCase;
import junit.framework.TestSuite;
public class BeaconHistoryDaoTest extends TestCase {
private BeaconHistoryDao dao = new BeaconHistoryDao();
public BeaconHistoryDaoTest(String string) {
super(string);
}
@Override
protected void setUp() throws Exception {
super.setUp();
ABVEnvironment.getInstance().isReader = true;
DBConnector conn = DBConnector.getInstance();
SQLiteOpenHelper sqlLiteOpenHelper = new JDBCSQLiteOpenHelper("test.db", 0);
conn.setSqlLiteOpenHelper(sqlLiteOpenHelper);
((JDBCSQLiteOpenHelper) sqlLiteOpenHelper).onCreate(conn.getDatabase());
}
public static TestSuite suite() {
TestSuite suite = new TestSuite("BeaconHistoryDaoTest");
// suite.addTest(new BeaconHistoryDaoTest("testInsert"));
// suite.addTest(new BeaconHistoryDaoTest("testUpdate"));
suite.addTest(new BeaconHistoryDaoTest("testInsertOrUpdate"));
return suite;
}
@Override
protected void tearDown() throws Exception {
super.tearDown();
}
public void testInsert() {
BeaconHistoryDto dto = new BeaconHistoryDto();
dto.major = Integer.parseInt("4F4F", 16);
dto.minor = Integer.parseInt("5871", 16);
dao.insert(dto);
}
public void testUpdate() {
BeaconHistoryDto dto = new BeaconHistoryDto();
dto.major = Integer.parseInt("4F4F", 16);
dto.minor = Integer.parseInt("5871", 16);
dao.update(dto);
}
public void testInsertOrUpdate() {
BeaconHistoryDto dto = new BeaconHistoryDto();
dto.major = Integer.parseInt("4FAF", 16);
dto.minor = Integer.parseInt("5871", 16);
dao.insertOrUpdate(dto);
}
}
package jp.agentec.abook.abv.bl.data.dao;
import java.util.Date;
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.SiteDto;
import junit.framework.TestCase;
public class SiteDaoTest extends TestCase {
SiteDao siteDao = AbstractDao.getDao(SiteDao.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();
}
public void testInsert() throws Exception {
SiteDto dto = new SiteDto(1, "http://aaa", "sitesss", "http://aaa/d", "http://aaa/l", "http://aaa/e", 0, new Date(), new Date());
siteDao.insert(dto);
System.out.println(siteDao.getDto(2).siteUrl);
}
public void testUpdate() throws Exception {
SiteDto dto = new SiteDto(1, "http://aaa/U", "sitesssU", "http://aaa/d", "http://aaa/l", "http://aaa/e/u", 0, new Date(), new Date());
siteDao.update(dto);
System.out.println(siteDao.getDto(1).siteUrl);
}
public void testLastUpdate() throws Exception {
System.out.println(siteDao.getLastUpdate());
}
public void testInsertOrUpdate() throws Exception {
SiteDto dto = new SiteDto(3, "http://aa33a222", "sitesss", "http://aaa/d", "http://aaa/l", "http://aaa/e", 0, new Date(), new Date());
siteDao.insertOrUpdate(dto);
}
public void testExists() throws Exception {
System.out.println(siteDao.exists(0));
System.out.println(siteDao.exists(1));
}
}
package jp.agentec.abook.abv.bl.data.dao;
import java.util.Date;
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.SubscriptionHistoryDto;
import junit.framework.TestCase;
public class SubscriptionHistoryDaoTest extends TestCase {
SubscriptionHistoryDao subscriptionHistoryDao = AbstractDao.getDao(SubscriptionHistoryDao.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();
}
public void testInsert() throws Exception {
SubscriptionHistoryDto dto = new SubscriptionHistoryDto();
dto.subscriptionHistoryId = 1;
dto.purchaseHistoryId = 1L;
dto.contentSetId = 2;
dto.contentSetName = "aaaa";
dto.allFlg = 1;
dto.productId = "aproductIdb";
dto.orderId = "aaorderId";
dto.packageName = "hoge.aaa";
dto.purchaseTime = 1234L;
dto.purchaseState = 0;
dto.developerPayload = "abaddsf";
dto.purchaseToken = "arerae";
dto.autoRenewing = true;
dto.startTimeMillis = 3456L;
dto.expiryTimeMillis = 78910L;
dto.sentFlg = 0;
dto.delFlg = 0;
dto.insertDate = new Date();
dto.updateDate = new Date();
subscriptionHistoryDao.insert(dto);
System.out.println(subscriptionHistoryDao.getDto(1).orderId);
}
public void testUpdate() throws Exception {
SubscriptionHistoryDto dto = new SubscriptionHistoryDto();
dto.subscriptionHistoryId = 1;
dto.purchaseHistoryId = 1L;
dto.contentSetId = 2;
dto.contentSetName = "bbbb";
dto.allFlg = 1;
dto.productId = "aproductIdb";
dto.orderId = "aaorderId";
dto.packageName = "hoge.aaa";
dto.purchaseTime = 1234L;
dto.purchaseState = 0;
dto.developerPayload = "abaddsf";
dto.purchaseToken = "arerae";
dto.autoRenewing = true;
dto.startTimeMillis = 3456L;
dto.expiryTimeMillis = 78910L;
dto.sentFlg = 0;
dto.delFlg = 0;
dto.insertDate = new Date();
dto.updateDate = new Date();
subscriptionHistoryDao.update(dto);
System.out.println(subscriptionHistoryDao.getDto(1).orderId);
}
public void testLastUpdate() throws Exception {
System.out.println(subscriptionHistoryDao.getSubscriptionHistorMax());
}
public void testInsertOrUpdate() throws Exception {
SubscriptionHistoryDto dto = new SubscriptionHistoryDto();
dto.subscriptionHistoryId = 1;
dto.purchaseHistoryId = 1L;
dto.contentSetId = 2;
dto.contentSetName = "cccc";
dto.allFlg = 1;
dto.productId = "aproductIdb";
dto.orderId = "aaorderId";
dto.packageName = "hoge.aaa";
dto.purchaseTime = 1234L;
dto.purchaseState = 0;
dto.developerPayload = "abaddsf";
dto.purchaseToken = "arerae";
dto.autoRenewing = true;
dto.startTimeMillis = 3456L;
dto.expiryTimeMillis = 78910L;
dto.sentFlg = 0;
dto.delFlg = 0;
dto.insertDate = new Date();
dto.updateDate = new Date();
subscriptionHistoryDao.insertOrUpdate(dto);
}
public void testExists() throws Exception {
System.out.println(subscriptionHistoryDao.exists("0"));
System.out.println(subscriptionHistoryDao.exists("1"));
}
}
......@@ -44,18 +44,6 @@
android:label="@string/app_name"
android:theme="@style/ABook"
android:largeHeap="true" >
<service
android:name ="jp.agentec.abook.abv.launcher.android.AutoDownloadService">
</service>
<receiver android:name="jp.agentec.abook.abv.launcher.android.OnBootReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.PACKAGE_REPLACED" />
<action android:name="android.intent.action.ACTION_MY_PACKAGE_REPLACED" />
</intent-filter>
</receiver>
<service android:name="jp.agentec.abook.abv.cl.push.ABVFcmListenerService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT"></action>
......@@ -212,7 +200,6 @@
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
<!--Voip-->
<!-- ABookCheck対応 -->
<activity android:name="jp.agentec.abook.abv.ui.home.activity.ProjectListActivity"
......
......@@ -150,13 +150,6 @@
android:layout_height="match_parent"
android:layout_marginLeft="0dp" />
<FrameLayout
android:id="@+id/streamingLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="0dp"
android:visibility="gone" />
<ProgressBar
android:id="@+id/refresh_prog"
style="?android:attr/progressBarStyleLarge"
......
......@@ -204,13 +204,6 @@
android:layout_height="match_parent"
android:layout_marginLeft="0dp" />
<FrameLayout
android:id="@+id/streamingLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="0dp"
android:visibility="gone" />
<ProgressBar
android:id="@+id/refresh_prog"
style="?android:attr/progressBarStyleLarge"
......
......@@ -209,13 +209,6 @@
android:layout_height="match_parent"
android:layout_marginLeft="0dp" />
<FrameLayout
android:id="@+id/streamingLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="0dp"
android:visibility="gone" />
<ProgressBar
android:id="@+id/refresh_prog"
style="?android:attr/progressBarStyleLarge"
......
package jp.agentec.abook.abv.launcher.android;
import java.util.Calendar;
import jp.agentec.abook.abv.bl.common.log.Logger;
import android.app.AlarmManager;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
// Booting시 자동적으로 서비스 시작을 하기 위한 부분
// アプリ起動時、PushServiceサービスを開始させる
public class OnBootReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
if (intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED) || intent.getAction().equals(Intent.ACTION_PACKAGE_REPLACED) || intent.getAction().equals(Intent.ACTION_MY_PACKAGE_REPLACED)) {
// 自動ダウンロードチェックの開始
// TODO later ABVNoAuthenticatedActivityとソース重複のため統一
Resources res = context.getResources();
}
}
}
\ No newline at end of file
......@@ -759,90 +759,6 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
public abstract boolean contentValidCheckAndDownload(long contentId);
/**
* Beacon共通ダイアログ表示
* @param contentId
* @param contentURL
* @param objectId
* @param xWalkView
* @return
*/
public ABookAlertDialog showBeacon(long contentId, String contentURL, final long objectId, final XWalkView xWalkView) {
Logger.d(TAG, "[ShowBeaconDialog]");
String qrCodePath = ABVEnvironment.getInstance().getContentCacheDirectoryPath(contentId) + "qrcode.jpg";
boolean success = false;
try { // QRコード生成
Bitmap bitmap = BitmapUtil.createQrCode(contentURL, 300);
success = BitmapUtil.outputFile(bitmap, qrCodePath, true); // ファイル出力
} catch (WriterException e) {
Logger.e(TAG, "create QR Code failed.", e);
return null;
}
if (!success) {
Logger.w(TAG, AndroidStringUtil.format(this, R.string.save_fail, R.string.show_qrcode_title));
handleErrorMessageToast(AndroidStringUtil.format(this, R.string.save_fail, R.string.show_qrcode_title));
return null;
}
final WebView beaconWebView = new WebView(this);
beaconWebView.setBackgroundColor(0);
WebSettings settings = beaconWebView.getSettings();
settings.setLoadsImagesAutomatically(true); // イメージを自動的にロードする
settings.setJavaScriptEnabled(true); // JavaScriptを有効にする
settings.setAppCacheEnabled(false);
settings.setCacheMode(WebSettings.LOAD_NO_CACHE);
// HTMLファイルを読み込む
String data = RawResourceUtil.readAsString(this, R.raw.beacon);
if (data != null) {
data = data.replaceAll("%QRCODE_SRC%", qrCodePath); // QRコードのパス置き換え
}
if (data != null) {
data = data.replaceAll("%URL%", contentURL);
}
FrameLayout.LayoutParams paramWebView = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
paramWebView.gravity = Gravity.TOP;
ScrollView scroll = new ScrollView(this);
scroll.addView(beaconWebView, paramWebView);
LinearLayout layout = new LinearLayout(this);
layout.setBackgroundColor(Color.WHITE);
layout.setLayoutParams(new LinearLayout.LayoutParams(FP, FP));
LinearLayout.LayoutParams paramScroll = new LinearLayout.LayoutParams(FP, FP);
layout.addView(scroll, paramScroll);
layout.setPadding(3, 3, 3, 3);
final ABVContentViewActivity contentViewActivity = activityHandlingHelper.getContentViewActivity();
// Webビューを表示するアラート
ABookAlertDialog dialog = new ABookAlertDialog(this) {
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
return super.dispatchTouchEvent(ev);
}
};
dialog.setCanceledOnTouchOutside(false);
dialog.setView(layout);
final ABookAlertDialog dialogF = dialog;
beaconWebView.setWebViewClient(new WebViewClient() {
@Override
public void onPageFinished(final WebView view, String url) { // HTMLのロードが終わったタイミングでアラートダイアログを表示する
super.onPageFinished(beaconWebView, url);
dialogF.show();
if (contentViewActivity != null && objectId != -1) {
contentViewActivity.objectIdPopupMap.put(objectId, dialogF);
}
if (xWalkView != null) {
// xWalkViewがnullではない場合、javaScriptでopengetitsshareコマンド実行
javaScriptSignageCmd(ABookKeys.CMD_GETITS_OPEN_SHARE, xWalkView);
}
}
});
beaconWebView.loadDataWithBaseURL("file:///android_res/raw/beacon.html", data, "text/html", "UTF-8", null);
return dialog;
}
public void startContentViewActivity(long contentId) {
startContentViewActivity(contentId, 0);
}
......
......@@ -115,7 +115,6 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
protected ConcurrentHashMap<Long, Object> objectIdPopupMap = new ConcurrentHashMap<>();
protected int mCurrentPageNumber = 0; // 表示中のページ番号(0からスタート)
protected ABookAlertDialog beaconDialog;
public Long mProjectId;
protected int mXWalkOpenType = -1;
......@@ -457,12 +456,6 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
@Override
public void finish() {
//Getits共有ダイアログを閉じる処理
if (beaconDialog != null) {
beaconDialog.dismiss();
beaconDialog = null;
}
// ホームをリロードさせる
ActivityHandlingHelper.getInstance().setRequireHomeReload(true);
super.finish();
......@@ -675,39 +668,6 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
finish();
}
/**
* Getits共有ダイアログ
* @param contentURL
* @param webView
* @return
*/
public ABookAlertDialog getBeaconDialog(String contentURL, final WebView webView) {
FrameLayout.LayoutParams paramWebView = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
paramWebView.gravity = Gravity.TOP;
ScrollView scroll = new ScrollView(this);
scroll.addView(webView, paramWebView);
LinearLayout layout = new LinearLayout(this);
layout.setBackgroundColor(Color.WHITE);
layout.setLayoutParams(new LinearLayout.LayoutParams(FP, FP));
LinearLayout.LayoutParams paramScroll = new LinearLayout.LayoutParams(FP, FP);
layout.addView(scroll, paramScroll);
layout.setPadding(3, 3, 3, 3);
// Webビューを表示するアラート
ABookAlertDialog dialog = new ABookAlertDialog(this) {
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
return super.dispatchTouchEvent(ev);
}
};
dialog.setCanceledOnTouchOutside(false);
dialog.setView(layout);
return dialog;
}
protected void createCheckToolbar() {
final RelativeLayout fl;
if (projectDto != null && projectDto.projectType == ProjectType.PDF &&
......
......@@ -3,11 +3,6 @@ package jp.agentec.abook.abv.ui.common.appinfo;
public interface AppDefType {
String APP_PACKAGE = "jp.agentec.abook.abv.launcher.android";
interface Intent {
String Action_Receive_iBeacon_Message = "jp.agentec.abook.action.Receive_iBeacon_Message";
String Action_Receive_Message = "jp.agentec.abook.action.Receive_Message";
}
interface ViewMode{
int THUMB = 1;
int PANEL = 2;
......@@ -208,11 +203,6 @@ public interface AppDefType {
int OBJECTVR_TYPE_ID = 14;
}
interface BeaconKey {
String major = "major";
String minor = "minor";
}
interface PushMessageKey {
String message = "message";
String shareKey = "shareKey";
......
package jp.agentec.abook.abv.ui.common.appinfo.options;
import android.content.Context;
/**
* @author tauchi
*
*/
public class DefaultOptions extends AbstractOptions {
public DefaultOptions(Context context) {
super(context);
}
@Override
public int getSettingMenuAccount() {
return 1;
}
@Override
public int getSettingMenuAppInfo() {
return 1;
}
@Override
public int getSettingMenuLogout() {
return 0;
}
@Override
public int getSettingMenuPasswordChange() {
return 0;
}
@Override
public int getSettingMenuLogInfo() {
return 1;
}
@Override
public int getViewerMenuTextcopy() {
return 0;
}
@Override
public int getViewerMenuMarking() {
return 0;
}
}
package jp.agentec.abook.abv.ui.common.appinfo.options;
import jp.agentec.abook.abv.bl.acms.type.ServiceOption.ServiceOptionId;
import jp.agentec.abook.abv.bl.data.ABVDataCache;
import android.content.Context;
/**
* @author tauchi
*
*/
public class LargeOptions extends AbstractOptions {
public LargeOptions(Context context) {
super(context);
}
@Override
public int getSettingMenuAccount() {
return 1;
}
@Override
public int getSettingMenuAppInfo() {
return 1;
}
@Override
public int getSettingMenuLogout() {
return 1;
}
@Override
public int getSettingMenuPasswordChange() {
return 1;
}
@Override
public int getSettingMenuLogInfo() {
return 1;
}
@Override
public int getViewerMenuTextcopy() {
return ABVDataCache.getInstance().serviceOption.isServiceOptionEnable(ServiceOptionId.PdfTextCopy) ? 1 : 0;
}
@Override
public int getViewerMenuMarking() {
return ABVDataCache.getInstance().serviceOption.isMarking() ? 1 : 0;
}
}
package jp.agentec.abook.abv.ui.common.appinfo.options;
import jp.agentec.abook.abv.bl.acms.type.ServiceOption.ServiceOptionId;
import jp.agentec.abook.abv.bl.data.ABVDataCache;
import android.content.Context;
/**
* @author tauchi
*
*/
public class MidOptions extends AbstractOptions {
public MidOptions(Context context) {
super(context);
}
@Override
public int getSettingMenuAccount() {
return 1;
}
@Override
public int getSettingMenuAppInfo() {
return 1;
}
@Override
public int getSettingMenuLogout() {
return 1;
}
@Override
public int getSettingMenuPasswordChange() {
return 1;
}
@Override
public int getSettingMenuLogInfo() {
return 1;
}
@Override
public int getViewerMenuTextcopy() {
return 0;
}
@Override
public int getViewerMenuMarking() {
return ABVDataCache.getInstance().serviceOption.isMarking() ? 1 : 0;
}
}
......@@ -2645,30 +2645,6 @@ public class ContentViewActivity extends ABVContentViewActivity {
case ActionInfoJSON.BALLOON_ACTION:
showBalloon(actionInfoJSON.getContentHTML(), pageNumber, actionInfoJSON.getObjectId());
break;
case ActionInfoJSON.BEACON_ACTION:
final long actionJsonObjectId = actionInfoJSON.getObjectId();
if (objectIdPopupMap.containsKey(actionJsonObjectId) || (beaconDialog != null && beaconDialog.isShowing())) {
Logger.d(TAG, "Already Open Beacon Dialog");
break;
}
beaconDialog = showBeacon(contentId, actionInfoJSON.getContentURL(), actionJsonObjectId, null);
if (beaconDialog == null) {
Logger.d(TAG, "beaconDialog is null");
break;
}
final int pageIdx = pageNumber;
beaconDialog.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int whichButton) {
if (meetingManager.isSendable()) {
meetingManager.sendWs(MeetingManager.CMD_CLOSEPOPUP, getContentId(), pageIdx, objectId, null);
}
objectIdPopupMap.remove(actionJsonObjectId);
beaconDialog.dismiss();
}
});
break;
case ActionInfoJSON.MEMO_ACTION:
break;
case ActionInfoJSON.HTML_ACTION:
......
......@@ -341,32 +341,6 @@ public class HTMLXWalkWebViewActivity extends ParentWebViewActivity {
if (ret != null && !ret.startsWith(ABookKeys.OK)) {
showSimpleAlertDialog(getRString(R.string.error), ret);
}
} else if (url.startsWith(ABookKeys.GETITS_OPEN_SHARE)) {
Map<String, String> param = new HashMap<String, String>();
for (String key : uri.getQueryParameterNames()) {
param.put(key, uri.getQueryParameter(key));
}
String shareUrl = null;
if (param.containsKey(ABookKeys.PARAM_SHARE_URL)) {
shareUrl = (String) param.get(ABookKeys.PARAM_SHARE_URL);
}
if (beaconDialog != null && beaconDialog.isShowing()) {
Logger.d(TAG, "Already Open Beacon Dialog");
return true;
}
beaconDialog = showBeacon(contentId, shareUrl, -1, webView);
if (beaconDialog == null) {
Logger.d(TAG, "beaconDialog is null");
return true;
}
beaconDialog.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int whichButton) {
javaScriptSignageCmd(ABookKeys.CMD_GETITS_CLOSE_SHARE, webView);
dialog.dismiss();
}
});
Logger.v(TAG, "Beacon Dialog is open");
} else if (url.contains(ABookKeys.ABOOK_CHECK_API)) {
commonShouldOverrideUrlLoading(uri, null);
}
......
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