[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:
parent
249ba41944
commit
acf3c12313
|
@ -96,7 +96,6 @@ public abstract class CachedElementMap<T extends StrolchRootElement> implements
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
T clone = (T) t.getClone();
|
T clone = (T) t.getClone();
|
||||||
clone.setVersion(t.getVersion());
|
|
||||||
return clone;
|
return clone;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@ package li.strolch.agent.impl;
|
||||||
|
|
||||||
import li.strolch.model.Order;
|
import li.strolch.model.Order;
|
||||||
import li.strolch.model.Resource;
|
import li.strolch.model.Resource;
|
||||||
|
import li.strolch.model.Version;
|
||||||
import li.strolch.model.activity.Activity;
|
import li.strolch.model.activity.Activity;
|
||||||
import li.strolch.model.xml.StrolchElementListener;
|
import li.strolch.model.xml.StrolchElementListener;
|
||||||
import li.strolch.persistence.api.ActivityDao;
|
import li.strolch.persistence.api.ActivityDao;
|
||||||
|
@ -40,16 +41,22 @@ public class StoreToDaoElementListener implements StrolchElementListener {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void notifyResource(Resource resource) {
|
public void notifyResource(Resource resource) {
|
||||||
|
if (tx.isVersioningEnabled() && resource.getVersion() == null)
|
||||||
|
Version.setInitialVersionFor(resource, tx.getCertificate().getUsername());
|
||||||
this.resourceDao.save(resource);
|
this.resourceDao.save(resource);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void notifyOrder(Order order) {
|
public void notifyOrder(Order order) {
|
||||||
|
if (tx.isVersioningEnabled() && order.getVersion() == null)
|
||||||
|
Version.setInitialVersionFor(order, tx.getCertificate().getUsername());
|
||||||
this.orderDao.save(order);
|
this.orderDao.save(order);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void notifyActivity(Activity activity) {
|
public void notifyActivity(Activity activity) {
|
||||||
|
if (tx.isVersioningEnabled() && activity.getVersion() == null)
|
||||||
|
Version.setInitialVersionFor(activity, tx.getCertificate().getUsername());
|
||||||
this.activityDao.save(activity);
|
this.activityDao.save(activity);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -92,7 +92,6 @@ public abstract class TransactionalElementMap<T extends StrolchRootElement> impl
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
T clone = (T) t.getClone();
|
T clone = (T) t.getClone();
|
||||||
clone.setVersion(t.getVersion());
|
|
||||||
return clone;
|
return clone;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,9 @@ import static li.strolch.runtime.StrolchConstants.makeRealmKey;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import li.strolch.agent.api.RealmHandler;
|
import li.strolch.agent.api.RealmHandler;
|
||||||
import li.strolch.agent.api.StrolchAgent;
|
import li.strolch.agent.api.StrolchAgent;
|
||||||
import li.strolch.agent.impl.StoreToDaoElementListener;
|
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.RuntimeConfiguration;
|
||||||
import li.strolch.runtime.configuration.StrolchConfiguration;
|
import li.strolch.runtime.configuration.StrolchConfiguration;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Robert von Burg <eitch@eitchnet.ch>
|
* @author Robert von Burg <eitch@eitchnet.ch>
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue