[Fix] Fixed errors due to new feature versioning

* When initializing the version was not set
* template copies had a version set
This commit is contained in:
Robert von Burg 2016-08-20 18:24:21 +02:00
parent 249ba41944
commit acf3c12313
4 changed files with 10 additions and 5 deletions

View File

@ -96,7 +96,6 @@ public abstract class CachedElementMap<T extends StrolchRootElement> implements
@SuppressWarnings("unchecked")
T clone = (T) t.getClone();
clone.setVersion(t.getVersion());
return clone;
}

View File

@ -17,6 +17,7 @@ package li.strolch.agent.impl;
import li.strolch.model.Order;
import li.strolch.model.Resource;
import li.strolch.model.Version;
import li.strolch.model.activity.Activity;
import li.strolch.model.xml.StrolchElementListener;
import li.strolch.persistence.api.ActivityDao;
@ -40,16 +41,22 @@ public class StoreToDaoElementListener implements StrolchElementListener {
@Override
public void notifyResource(Resource resource) {
if (tx.isVersioningEnabled() && resource.getVersion() == null)
Version.setInitialVersionFor(resource, tx.getCertificate().getUsername());
this.resourceDao.save(resource);
}
@Override
public void notifyOrder(Order order) {
if (tx.isVersioningEnabled() && order.getVersion() == null)
Version.setInitialVersionFor(order, tx.getCertificate().getUsername());
this.orderDao.save(order);
}
@Override
public void notifyActivity(Activity activity) {
if (tx.isVersioningEnabled() && activity.getVersion() == null)
Version.setInitialVersionFor(activity, tx.getCertificate().getUsername());
this.activityDao.save(activity);
}
}

View File

@ -92,7 +92,6 @@ public abstract class TransactionalElementMap<T extends StrolchRootElement> impl
@SuppressWarnings("unchecked")
T clone = (T) t.getClone();
clone.setVersion(t.getVersion());
return clone;
}

View File

@ -21,6 +21,9 @@ import static li.strolch.runtime.StrolchConstants.makeRealmKey;
import java.io.File;
import java.text.MessageFormat;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import li.strolch.agent.api.RealmHandler;
import li.strolch.agent.api.StrolchAgent;
import li.strolch.agent.impl.StoreToDaoElementListener;
@ -34,9 +37,6 @@ import li.strolch.runtime.configuration.ComponentConfiguration;
import li.strolch.runtime.configuration.RuntimeConfiguration;
import li.strolch.runtime.configuration.StrolchConfiguration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* @author Robert von Burg <eitch@eitchnet.ch>
*/