[Major] rename add/update/remove methods in StrolchTransaction

This commit is contained in:
Robert von Burg 2017-10-03 11:41:30 +02:00
parent 90a81b6725
commit 2c5dddd893
5 changed files with 47 additions and 47 deletions

View File

@ -668,55 +668,55 @@ public abstract class AbstractTransaction implements StrolchTransaction {
}
@Override
public void addResource(Resource resource) throws StrolchModelException {
public void add(Resource resource) throws StrolchModelException {
DBC.PRE.assertNotNull("resource must not be null", resource);
getObjectFilter().add(Tags.RESOURCE, resource);
}
@Override
public void addOrder(Order order) throws StrolchException {
public void add(Order order) throws StrolchException {
DBC.PRE.assertNotNull("order must not be null", order);
getObjectFilter().add(Tags.ORDER, order);
}
@Override
public void addActivity(Activity activity) throws StrolchException {
public void add(Activity activity) throws StrolchException {
DBC.PRE.assertNotNull("activity must not be null", activity);
getObjectFilter().add(Tags.ACTIVITY, activity);
}
@Override
public void updateResource(Resource resource) throws StrolchException {
public void update(Resource resource) throws StrolchException {
DBC.PRE.assertNotNull("resource must not be null", resource);
getObjectFilter().update(Tags.RESOURCE, resource);
}
@Override
public void updateOrder(Order order) {
public void update(Order order) {
DBC.PRE.assertNotNull("order must not be null", order);
getObjectFilter().update(Tags.ORDER, order);
}
@Override
public void updateActivity(Activity activity) throws StrolchException {
public void update(Activity activity) throws StrolchException {
DBC.PRE.assertNotNull("activity must not be null", activity);
getObjectFilter().update(Tags.ACTIVITY, activity);
}
@Override
public void removeResource(Resource resource) throws StrolchException {
public void remove(Resource resource) throws StrolchException {
DBC.PRE.assertNotNull("resource must not be null", resource);
getObjectFilter().remove(Tags.RESOURCE, resource);
}
@Override
public void removeOrder(Order order) throws StrolchException {
public void remove(Order order) throws StrolchException {
DBC.PRE.assertNotNull("order must not be null", order);
getObjectFilter().remove(Tags.ORDER, order);
}
@Override
public void removeActivity(Activity activity) throws StrolchException {
public void remove(Activity activity) throws StrolchException {
DBC.PRE.assertNotNull("activity must not be null", activity);
getObjectFilter().remove(Tags.ACTIVITY, activity);
}

View File

@ -968,7 +968,7 @@ public interface StrolchTransaction extends AutoCloseable {
* @throws StrolchModelException
* if the resource is null, or a resource with the given ID already exists
*/
public void addResource(Resource resource) throws StrolchModelException;
public void add(Resource resource) throws StrolchModelException;
/**
* Adds and thus persists the given {@link Order} by calling the relevant {@link Command}
@ -979,7 +979,7 @@ public interface StrolchTransaction extends AutoCloseable {
* @throws StrolchModelException
* if the order is null, or an order with the given ID already exists
*/
public void addOrder(Order order) throws StrolchException;
public void add(Order order) throws StrolchException;
/**
* Adds and thus persists the given {@link Activity} by calling the relevant {@link Command}
@ -990,7 +990,7 @@ public interface StrolchTransaction extends AutoCloseable {
* @throws StrolchModelException
* if the activity is null, or an activity with the given ID already exists
*/
public void addActivity(Activity activity) throws StrolchException;
public void add(Activity activity) throws StrolchException;
/**
* Updates the given {@link Resource} by calling the relevant {@link Command}
@ -1001,7 +1001,7 @@ public interface StrolchTransaction extends AutoCloseable {
* @throws StrolchModelException
* if the resource is null
*/
public void updateResource(Resource resource) throws StrolchException;
public void update(Resource resource) throws StrolchException;
/**
* Updates the given {@link Order} by calling the relevant {@link Command}
@ -1012,7 +1012,7 @@ public interface StrolchTransaction extends AutoCloseable {
* @throws StrolchModelException
* if the order is null
*/
public void updateOrder(Order order);
public void update(Order order);
/**
* Updates the given {@link Activity} by calling the relevant {@link Command}
@ -1023,7 +1023,7 @@ public interface StrolchTransaction extends AutoCloseable {
* @throws StrolchModelException
* if the activity is null
*/
public void updateActivity(Activity activity) throws StrolchException;
public void update(Activity activity) throws StrolchException;
/**
* Removes the given {@link Resource} by calling the relevant {@link Command}
@ -1034,7 +1034,7 @@ public interface StrolchTransaction extends AutoCloseable {
* @throws StrolchModelException
* if the resource is null
*/
public void removeResource(Resource resource) throws StrolchException;
public void remove(Resource resource) throws StrolchException;
/**
* Removes the given {@link Order} by calling the relevant {@link Command}
@ -1045,7 +1045,7 @@ public interface StrolchTransaction extends AutoCloseable {
* @throws StrolchModelException
* if the order is null
*/
public void removeOrder(Order order) throws StrolchException;
public void remove(Order order) throws StrolchException;
/**
* Removes the given {@link Activity} by calling the relevant {@link Command}
@ -1056,7 +1056,7 @@ public interface StrolchTransaction extends AutoCloseable {
* @throws StrolchModelException
* if the activity is null
*/
public void removeActivity(Activity activity) throws StrolchException;
public void remove(Activity activity) throws StrolchException;
/**
* Asserts that the current {@link Certificate} has access to the given element with the given operation

View File

@ -141,7 +141,7 @@ public class EventBasedExecutionHandler extends ExecutionHandler {
} else if (state == State.EXECUTION) {
activity.getActionsWithState(State.EXECUTION).forEach(a -> a.setState(State.STOPPED));
}
tx.updateActivity(activity);
tx.update(activity);
// register for execution
this.registeredActivities.addElement(realmName, activity.getLocator());

View File

@ -16,7 +16,7 @@ public class RemoveActivityArchival extends ActivityArchivalPolicy {
if (!activity.getState().isExecuted())
throw new IllegalStateException("Can not archive non-executed " + activity.getLocator());
tx().removeActivity(activity);
tx().remove(activity);
logger.info("Removing " + activity.getLocator());
}

View File

@ -210,7 +210,7 @@ public class InMemoryTransactionTest {
// privilege assertion
tx.assertHasPrivilege(Operation.ADD, newRes);
tx.addResource(newRes);
tx.add(newRes);
tx.commitOnClose();
}
@ -228,7 +228,7 @@ public class InMemoryTransactionTest {
tx.assertHasPrivilege(Operation.UPDATE, res);
res.setName("Foo foo");
tx.updateResource(res);
tx.update(res);
tx.commitOnClose();
}
@ -245,7 +245,7 @@ public class InMemoryTransactionTest {
// privilege assertion
tx.assertHasPrivilege(Operation.REMOVE, res);
tx.removeResource(res);
tx.remove(res);
tx.commitOnClose();
}
@ -257,7 +257,7 @@ public class InMemoryTransactionTest {
// create again
newRes = ModelGenerator.createResource(id, "200", type);
try (StrolchTransaction tx = openTx(realmName)) {
tx.addResource(newRes);
tx.add(newRes);
tx.commitOnClose();
}
@ -278,7 +278,7 @@ public class InMemoryTransactionTest {
// privilege assertion
tx.assertHasPrivilege(Operation.ADD, newOrder);
tx.addOrder(newOrder);
tx.add(newOrder);
tx.commitOnClose();
}
@ -296,7 +296,7 @@ public class InMemoryTransactionTest {
tx.assertHasPrivilege(Operation.UPDATE, order);
order.setName("Foo foo");
tx.updateOrder(order);
tx.update(order);
tx.commitOnClose();
}
@ -313,7 +313,7 @@ public class InMemoryTransactionTest {
// privilege assertion
tx.assertHasPrivilege(Operation.REMOVE, order);
tx.removeOrder(order);
tx.remove(order);
tx.commitOnClose();
}
@ -325,7 +325,7 @@ public class InMemoryTransactionTest {
// create again
newOrder = ModelGenerator.createOrder(id, "200", type);
try (StrolchTransaction tx = openTx(realmName)) {
tx.addOrder(newOrder);
tx.add(newOrder);
tx.commitOnClose();
}
@ -346,7 +346,7 @@ public class InMemoryTransactionTest {
// privilege assertion
tx.assertHasPrivilege(Operation.ADD, newActivity);
tx.addActivity(newActivity);
tx.add(newActivity);
tx.commitOnClose();
}
@ -364,7 +364,7 @@ public class InMemoryTransactionTest {
tx.assertHasPrivilege(Operation.UPDATE, activity);
activity.setName("Foo foo");
tx.updateActivity(activity);
tx.update(activity);
tx.commitOnClose();
}
@ -381,7 +381,7 @@ public class InMemoryTransactionTest {
// privilege assertion
tx.assertHasPrivilege(Operation.REMOVE, activity);
tx.removeActivity(activity);
tx.remove(activity);
tx.commitOnClose();
}
@ -393,7 +393,7 @@ public class InMemoryTransactionTest {
// create again
newActivity = ModelGenerator.createActivity(id, "200", type, TimeOrdering.SERIES);
try (StrolchTransaction tx = openTx(realmName)) {
tx.addActivity(newActivity);
tx.add(newActivity);
tx.commitOnClose();
}
@ -410,9 +410,9 @@ public class InMemoryTransactionTest {
// create and update
Resource newRes = ModelGenerator.createResource(id, "200", type);
try (StrolchTransaction tx = openTx(realmName)) {
tx.addResource(newRes);
tx.add(newRes);
newRes.setName("Foo foo!");
tx.updateResource(newRes);
tx.update(newRes);
tx.commitOnClose();
}
@ -429,10 +429,10 @@ public class InMemoryTransactionTest {
// create, update and remove
Resource newRes = ModelGenerator.createResource(id, "200", type);
try (StrolchTransaction tx = openTx(realmName)) {
tx.addResource(newRes);
tx.add(newRes);
newRes.setName("Foo foo!");
tx.updateResource(newRes);
tx.removeResource(newRes);
tx.update(newRes);
tx.remove(newRes);
tx.commitOnClose();
}
@ -449,9 +449,9 @@ public class InMemoryTransactionTest {
// create and update
Order newOrder = ModelGenerator.createOrder(id, "200", type);
try (StrolchTransaction tx = openTx(realmName)) {
tx.addOrder(newOrder);
tx.add(newOrder);
newOrder.setName("Foo foo!");
tx.updateOrder(newOrder);
tx.update(newOrder);
tx.commitOnClose();
}
@ -468,10 +468,10 @@ public class InMemoryTransactionTest {
// create and update
Order newOrder = ModelGenerator.createOrder(id, "200", type);
try (StrolchTransaction tx = openTx(realmName)) {
tx.addOrder(newOrder);
tx.add(newOrder);
newOrder.setName("Foo foo!");
tx.updateOrder(newOrder);
tx.removeOrder(newOrder);
tx.update(newOrder);
tx.remove(newOrder);
tx.commitOnClose();
}
@ -488,9 +488,9 @@ public class InMemoryTransactionTest {
// create and update
Activity newActivity = ModelGenerator.createActivity(id, "200", type, TimeOrdering.SERIES);
try (StrolchTransaction tx = openTx(realmName)) {
tx.addActivity(newActivity);
tx.add(newActivity);
newActivity.setName("Foo foo!");
tx.updateActivity(newActivity);
tx.update(newActivity);
tx.commitOnClose();
}
@ -507,10 +507,10 @@ public class InMemoryTransactionTest {
// create, update and remove
Activity newActivity = ModelGenerator.createActivity(id, "200", type, TimeOrdering.SERIES);
try (StrolchTransaction tx = openTx(realmName)) {
tx.addActivity(newActivity);
tx.add(newActivity);
newActivity.setName("Foo foo!");
tx.updateActivity(newActivity);
tx.removeActivity(newActivity);
tx.update(newActivity);
tx.remove(newActivity);
tx.commitOnClose();
}