Example usage for java.util GregorianCalendar setTime

List of usage examples for java.util GregorianCalendar setTime

Introduction

In this page you can find the example usage for java.util GregorianCalendar setTime.

Prototype

public final void setTime(Date date) 

Source Link

Document

Sets this Calendar's time with the given Date.

Usage

From source file:com.github.dozermapper.core.functional_tests.support.TestDataFactory.java

public TestObject getInputGeneralMappingTestObject() {
    TestObject custom = newInstance(TestObject.class);
    custom.setOne("one");
    custom.setTwo(new Integer(2));

    int[] pa = { 0, 1, 2, 3, 4 };
    custom.setPrimArray(pa);//from   w w w . j  ava  2 s. co  m

    InsideTestObject ito = newInstance(InsideTestObject.class);
    ito.setLabel("label");
    ito.setWrapper(new Integer(1));
    ito.setToWrapper(1);

    custom.setThree(ito);

    // testing if it will map two custom objects that are different types but same names //
    InsideTestObject ito2 = newInstance(InsideTestObject.class);
    ito2.setLabel("label");
    custom.setInsideTestObject(ito2);

    List<String> list1 = newInstance(ArrayList.class);
    list1.add("1value");
    list1.add("2value");
    List<String> list2 = newInstance(ArrayList.class);
    list2.add("1value");
    list2.add("2value");
    custom.setEqualNamedList(list1);
    custom.setUnequalNamedList(list2);

    custom.setThePrimitive(3);
    custom.setTheMappedPrimitive(4);

    int[] intArray = { 1, 1 };
    Integer[] integerArray = { new Integer(1), new Integer(1) };
    custom.setAnArray(intArray);
    custom.setArrayForLists(integerArray);
    custom.setBigDecimalToInt(new BigDecimal(1));
    custom.setIntToBigDecimal(1);
    Date date = new Date();
    custom.setDate(date);
    GregorianCalendar calendar = new GregorianCalendar();
    calendar.setTime(date);
    custom.setCalendar(calendar);
    Van van = newInstance(Van.class);
    van.setName("van");
    van.setTestValue("testValue");
    custom.setVan(van);
    custom.setExcludeMe("takemeout");

    // testing interfaces
    MetalThingyIF car = newInstance(Car.class);
    car.setName("metalthingy");
    custom.setCarMetalThingy(car);

    List<TheFirstSubClass> hintList = newInstance(ArrayList.class);
    TheFirstSubClass fsc = newInstance(TheFirstSubClass.class);
    TheFirstSubClass fsc2 = newInstance(TheFirstSubClass.class);
    fsc.setS("s");
    fsc2.setS("s");
    hintList.add(fsc);
    hintList.add(fsc2);

    custom.setHintList(hintList);

    custom.setBlankDate("");
    custom.setBlankStringToLong("");
    NoExtendBaseObject nebo = newInstance(NoExtendBaseObject.class);
    custom.setCopyByReference(nebo);
    NoExtendBaseObject nebo2 = newInstance(NoExtendBaseObject.class);
    custom.setCopyByReferenceDeep(nebo2);
    NoExtendBaseObjectGlobalCopyByReference globalNebo = newInstance(
            NoExtendBaseObjectGlobalCopyByReference.class);
    custom.setGlobalCopyByReference(globalNebo);

    String[] stringArray = new String[] { null, "one", "two" };
    custom.setStringArrayWithNullValue(stringArray);
    return custom;
}

From source file:com.sapienter.jbilling.client.payment.PaymentCrudAction.java

