Commit 7d4a7326 by Lee Jaebin

シーン追加用の素材API修正

parent b6d05e31
...@@ -619,22 +619,24 @@ public class AcmsClient implements AcmsClientResponseListener { ...@@ -619,22 +619,24 @@ public class AcmsClient implements AcmsClientResponseListener {
/** /**
* パノラマで使用するシーンを登録 * パノラマで使用するシーンを登録
* @param sid * @param sid
* @param contentId
* @param FormFile シーンで使用する画像 * @param FormFile シーンで使用する画像
* @return * @return
* @throws IOException * @throws IOException
* @throws AcmsException * @throws AcmsException
*/ */
public SceneEntryJSON sceneEntry(String sid, File FormFile) throws IOException, AcmsException, NetworkDisconnectedException { public SceneEntryJSON sceneEntry(String sid, Long contentId, File FormFile) throws IOException, AcmsException, NetworkDisconnectedException {
if (networkAdapter != null && !networkAdapter.isNetworkConnected()) { // NWのチェック if (networkAdapter != null && !networkAdapter.isNetworkConnected()) { // NWのチェック
throw new NetworkDisconnectedException(); throw new NetworkDisconnectedException();
} }
String apiUrl = AcmsApis.getApiUrl(env.acmsAddress, urlPath, AcmsApis.ApiSceneEntry); String apiUrl = AcmsApis.getApiUrl(env.acmsAddress, urlPath, AcmsApis.ApiSceneEntry);
HttpMultipart part1 = new HttpMultipart(ABookKeys.SID, sid); HttpMultipart part1 = new HttpMultipart(ABookKeys.SID, sid);
HttpMultipart part2 = new HttpMultipart(ABookKeys.FORM_FILE, FormFile); HttpMultipart part2 = new HttpMultipart(ABookKeys.CONTENT_ID, StringUtil.toString(contentId));
HttpResponse result = HttpRequestSender.post(apiUrl, new HttpMultipart[]{part1, part2}); HttpMultipart part3 = new HttpMultipart(ABookKeys.FORM_FILE, FormFile);
HttpResponse result = HttpRequestSender.post(apiUrl, new HttpMultipart[]{part1, part2, part3});
SceneEntryJSON json = new SceneEntryJSON(result.httpResponseBody); SceneEntryJSON json = new SceneEntryJSON(result.httpResponseBody);
if (json.httpStatus != 200) { if (json.httpStatus != 200) {
throw new AcmsException(ABVExceptionCode.fromResponseCode(result.httpResponseCode), null); throw new AcmsException(ABVExceptionCode.fromResponseCode(result.httpResponseCode), new AcmsMessageJSON(result.httpResponseBody));
} }
Logger.d(TAG, "sceneEntry res: %s", json.toString()); Logger.d(TAG, "sceneEntry res: %s", json.toString());
......
...@@ -1378,11 +1378,12 @@ public class OperationLogic extends AbstractLogic { ...@@ -1378,11 +1378,12 @@ public class OperationLogic extends AbstractLogic {
/** /**
* シーンの登録 * シーンの登録
* @param file * @param file
* @param contentId
* @throws IOException * @throws IOException
* @throws AcmsException * @throws AcmsException
*/ */
public Integer sendScene(File file) throws IOException, AcmsException, NetworkDisconnectedException { public Integer sendScene(File file, Long contentId) throws IOException, AcmsException, NetworkDisconnectedException {
SceneEntryJSON json = AcmsClient.getInstance(cache.getUrlPath(), networkAdapter).sceneEntry(cache.getMemberInfo().sid, file); SceneEntryJSON json = AcmsClient.getInstance(cache.getUrlPath(), networkAdapter).sceneEntry(cache.getMemberInfo().sid, contentId, file);
return json.resourceId; return json.resourceId;
} }
......
...@@ -73,6 +73,7 @@ public class OperationGroupMasterListHelper extends HierarchyOperationListHelper ...@@ -73,6 +73,7 @@ public class OperationGroupMasterListHelper extends HierarchyOperationListHelper
} else { } else {
// 表示する作業種別が既に削除された場合、最上位階層に戻る(リセット) // 表示する作業種別が既に削除された場合、最上位階層に戻る(リセット)
popList(breadCrumbList.size() - 1, false); popList(breadCrumbList.size() - 1, false);
// クリアフラグをfalseにセット
ABVEnvironment.getInstance().setOperationGroupMasterClearFlg(false); ABVEnvironment.getInstance().setOperationGroupMasterClearFlg(false);
// 作業種別の選択画面を閉じる // 作業種別の選択画面を閉じる
mAppActivity.closeOperationGroupMasterDialog(); mAppActivity.closeOperationGroupMasterDialog();
......
...@@ -277,7 +277,7 @@ public class ParentWebViewActivity extends ABVContentViewActivity { ...@@ -277,7 +277,7 @@ public class ParentWebViewActivity extends ABVContentViewActivity {
if (responseUri != null && responseUri.getPath() != null) { if (responseUri != null && responseUri.getPath() != null) {
File file = new File(responseUri.getPath()); File file = new File(responseUri.getPath());
try { try {
final Integer resourceId = AbstractLogic.getLogic(OperationLogic.class).sendScene(file); final Integer resourceId = AbstractLogic.getLogic(OperationLogic.class).sendScene(file, contentId);
if (resourceId != null) { if (resourceId != null) {
runOnUiThread(new Runnable() { runOnUiThread(new Runnable() {
@Override @Override
...@@ -320,13 +320,24 @@ public class ParentWebViewActivity extends ABVContentViewActivity { ...@@ -320,13 +320,24 @@ public class ParentWebViewActivity extends ABVContentViewActivity {
} }
} catch (Exception e) { } catch (Exception e) {
Logger.e(TAG, e); Logger.e(TAG, e);
handler.post(new Runnable() { // ロック中である場合以下のエラーメッセージで判定
@Override if (e.getMessage().equals("C018")) {
public void run() { runOnUiThread(new Runnable() {
closeProgressPopup(); @Override
showFailedSceneApiDialog(); public void run() {
} closeProgressPopup();
}); webViewLoadUrl(String.format("javascript:EDC.handleError({ 'status' : 400 }, '', {'message' : 'C018'})"));
}
});
} else {
handler.post(new Runnable() {
@Override
public void run() {
closeProgressPopup();
showFailedSceneApiDialog();
}
});
}
} finally { } finally {
//アプリ内のファイルのみ削除(Galleryファイルは削除しない) //アプリ内のファイルのみ削除(Galleryファイルは削除しない)
if (mLocalFile != null && mLocalFile.getPath().contains(getPackageName())) { if (mLocalFile != null && mLocalFile.getPath().contains(getPackageName())) {
......
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