コード例 #1
0
 /*
        <![CDATA[
        var autoRenewal = thisComponent.getParameterValueObject("autoRenewal");
        if (autoRenewal == 'yes') {
            var ed = thisComponent.getParameterValueObject("endDate");
            if (ed != null) {
                var renNoticePer = Number(thisComponent.getParameterValueObject("renNoticePer"));
                if (renNoticePer > 0) {
                    edCal = ed.copy();
                    edCal.add(Packages.java.util.Calendar.DATE, -renNoticePer);
                    thisComponent.setDateValue("/renNoticeDate", edCal, false);
                }
                else {
                    thisComponent.setValue("/renNoticeDate", "", false);
                }
            }
            else {
                thisComponent.setValue("/renNoticeDate", "", false);
            }
        }
        else {
            thisComponent.setValue("/renNoticeDate", "", false);
        }
        ]]>
 */
 @Override
 public Boolean process() throws Exception {
   CSDetails details = getHelper().getCurrentComponentStub();
   String autoRenewal = details.getAutoRenewal();
   if ("yes".equals(autoRenewal)) {
     Date end = details.getEndDate();
     if (end != null) {
       Integer renNoticePeriod = details.getRenNoticePer();
       if (renNoticePeriod != null && renNoticePeriod > 0) {
         Calendar endCal = Calendar.getInstance();
         endCal.setTime(end);
         endCal.add(Calendar.DATE, -renNoticePeriod);
         details.setRenNoticeDate(endCal.getTime());
       } else {
         details.setRenNoticeDate(null);
       }
     } else {
       details.setRenNoticeDate(null);
     }
   } else {
     details.setRenNoticeDate(null);
   }
   return true;
 }
コード例 #2
0
 /*
            thisComponent.setValue("CSalesData/ReqCSalesDetails/contractStatus", "Awaiting Signature");
            thisComponent.save();
 */
 @Override
 public Boolean process() throws Exception {
   CSDetails info = getHelper().getInfoComponentStub();
   info.setContractStatus(ContractStatus.AWAITING_SIGNATURE.getStatus());
   return getHelper().saveComponent(info);
 }