@Override
protected PaymentDTOEx doEditFormToDTO() {
    PaymentDTOEx dto = new PaymentDTOEx();
    // the id, only for payment edits
    dto.setId((Integer) myForm.get(FIELD_ID) == null ? 0 : (Integer) myForm.get(FIELD_ID));
    // set the amount
    dto.setAmount(string2decimal((String) myForm.get(FIELD_AMOUNT)));
    // set the date
    dto.setPaymentDate(parseDate(FIELD_GROUP_DATE, "payment.date"));
    final String payMethod = (String) myForm.get(FIELD_PAY_METHOD);
    if ("cheque".equals(payMethod)) {
        // create the cheque dto
        PaymentInfoChequeDTO chequeDto = new PaymentInfoChequeDTO();
        chequeDto.setBank((String) myForm.get(FIELD_CHEQUE_BANK));
        chequeDto.setNumber((String) myForm.get(FIELD_CHEQUE_NUMBER));
        chequeDto.setDate(parseDate(FIELD_GROUP_CHEQUE_DATE, "payment.cheque.date"));
        // set the cheque
        dto.setCheque(chequeDto);//from  w  w w  .j a v  a  2  s .  c  o  m
        dto.setPaymentMethod(new PaymentMethodDTO(Constants.PAYMENT_METHOD_CHEQUE));
        // validate required fields        
        required(chequeDto.getNumber(), "payment.cheque.number");
        required(chequeDto.getDate(), "payment.cheque.date");
        // cheques now are never process realtime (may be later will support
        // electronic cheques
        dto.setPaymentResult(new PaymentResultDTO(Constants.RESULT_ENTERED));
        session.setAttribute("tmp_process_now", new Boolean(false));

    } else if ("cc".equals(payMethod)) {
        String ccNumber = (String) myForm.get(FIELD_CC_NUMBER);
        boolean masked = false;

        // check if cc number is masked
        if (isMaskedCreditCard(ccNumber)) {
            LOG.debug("cc no. masked; " + "getting user's existing cc details");
            // try to get existing cc details
            UserDTOEx user = getSessionUser();
            CreditCardDTO existingCcDTO = user.getCreditCard();
            if (existingCcDTO != null) {
                String existingNumber = existingCcDTO.getNumber();
                // check that four last digits match
                if (existingNumber.substring(existingNumber.length() - 4)
                        .equals(ccNumber.substring(ccNumber.length() - 4))) {
                    LOG.debug("got a matching masked cc number");
                    masked = true;
                    ccNumber = existingNumber;
                }
            }
        }

        // do cc validation for non-masked numbers
        if (!masked) {
            validateCreditCard();

            // return if credit card validation failed
            if (!errors.isEmpty()) {
                return null;
            }
        }

        CreditCardDTO ccDto = new CreditCardDTO();
        ccDto.setNumber(ccNumber);
        ccDto.setName((String) myForm.get(FIELD_CC_NAME));
        myForm.set(FIELD_GROUP_CC_EXPIRY + "_day", "01"); // to complete the date
        ccDto.setCcExpiry(parseDate(FIELD_GROUP_CC_EXPIRY, "payment.cc.date"));
        if (ccDto.getCcExpiry() != null) {
            // the expiry can't be past today
            GregorianCalendar cal = new GregorianCalendar();
            cal.setTime(ccDto.getCcExpiry());
            cal.add(GregorianCalendar.MONTH, 1); // add 1 month
            if (Calendar.getInstance().getTime().after(cal.getTime())) {
                errors.add(ActionErrors.GLOBAL_ERROR,
                        new ActionError("creditcard.error.expired", "payment.cc.date"));
            }
        }
        dto.setCreditCard(ccDto);

        // this will be checked when the payment is sent
        session.setAttribute("tmp_process_now", (Boolean) myForm.get(FIELD_PROCESS_NOW));
        // validate required fields        
        required(ccDto.getNumber(), "payment.cc.number");
        required(ccDto.getCcExpiry(), "payment.cc.date");
        required(ccDto.getName(), "payment.cc.name");

        // make sure that the cc is valid before trying to get
        // the payment method from it
        if (errors.isEmpty()) {
            dto.setPaymentMethod(new PaymentMethodDTO(Util.getPaymentMethod(ccDto.getNumber())));
        }

    } else if ("ach".equals(payMethod)) {
        AchDTO ach = new AchDTO();
        ach.setAbaRouting((String) myForm.get(FIELD_ACH_ABA_CODE));
        ach.setBankAccount((String) myForm.get(FIELD_ACH_ACCOUNT_NUMBER));
        ach.setAccountType((Integer) myForm.get(FIELD_ACH_ACCOUNT_TYPE));
        ach.setBankName((String) myForm.get(FIELD_ACH_BANK_NAME));
        ach.setAccountName((String) myForm.get(FIELD_ACH_ACCOUNT_NAME));
        dto.setAch(ach);
        //this will be checked when the payment is sent
        session.setAttribute("tmp_process_now", new Boolean(true));

        // since it is one big form for all methods, we need to 
        // validate the required manually
        required(ach.getAbaRouting(), "ach.aba.prompt");
        required(ach.getBankAccount(), "ach.account_number.prompt");
        required(ach.getBankName(), "ach.bank_name.prompt");
        required(ach.getAccountName(), "ach.account_name.prompt");

        if (errors.isEmpty()) {
            dto.setPaymentMethod(new PaymentMethodDTO(Constants.PAYMENT_METHOD_ACH));
        }
    }

    // set the customer id selected in the list (not the logged)
    dto.setUserId((Integer) session.getAttribute(Constants.SESSION_USER_ID));
    // specify if this is a normal payment or a refund
    dto.setIsRefund(session.getAttribute("jsp_is_refund") == null ? 0 : 1);
    LOG.debug("refund = " + dto.getIsRefund());
    // set the selected payment for refunds
    if (dto.getIsRefund() == 1) {
        PaymentDTOEx refundPayment = (PaymentDTOEx) session.getAttribute(Constants.SESSION_PAYMENT_DTO);
        /*
         * Right now, to process a real-time credit card refund it has to be to
         * refund a previously done credit card payment. This could be
         * changed, to say, refund using the customer's credit card no matter
         * how the guy paid initially. But this might be subjet to the
         * processor features.
         * 
         */

        ActionError realTimeNoPayment = null;
        boolean processNow = (Boolean) myForm.get(FIELD_PROCESS_NOW);
        if ("cc".equals(payMethod) && processNow) {
            if (refundPayment == null || refundPayment.getCreditCard() == null
                    || refundPayment.getAuthorization() == null
                    || !Constants.RESULT_OK.equals(refundPayment.getPaymentResult().getId())) {

                realTimeNoPayment = new ActionError(//
                        "refund.error.realtimeNoPayment", "payment.cc.processNow");
            }
        }

        if (realTimeNoPayment != null) {
            errors.add(ActionErrors.GLOBAL_ERROR, realTimeNoPayment);
        } else {
            dto.setPayment(refundPayment);
        }

        // refunds, I need to manually delete the list, because
        // in the end only the LIST_PAYMENT will be removed
        session.removeAttribute(Constants.SESSION_LIST_KEY + Constants.LIST_TYPE_REFUND);
    }

    // last, set the currency
    //If a related document is
    // set (invoice/payment) it'll take it from there. Otherwise it
    // wil inherite the one from the user
    Integer currencyId = (Integer) myForm.get(FIELD_CURRENCY);
    dto.setCurrency(currencyId != null ? new CurrencyDTO((Integer) myForm.get(FIELD_CURRENCY)) : null);
    if (dto.getCurrency() == null) {
        dto.setCurrency(getUser(dto.getUserId()).getCurrency());
    }

    if (errors.isEmpty()) {
        // verify that this entity actually accepts this kind of 
        //payment method
        if (!myPaymentSession.isMethodAccepted((Integer) session.getAttribute(Constants.SESSION_ENTITY_ID_KEY),
                dto.getPaymentMethod().getId())) {

            errors.add(ActionErrors.GLOBAL_ERROR,
                    new ActionError("payment.error.notAccepted", "payment.method"));
        }
    }

    //LOG.debug("now payment methodId = " + dto.getPaymentMethod().getId());
    LOG.debug("now paymentDto = " + dto);

    return dto;
}

