Examples of RecurrenceInfo


Examples of org.ofbiz.service.calendar.RecurrenceInfo

        if (crashed != null && crashed.size() > 0) {
            try {
                int rescheduled = 0;
                for (GenericValue job: crashed) {
                    long runtime = job.getTimestamp("runTime").getTime();
                    RecurrenceInfo ri = JobManager.getRecurrenceInfo(job);
                    if (ri != null) {
                        long next = ri.next();
                        if (next <= runtime) {
                            Timestamp now = UtilDateTime.nowTimestamp();
                            // only re-schedule if there is no new recurrences since last run
                            Debug.log("Scheduling Job : " + job, module);
   
View Full Code Here

Examples of org.ofbiz.service.calendar.RecurrenceInfo

        // create the recurrence
        String infoId = null;
        if (frequency > -1 && count != 0) {
            try {
                RecurrenceInfo info = RecurrenceInfo.makeInfo(delegator, startTime, frequency, interval, count);
                infoId = info.primaryKey();
            } catch (RecurrenceInfoException e) {
                throw new JobManagerException(e.getMessage(), e);
            }
        }
View Full Code Here

Examples of org.ofbiz.service.calendar.RecurrenceInfo

                    return null;
                }
                GenericValue ri = job.getRelatedOne("RecurrenceInfo");

                if (ri != null) {
                    return new RecurrenceInfo(ri);
                } else {
                    return null;
                }
            } else {
                return null;
View Full Code Here

Examples of org.ofbiz.service.calendar.RecurrenceInfo

        long endTime = 0;
        if (endDate != null) {
            endTime = endDate.getTime();
        }

        RecurrenceInfo recInfo = null;
        try {
            recInfo = RecurrenceInfo.makeInfo(delegator, startTime, frequency.intValue(), interval.intValue(), -1, endTime);
        } catch (RecurrenceInfoException e) {
            Debug.logError(e, module);
            return ServiceUtil.returnError(UtilProperties.getMessage(resource_error,"OrderUnableToCreateShoppingListRecurrenceInformation",locale));
        }

        Debug.log("Next Recurrence - " + UtilDateTime.getTimestamp(recInfo.next()), module);
        Map result = ServiceUtil.returnSuccess();
        result.put("recurrenceInfoId", recInfo.getID());

        return result;
    }
View Full Code Here

Examples of org.ofbiz.service.calendar.RecurrenceInfo

                    Timestamp lastOrder = shoppingList.getTimestamp("lastOrderedDate");
                    GenericValue recurrenceInfo = null;
                    recurrenceInfo = shoppingList.getRelatedOne("RecurrenceInfo");
   
                    Timestamp startDateTime = recurrenceInfo.getTimestamp("startDateTime");
                    RecurrenceInfo recurrence = null;
                    if (recurrenceInfo != null) {
                        try {
                            recurrence = new RecurrenceInfo(recurrenceInfo);
                        } catch (RecurrenceInfoException e) {
                            Debug.logError(e, module);
                        }
                    }
   
                    // check the next recurrence
                    if (recurrence != null) {
                        long next = lastOrder == null ? recurrence.next(startDateTime.getTime()) : recurrence.next(lastOrder.getTime());
                        Timestamp now = UtilDateTime.nowTimestamp();
                        Timestamp nextOrder = UtilDateTime.getDayStart(UtilDateTime.getTimestamp(next));
   
                        if (nextOrder.after(now)) {
                            continue;
                        }
                    } else {
                        continue;
                    }
   
                    ShoppingCart listCart = makeShoppingListCart(dispatcher, shoppingList, locale);
                    CheckOutHelper helper = new CheckOutHelper(dispatcher, delegator, listCart);
   
                    // store the order
                    Map createResp = helper.createOrder(userLogin);
                    if (createResp != null && ServiceUtil.isError(createResp)) {
                        Debug.logError("Cannot create order for shopping list - " + shoppingList, module);
                    } else {
                        String orderId = (String) createResp.get("orderId");
   
                        // authorize the payments
                        Map payRes = null;
                        try {
                            payRes = helper.processPayment(ProductStoreWorker.getProductStore(listCart.getProductStoreId(), delegator), userLogin);
                        } catch (GeneralException e) {
                            Debug.logError(e, module);
                        }
   
                        if (payRes != null && ServiceUtil.isError(payRes)) {
                            Debug.logError("Payment processing problems with shopping list - " + shoppingList, module);
                        }
   
                        shoppingList.set("lastOrderedDate", UtilDateTime.nowTimestamp());
                        shoppingList.store();
   
                        // send notification
                        try {
                            dispatcher.runAsync("sendOrderPayRetryNotification", UtilMisc.toMap("orderId", orderId));
                        } catch (GenericServiceException e) {
                            Debug.logError(e, module);
                        }
   
                        // increment the recurrence
                        recurrence.incrementCurrentCount();
                    }
                }
   
                eli.close();
            }
View Full Code Here

Examples of org.ofbiz.service.calendar.RecurrenceInfo

            }
        } else if ("PPIP_RECURRENCE".equals(inputParamEnumId)) {
            compareBase = new Integer(1);
            GenericValue recurrenceInfo = delegator.findByPrimaryKeyCache("RecurrenceInfo", UtilMisc.toMap("recurrenceInfoId", condValue));
            if (recurrenceInfo != null) {
                RecurrenceInfo recurrence = null;
                try {
                    recurrence = new RecurrenceInfo(recurrenceInfo);
                } catch (RecurrenceInfoException e) {
                    Debug.logError(e, module);
                }  
               
                // check the current recurrence
                if (recurrence != null) {
                    if (recurrence.isValidCurrent()) {
                        compareBase = new Integer(0);
                    }
                }
            }
        } else {
View Full Code Here

Examples of org.ofbiz.service.calendar.RecurrenceInfo

        long endTime = 0;
        if (endDate != null) {
            endTime = endDate.getTime();
        }

        RecurrenceInfo recInfo = null;
        try {
            recInfo = RecurrenceInfo.makeInfo(delegator, startTime, frequency.intValue(), interval.intValue(), -1, endTime);
        } catch (RecurrenceInfoException e) {
            Debug.logError(e, module);
            return ServiceUtil.returnError(UtilProperties.getMessage(resource_error,"OrderUnableToCreateShoppingListRecurrenceInformation",locale));
        }

        Debug.log("Next Recurrence - " + UtilDateTime.getTimestamp(recInfo.next()), module);
        Map result = ServiceUtil.returnSuccess();
        result.put("recurrenceInfoId", recInfo.getID());

        return result;
    }
