[New] When retrieving new templates, then the type and ID is set auto
This commit is contained in:
parent
f8165208b1
commit
e3ea9fa159
|
@ -25,6 +25,7 @@ import org.slf4j.Logger;
|
|||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import li.strolch.agent.api.ElementMap;
|
||||
import li.strolch.agent.api.StrolchAgent;
|
||||
import li.strolch.agent.api.StrolchRealm;
|
||||
import li.strolch.exception.StrolchException;
|
||||
import li.strolch.model.StrolchRootElement;
|
||||
|
@ -96,6 +97,8 @@ public abstract class CachedElementMap<T extends StrolchRootElement> implements
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
T clone = (T) t.getClone();
|
||||
clone.setId(StrolchAgent.getUniqueId());
|
||||
clone.setType(type);
|
||||
return clone;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ import java.util.Set;
|
|||
import java.util.stream.Collectors;
|
||||
|
||||
import li.strolch.agent.api.ElementMap;
|
||||
import li.strolch.agent.api.StrolchAgent;
|
||||
import li.strolch.agent.api.StrolchRealm;
|
||||
import li.strolch.exception.StrolchException;
|
||||
import li.strolch.model.StrolchRootElement;
|
||||
|
@ -92,6 +93,8 @@ public abstract class TransactionalElementMap<T extends StrolchRootElement> impl
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
T clone = (T) t.getClone();
|
||||
clone.setId(StrolchAgent.getUniqueId());
|
||||
clone.setType(type);
|
||||
return clone;
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,14 @@ import li.strolch.model.visitor.StrolchRootElementVisitor;
|
|||
*/
|
||||
public interface StrolchRootElement extends StrolchElement, PolicyContainer, ParameterBagContainer {
|
||||
|
||||
/**
|
||||
* Set the type of this {@link StrolchRootElement}. Not that this method should only be called for new elements, not
|
||||
* if this element has already been persisted!
|
||||
*
|
||||
* @param type
|
||||
*/
|
||||
public void setType(String type);
|
||||
|
||||
/**
|
||||
* Returns true if this {@link StrolchRootElement} has a version set
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue