Examples of UserPoint


Examples of org.jayasoft.woj.portal.model.UserPoint

import org.jayasoft.woj.portal.model.UserPoint;
import org.jayasoft.woj.portal.utils.Messages;

public class UserPointFactory {
    public static UserPoint godson(User u, UserPoint old, User godson, Product p, int nb, ProductPoint pp) {
        UserPoint newUP = (UserPoint)DaoFactory.getUserPointDao().newHandledObject();
        newUP.setUser(u);
        newUP.setEarnedPoints(pp.getPoints()*nb);
        newUP.setPoints(((old==null)?0:old.getPoints())+pp.getPoints()*nb);
        newUP.setReason("fidelity.point.godson.buy" + "|" + godson.getLogin() + "|" + p.getName() + "|" + new Integer(nb));//"godson " + godson.getLogin() + " take a license for " + p.getName());
        return newUP;
    }
View Full Code Here

Examples of org.jayasoft.woj.portal.model.UserPoint

        newUP.setReason("fidelity.point.godson.buy" + "|" + godson.getLogin() + "|" + p.getName() + "|" + new Integer(nb));//"godson " + godson.getLogin() + " take a license for " + p.getName());
        return newUP;
    }
   
    public static UserPoint purchase(User u, UserPoint old, Product p, int nb, ProductPoint pp) {
        UserPoint newUP = (UserPoint)DaoFactory.getUserPointDao().newHandledObject();
        newUP.setUser(u);
        newUP.setEarnedPoints(pp.getPoints()*nb);
        newUP.setPoints(((old==null)?0:old.getPoints())+pp.getPoints()*nb);
        newUP.setReason("fidelity.point.buy" + "|" + p.getName() + "|" + new Integer(nb));//"you have purchased a new license for the product " + p.getName());
        return newUP;
    }
View Full Code Here

Examples of org.jayasoft.woj.portal.model.UserPoint

        newUP.setReason("fidelity.point.buy" + "|" + p.getName() + "|" + new Integer(nb));//"you have purchased a new license for the product " + p.getName());
        return newUP;
    }
   
    public static UserPoint renew(User u, UserPoint old, Product p, ProductPoint pp) {
        UserPoint newUP = (UserPoint)DaoFactory.getUserPointDao().newHandledObject();
        newUP.setUser(u);
        newUP.setEarnedPoints(pp.getPoints());
        newUP.setPoints(((old==null)?0:old.getPoints())+pp.getPoints());
        newUP.setReason("fidelity.point.upgrade" + "|" + p.getName());//"you have upgraded a license for the product " + p.getName());
        return newUP;
    }
View Full Code Here

Examples of org.jayasoft.woj.portal.model.UserPoint

        newUP.setReason("fidelity.point.upgrade" + "|" + p.getName());//"you have upgraded a license for the product " + p.getName());
        return newUP;
    }
   
    public static UserPoint orderGift(User u, UserPoint old, FidelityOffer fo) {
        UserPoint newUP = (UserPoint)DaoFactory.getUserPointDao().newHandledObject();
        newUP.setUser(u);
        newUP.setEarnedPoints(fo.getNeededPoints()*-1);
        newUP.setPoints(((old==null)?0:old.getPoints())-fo.getNeededPoints());
//        newUP.setReason(Messages.DEFAULT.getString("fidelity.point.gift.order", new Object[]{ Messages.DEFAULT.getString(fo.getKey())}));// "you have ordered a gift:  " + Messages.DEFAULT.getString(fo.getKey()));
        newUP.setReason("fidelity.point.gift.order" + "|" + Messages.DEFAULT.getString(fo.getKey()));// "you have ordered a gift:  " + Messages.DEFAULT.getString(fo.getKey()));
        return newUP;
    }
View Full Code Here

Examples of org.jayasoft.woj.portal.model.UserPoint

        newUP.setReason("fidelity.point.gift.order" + "|" + Messages.DEFAULT.getString(fo.getKey()));// "you have ordered a gift:  " + Messages.DEFAULT.getString(fo.getKey()));
        return newUP;
    }

    public static UserPoint promotion(User u, UserPoint old, String moduleName, int points) {
        UserPoint newUP = (UserPoint)DaoFactory.getUserPointDao().newHandledObject();
        newUP.setUser(u);
        newUP.setEarnedPoints(points);
        newUP.setPoints(((old==null)?0:old.getPoints())+points);
//        newUP.setReason(Messages.DEFAULT.getString("fidelity.point.module.promote", new Object[]{moduleName}));//"the module " + moduleName + " has been promoted");
        newUP.setReason("fidelity.point.module.promote" + "|" + moduleName);//"the module " + moduleName + " has been promoted");
        return newUP;
    }
View Full Code Here

