avoid that an order is submitted more than once by blocking it.
This commit is contained in:
parent
dffa8fb6ce
commit
af432c083f
|
@ -52,9 +52,6 @@ import net.spy.memcached.MemcachedClient;
|
||||||
*/
|
*/
|
||||||
public class DdasVreIntegration extends MVCPortlet {
|
public class DdasVreIntegration extends MVCPortlet {
|
||||||
private static com.liferay.portal.kernel.log.Log log = LogFactoryUtil.getLog(DdasVreIntegration.class);
|
private static com.liferay.portal.kernel.log.Log log = LogFactoryUtil.getLog(DdasVreIntegration.class);
|
||||||
//The Blue-Cloud DD&AS Service endpoint for feedback about downloads
|
|
||||||
public static final String BROKERf_FEEDBACK_ENDPOINT = "https://data.blue-cloud.org/api/vre/download-ready";
|
|
||||||
|
|
||||||
|
|
||||||
private static final String BC_BROKER_RESOURCE_NAME = "Blue-Cloud-DataDownloadAndAccess";
|
private static final String BC_BROKER_RESOURCE_NAME = "Blue-Cloud-DataDownloadAndAccess";
|
||||||
private static final String CATEGORY_NAME = "Service";
|
private static final String CATEGORY_NAME = "Service";
|
||||||
|
@ -78,7 +75,7 @@ public class DdasVreIntegration extends MVCPortlet {
|
||||||
boolean result = false;
|
boolean result = false;
|
||||||
if (params != null && params.length > 0) {
|
if (params != null && params.length > 0) {
|
||||||
String otp = params[0];
|
String otp = params[0];
|
||||||
System.out.println("Read OTP="+otp);
|
log.debug("Read Blue-Cloud cache OTP="+otp);
|
||||||
if (otp != null && !otp.equals("")) {
|
if (otp != null && !otp.equals("")) {
|
||||||
JsonElement brokerRequest = checkRequest(otp);
|
JsonElement brokerRequest = checkRequest(otp);
|
||||||
if (brokerRequest == null) {//the token is expired or there was no request, return to the JSP token expired page
|
if (brokerRequest == null) {//the token is expired or there was no request, return to the JSP token expired page
|
||||||
|
@ -259,6 +256,9 @@ public class DdasVreIntegration extends MVCPortlet {
|
||||||
JsonElement jelement = new JsonParser().parse(brokerRequest);
|
JsonElement jelement = new JsonParser().parse(brokerRequest);
|
||||||
JsonObject jobject = jelement.getAsJsonObject();
|
JsonObject jobject = jelement.getAsJsonObject();
|
||||||
log.debug("Found tempCode into memcached, broker request="+jobject.toString());
|
log.debug("Found tempCode into memcached, broker request="+jobject.toString());
|
||||||
|
log.debug("Invalidating tempCode into memcached with key="+code);
|
||||||
|
entries.delete(code);
|
||||||
|
log.debug("Invalidated key "+ code + " with success.");
|
||||||
return jelement;
|
return jelement;
|
||||||
} catch(Exception e){
|
} catch(Exception e){
|
||||||
log.error("Failed to check the correctness of the broker request", e);
|
log.error("Failed to check the correctness of the broker request", e);
|
||||||
|
|
|
@ -33,5 +33,7 @@ pageContext.setAttribute("responseResultSuccess", responseResultSuccess);
|
||||||
<p class="lead">Your order <c:out value="${orderData}"></c:out>, is being retrieved and the dataset are being saved to your
|
<p class="lead">Your order <c:out value="${orderData}"></c:out>, is being retrieved and the dataset are being saved to your
|
||||||
workspace area, you will receive an e-email when the
|
workspace area, you will receive an e-email when the
|
||||||
download process is completed. You may close this Tab now.</p>
|
download process is completed. You may close this Tab now.</p>
|
||||||
|
<a class="btn btn-large btn-primary" href="javascript:window.close();"><i
|
||||||
|
class="icon icon-times"></i> Close</a>
|
||||||
</c:otherwise>
|
</c:otherwise>
|
||||||
</c:choose>
|
</c:choose>
|
||||||
|
|
|
@ -10,16 +10,16 @@
|
||||||
<%@page import="com.liferay.portal.kernel.util.WebKeys"%>
|
<%@page import="com.liferay.portal.kernel.util.WebKeys"%>
|
||||||
<portlet:defineObjects />
|
<portlet:defineObjects />
|
||||||
<liferay-theme:defineObjects />
|
<liferay-theme:defineObjects />
|
||||||
|
<%String orderData = (String) renderRequest.getAttribute("orderData");%>
|
||||||
|
|
||||||
<portlet:renderURL var="normalState"
|
<portlet:renderURL var="normalState"
|
||||||
windowState="<%=LiferayWindowState.NORMAL.toString()%>" />
|
windowState="<%=LiferayWindowState.NORMAL.toString()%>" />
|
||||||
|
|
||||||
<p class="lead">
|
<p class="lead">
|
||||||
We're sorry, it seems that too much time is passed since your order on Blue-Cloud Data Discovery & Access Service. <br>
|
We're sorry, your order <c:out value="${orderData}"></c:out> has either expired or was already submitted.<br>
|
||||||
Please close this page and trigger the move to VRE again from Blue-Cloud Data Discovery & Access Service application.
|
Please close this page and click the Push to VRE button from Blue-Cloud Data Discovery & Access Service again.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
||||||
<a class="btn btn-large btn-primary" href="https://blue-cloud.d4science.org/"><i
|
<a class="btn btn-large btn-primary" href="javascript:window.close();"><i
|
||||||
class="icon icon-angle-left"></i> Close</a>
|
class="icon icon-times"></i> Close</a>
|
||||||
|
|
Loading…
Reference in New Issue