[New] Added StrolchTransaction.getResourceFor(Action)
This commit is contained in:
parent
5c5a3afbbc
commit
394c3735e3
|
@ -30,6 +30,7 @@ import li.strolch.handler.operationslog.LogMessage;
|
||||||
import li.strolch.handler.operationslog.LogSeverity;
|
import li.strolch.handler.operationslog.LogSeverity;
|
||||||
import li.strolch.handler.operationslog.OperationsLog;
|
import li.strolch.handler.operationslog.OperationsLog;
|
||||||
import li.strolch.model.*;
|
import li.strolch.model.*;
|
||||||
|
import li.strolch.model.activity.Action;
|
||||||
import li.strolch.model.activity.Activity;
|
import li.strolch.model.activity.Activity;
|
||||||
import li.strolch.model.activity.IActivityElement;
|
import li.strolch.model.activity.IActivityElement;
|
||||||
import li.strolch.model.audit.AccessType;
|
import li.strolch.model.audit.AccessType;
|
||||||
|
@ -631,6 +632,18 @@ public abstract class AbstractTransaction implements StrolchTransaction {
|
||||||
return elements;
|
return elements;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Resource getResourceFor(Action action) throws StrolchException {
|
||||||
|
return getResourceFor(action, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Resource getResourceFor(Action action, boolean assertExists) throws StrolchException {
|
||||||
|
DBC.PRE.assertNotEmpty("action.resourceType must be set", action.getResourceType());
|
||||||
|
DBC.PRE.assertNotEmpty("action.resourceId must be set", action.getResourceId());
|
||||||
|
return getResourceBy(action.getResourceType(), action.getResourceId(), assertExists);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Activity getActivityBy(String type, String id) {
|
public Activity getActivityBy(String type, String id) {
|
||||||
return getActivityBy(type, id, false);
|
return getActivityBy(type, id, false);
|
||||||
|
|
|
@ -35,6 +35,7 @@ import li.strolch.model.Resource;
|
||||||
import li.strolch.model.StrolchElement;
|
import li.strolch.model.StrolchElement;
|
||||||
import li.strolch.model.StrolchRootElement;
|
import li.strolch.model.StrolchRootElement;
|
||||||
import li.strolch.model.Tags;
|
import li.strolch.model.Tags;
|
||||||
|
import li.strolch.model.activity.Action;
|
||||||
import li.strolch.model.activity.Activity;
|
import li.strolch.model.activity.Activity;
|
||||||
import li.strolch.model.audit.AccessType;
|
import li.strolch.model.audit.AccessType;
|
||||||
import li.strolch.model.audit.Audit;
|
import li.strolch.model.audit.Audit;
|
||||||
|
@ -763,6 +764,36 @@ public interface StrolchTransaction extends AutoCloseable {
|
||||||
*/
|
*/
|
||||||
public List<Resource> getResourcesBy(StringListParameter refP, boolean assertExists) throws StrolchException;
|
public List<Resource> getResourcesBy(StringListParameter refP, boolean assertExists) throws StrolchException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Returns the {@link Resource} for the given {@link Action}. This is done by getting the resource by {@link Action#getResourceType()} and {@link Action#getResourceId()}</p>
|
||||||
|
*
|
||||||
|
* <p>Should the resource not exist, then null is returned</p>
|
||||||
|
*
|
||||||
|
* @param action
|
||||||
|
* the action for which to return the resoruce
|
||||||
|
*
|
||||||
|
* @return the resource referenced by the action, or null if it does not exist
|
||||||
|
*
|
||||||
|
* @throws StrolchException
|
||||||
|
* if the action is null, or something else goes wrong
|
||||||
|
*/
|
||||||
|
public Resource getResourceFor(Action action) throws StrolchException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Returns the {@link Resource} for the given {@link Action}. This is done by getting the resource by {@link Action#getResourceType()} and {@link Action#getResourceId()}</p>
|
||||||
|
*
|
||||||
|
* <p>Should the resource not exist and <code>assertExists</code> is true, then an exception is thrown, otherwise null is returned</p>
|
||||||
|
*
|
||||||
|
* @param action
|
||||||
|
* the action for which to return the resoruce
|
||||||
|
*
|
||||||
|
* @return the resource referenced by the action. If the resource does not exist and <code>assertExists</code> is true then an exception is thrown, otherwise null is returnee
|
||||||
|
*
|
||||||
|
* @throws StrolchException
|
||||||
|
* if the action is null and <code>assertExists</code> is true, or something else goes wrong
|
||||||
|
*/
|
||||||
|
public Resource getResourceFor(Action action, boolean assertExists) throws StrolchException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the {@link Activity} with the given type and id, or null if it does not exist
|
* Returns the {@link Activity} with the given type and id, or null if it does not exist
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue