コード例 #1
0
  public void update(EventBean[] newData, EventBean[] oldData) {

    System.out.println("AIR FUSION HAS BEEN FIRED ");

    int max_replication = Integer.parseInt(newData[0].get("maxReplication").toString());
    System.out.println("Air max replication " + max_replication);
    String value = newData[0].get("value").toString();
    String bornDate = newData[0].get("maxBornDate").toString();

    value = EvalUtil.setTime("P3", value, ";", "=");

    Resource r = this.getResourceFacade().find(Param.sensor_air);

    ResourceLog lr = new ResourceLog();
    lr.setResourceLogValue(value);
    lr.setResource(r);
    lr.setCreationDate(new Timestamp(new Date().getTime()));

    this.getResourceLogFacade().create(lr);

    Fusion f = this.getFusionFacade().find(Param.sensor_air);

    FusionLog fl = new FusionLog();
    fl.setCreationDate(new Timestamp(new Date().getTime()));
    fl.setFusion(f);
    fl.setFusionLogValue(max_replication + ";" + bornDate);

    this.getFusionLogFacade().create(fl);

    fl = this.getFusionLogFacade().find(fl);
    // System.out.println("ID " + fl.getId());

    ResourceFusionLog rfl = new ResourceFusionLog();
    rfl.setCreationDate(new Timestamp(new Date().getTime()));
    rfl.setFusionLog(fl);
    rfl.setResourceLog(lr);

    this.getResourceFusionLogFacade().create(rfl);

    // String resource = EvalUtil.getParameter("resource", value, ";", "=");
    String UID = EvalUtil.getParameter("UID", value, ";", "=");

    String p3 = EvalUtil.getParameter("P3", value, ";", "=");
    // String rep = EvalUtil.getParameter("REP", value, ";", "=");
    // String exp = EvalUtil.getParameter("EXP", value, ";", "=");

    // Resource res = getResourceFacade().find(Integer.parseInt(resource));

    EvalSdp eval = this.getEvalSdpFacade().find(Long.valueOf(UID));
    eval.setP3(new Timestamp(Long.valueOf(p3)));
    this.getEvalSdpFacade().update(eval);

    Drools drools = new Drools();
    drools.requestRepository(lr, value);
  }
コード例 #2
0
ファイル: EvalSdpDAO.java プロジェクト: ffborelli/impress-dev
 public void delete(EvalSdp obj) {
   super.delete(obj.getId(), EvalSdp.class);
 }