/** * Convert a given PlanWS web-service object into a PlanDTO * * @param ws ws object to convert * @return converted DTO object */ public static PlanDTO getDTO(PlanWS ws) { if (ws != null) { if (ws.getItemId() == null) throw new SessionInternalError("PlanDTO must have a plan subscription item."); if (ws.getPeriodId() == null) throw new SessionInternalError("PlanDTO must have an applicable order period."); // subscription plan item ItemDTO item = new ItemBL(ws.getItemId()).getEntity(); // plan period OrderPeriodDTO period = new OrderPeriodDAS().find(ws.getPeriodId()); return new PlanDTO(ws, item, period, PlanItemBL.getDTO(ws.getPlanItems())); } return null; }
/** * Convert a given PlanDTO into a PlanWS web-service object * * @param dto dto to convert * @return converted web-service object */ public static PlanWS getWS(PlanDTO dto) { if (dto != null) { return new PlanWS(dto, PlanItemBL.getWS(dto.getPlanItems())); } return null; }