From source file:org.jbpm.formModeler.core.processing.formProcessing.Functions.java

public Map getValidDays(String value) {
    GregorianCalendar gc = new GregorianCalendar();
    gc.set(GregorianCalendar.DAY_OF_MONTH, 1);

    if (value == null || value.equals("") || value.startsWith("/")) {
        gc.set(GregorianCalendar.MONTH, 0);
    } else if (value.endsWith("/")) {
        int month = Integer.decode(value.substring(0, value.indexOf("/"))).intValue();
        gc.set(GregorianCalendar.MONTH, month);
    } else {//from   w  w  w . ja  v  a  2 s.c  o  m
        SimpleDateFormat sdf = new SimpleDateFormat("MM/yyyy");
        try {
            gc.setTime(sdf.parse(value));
            gc.set(GregorianCalendar.MONTH, gc.get(GregorianCalendar.MONTH) + 1);
        } catch (Exception e) {
            log.warn("Error parsing date " + value + " : ", e);
        }
    }

    Map days = new TreeMap();

    int month = gc.get(GregorianCalendar.MONTH);
    while (gc.get(GregorianCalendar.MONTH) == month) {
        int intValue = gc.get(GregorianCalendar.DAY_OF_MONTH);
        String key = java.lang.String.valueOf(intValue);
        if (key.length() == 1)
            key = "0" + key;
        days.put(key, key);
        gc.set(GregorianCalendar.DAY_OF_MONTH, intValue + 1);
    }

    return days;
}