View Full Code Here

Examples of org.ofbiz.service.calendar.RecurrenceInfo

                    Timestamp lastOrder = shoppingList.getTimestamp("lastOrderedDate");
                    GenericValue recurrenceInfo = null;
                    recurrenceInfo = shoppingList.getRelatedOne("RecurrenceInfo");
   
                    Timestamp startDateTime = recurrenceInfo.getTimestamp("startDateTime");
                    RecurrenceInfo recurrence = null;
                    if (recurrenceInfo != null) {
                        try {
                            recurrence = new RecurrenceInfo(recurrenceInfo);
                        } catch (RecurrenceInfoException e) {
                            Debug.logError(e, module);
                        }
                    }
   
                    // check the next recurrence
                    if (recurrence != null) {
                        long next = lastOrder == null ? recurrence.next(startDateTime.getTime()) : recurrence.next(lastOrder.getTime());
                        Timestamp now = UtilDateTime.nowTimestamp();
                        Timestamp nextOrder = UtilDateTime.getDayStart(UtilDateTime.getTimestamp(next));
   
                        if (nextOrder.after(now)) {
                            continue;
                        }
                    } else {
                        continue;
                    }
   
                    ShoppingCart listCart = makeShoppingListCart(dispatcher, shoppingList, locale);
                    CheckOutHelper helper = new CheckOutHelper(dispatcher, delegator, listCart);
   
                    // store the order
                    Map createResp = helper.createOrder(userLogin);
                    if (createResp != null && ServiceUtil.isError(createResp)) {
                        Debug.logError("Cannot create order for shopping list - " + shoppingList, module);
                    } else {
                        String orderId = (String) createResp.get("orderId");
   
                        // authorize the payments
                        Map payRes = null;
                        try {
                            payRes = helper.processPayment(ProductStoreWorker.getProductStore(listCart.getProductStoreId(), delegator), userLogin);
                        } catch (GeneralException e) {
                            Debug.logError(e, module);
                        }
   
                        if (payRes != null && ServiceUtil.isError(payRes)) {
                            Debug.logError("Payment processing problems with shopping list - " + shoppingList, module);
                        }
   
                        shoppingList.set("lastOrderedDate", UtilDateTime.nowTimestamp());
                        shoppingList.store();
   
                        // send notification
                        try {
                            dispatcher.runAsync("sendOrderPayRetryNotification", UtilMisc.toMap("orderId", orderId));
                        } catch (GenericServiceException e) {
                            Debug.logError(e, module);
                        }
   
                        // increment the recurrence
                        recurrence.incrementCurrentCount();
                    }
                }
   
                eli.close();
            }
View Full Code Here

Examples of org.ofbiz.service.calendar.RecurrenceInfo

        if (crashed != null && crashed.size() > 0) {
            Iterator i = crashed.iterator();
            while (i.hasNext()) {
                GenericValue job = (GenericValue) i.next();
                long runtime = job.getTimestamp("runTime").getTime();
                RecurrenceInfo ri = JobManager.getRecurrenceInfo(job);
                if (ri != null) {
                    long next = ri.next();
                    if (next <= runtime) {
                        Timestamp now = UtilDateTime.nowTimestamp();
                        // only re-schedule if there is no new recurrences since last run
                        Debug.log("Scheduling Job : " + job, module);
View Full Code Here

Examples of org.ofbiz.service.calendar.RecurrenceInfo

        // create the recurrence
        String infoId = null;
        if (frequency > -1 && count != 0) {
            try {
                RecurrenceInfo info = RecurrenceInfo.makeInfo(delegator, startTime, frequency, interval, count);
                infoId = info.primaryKey();
            } catch (RecurrenceInfoException e) {
                throw new JobManagerException(e.getMessage(), e);
            }
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.