Examples of org.jayasoft.woj.portal.model.UserPoint

   
    private void prepareUserPointsPage(HttpServletRequest request, User user) {
        List userPoints = ServiceFactory.getFidelityService().getUserPoints(user);
        int points = 0;
        if (userPoints.size()>0) {
            UserPoint up = (UserPoint)userPoints.get(userPoints.size()-1);
            points = up.getPoints();
        }
        request.setAttribute(Params.FIDELITY_OFFERS.SHOW_USER_POINTS.REQUEST.HAS_POINTS, Boolean.valueOf(points>0));
        request.setAttribute(Params.FIDELITY_OFFERS.SHOW_USER_POINTS.REQUEST.POINTS, new Integer(points));
        request.setAttribute(Params.FIDELITY_OFFERS.SHOW_USER_POINTS.REQUEST.HAS_USER_POINTS, Boolean.valueOf(userPoints.size()>0));
        request.setAttribute(Params.FIDELITY_OFFERS.SHOW_USER_POINTS.REQUEST.USER_POINTS, userPoints);
View Full Code Here

Examples of org.jayasoft.woj.portal.model.UserPoint

     * @return a non null list of FidelityOffer
     */
    public List getFidelityOffers(User u) {
        if (u instanceof UserImpl) {
            UserImpl user = (UserImpl)ServiceFactory.getUserService().getUser(u.getLogin());
            UserPoint up = DaoFactory.getUserPointDao().getLast(user);
            return DaoFactory.getFidelityOfferDao().getAccessible((up==null)?0:up.getPoints());
        }
        LOGGER.warn("cannot get fidelity offers for a non UserImpl object:" + u);
        return Collections.EMPTY_LIST;
    }
View Full Code Here

Examples of org.jayasoft.woj.portal.model.UserPoint

        }
        return pp;
    }
   
    public UserPoint getUserPoint(User u) {
        UserPoint p = DaoFactory.getUserPointDao().getLast(u);
        if (p==null) {
            p = new UserPoint();
            p.setUser(u);
            p.setPoints(0);
        }
        return p;
    }
View Full Code Here

Examples of org.jayasoft.woj.portal.model.UserPoint

               
                UserImpl godfather = (UserImpl)uDao.findUser(godson.getGodfather());
                if (godfather != null) {
                    ProductPoint pp = ppDao.get(p, years, ProductPoint.GODSON);
                    if (pp.getPoints()!=0) {
                        UserPoint oldGFUP = getUserPoint(godfather);
                        UserPoint gfUP = UserPointFactory.godson(godfather, oldGFUP, godson, p, subscribedUsers, pp);
                        upDao.save(gfUP);
                        ServiceFactory.getRegistrationService().sendFidelityAccountPointEarnedByGodSonBuyMail(godfather, godson, p, subscribedUsers, years, gfUP.getEarnedPoints(), gfUP.getPoints());
                        LOGGER.info("adding " + pp.getPoints() + " to user: " + godfather.getId() + ", his godson: " + godson.getId() + " bought " + p.getCode() + " for " + years + " years");
                    }
                } else {
                    LOGGER.info("user: " + buyer.getId() + " does not have a godfather");
                }
                ProductPoint pp = ppDao.get(p, years, ProductPoint.PURCHASE);
                if (pp != null && pp.getPoints()!=0) {
                    UserPoint oldGSUP = getUserPoint(godson);
                    UserPoint gsUP = UserPointFactory.purchase(godson, oldGSUP, p, subscribedUsers, pp);
                    upDao.save(gsUP);
                    ServiceFactory.getRegistrationService().sendFidelityAccountPointEarnedBySelfPurchaseMail(godson, p, subscribedUsers, years, gsUP.getEarnedPoints(),  gsUP.getPoints());
                    LOGGER.info("adding " + pp.getPoints() + " to user: " + godson.getId() + ", he bought " + p.getCode() + " for " + years + " years");
                }
            } catch (DaoException e) {
                LOGGER.warn("cannot add fidelity points to user: " + buyer.getId(), e);
            }
View Full Code Here

Examples of org.jayasoft.woj.portal.model.UserPoint

                UserPointDao upDao = DaoFactory.getUserPointDao();
                ProductPointDao ppDao = DaoFactory.getProductPointDao();
               
                ProductPoint pp = ppDao.get(p, years, ProductPoint.RENEWAL);
                if (pp.getPoints()!=0) {
                    UserPoint oldGSUP = getUserPoint(godson);
                    UserPoint gsUP = UserPointFactory.renew(godson, oldGSUP, p, pp);
                    upDao.save(gsUP);
                    ServiceFactory.getRegistrationService().sendFidelityAccountPointEarnedBySelfRenewMail(godson, p, years, gsUP.getEarnedPoints(), gsUP.getPoints());
                    LOGGER.info("adding " + pp.getPoints() + " to user: " + godson.getId() + ", he renews " + p.getCode() + " for " + years + " years");
                }
            } catch (DaoException e) {
                LOGGER.warn("cannot add fidelity points to user: " + buyer.getId(), 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.