From source file:mil.navy.med.dzreg.dao.RegistriesManagerDAO.java

/**
 *
 * @param pt/*from  www  . j  a v  a 2s  .co m*/
 * @return
 */
private PersonRegistryProfileType map(DzPatients pt) throws Exception {
    PersonRegistryProfileType profile = new PersonRegistryProfileType();

    profile.setDataSource(pt.getDataSource());

    //--------------------------------------------------------------------------
    // map person info
    //--------------------------------------------------------------------------
    PersonType person = new PersonType();

    if (pt != null) {
        person.setDataSource(pt.getDataSource());
        GregorianCalendar gc = new GregorianCalendar();
        gc.setTime(pt.getPatientDob());
        person.setDateOfBirth(DatatypeFactory.newInstance().newXMLGregorianCalendar(gc));
        person.setId(pt.getPatid());
        person.setEligibilityIdentifier(pt.getPatientDeersIdentifier());
        person.setFmpssn(pt.getFmpssn());
        person.setName(pt.getName());
        person.setOfficePhone(pt.getOfficePhone());
        person.setHomePhone(pt.getPhone());

        AddressType address = new AddressType();
        address.setStreetAddress(pt.getAddress());
        address.setStreetAddress2(pt.getStreet2());
        address.setCity(pt.getCity());
        address.setPostalCode(pt.getZip());
        address.setState(pt.getState());
        JAXBElement<AddressType> jAddr = new JAXBElement<AddressType>(
                new QName("urn:mil:navy:med:dzreg:service", "AddressType"), AddressType.class, null, address);
        person.setAddress(jAddr);

        profile.setPerson(person);
    }

    //--------------------------------------------------------------------------
    // map registry info
    //--------------------------------------------------------------------------
    Collection<DzReg> dzregColl = pt.getDzRegCollection();

    if (!dzregColl.isEmpty()) {
        for (DzReg d : dzregColl) {
            RegistryProfileType registry = map(d);
            if (registry != null) {
                registry.setRegisteredDate(d.getRegisteredDt());
            }

            profile.getRegistry().add(registry);
        }
    }

    return profile;
}

From source file:edu.uga.cs.fluxbuster.features.FeatureCalculator.java

/**
 * Gets run dates previous to a specific date within a window
 * of days from that date.//w w w.ja v  a 2s.c  o m
 *
 * @param log_date the run date
 * @param window the number of days previous to the current date
 * @return the list of previous run dates
 * @throws SQLException if there is an error retrieving the previous
 *       run dates
 */
public ArrayList<Date> getPrevDates(Date log_date, int window) throws SQLException {
    ArrayList<Date> prevDates = new ArrayList<Date>();
    if (prevDateBufDate != null && prevDateBuf != null && prevDateBufDate.equals(log_date)
            && prevDateBufWindow >= window) {

        //pull the dates within the day window from the prevDateBuf cache
        Date pd = null;
        int windowcount = 0;
        for (Date d : prevDateBuf) {
            if (windowcount >= window) {
                break;
            }
            if (pd == null) {
                pd = d;
                windowcount++;
            } else {
                DateTime morerecent = new DateTime(d.getTime());
                DateTime lessrecent = new DateTime(pd.getTime());
                Days days = Days.daysBetween(morerecent, lessrecent);
                windowcount += days.getDays();
                pd = d;
            }
            prevDates.add(d);
        }

    } else {
        String domainsprefix = properties.getProperty(DOMAINSPREFIXKEY);
        String resipsprefix = properties.getProperty(RESIPSPREFIXKEY);

        ArrayList<String> tablenames = new ArrayList<String>();
        ResultSet rs1 = null;
        try {
            rs1 = dbi.executeQueryWithResult(properties.getProperty(TABLES_QUERY1KEY));
            while (rs1.next()) {
                tablenames.add(rs1.getString(1));
            }
        } catch (Exception e) {
            if (log.isErrorEnabled()) {
                log.error(e);
            }
        } finally {
            if (rs1 != null && !rs1.isClosed()) {
                rs1.close();
            }
        }

        GregorianCalendar cal = new GregorianCalendar();
        cal.setTime(log_date);
        for (int i = 0; i < window; i++) {
            cal.roll(Calendar.DAY_OF_YEAR, false);
            Date temp = cal.getTime();
            String datestr = df.format(temp);
            if (tablenames.contains(domainsprefix + "_" + datestr)
                    && tablenames.contains(resipsprefix + "_" + datestr)) {
                prevDates.add(temp);
            }
        }

        //cache the values for later
        if (prevDateBuf == null) {
            prevDateBuf = new ArrayList<Date>();
        } else {
            prevDateBuf.clear();
        }
        prevDateBuf.addAll(prevDates);
        prevDateBufDate = log_date;
        prevDateBufWindow = window;
    }
    return prevDates;
}

