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
 public Set<CorrelationSetDAO> getCorrelationSets() {
   entering("ScopeDaoImpl.getCorrelationSets");
   Set<CorrelationSetDAO> results = new HashSet<CorrelationSetDAO>();
   for (HCorrelationSet hCorrelationSet : _scope.getCorrelationSets()) {
     results.add(new CorrelationSetDaoImpl(_sm, hCorrelationSet));
   }
   return results;
 }
Esempio n. 3
0
 public Collection<PartnerLinkDAO> getPartnerLinks() {
   entering("ScopeDaoImpl.getPartnerLinks");
   ArrayList<PartnerLinkDAO> plinks = new ArrayList<PartnerLinkDAO>();
   for (HPartnerLink hPartnerLink : _scope.getPartnerLinks()) {
     plinks.add(new PartnerLinkDAOImpl(_sm, hPartnerLink));
   }
   return plinks;
 }
Esempio n. 4
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. 5
0
 @SuppressWarnings("unchecked")
 public Collection<XmlDataDAO> getVariables() {
   entering("ScopeDaoImpl.getVariables");
   Query q = getSession().createFilter(_scope.getVariables(), "where this.scope=?");
   q.setEntity(0, _scope);
   return CollectionsX.transform(
       new LinkedList<XmlDataDAO>(),
       (Collection<HXmlData>) q.list(),
       new UnaryFunction<HXmlData, XmlDataDAO>() {
         public XmlDataDAO apply(HXmlData x) {
           return new XmlDataDaoImpl(_sm, x);
         }
       });
 }
Esempio n. 6
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. 7
0
 /** @see org.apache.ode.bpel.dao.ScopeDAO#getProcessInstance() */
 public ProcessInstanceDAO getProcessInstance() {
   entering("ScopeDaoImpl.getProcessInstance");
   return new ProcessInstanceDaoImpl(_sm, _scope.getInstance());
 }
Esempio n. 8
0
 /** @see org.apache.ode.bpel.dao.ScopeDAO#getParentScope() */
 public ScopeDAO getParentScope() {
   entering("ScopeDaoImpl.getParentScope");
   return _scope.getParentScope() != null ? new ScopeDaoImpl(_sm, _scope.getParentScope()) : null;
 }
Esempio n. 9
0
 /** @see org.apache.ode.bpel.dao.ScopeDAO#getModelId() */
 public int getModelId() {
   return _scope.getScopeModelId();
 }
Esempio n. 10
0
 /** @see org.apache.ode.bpel.dao.ScopeDAO#getScopeInstanceId() */
 public Long getScopeInstanceId() {
   return _scope.getId();
 }
Esempio n. 11
0
 /** @see org.apache.ode.bpel.dao.ScopeDAO#getName() */
 public String getName() {
   return _scope.getName();
 }
Esempio n. 12
0
 /** @see org.apache.ode.bpel.dao.ScopeDAO#getState() */
 public ScopeStateEnum getState() {
   return ScopeStateEnum.valueOf(_scope.getState());
 }
Esempio n. 13
0
 /** @see org.apache.ode.bpel.dao.ScopeDAO#setState(org.apache.ode.bpel.dao.ScopeStateEnum) */
 public void setState(ScopeStateEnum state) {
   entering("ScopeDaoImpl.setState");
   _scope.setState(state.toString());
   getSession().update(_scope);
 }