Package net.sf.chellow.monad.types

Examples of net.sf.chellow.monad.types.MonadDate


        .createQuery(
            "from Party party where party.role.code = :roleCode order by party.participant.code")
        .setCharacter("roleCode", MarketRole.HHDC).list()) {
      source.appendChild(party.toXml(doc, new XmlTree("participant")));
    }
    source.appendChild(new MonadDate().toXml(doc));
    source.appendChild(MonadDate.getMonthsXml(doc));
    source.appendChild(MonadDate.getDaysXml(doc));
    return doc;
  }
View Full Code Here


        .createQuery("from BillType type order by type.code").list()) {
      source.appendChild(type.toXml(doc));
    }
    source.appendChild(MonadDate.getMonthsXml(doc));
    source.appendChild(MonadDate.getDaysXml(doc));
    source.appendChild(new MonadDate().toXml(doc));
    return doc;
  }
View Full Code Here

    Element element = super.toXml(doc, "llfc");
    element.setAttribute("code", toString());
    element.setAttribute("description", description);
    element.setAttribute("is-substation", Boolean.toString(isSubstation));
    element.setAttribute("is-import", Boolean.toString(isImport));
    MonadDate fromDate = new MonadDate(validFrom);
    fromDate.setLabel("from");
    element.appendChild(fromDate.toXml(doc));
    if (validTo != null) {
      MonadDate toDate = new MonadDate(validTo);
      toDate.setLabel("to");
      element.appendChild(toDate.toXml(doc));
    }
    return element;
  }
View Full Code Here

      String mpanCoreStr = GeneralImport.addField(csvElement,
          "Mpan Core", values, 3);
      MpanCore mpanCore = MpanCore.getMpanCore(mpanCoreStr);
      String issueDateStr = GeneralImport.addField(csvElement,
          "Issue Date", values, 4);
      Date issueDate = new MonadDate(issueDateStr).getDate();
      String startDateStr = GeneralImport.addField(csvElement,
          "Start Date", values, 5);
      HhStartDate startDate = new HhStartDate(startDateStr);
      String finishDateStr = GeneralImport.addField(csvElement,
          "Finish Date", values, 6);
      HhStartDate finishDate = new HhStartDate(finishDateStr);
      String netStr = GeneralImport
          .addField(csvElement, "Net", values, 7);
      BigDecimal net = new BigDecimal(netStr);
      String vatStr = GeneralImport
          .addField(csvElement, "Vat", values, 8);
      BigDecimal vat = new BigDecimal(vatStr);

      String grossStr = GeneralImport.addField(csvElement, "Gross",
          values, 9);
      BigDecimal gross = new BigDecimal(grossStr);

      String account = GeneralImport.addField(csvElement,
          "Account Reference", values, 10);

      String reference = GeneralImport.addField(csvElement, "Reference",
          values, 11);
      String typeCode = GeneralImport.addField(csvElement, "Type",
          values, 12);
      BillType type = BillType.getBillType(typeCode);

      String breakdown = GeneralImport.addField(csvElement, "Breakdown",
          values, 13);

      String kwhStr = GeneralImport.addField(csvElement, "kWh", values,
          14);
      BigDecimal kwh = new BigDecimal(kwhStr);

      Bill bill = batch.insertBill(mpanCore.getSupply(), account,
          reference, issueDate, startDate, finishDate, kwh, net, vat,
          gross, type, breakdown);
      for (int i = 15; i < values.length; i += 11) {
        String meterSerialNumber = GeneralImport.addField(csvElement,
            "Meter Serial Number", values, i);
        String mpanStr = GeneralImport.addField(csvElement, "MPAN",
            values, i + 1);
        String coefficientStr = GeneralImport.addField(csvElement,
            "Coefficient", values, i + 2);
        BigDecimal coefficient = new BigDecimal(coefficientStr);
        String unitsStr = GeneralImport.addField(csvElement, "Units",
            values, i + 3);
        Units units = Units.getUnits(unitsStr);
        String tprStr = GeneralImport.addField(csvElement, "TPR",
            values, i + 4);
        Tpr tpr = null;
        if (tprStr.length() > 0) {
          tpr = Tpr.getTpr(tprStr);
        }
        String previousDateStr = GeneralImport.addField(csvElement,
            "Previous Date", values, i + 5);
        HhStartDate previousDate = new HhStartDate(previousDateStr);
        String previousValueStr = GeneralImport.addField(csvElement,
            "Previous Value", values, i + 6);
        BigDecimal previousValue = new BigDecimal(previousValueStr);

        String previousTypeStr = GeneralImport.addField(csvElement,
            "Previous Type", values, i + 7);
        ReadType previousType = ReadType.getReadType(previousTypeStr);

        String presentDateStr = GeneralImport.addField(csvElement,
            "Present Date", values, i + 8);
        HhStartDate presentDate = new HhStartDate(presentDateStr);
        String presentValueStr = GeneralImport.addField(csvElement,
            "Present Value", values, i + 9);
        BigDecimal presentValue = new BigDecimal(presentValueStr);

        String presentTypeStr = GeneralImport.addField(csvElement,
            "Present Type", values, i + 10);
        ReadType presentType = ReadType.getReadType(presentTypeStr);
        bill.insertRead(tpr, coefficient, units, meterSerialNumber,
            mpanStr, previousDate, previousValue, previousType,
            presentDate, presentValue, presentType);
      }
    } else if (action.equals("update")) {
      String billIdStr = GeneralImport.addField(csvElement, "Bill Id",
          values, 0);
      Bill bill = Bill.getBill(Long.parseLong(billIdStr));

      String account = GeneralImport.addField(csvElement,
          "Account Reference", values, 1);
      if (account.equals(GeneralImport.NO_CHANGE)) {
        account = bill.getAccount();
      }

      String reference = GeneralImport.addField(csvElement, "Reference",
          values, 2);
      if (reference.equals(GeneralImport.NO_CHANGE)) {
        reference = bill.getReference();
      }

      String issueDateStr = GeneralImport.addField(csvElement,
          "Issue Date", values, 3);
      Date issueDate = null;
      if (issueDateStr.equals(GeneralImport.NO_CHANGE)) {
        issueDate = bill.getIssueDate();
      } else {
        issueDate = new MonadDate(issueDateStr).getDate();
      }

      String startDateStr = GeneralImport.addField(csvElement,
          "Start Date", values, 4);
      HhStartDate startDate = null;
View Full Code Here

    setBreakdown(breakdown);
  }

  public Element toXml(Document doc) throws HttpException {
    Element element = super.toXml(doc, "bill");
    element.appendChild(new MonadDate("issue", issueDate).toXml(doc));
    startDate.setLabel("start");
    element.appendChild(startDate.toXml(doc));
    finishDate.setLabel("finish");
    element.appendChild(finishDate.toXml(doc));
    element.setAttribute("kwh", kwh.toString());
View Full Code Here

    }
    source.appendChild(MonadDate.getMonthsXml(doc));
    source.appendChild(MonadDate.getDaysXml(doc));
    source.appendChild(MonadDate.getHoursXml(doc));
    source.appendChild(HhStartDate.getHhMinutesXml(doc));
    source.appendChild(new MonadDate().toXml(doc));
    return doc;
  }
