public Lock (final Subject s, final long lockTimeout) { this.locker = s; this.lockTimeout = lockTimeout; touch(); }
/** * Inserts a workitem in the store. * This method takes no Subject as parameter because it is used * by listeners, not clients. */ public void store (final InFlowWorkItem wi) throws StoreException { this.putStrategy.put(wi); }
/** * A short cut to get the parent store's name. */ public String getStoreName () { return this.store.getName(); }
/** * Returns the number of workitems in a store. */ public int countWorkItems (final String storeName) throws StoreException { return getCachedStorage().countWorkItems(storeName); }
/** * This implementation simply calls the underlying storage's * storeWorkItem() method. */ public void put (final InFlowWorkItem wi) throws StoreException { getStorage().storeWorkItem(getStoreName(), wi); }
/** * An iterator on the stored workitems themselves. */ public java.util.Iterator iterator () throws WorkListException { return getStorage().listWorkItems(this.listName, -1).iterator(); }
/** * Returns a workitem from its given id. */ public InFlowWorkItem get (final FlowExpressionId fei) throws WorkListException { return getStorage().retrieveWorkItem(this.listName, fei); }
/** * Removes a workitem from the underlying storage. */ public void remove (final FlowExpressionId id) throws StoreException { getStorage().removeWorkItem(getStoreName(), id); }
/** * Returns the store entry for the given store. * Will throw a StoreException if the store is not present. */ protected StoreEntry getStore (final String storeName) throws StoreException { StoreEntry result = (StoreEntry)this.storeMap.get(storeName); if (result != null) return result; throw new StoreException ("There is no store named '"+storeName+"' here."); }
/** * Returns true if the given workitem (id) has been locked by another * subject (principal). */ public boolean isLockedBySomeoneElse (final Subject s, final FlowExpressionId workitemId) { final Lock l = getLock(workitemId); if (l == null) return false; return ! l.getLocker().equals(s); }
/** * Locks a workitem. Internal usage. */ protected void lockWorkItem (final Subject s, final FlowExpressionId workitemId) { this.lockMap.put(workitemId, new Lock(s, this.lockTimeout)); if (log.isDebugEnabled()) log.debug("lockWorkItem() locked "+workitemId); }
/** * 'Cancels' a workitem, either remove it, either flags it as cancelled */ public void cancel (final CancelItem ci) throws StoreException { this.putStrategy.remove(ci.getId()); }
/** * Returns the count of workitems found in this store. */ public int countWorkItems (final Subject s) throws StoreException { java.security.AccessController.checkPermission (StorePermission.newStorePermission(getName(), "browse")); return this.getStrategy.countWorkItems(s); }
/** * Returns how much workitems are stored in this list. */ public int countWorkItems () throws WorkListException { return getStorage().countWorkItems(this.listName); }
/** * Saves a workitem. */ public void save (final InFlowWorkItem wi) throws WorkListException { getStorage().storeWorkItem(this.listName, (InFlowWorkItem)wi.clone()); }
public java.util.List listWorkItems (final Subject s, final int limit) throws StoreException { return getStorage().listWorkItems(getStoreName(), limit); }
public InFlowWorkItem retrieveWorkItem (final Subject s, final FlowExpressionId fei) throws StoreException { return getStorage().retrieveWorkItem(getStoreName(), fei); }
/** * The worklist as good a embedded participant, implements this cancel() * method (which removes regular workitems). */ public void cancel (final CancelItem ci) throws Exception { //getStorage().removeWorkItem(this.listName, ci.getLastExpressionId()); getStorage().removeWorkItem(this.listName, ci.getId()); }
/** * Returns the name of the locker of this workitem, or null if the * workitem is not locked. */ public String getLockerName (final FlowExpressionId workitemId) { final Lock l = getLock(workitemId); if (l == null) return null; return BasicPrincipal.getBasicPrincipal(l.getLocker()).getName(); }
public int countWorkItems (final Subject s) throws StoreException { return getStorage().countWorkItems(getStoreName()); }