Esempio n. 1
0
  @SuppressWarnings("unchecked")
  public List<BpelEvent> listEvents() {
    entering("ScopeDaoImpl.listEvents");
    //        CriteriaBuilder cb = new CriteriaBuilder();
    Criteria crit = _sm.getSession().createCriteria(HBpelEvent.class);
    //        if (efilter != null)
    //            cb.buildCriteria(crit, efilter);
    crit.add(Restrictions.eq("scopeId", _scope.getId()));

    List<HBpelEvent> hevents = crit.list();
    List<BpelEvent> ret = new ArrayList<BpelEvent>(hevents.size());
    try {
      CollectionsX.transformEx(
          ret,
          hevents,
          new UnaryFunctionEx<HBpelEvent, BpelEvent>() {
            public BpelEvent apply(HBpelEvent x) throws Exception {
              return (BpelEvent)
                  SerializableUtils.toObject(x.getData(), BpelEvent.class.getClassLoader());
            }
          });
    } catch (Exception ex) {
      throw new RuntimeException(ex);
    }
    return ret;
  }
Esempio n. 2
0
  /** @see org.apache.ode.bpel.dao.ScopeDAO#getCorrelationSet(java.lang.String) */
  public CorrelationSetDAO getCorrelationSet(String corrSetName) {
    entering("ScopeDaoImpl.getCorrelationSet");
    Query qry = getSession().createQuery(QRY_CSET);
    qry.setString(0, corrSetName);
    qry.setLong(1, _scope.getId());
    HCorrelationSet cs;
    List res = qry.list();

    if (res.size() == 0) {
      // if it doesn't exist, we make it
      cs = new HCorrelationSet(_scope, corrSetName);
      //            _scope.addCorrelationSet(cs);
      getSession().save(cs);
    } else {
      cs = (HCorrelationSet) res.get(0);
    }
    return new CorrelationSetDaoImpl(_sm, cs);
  }
Esempio n. 3
0
  /** @see org.apache.ode.bpel.dao.ScopeDAO#getVariable(java.lang.String) */
  public XmlDataDAO getVariable(String varName) {
    entering("ScopeDaoImpl.getVariable");
    XmlDataDAO cached = _variables.get(varName);
    if (cached != null) return _variables.get(varName);

    HXmlData data = null;
    for (HXmlData e : _scope.getVariables()) {
      if (e.getName().equals(varName) && e.getScope().getId().equals(_scope.getId())) {
        data = e;
      }
    }
    if (data == null) {
      data = new HXmlData();
      data.setName(varName);
      data.setScope(_scope);
      _scope.getVariables().add(data);
    }

    XmlDataDaoImpl varDao = new XmlDataDaoImpl(_sm, data);
    _variables.put(varName, varDao);
    return varDao;
  }
Esempio n. 4
0
 /** @see org.apache.ode.bpel.dao.ScopeDAO#getScopeInstanceId() */
 public Long getScopeInstanceId() {
   return _scope.getId();
 }