View Full Code Here

    }
    source.appendChild(MonadDate.getMonthsXml(doc));
    source.appendChild(MonadDate.getDaysXml(doc));
    source.appendChild(MonadDate.getHoursXml(doc));
    source.appendChild(HhStartDate.getHhMinutesXml(doc));
    source.appendChild(new MonadDate().toXml(doc));
    return doc;
  }
View Full Code Here

      String gspGroupCode = GeneralImport.addField(csvElement,
          "GSP Group", values, 4);
      GspGroup gspGroup = GspGroup.getGspGroup(gspGroupCode);
      String startDateStr = GeneralImport.addField(csvElement,
          "Start date", values, 5);
      HhStartDate startDate = HhStartDate.roundUp(new MonadDate(
          startDateStr).getDate());
      String finishDateStr = GeneralImport.addField(csvElement,
          "Finish date", values, 6);
      HhStartDate finishDate = finishDateStr.trim().length() > 0 ? HhStartDate
          .roundUp(new MonadDate(finishDateStr).getDate()) : null;
      String mopContractName = GeneralImport.addField(csvElement,
          "MOP Contract", values, 7);
      MopContract mopContract = mopContractName.length() == 0 ? null
          : MopContract.getMopContract(mopContractName);
      String mopAccount = GeneralImport.addField(csvElement,
View Full Code Here

        .list()) {
      source.appendChild(type.toXml(doc));
    }
    source.appendChild(MonadDate.getMonthsXml(doc));
    source.appendChild(MonadDate.getDaysXml(doc));
    source.appendChild(new MonadDate().toXml(doc));
    for (GspGroup group : (List<GspGroup>) Hiber.session()
        .createQuery("from GspGroup group order by group.code").list()) {
      source.appendChild(group.toXml(doc));
    }
View Full Code Here

        .createQuery(
            "from Party party where party.role.code = :roleCode order by party.participant.code")
        .setCharacter("roleCode", MarketRole.MOP).list()) {
      source.appendChild(party.toXml(doc, new XmlTree("participant")));
    }
    source.appendChild(new MonadDate().toXml(doc));
    source.appendChild(MonadDate.getMonthsXml(doc));
    source.appendChild(MonadDate.getDaysXml(doc));
    return doc;
  }
View Full Code Here

TOP

Related Classes of net.sf.chellow.monad.types.MonadDate

Copyright © 2018 www.massapicom. 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.