Package net.sf.chellow.monad

Examples of net.sf.chellow.monad.UserException


    Hiber.setReadWrite();
    Long participantId = inv.getLong("participant-id");
    String name = inv.getString("name");
    Date startDate = inv.getDateTime("start");
    if (!inv.isValid()) {
      throw new UserException(document());
    }
    try {
      HhdcContract contract = HhdcContract.insertHhdcContract(null,
          Participant.getParticipant(participantId), name,
          HhStartDate.roundDown(startDate), null, "", "", "", null,
View Full Code Here


  }

  public void deleteGeneration(SupplyGeneration generation)
      throws HttpException {
    if (getGenerations().size() == 1) {
      throw new UserException(
          "The only way to delete the last generation is to delete the entire supply.");
    }
    SupplyGeneration previousGeneration = getGenerationPrevious(generation);
    SupplyGeneration nextGeneration = getGenerationNext(generation);
    if (previousGeneration != null) {
View Full Code Here

        String name = inv.getString("name");
        Long sourceId = inv.getLong("source-id");
        Long gspGroupId = inv.getLong("gsp-group-id");

        if (!inv.isValid()) {
          throw new UserException(document());
        }
        Source supplySource = Source.getSource(sourceId);
        GeneratorType type = null;
        if (supplySource.getCode().equals(Source.GENERATOR_CODE)
            || supplySource.getCode().equals(
                Source.GENERATOR_NETWORK_CODE)) {
          Long generatorTypeId = inv.getLong("generator-type-id");
          if (!inv.isValid()) {
            throw new UserException(document());
          }
          type = GeneratorType.getGeneratorType(generatorTypeId);
        }
        GspGroup gspGroup = GspGroup.getGspGroup(gspGroupId);
        update(name, supplySource, type, gspGroup);
View Full Code Here

    if ((Long) Hiber
        .session()
        .createQuery(
            "select count(bill) from Bill bill where bill.supply = :supply")
        .setEntity("supply", this).uniqueResult() > 0) {
      throw new UserException(
          "One can't delete a supply if there are still bills attached to it.");
    }
    for (SupplyGeneration generation : getGenerations()) {
      generation.delete();
    }
View Full Code Here

  }

  public static MopContract getMopContract(Long id) throws HttpException {
    MopContract contract = findMopContract(id);
    if (contract == null) {
      throw new UserException(
          "There isn't a meter operator contract with that id.");
    }
    return contract;
  }
View Full Code Here

  }

  public static MopContract getMopContract(String name) throws HttpException {
    MopContract contract = findMopContract(name);
    if (contract == null) {
      throw new UserException(
          "There isn't a meter operator contract with that name.");
    }
    return contract;
  }
View Full Code Here

  private void intrinsicUpdate(Participant participant, String name,
      String chargeScript) throws HttpException {
    super.internalUpdate(name, chargeScript);
    MopContract existing = findMopContract(getName());
    if (existing != null && getId() != existing.getId()) {
      throw new UserException(
          "There's already a HHDC contract with the name "
              + getName());
    }
    setParty(Provider.getProvider(participant,
        MarketRole.getMarketRole(MarketRole.MOP)));
View Full Code Here

    } else {
      Long participantId = inv.getLong("participant-id");
      String name = inv.getString("name");
      String chargeScript = inv.getString("charge-script");
      if (!inv.isValid()) {
        throw new UserException(document());
      }
      chargeScript = chargeScript.replace("\r", "").replace("\t", "    ");
      try {
        update(Participant.getParticipant(participantId), name,
            chargeScript);
View Full Code Here

          .setTimestamp("finishDate", getFinishDate().getDate());
    }
    List<Mpan> mpansOutside = query.setEntity("contract", this)
        .setTimestamp("startDate", getStartDate().getDate()).list();
    if (!mpansOutside.isEmpty()) {
      throw new UserException(
          document(),
          mpansOutside.size() > 1 ? "The supply generations with MPAN cores "
              + mpansOutside.get(0).getCore()
              + " and "
              + mpansOutside.get(mpansOutside.size() - 1)
View Full Code Here

  static public VoltageLevel getVoltageLevel(String code)
      throws HttpException {
    VoltageLevel voltageLevel = findVoltageLevel(code);
    if (voltageLevel == null) {
      throw new UserException("There is no voltage level with the code '"
          + code + "'.");
    }
    return voltageLevel;
  }
View Full Code Here

TOP

Related Classes of net.sf.chellow.monad.UserException

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.