Package net.sf.chellow.monad

Examples of net.sf.chellow.monad.UserException


  public Object getRate(String rateName) throws HttpException {
    Object rate = null;
    try {
      rate = invocableEngine().invokeFunction(rateName, new Object[0]);
    } catch (ScriptException e) {
      throw new UserException(e.getMessage());
    } catch (NoSuchMethodException e) {
      throw new UserException("The rate script " + getEditUri()
          + " has no such method: " + e.getMessage());
    } catch (PyException e) {
      Object obj = e.value.__tojava__(HttpException.class);
      if (obj instanceof HttpException) {
        throw (HttpException) obj;
      } else {
        throw new UserException(e.toString());
      }
    }
    return rate;
  }
View Full Code Here


    List<Exception> exceptions = su.getExceptions();
    if (exceptions.size() > 0) {
      for (Exception exception : exceptions) {
        exception.printStackTrace();
      }
      throw new UserException("Errors in schema generation.");
    }
    Hiber.setReadWrite();
    Configuration.getConfiguration();

    VoltageLevel.insertVoltageLevels();
View Full Code Here

  }

  static public MeterType getMeterType(Long id) throws HttpException {
    MeterType type = (MeterType) Hiber.session().get(MeterType.class, id);
    if (type == null) {
      throw new UserException(
          "There is no meter timeswitch class meter type with that id.");
    }
    return type;
  }
View Full Code Here

    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 {
      MopContract contract = MopContract.insertMopContract(null,
          Participant.getParticipant(participantId), name,
          HhStartDate.roundDown(startDate), null, "", null, "");
View Full Code Here

        : sdIsoDate();

    try {
      date = sdFormat.parse(dateStr);
    } catch (ParseException e) {
      throw new UserException("The date '" + dateStr
          + "' must be of the form yyyy-MM-dd or yyyy-MM-ddThh:mmZ.");
    }
    setDate(date);
  }
View Full Code Here

    cal.clear();
    try {
      cal.set(year, month - 1, day);
      update(cal.getTime());
    } catch (IllegalArgumentException e) {
      throw new UserException("Invalid date.");
    }
  }
View Full Code Here

    cal.clear();
    try {
      cal.set(year, month - 1, day, hour, minute);
      update(cal.getTime());
    } catch (IllegalArgumentException e) {
      throw new UserException("Invalid date.");
    }
  }
View Full Code Here

    Document doc = MonadUtils.newSourceDocument();
    Element source = doc.getDocumentElement();

    String properties = inv.getString("properties");
    if (!inv.isValid()) {
      throw new UserException();
    }
    properties = properties.replace("\r", "").replace("\t", "    ");

    Element propertiesElement = doc.createElement("properties");
    source.appendChild(propertiesElement);
View Full Code Here

      HhStartDate finishDate, String chargeScript,
      String importerProperties, String state, Long rateScriptId,
      String rateScript) throws HttpException {
    HhdcContract existing = findHhdcContract(name);
    if (existing != null) {
      throw new UserException(
          "There's already a HHDC contract with the name " + name);
    }
    HhdcContract contract = new HhdcContract(id, participant, name,
        startDate, finishDate, chargeScript, importerProperties, state);
    Hiber.session().save(contract);
View Full Code Here

  }

  public static HhdcContract getHhdcContract(Long id) throws HttpException {
    HhdcContract contract = findHhdcContract(id);
    if (contract == null) {
      throw new UserException("There isn't a HHDC contract with that id.");
    }
    return contract;
  }
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.