public TransitionTokenDigest(TransitionTokenBean transitionToken) {
    super(null);

    Assert.isNotNull(transitionToken);

    oid = transitionToken.getOID();
    isConsumed = Boolean.valueOf(transitionToken.isConsumed()).booleanValue();

    ITransition transition = transitionToken.getTransition();
    IModel model = transition == null ? null : (IModel) transition.getModel();
    transitionId =
        transition == null ? null : "{" + model.getId() + '}' + transition.getId(); // $NON-NLS-1$
    procDefId =
        transition == null
            ? null
            : "{" + model.getId() + '}' + transition.getProcessDefinition().getId(); // $NON-NLS-1$
  }
Exemplo n.º 2
0
 @Override
 public Collection<IDaemon> getDaemons() {
   List<IModel> models = ModelManagerFactory.getCurrent().findActiveModels();
   if (!models.isEmpty()) {
     Set<String> ids = CollectionUtils.newSet();
     List<IDaemon> daemons = CollectionUtils.newList();
     for (IModel model : models) {
       // Compute and store the model dependent daemons in model for faster lookup
       List<IDaemon> modelDependentDaemons;
       synchronized (model) {
         modelDependentDaemons =
             (List<IDaemon>) model.getRuntimeAttribute(CACHED_DAEMON_FACTORY);
         if (modelDependentDaemons == null) {
           modelDependentDaemons = CollectionUtils.newList();
           for (Iterator i = model.getAllTriggerTypes(); i.hasNext(); ) {
             ITriggerType type = (ITriggerType) i.next();
             if (type.isPullTrigger()) {
               modelDependentDaemons.add(new TriggerDaemon(type));
             }
           }
           model.setRuntimeAttribute(CACHED_DAEMON_FACTORY, modelDependentDaemons);
         }
       }
       // Compute union of all daemons
       // This always has to be computed as the daemons of a model might change
       // if new model version is deployed
       for (IDaemon daemon : modelDependentDaemons) {
         String type = daemon.getType();
         if (!ids.contains(type)) {
           daemons.add(daemon);
           ids.add(type);
         }
       }
     }
     return daemons;
   }
   return Collections.emptyList();
 }