From source file:mekhq.campaign.mission.Contract.java

/**
 * Get the number of months left in this contract after the given date. Partial months are counted as
 * full months./*from  www .  j  a va 2 s .c  o m*/
 *
 * @param date
 * @return
 */
public int getMonthsLeft(Date date) {
    GregorianCalendar cal = new GregorianCalendar();
    cal.setTime(date);
    cal.add(Calendar.MONTH, 1);
    date = cal.getTime();
    int monthsLeft = 0;
    while (date.before(endDate) || date.equals(endDate)) {
        monthsLeft++;
        cal.add(Calendar.MONTH, 1);
        date = cal.getTime();
    }
    return monthsLeft;
}

From source file:org.novoj.utils.datePattern.DatePatternConverter.java

/**
 * Tries to recognize date / time pattern from arbitrary string. Uses several decomposition patterns to recognize
 * proper value. It tries to make up missing parts in the natural way (current or initial date / time).
 *
 * @param dateAsString - user entered string
 * @param dateRequested - true if you expect some date value
 * @param timeRequested - true if you expect some time value
 * @param locale - locale used to parse string (passed to the SimpleDateFormat object)
 * @return//from   www .j  av  a 2 s .  c  o m
 */
@SuppressWarnings({ "OverlyComplexMethod" })
public Date getDate(String dateAsString, boolean dateRequested, boolean timeRequested, Locale locale) {
    String normalizedDateValue = getNormalizedDateValue(dateAsString, locale);
    Date now = new Date();
    GregorianCalendar nowCld = new GregorianCalendar();
    nowCld.setTime(now);
    if (dateRequested && timeRequested) {
        for (DateFormatHolder dateFormat : dateTimeRecognitionPatterns) {
            Date parsedDate = tryToParse(normalizedDateValue, dateFormat, nowCld, locale, false);
            if (parsedDate != null) {
                return parsedDate;
            }
        }
        for (DateFormatHolder dateFormat : dateRecognitionPatterns) {
            Date parsedDate = tryToParse(normalizedDateValue, dateFormat, nowCld, locale, false);
            if (parsedDate != null) {
                return parsedDate;
            }
        }
        for (DateFormatHolder timeFormat : timeRecognitionPatterns) {
            Date parsedDate = tryToParse(normalizedDateValue, timeFormat, nowCld, locale, false);
            if (parsedDate != null) {
                return parsedDate;
            }
        }
    } else if (dateRequested) {
        for (DateFormatHolder dateFormat : dateRecognitionPatterns) {
            Date parsedDate = tryToParse(normalizedDateValue, dateFormat, nowCld, locale, true);
            if (parsedDate != null) {
                return parsedDate;
            }
        }
    } else if (timeRequested) {
        for (DateFormatHolder timeFormat : timeRecognitionPatterns) {
            Date parsedDate = tryToParse(normalizedDateValue, timeFormat, nowCld, locale, true);
            if (parsedDate != null) {
                return parsedDate;
            }
        }
    }
    return null;
}

From source file:com.sapienter.jbilling.server.process.AgeingBL.java

/**
 * Will move the user one step forward in the ageing proces ONLY IF
 * the user has been long enough in the present status. (for a user
 * in active status, it always moves it to the first ageing step).
 * @param userId/*w  w  w . j  a  v a  2s.  co m*/
 * @throws NamingException
 * @throws SessionInternalError
 */
public void age(UserDTO user, Date today) throws NamingException, SessionInternalError {
    LOG.debug("Ageing user:" + user.getUserId());
    Integer status = user.getStatus().getId();
    Integer nextStatus = null;
    if (status.equals(UserDTOEx.STATUS_ACTIVE)) {
        // welcome to the ageing process
        nextStatus = getNextStep(user.getEntity(), UserDTOEx.STATUS_ACTIVE);
    } else {
        LOG.debug("she's already in the ageing");
        // this guy is already in the ageing
        AgeingEntityStepDTO step = new AgeingEntityStepDAS().findStep(user.getEntity().getId(), status);
        if (step != null) {
            ageing = ageingDas.find(step.getId());

            // verify if it is time for another notch
            GregorianCalendar cal = new GregorianCalendar();
            Date lastChange = user.getLastStatusChange();
            if (lastChange == null) {
                lastChange = user.getCreateDatetime();
            }
            cal.setTime(lastChange);
            cal.add(Calendar.DATE, ageing.getDays());
            LOG.debug("last time + days=" + cal.getTime() + " today " + today + "compare="
                    + cal.getTime().compareTo(today));
            if (cal.getTime().compareTo(today) <= 0) {
                nextStatus = getNextStep(user.getEntity(), user.getStatus().getId());
            } else {
                return;
            }
        } else {
            // this user is an ageing status that has been removed.
            // may be this is a bug, and a currently-in-use status
            // should not be removable.
            // Now it will simple jump to the next status.
            nextStatus = getNextStep(user.getEntity(), user.getStatus().getId());
        }
    }
    if (nextStatus != null) {
        setUserStatus(null, user.getUserId(), nextStatus, today);
    } else {
        eLogger.warning(user.getEntity().getId(), user.getUserId(), user.getUserId(),
                EventLogger.MODULE_USER_MAINTENANCE, EventLogger.NO_FURTHER_STEP, Constants.TABLE_BASE_USER);
    }
}

From source file:com.ephesoft.dcma.workflows.service.engine.impl.EngineServiceImpl.java

@Override
@Transactional//from  w  w w. j  a va 2  s  . c  o  m
public JobEntity lockJob(final CommandContext commandContext, final JobEntity job, String lockOwner,
        final int lockTimeInMillis) {
    JobEntity modifiedJobEntity;

    // Providing check again before locking a job and using activiti command listener class for reset retry count for job.
    if (EphesoftStringUtil.isNullOrEmpty(job.getLockOwner())) {
        String jobId = job.getId();
        resetJobRetries(jobId, WorkflowConstants.MAX_NUMBER_OF_JOB_RETRIES);
        modifiedJobEntity = commandContext.getJobEntityManager().findJobById(jobId);
        GregorianCalendar gregorianCalendar = new GregorianCalendar();
        Date currentTime = getCurrentTime(commandContext);
        gregorianCalendar.setTime(currentTime);
        gregorianCalendar.add(Calendar.MILLISECOND, lockTimeInMillis);
        Date date = gregorianCalendar.getTime();
        LOGGER.info("Trying to obtain a lock for job with id: ", jobId, " with expiration time: ",
                timeFormat.format(date), " by lock owner: ", lockOwner);
        modifiedJobEntity.setLockOwner(lockOwner);
        modifiedJobEntity.setLockExpirationTime(date);
    } else {
        modifiedJobEntity = null;
    }
    return modifiedJobEntity;
}

From source file:oracle.retail.stores.pos.ado.utility.Utility.java

/**
This method validates the expiration date.
@param expirationDate//from ww w  .  ja va2s. co m
@throws TenderException if not a valid expiration date
**/
//----------------------------------------------------------------------
public synchronized void validateExpirationDate(String expDate) throws TenderException {
    GregorianCalendar gc = (GregorianCalendar) Calendar.getInstance();
    // get today's date and from that get the current
    // Month and Year.
    Date today = new Date();
    gc.setTime(today);
    int thisMonth = gc.get(Calendar.MONTH);
    int thisYear = gc.get(Calendar.YEAR);
    gc.clear();
    EYSDate expirationDate = parseEncryptedExpirationDate(expDate);
    // reset the calendar with this tend;er's Exp. Date
    Calendar c = expirationDate.calendarValue();
    gc.setTime(c.getTime());

    // if expiration date is before today and
    // the month and year both do not match the
    // current month and year, the card must be expired.
    EYSDate todayEYS = new EYSDate(today);
    if (expirationDate.before(todayEYS)
            && !((thisMonth == gc.get(Calendar.MONTH)) && (thisYear == gc.get(Calendar.YEAR)))) {
        throw new TenderException("Expired", TenderErrorCodeEnum.EXPIRED);
    }
    // set the object to nul
    expirationDate = null;
}