[Major] Added Activity.TimeOrdering and updated Model XSD

This commit is contained in:
Robert von Burg 2016-09-23 10:53:37 +02:00
parent 02e0110fc6
commit d413794213
54 changed files with 763 additions and 224 deletions

View File

@ -21,6 +21,7 @@ import li.strolch.model.ModelGenerator;
import li.strolch.model.ParameterBag;
import li.strolch.model.Version;
import li.strolch.model.activity.Activity;
import li.strolch.model.activity.TimeOrdering;
import li.strolch.model.parameter.BooleanParameter;
import li.strolch.model.parameter.FloatListParameter;
import li.strolch.model.parameter.FloatParameter;
@ -263,7 +264,7 @@ public class InMemoryActivityQueryTest {
}
private Activity getBallActivity() {
Activity res1 = new Activity("childrensBall", "Ball 1", "Ball");
Activity res1 = new Activity("childrensBall", "Ball 1", "Ball", TimeOrdering.SERIES);
Version.setInitialVersionFor(res1, "test");
ParameterBag bag = new ParameterBag("parameters", "Ball Details", "Parameters");
bag.addParameter(new StringParameter("color", "Color", "red"));
@ -280,12 +281,12 @@ public class InMemoryActivityQueryTest {
}
private List<Activity> getActivities() {
Activity res1 = ModelGenerator.createActivity("@1", "Activity 1", "MyType1");
Activity res2 = ModelGenerator.createActivity("@2", "Activity 2", "MyType1");
Activity res3 = ModelGenerator.createActivity("@3", "Activity 3", "MyType2");
Activity res4 = ModelGenerator.createActivity("@4", "Activity 4", "MyType2");
Activity res5 = ModelGenerator.createActivity("@5", "Activity 5", "MyType3");
Activity res6 = ModelGenerator.createActivity("@6", "Activity 6", "MyType3");
Activity res1 = ModelGenerator.createActivity("@1", "Activity 1", "MyType1", TimeOrdering.SERIES);
Activity res2 = ModelGenerator.createActivity("@2", "Activity 2", "MyType1", TimeOrdering.SERIES);
Activity res3 = ModelGenerator.createActivity("@3", "Activity 3", "MyType2", TimeOrdering.SERIES);
Activity res4 = ModelGenerator.createActivity("@4", "Activity 4", "MyType2", TimeOrdering.SERIES);
Activity res5 = ModelGenerator.createActivity("@5", "Activity 5", "MyType3", TimeOrdering.SERIES);
Activity res6 = ModelGenerator.createActivity("@6", "Activity 6", "MyType3", TimeOrdering.SERIES);
List<Activity> activitys = new ArrayList<>();
activitys.add(res1);
activitys.add(res2);

View File

@ -25,6 +25,7 @@ import java.util.Set;
import li.strolch.model.activity.Action;
import li.strolch.model.activity.Activity;
import li.strolch.model.activity.TimeOrdering;
import li.strolch.model.audit.AccessType;
import li.strolch.model.audit.Audit;
import li.strolch.model.parameter.BooleanParameter;
@ -363,26 +364,26 @@ public class ModelGenerator {
*
* @return the list of newly created {@link Activity Activities}
*/
public static List<Activity> createActivities(int idStart, int count, String idPrefix, String name, String type) {
public static List<Activity> createActivities(int idStart, int count, String idPrefix, String name, String type,
TimeOrdering timeOrdering) {
List<Activity> activities = new ArrayList<>();
for (int i = 0; i < count; i++) {
String id = StringHelper.normalizeLength(String.valueOf((i + idStart)), 8, true, '0');
activities.add(createActivity(idPrefix + id, name + " " + i, type));
activities.add(createActivity(idPrefix + id, name + " " + i, type, timeOrdering));
}
return activities;
}
public static Activity createActivity(String id, String name, String type) {
public static Activity createActivity(String id, String name, String type, TimeOrdering timeOrdering) {
Activity rootActivity = new Activity(id, name, type);
Activity rootActivity = new Activity(id, name, type, timeOrdering);
ParameterBag bag = createParameterBag(BAG_ID, BAG_NAME, BAG_TYPE);
rootActivity.addParameterBag(bag);
Action action = createAction("action_" + rootActivity.getId(), "Action " + rootActivity.getName(), "Use");
rootActivity.addElement(action);
Activity subActivity = new Activity("sub_" + id, "sub_" + name, type);
Activity subActivity = new Activity("sub_" + id, "sub_" + name, type, timeOrdering);
bag = createParameterBag(BAG_ID, BAG_NAME, BAG_TYPE);
subActivity.addParameterBag(bag);
rootActivity.addElement(subActivity);
@ -390,7 +391,7 @@ public class ModelGenerator {
action = createAction("action_" + id, "Action " + name, "Use");
subActivity.addElement(action);
Activity subSubActivity = new Activity("subSub_" + id, "subSub_" + name, type);
Activity subSubActivity = new Activity("subSub_" + id, "subSub_" + name, type, timeOrdering);
bag = createParameterBag(BAG_ID, BAG_NAME, BAG_TYPE);
subSubActivity.addParameterBag(bag);
subActivity.addElement(subSubActivity);

View File

@ -15,30 +15,39 @@
*/
package li.strolch.model;
import li.strolch.exception.StrolchException;
import li.strolch.utils.dbc.DBC;
/**
* @author Robert von Burg <eitch@eitchnet.ch>
*/
public enum State {
CREATED("Created"), //$NON-NLS-1$
OPEN("Open"), //$NON-NLS-1$
PLANNING("Planning"), //$NON-NLS-1$
PLANNED("Planned"), //$NON-NLS-1$
EXECUTION("Execution"), //$NON-NLS-1$
CLOSED("Closed"), //$NON-NLS-1$
PLANNED("Planned"); //$NON-NLS-1$
STOPPED("Stopped"), //$NON-NLS-1$
EXECUTED("Executed"), //$NON-NLS-1$
CLOSED("Closed"); //$NON-NLS-1$
private String state;
/**
* @param state
*/
private State(String state) {
this.state = state;
}
/**
* @return
*/
public String getStateName() {
public String getName() {
return this.state;
}
public static State parse(String s) {
DBC.PRE.assertNotEmpty("Value may not be null", s);
for (State state : values()) {
if (state.state.toLowerCase().equals(s.toLowerCase()))
return state;
}
throw new StrolchException("No State for " + s);
}
}

View File

@ -55,6 +55,7 @@ public class Tags {
public static final String DELETED = "Deleted";
public static final String ACTIVITY = "Activity";
public static final String TIME_ORDERING = "TimeOrdering";
public static final String ACTION = "Action";
public static final String START = "Start";
public static final String END = "End";

View File

@ -29,10 +29,10 @@ import li.strolch.model.Locator.LocatorBuilder;
import li.strolch.model.PolicyContainer;
import li.strolch.model.Resource;
import li.strolch.model.State;
import li.strolch.model.StrolchRootElement;
import li.strolch.model.policy.PolicyDefs;
import li.strolch.model.timevalue.IValue;
import li.strolch.model.timevalue.IValueChange;
import li.strolch.model.visitor.IActivityElementVisitor;
/**
* An {@link Action} represents a single step within an {@link Activity}, that is, one that is not further decomposed
@ -163,7 +163,7 @@ public class Action extends GroupedParameterizedElement implements IActivityElem
}
@Override
public StrolchRootElement getRootElement() {
public Activity getRootElement() {
return (this.parent == null) ? null : this.parent.getRootElement();
}
@ -265,4 +265,9 @@ public class Action extends GroupedParameterizedElement implements IActivityElem
}
return end;
}
@Override
public void accept(IActivityElementVisitor visitor) {
visitor.visit(this);
}
}

View File

@ -33,6 +33,7 @@ import li.strolch.model.StrolchRootElement;
import li.strolch.model.Tags;
import li.strolch.model.Version;
import li.strolch.model.policy.PolicyDefs;
import li.strolch.model.visitor.IActivityElementVisitor;
import li.strolch.model.visitor.StrolchRootElementVisitor;
import li.strolch.utils.dbc.DBC;
@ -48,7 +49,9 @@ public class Activity extends GroupedParameterizedElement
private static final long serialVersionUID = 1L;
private Version version;
protected Activity parent;
protected TimeOrdering timeOrdering;
protected Map<String, IActivityElement> elements;
protected PolicyDefs policyDefs;
@ -62,12 +65,21 @@ public class Activity extends GroupedParameterizedElement
/**
* Default constructor
*
* @param id
* @param name
* @param type
* @param id the id
* @param name the name
* @param type the type
*/
public Activity(String id, String name, String type) {
public Activity(String id, String name, String type, TimeOrdering timeOrdering) {
super(id, name, type);
this.timeOrdering = timeOrdering;
}
public TimeOrdering getTimeOrdering() {
return this.timeOrdering;
}
public void setTimeOrdering(TimeOrdering timeOrdering) {
this.timeOrdering = timeOrdering;
}
@Override
@ -82,7 +94,7 @@ public class Activity extends GroupedParameterizedElement
@Override
public void setVersion(Version version) throws IllegalArgumentException, IllegalStateException {
if (!this.isRootElement())
if (!isRootElement())
throw new IllegalStateException("Can't set the version on non root of " + getLocator());
if (version != null && !getLocator().equals(version.getLocator())) {
@ -139,12 +151,12 @@ public class Activity extends GroupedParameterizedElement
String id = activityElement.getId();
if (id == null)
throw new StrolchException("Cannot add IActivityElement without id.");
else if (elements.containsKey(id))
else if (this.elements.containsKey(id))
throw new StrolchException(
"Activiy " + getLocator() + " already contains an activity element with id = " + id);
else {
activityElement.setParent(this);
return elements.put(activityElement.getId(), activityElement);
return this.elements.put(activityElement.getId(), activityElement);
}
}
@ -159,7 +171,7 @@ public class Activity extends GroupedParameterizedElement
public <T extends IActivityElement> T getElement(String id) {
if (this.elements == null)
return null;
return (T) elements.get(id);
return (T) this.elements.get(id);
}
/**
@ -168,7 +180,7 @@ public class Activity extends GroupedParameterizedElement
public Map<String, IActivityElement> getElements() {
if (this.elements == null)
return Collections.emptyMap();
return elements;
return this.elements;
}
/**
@ -177,7 +189,7 @@ public class Activity extends GroupedParameterizedElement
public Iterator<Entry<String, IActivityElement>> elementIterator() {
if (this.elements == null)
return Collections.<String, IActivityElement> emptyMap().entrySet().iterator();
return elements.entrySet().iterator();
return this.elements.entrySet().iterator();
}
@Override
@ -208,7 +220,7 @@ public class Activity extends GroupedParameterizedElement
@Override
public State getState() {
State state = State.PLANNED;
State state = State.CREATED;
if (this.elements == null)
return state;
Iterator<Entry<String, IActivityElement>> elementIterator = elementIterator();
@ -254,22 +266,23 @@ public class Activity extends GroupedParameterizedElement
@Override
public StrolchElement getParent() {
return parent;
return this.parent;
}
@Override
public StrolchRootElement getRootElement() {
return (parent == null) ? this : parent.getRootElement();
public Activity getRootElement() {
return (this.parent == null) ? this : this.parent.getRootElement();
}
@Override
public boolean isRootElement() {
return (parent == null);
return (this.parent == null);
}
@Override
public Activity getClone() {
Activity clone = new Activity();
clone.timeOrdering = this.timeOrdering;
super.fillClone(clone);
@ -296,11 +309,11 @@ public class Activity extends GroupedParameterizedElement
builder.append(", type=");
builder.append(this.type);
builder.append(", state=");
builder.append(this.getState());
builder.append(getState());
builder.append(", start=");
builder.append(this.getStart());
builder.append(getStart());
builder.append(", end=");
builder.append(this.getEnd());
builder.append(getEnd());
if (isRootElement()) {
builder.append(", version=");
builder.append(this.version);
@ -316,7 +329,12 @@ public class Activity extends GroupedParameterizedElement
@Override
public <T> T accept(StrolchRootElementVisitor<T> visitor) {
throw new StrolchException("not implemented yet");
return visitor.visitActivity(this);
}
@Override
public void accept(IActivityElementVisitor visitor) {
visitor.visit(this);
}
@Override

View File

@ -17,6 +17,7 @@ package li.strolch.model.activity;
import li.strolch.model.State;
import li.strolch.model.StrolchElement;
import li.strolch.model.visitor.IActivityElementVisitor;
/**
* Marker for all child elements of {@link Activity} objects
@ -32,6 +33,8 @@ public interface IActivityElement extends StrolchElement {
public State getState();
public void setParent(Activity activity);
public void accept(IActivityElementVisitor visitor);
@Override
public IActivityElement getClone();

View File

@ -0,0 +1,41 @@
package li.strolch.model.activity;
import li.strolch.exception.StrolchException;
import li.strolch.utils.dbc.DBC;
public enum TimeOrdering {
SERIES("Series") {
@Override
public void accept(TimeOrderingVisitor visitor, Activity activity) {
visitor.visitSeries(activity);
}
},
PARALLEL("Parallel") {
@Override
public void accept(TimeOrderingVisitor visitor, Activity activity) {
visitor.visitParallel(activity);
}
};
private final String name;
private TimeOrdering(String name) {
this.name = name;
}
public String getName() {
return this.name;
}
public abstract void accept(TimeOrderingVisitor visitor, Activity activity);
public static TimeOrdering parse(String s) {
DBC.PRE.assertNotEmpty("Value may not be null", s);
for (TimeOrdering timeOrdering : values()) {
if (timeOrdering.name.equals(s))
return timeOrdering;
}
throw new StrolchException("No TimeOrdering for " + s);
}
}

View File

@ -0,0 +1,8 @@
package li.strolch.model.activity;
public interface TimeOrderingVisitor {
public void visitSeries(Activity activity);
public void visitParallel(Activity activity);
}

View File

@ -38,6 +38,7 @@ import li.strolch.model.Tags;
import li.strolch.model.Version;
import li.strolch.model.activity.Action;
import li.strolch.model.activity.Activity;
import li.strolch.model.activity.TimeOrdering;
import li.strolch.model.parameter.Parameter;
import li.strolch.model.policy.PolicyDef;
import li.strolch.model.policy.PolicyDefs;
@ -71,7 +72,7 @@ public class StrolchElementFromJsonVisitor {
}
if (jsonObject.has(Tags.STATE)) {
order.setState(State.valueOf(jsonObject.get(Tags.STATE).getAsString()));
order.setState(State.parse(jsonObject.get(Tags.STATE).getAsString()));
} else {
order.setState(State.CREATED);
}
@ -146,6 +147,12 @@ public class StrolchElementFromJsonVisitor {
public void fillElement(JsonObject jsonObject, Activity activity) {
fillElement(jsonObject, (GroupedParameterizedElement) activity);
if (!jsonObject.has(Tags.TIME_ORDERING))
throw new StrolchException("TimeOrdering not set on " + activity.getLocator());
String timeOrderingS = jsonObject.get(Tags.TIME_ORDERING).getAsString();
TimeOrdering timeOrdering = TimeOrdering.parse(timeOrderingS);
activity.setTimeOrdering(timeOrdering);
parseVersion(activity, jsonObject);
// policies
@ -301,7 +308,7 @@ public class StrolchElementFromJsonVisitor {
if (jsonObject.has(Tags.RESOURCE_TYPE))
action.setResourceType(jsonObject.get(Tags.RESOURCE_TYPE).getAsString());
if (jsonObject.has(Tags.STATE))
action.setState(State.valueOf(jsonObject.get(Tags.STATE).getAsString()));
action.setState(State.parse(jsonObject.get(Tags.STATE).getAsString()));
// policies
PolicyDefs defs = parsePolicies(jsonObject);

View File

@ -53,7 +53,7 @@ public class StrolchElementToJsonVisitor {
toJson(element, rootJ);
rootJ.addProperty(Tags.DATE, ISO8601FormatFactory.getInstance().formatDate(element.getDate()));
rootJ.addProperty(Tags.STATE, element.getState().name());
rootJ.addProperty(Tags.STATE, element.getState().getName());
addVersion(element, rootJ);
addParameterBags(element, rootJ);
@ -77,6 +77,8 @@ public class StrolchElementToJsonVisitor {
rootJ.addProperty(Tags.OBJECT_TYPE, Tags.ACTIVITY);
rootJ.addProperty(Tags.TIME_ORDERING, element.getTimeOrdering().getName());
toJson((AbstractStrolchElement) element, rootJ);
addParameterBags(element, rootJ);
@ -111,6 +113,8 @@ public class StrolchElementToJsonVisitor {
rootJ.addProperty(Tags.OBJECT_TYPE, Tags.ACTION);
rootJ.addProperty(Tags.STATE, element.getState().getName());
// attributes
toJson((AbstractStrolchElement) element, rootJ);
rootJ.addProperty(Tags.RESOURCE_ID, element.getResourceId());

View File

@ -0,0 +1,11 @@
package li.strolch.model.visitor;
import li.strolch.model.activity.Action;
import li.strolch.model.activity.Activity;
public interface IActivityElementVisitor {
public void visit(Activity activity);
public void visit(Action action);
}

View File

@ -132,6 +132,9 @@ public class StrolchElementDeepEqualsVisitor {
public void deepEquals(Activity srcActivity, Activity dstActivity) {
deepEquals((StrolchRootElement) srcActivity, (StrolchRootElement) dstActivity);
if (!srcActivity.getTimeOrdering().equals(dstActivity.getTimeOrdering()))
addLocator(dstActivity.getLocator().append(Tags.TIME_ORDERING));
Iterator<Entry<String, IActivityElement>> iter = srcActivity.elementIterator();
while (iter.hasNext()) {
IActivityElement srcActivityElement = iter.next().getValue();

View File

@ -36,6 +36,7 @@ import li.strolch.model.Tags;
import li.strolch.model.Version;
import li.strolch.model.activity.Action;
import li.strolch.model.activity.Activity;
import li.strolch.model.activity.TimeOrdering;
import li.strolch.model.parameter.Parameter;
import li.strolch.model.policy.PolicyDef;
import li.strolch.model.policy.PolicyDefs;
@ -66,7 +67,7 @@ public class StrolchElementFromDomVisitor {
if (state == null || state.isEmpty()) {
order.setState(State.CREATED);
} else {
order.setState(State.valueOf(state));
order.setState(State.parse(state));
}
}
@ -144,6 +145,12 @@ public class StrolchElementFromDomVisitor {
public void fillElement(Element activityElement, Activity activity) {
fillElement(activityElement, (StrolchRootElement) activity);
String timeOrderingS = activityElement.getAttribute(Tags.TIME_ORDERING);
if (StringHelper.isEmpty(timeOrderingS))
throw new StrolchException("TimeOrdering is not set for " + activity.getLocator());
TimeOrdering timeOrdering = TimeOrdering.parse(timeOrderingS);
activity.setTimeOrdering(timeOrdering);
NodeList childNodes = activityElement.getChildNodes();
for (int i = 0; i < childNodes.getLength(); i++) {
Node item = childNodes.item(i);
@ -290,7 +297,7 @@ public class StrolchElementFromDomVisitor {
action.setResourceId(resourceId);
action.setResourceType(resourceType);
action.setState(State.valueOf(stateS));
action.setState(State.parse(stateS));
PolicyDefs defs = parsePolicies(element);
if (defs.hasPolicyDefs())

View File

@ -59,7 +59,7 @@ public class StrolchElementToDomVisitor {
Element asDom = document.createElement(Tags.ORDER);
asDom.setAttribute(Tags.DATE, ISO8601FormatFactory.getInstance().formatDate(order.getDate()));
asDom.setAttribute(Tags.STATE, order.getState().name());
asDom.setAttribute(Tags.STATE, order.getState().getName());
fillElement(asDom, (StrolchRootElement) order);
@ -84,6 +84,8 @@ public class StrolchElementToDomVisitor {
protected Element toDom(Activity activity) {
Element element = document.createElement(Tags.ACTIVITY);
element.setAttribute(Tags.TIME_ORDERING, activity.getTimeOrdering().getName());
fillElement(element, (StrolchRootElement) activity);
if (activity.hasElements()) {
@ -109,7 +111,7 @@ public class StrolchElementToDomVisitor {
element.setAttribute(Tags.RESOURCE_ID, action.getResourceId());
element.setAttribute(Tags.RESOURCE_TYPE, action.getResourceType());
element.setAttribute(Tags.STATE, action.getState().name());
element.setAttribute(Tags.STATE, action.getState().getName());
if (action.hasPolicyDefs())
fillElement(element, action.getPolicyDefs());

View File

@ -203,12 +203,19 @@ public abstract class StrolchElementToSaxVisitor {
protected AttributesImpl attributesFor(Order order) {
AttributesImpl attributes = attributesFor((StrolchElement) order);
attributes.addAttribute(null, null, Tags.STATE, Tags.CDATA, order.getState().name());
attributes.addAttribute(null, null, Tags.STATE, Tags.CDATA, order.getState().getName());
attributes.addAttribute(null, null, Tags.DATE, Tags.CDATA,
ISO8601FormatFactory.getInstance().formatDate(order.getDate()));
return attributes;
}
protected AttributesImpl attributesFor(Activity activity) {
AttributesImpl attributes = attributesFor((StrolchElement) activity);
attributes.addAttribute(null, null, Tags.STATE, Tags.CDATA, activity.getState().getName());
attributes.addAttribute(null, null, Tags.TIME_ORDERING, Tags.CDATA, activity.getTimeOrdering().getName());
return attributes;
}
private Attributes attributesFor(Version version) {
AttributesImpl attributes = new AttributesImpl();
attributes.addAttribute(null, null, Tags.VERSION, Tags.CDATA, Integer.toString(version.getVersion()));
@ -258,7 +265,7 @@ public abstract class StrolchElementToSaxVisitor {
AttributesImpl attributes = attributesFor((StrolchElement) action);
attributes.addAttribute(null, null, Tags.RESOURCE_ID, Tags.CDATA, action.getResourceId());
attributes.addAttribute(null, null, Tags.RESOURCE_TYPE, Tags.CDATA, action.getResourceType());
attributes.addAttribute(null, null, Tags.STATE, Tags.CDATA, action.getState().name());
attributes.addAttribute(null, null, Tags.STATE, Tags.CDATA, action.getState().getName());
return attributes;
}

View File

@ -89,7 +89,7 @@ public abstract class StrolchElementToSaxWriterVisitor {
writeStartStrolchElement(Tags.ORDER, empty, order);
this.writer.writeAttribute(Tags.DATE, ISO8601FormatFactory.getInstance().formatDate(order.getDate()));
this.writer.writeAttribute(Tags.STATE, order.getState().name());
this.writer.writeAttribute(Tags.STATE, order.getState().getName());
if (order.hasVersion())
writeVersion(order);
@ -109,7 +109,8 @@ public abstract class StrolchElementToSaxWriterVisitor {
&& !activity.hasPolicyDefs();
writeStartStrolchElement(Tags.ACTIVITY, empty, activity);
this.writer.writeAttribute(Tags.TIME_ORDERING, activity.getTimeOrdering().getName());
if (activity.hasVersion())
writeVersion(activity);
@ -150,7 +151,7 @@ public abstract class StrolchElementToSaxWriterVisitor {
boolean empty = !action.hasParameterBags() && !action.hasChanges() && !action.hasPolicyDefs();
writeStartStrolchElement(Tags.ACTION, empty, action);
this.writer.writeAttribute(Tags.STATE, action.getState().name());
this.writer.writeAttribute(Tags.STATE, action.getState().getName());
this.writer.writeAttribute(Tags.RESOURCE_ID, action.getResourceId());
this.writer.writeAttribute(Tags.RESOURCE_TYPE, action.getResourceType());

View File

@ -40,6 +40,7 @@ import li.strolch.model.Tags;
import li.strolch.model.Version;
import li.strolch.model.activity.Action;
import li.strolch.model.activity.Activity;
import li.strolch.model.activity.TimeOrdering;
import li.strolch.model.parameter.Parameter;
import li.strolch.model.policy.PolicyDef;
import li.strolch.model.policy.PolicyDefs;
@ -104,7 +105,11 @@ public class XmlModelSaxReader extends DefaultHandler {
String activityId = attributes.getValue(Tags.ID);
String activityName = attributes.getValue(Tags.NAME);
String activityType = attributes.getValue(Tags.TYPE);
Activity activity = new Activity(activityId, activityName, activityType);
String timeOrderingS = attributes.getValue(Tags.TIME_ORDERING);
if (StringHelper.isEmpty(timeOrderingS))
throw new StrolchException("TimeOrdering is not set for Activity with ID " + activityId);
TimeOrdering timeOrdering = TimeOrdering.parse(timeOrderingS);
Activity activity = new Activity(activityId, activityName, activityType, timeOrdering);
this.parameterizedElement = activity;
@ -124,7 +129,7 @@ public class XmlModelSaxReader extends DefaultHandler {
action.setResourceId(actionResourceId);
action.setResourceType(actionResourceType);
if (StringHelper.isNotEmpty(actionState))
action.setState(State.valueOf(actionState));
action.setState(State.parse(actionState));
this.parameterizedElement = action;
@ -157,7 +162,7 @@ public class XmlModelSaxReader extends DefaultHandler {
order.setDate(orderDate);
}
if (StringHelper.isNotEmpty(orderStateS))
order.setState(State.valueOf(orderStateS));
order.setState(State.parse(orderStateS));
this.parameterizedElement = order;

View File

@ -1,8 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="https://www.strolch.li/xsd/StrolchModel.xsd" xmlns="https://www.strolch.li/xsd/StrolchModel.xsd"
elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:annotation>
<xs:documentation>This is Version 1.3.0-SNAPSHOT of the StrolchModel XSD.</xs:documentation>
<xs:documentation>This is Version 1.4.0-SNAPSHOT of the StrolchModel XSD.</xs:documentation>
</xs:annotation>
<xs:element name="StrolchModel" type="StrolchModelType" />
@ -19,32 +20,26 @@
</xs:complexType>
<xs:complexType name="IncludeFileType">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute type="xs:string" name="file" />
</xs:extension>
</xs:simpleContent>
<xs:attribute type="xs:string" name="file" />
</xs:complexType>
<xs:complexType name="VersionType">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute type="xs:int" name="Version" />
<xs:attribute type="xs:string" name="CreatedBy" />
<xs:attribute type="xs:dateTime" name="CreatedAt" />
<xs:attribute type="xs:string" name="Deleted" />
</xs:extension>
</xs:simpleContent>
<xs:attribute type="xs:int" name="Version" />
<xs:attribute type="xs:string" name="CreatedBy" />
<xs:attribute type="xs:dateTime" name="CreatedAt" />
<xs:attribute type="xs:string" name="Deleted" />
</xs:complexType>
<xs:complexType name="OrderType">
<xs:sequence>
<xs:element type="VersionType" name="Version" maxOccurs="1" minOccurs="0" />
<xs:element type="ParameterBagType" name="ParameterBag" maxOccurs="unbounded" minOccurs="0" />
<xs:element type="PoliciesType" name="Policies" maxOccurs="1" minOccurs="0" />
</xs:sequence>
<xs:attribute type="xs:string" name="Id" />
<xs:attribute type="xs:string" name="Name" />
<xs:attribute type="xs:string" name="Type" />
<xs:attribute type="StateType" name="State" />
</xs:complexType>
<xs:complexType name="ResourceType">
@ -74,9 +69,11 @@
<xs:attribute type="xs:string" name="Id" />
<xs:attribute type="xs:string" name="Name" />
<xs:attribute type="xs:string" name="Type" />
<xs:attribute type="StateType" name="State" />
<xs:attribute type="TimeOrderingType" name="TimeOrdering" />
</xs:complexType>
<xs:complexType name="ActionType" mixed="true">
<xs:complexType name="ActionType">
<xs:sequence>
<xs:element type="ParameterBagType" name="ParameterBag" maxOccurs="unbounded" minOccurs="0" />
<xs:element type="PoliciesType" name="Policies" maxOccurs="1" minOccurs="0" />
@ -86,7 +83,7 @@
<xs:attribute type="xs:string" name="Name" />
<xs:attribute type="xs:string" name="ResourceId" />
<xs:attribute type="xs:string" name="ResourceType" />
<xs:attribute type="xs:string" name="State" />
<xs:attribute type="StateType" name="State" />
<xs:attribute type="xs:string" name="Type" />
</xs:complexType>
@ -100,18 +97,14 @@
</xs:complexType>
<xs:complexType name="ParameterType">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute type="xs:string" name="Id" />
<xs:attribute type="xs:string" name="Name" />
<xs:attribute type="xs:string" name="Type" />
<xs:attribute type="xs:string" name="Value" />
<xs:attribute type="xs:string" name="Uom" use="optional" />
<xs:attribute type="xs:string" name="Interpretation" use="optional" />
<xs:attribute type="xs:string" name="Hidden" use="optional" />
<xs:attribute type="xs:string" name="Index" use="optional" />
</xs:extension>
</xs:simpleContent>
<xs:attribute type="xs:string" name="Id" />
<xs:attribute type="xs:string" name="Name" />
<xs:attribute type="ParameterValueType" name="Type" />
<xs:attribute type="xs:string" name="Value" />
<xs:attribute type="xs:string" name="Interpretation" use="optional" />
<xs:attribute type="xs:string" name="Uom" use="optional" />
<xs:attribute type="xs:boolean" name="Hidden" use="optional" />
<xs:attribute type="xs:int" name="Index" use="optional" />
</xs:complexType>
<xs:complexType name="PoliciesType">
@ -119,13 +112,10 @@
<xs:element type="PolicyType" name="Policy" maxOccurs="unbounded" minOccurs="0" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="PolicyType">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute type="xs:string" name="Type" />
<xs:attribute type="xs:string" name="Value" />
</xs:extension>
</xs:simpleContent>
<xs:attribute type="xs:string" name="Type" />
<xs:attribute type="xs:string" name="Value" />
</xs:complexType>
<xs:complexType name="TimedStateType">
@ -134,27 +124,62 @@
</xs:sequence>
<xs:attribute type="xs:string" name="Id" />
<xs:attribute type="xs:string" name="Name" />
<xs:attribute type="xs:string" name="Type" />
<xs:attribute type="TimedStateTypeType" name="Type" />
</xs:complexType>
<xs:complexType name="ValueType">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute type="xs:dateTime" name="Time" />
<xs:attribute type="xs:string" name="Value" />
</xs:extension>
</xs:simpleContent>
<xs:attribute type="xs:dateTime" name="Time" />
<xs:attribute type="xs:string" name="Value" />
</xs:complexType>
<xs:complexType name="ValueChangeType">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute type="xs:string" name="StateId" />
<xs:attribute type="xs:dateTime" name="Time" />
<xs:attribute type="xs:byte" name="Value" />
<xs:attribute type="xs:string" name="Type" />
</xs:extension>
</xs:simpleContent>
<xs:attribute type="xs:string" name="StateId" />
<xs:attribute type="xs:dateTime" name="Time" />
<xs:attribute type="xs:string" name="Value" />
<xs:attribute type="TimedStateTypeType" name="Type" />
</xs:complexType>
<xs:simpleType name="StateType">
<xs:restriction base="xs:string">
<xs:enumeration value="Created" />
<xs:enumeration value="Planning" />
<xs:enumeration value="Planned" />
<xs:enumeration value="Execution" />
<xs:enumeration value="Stopped" />
<xs:enumeration value="Executed" />
<xs:enumeration value="Closed" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="TimeOrderingType">
<xs:restriction base="xs:string">
<xs:enumeration value="Series" />
<xs:enumeration value="Parallel" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="ParameterValueType">
<xs:restriction base="xs:string">
<xs:enumeration value="Boolean" />
<xs:enumeration value="String" />
<xs:enumeration value="Integer" />
<xs:enumeration value="Long" />
<xs:enumeration value="Float" />
<xs:enumeration value="Date" />
<xs:enumeration value="Duration" />
<xs:enumeration value="StringList" />
<xs:enumeration value="IntegerList" />
<xs:enumeration value="FloatList" />
<xs:enumeration value="LongList" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="TimedStateTypeType">
<xs:restriction base="xs:string">
<xs:enumeration value="Boolean" />
<xs:enumeration value="Integer" />
<xs:enumeration value="Float" />
<xs:enumeration value="StringSet" />
</xs:restriction>
</xs:simpleType>
</xs:schema>

View File

@ -5,6 +5,7 @@ import static org.junit.Assert.assertEquals;
import org.junit.Test;
import li.strolch.model.activity.Activity;
import li.strolch.model.activity.TimeOrdering;
public abstract class ModelMarshallingTest {
@ -38,13 +39,13 @@ public abstract class ModelMarshallingTest {
@Test
public void shouldFormatAndParseActivity() throws Exception {
Activity activity = ModelGenerator.createActivity("@1", "My Activity 1", "Transport");
Activity activity = ModelGenerator.createActivity("@1", "My Activity 1", "Transport", TimeOrdering.SERIES);
formatAndParseActivity(activity);
}
@Test
public void shouldFormatAndParseVersionedActivity() throws Exception {
Activity activity = ModelGenerator.createActivity("@1", "My Activity 1", "Transport");
Activity activity = ModelGenerator.createActivity("@1", "My Activity 1", "Transport", TimeOrdering.SERIES);
Version.setInitialVersionFor(activity, "test");
Activity parsed = formatAndParseActivity(activity);
assertEquals(activity.getVersion(), parsed.getVersion());

View File

@ -70,8 +70,13 @@ import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import li.strolch.model.activity.Action;
import li.strolch.model.activity.Activity;
import li.strolch.model.activity.TimeOrdering;
import li.strolch.model.parameter.BooleanParameter;
import li.strolch.model.parameter.DateParameter;
import li.strolch.model.parameter.FloatListParameter;
@ -95,10 +100,6 @@ import li.strolch.model.visitor.ActivityDeepEqualsVisitor;
import li.strolch.model.visitor.OrderDeepEqualsVisitor;
import li.strolch.model.visitor.ResourceDeepEqualsVisitor;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@SuppressWarnings("nls")
public class ModelTest {
@ -122,12 +123,12 @@ public class ModelTest {
public void shouldCreateOrder() {
Date date = new Date();
Order order = createOrder("@ord01", "Test Order", "MyType", date, State.OPEN);
Order order = createOrder("@ord01", "Test Order", "MyType", date, State.CLOSED);
assertEquals("@ord01", order.getId());
assertEquals("Test Order", order.getName());
assertEquals("MyType", order.getType());
assertEquals(date, order.getDate());
assertEquals(State.OPEN, order.getState());
assertEquals(State.CLOSED, order.getState());
ParameterBag bag = order.getParameterBag(BAG_ID);
validateBag(bag);
@ -149,7 +150,7 @@ public class ModelTest {
changes.add(new ValueChange<>(50L, new IntegerValue(10), STATE_INTEGER_ID));
changes.add(new ValueChange<>(60L, new IntegerValue(0), STATE_INTEGER_ID));
Activity activity = createActivity(actId, actName, actType);
Activity activity = createActivity(actId, actName, actType, TimeOrdering.SERIES);
assertEquals(actId, activity.getId());
assertEquals(actName, activity.getName());
assertEquals(actType, activity.getType());
@ -208,7 +209,7 @@ public class ModelTest {
FloatTimedState floatS = resource.getTimedState(STATE_FLOAT_ID);
assertEquals(Locator.valueOf(RESOURCE, "MyType", "@res01", STATE, STATE_FLOAT_ID), floatS.getLocator());
Order order = createOrder("@ord01", "Test Order", "MyType", new Date(), State.OPEN);
Order order = createOrder("@ord01", "Test Order", "MyType", new Date(), State.CLOSED);
assertEquals(Locator.valueOf(ORDER, "MyType", "@ord01"), order.getLocator());
bag = order.getParameterBag(BAG_ID);
assertEquals(Locator.valueOf(ORDER, "MyType", "@ord01", BAG, BAG_ID), bag.getLocator());
@ -218,8 +219,8 @@ public class ModelTest {
@Test
public void shouldPerformDeepActivityEquals() {
Activity srcActivity = createActivity("@act01", "Test Activity", "MyType");
Activity dstActivity = createActivity("@act01", "Test Activity", "MyType");
Activity srcActivity = createActivity("@act01", "Test Activity", "MyType", TimeOrdering.SERIES);
Activity dstActivity = createActivity("@act01", "Test Activity", "MyType", TimeOrdering.SERIES);
ActivityDeepEqualsVisitor visitor = new ActivityDeepEqualsVisitor(srcActivity);
visitor.visit(dstActivity);
assertTrue("Same Activity should be deep equal!", visitor.isEqual());
@ -227,7 +228,7 @@ public class ModelTest {
@Test
public void shouldPerformActivityClone() {
Activity srcActivity = createActivity("@act01", "Test Activity", "MyType");
Activity srcActivity = createActivity("@act01", "Test Activity", "MyType", TimeOrdering.SERIES);
Activity dstActivity = srcActivity.getClone();
ActivityDeepEqualsVisitor visitor = new ActivityDeepEqualsVisitor(srcActivity);
visitor.visit(dstActivity);
@ -236,8 +237,8 @@ public class ModelTest {
@Test
public void shouldFailDeepActivityEquals1() {
Activity srcActivity = createActivity("@act01", "Test Activity", "MyType");
Activity dstActivity = createActivity("@act01", "Test Activity", "MyType");
Activity srcActivity = createActivity("@act01", "Test Activity", "MyType", TimeOrdering.SERIES);
Activity dstActivity = createActivity("@act01", "Test Activity", "MyType", TimeOrdering.SERIES);
dstActivity.setName("Bla");
dstActivity.setType("BlaBla");
ParameterBag bag = dstActivity.getParameterBag(BAG_ID);
@ -253,8 +254,8 @@ public class ModelTest {
@Test
public void shouldFailDeepActivityEquals2() {
Activity srcActivity = createActivity("@act01", "Test Activity", "MyType");
Activity dstActivity = createActivity("@act01", "Test Activity", "MyType");
Activity srcActivity = createActivity("@act01", "Test Activity", "MyType", TimeOrdering.SERIES);
Activity dstActivity = createActivity("@act01", "Test Activity", "MyType", TimeOrdering.SERIES);
Action action = dstActivity.getElement("action_" + "@act01");
action.setResourceId("Bla");
@ -330,8 +331,8 @@ public class ModelTest {
@Test
public void shouldPerformDeepOrderEquals() {
Date date = new Date();
Order srcOrder = createOrder("@ord01", "Test Order", "MyType", date, State.OPEN);
Order dstOrder = createOrder("@ord01", "Test Order", "MyType", date, State.OPEN);
Order srcOrder = createOrder("@ord01", "Test Order", "MyType", date, State.CREATED);
Order dstOrder = createOrder("@ord01", "Test Order", "MyType", date, State.CREATED);
OrderDeepEqualsVisitor visitor = new OrderDeepEqualsVisitor(srcOrder);
visitor.visit(dstOrder);
assertTrue("Same Order should be deep equal: " + visitor.getMismatchedLocators(), visitor.isEqual());
@ -340,7 +341,7 @@ public class ModelTest {
@Test
public void shouldPerformOrderClone() {
Date date = new Date();
Order srcOrder = createOrder("@ord01", "Test Order", "MyType", date, State.OPEN);
Order srcOrder = createOrder("@ord01", "Test Order", "MyType", date, State.CREATED);
Order dstOrder = srcOrder.getClone();
OrderDeepEqualsVisitor visitor = new OrderDeepEqualsVisitor(srcOrder);
visitor.visit(dstOrder);
@ -350,8 +351,8 @@ public class ModelTest {
@Test
public void shouldFailDeepOrderEquals1() {
Date date = new Date();
Order srcOrder = createOrder("@ord01", "Test Order", "MyType", date, State.OPEN);
Order dstOrder = createOrder("@ord01", "Test Order", "MyType", date, State.OPEN);
Order srcOrder = createOrder("@ord01", "Test Order", "MyType", date, State.CREATED);
Order dstOrder = createOrder("@ord01", "Test Order", "MyType", date, State.CREATED);
dstOrder.setDate(new Date(1L));
dstOrder.setState(State.CLOSED);
ParameterBag bag = dstOrder.getParameterBag(BAG_ID);

View File

@ -48,7 +48,7 @@ public class ActivityTest {
public void init() {
// create activity element
this.activity = new Activity("activity", "Activity", "parentType");
this.activity = new Activity("activity", "Activity", "parentType", TimeOrdering.SERIES);
// create action 1
this.action_1 = new Action("action_1", "Action 1", "Use");
@ -58,7 +58,7 @@ public class ActivityTest {
this.activity.addElement(this.action_1);
this.childActivity = new Activity("child_activity", "Child Activity", "childType");
this.childActivity = new Activity("child_activity", "Child Activity", "childType", TimeOrdering.SERIES);
// create action 2
this.action_2 = new Action("action_2", "Action 2", "Use");

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<StrolchModel>
<StrolchModel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="https://www.strolch.li/xsd/StrolchModel.xsd" xsi:schemaLocation="https://www.strolch.li/xsd/StrolchModel.xsd StrolchModel.xsd">
<Order Id="@test1" Name="Test Order" Type="Order">
<ParameterBag Id="@bag01" Name="Test Bag" Type="TestBag">

View File

@ -1,5 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<StrolchModel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="StrolchModel.xsd">
<StrolchModel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="https://www.strolch.li/xsd/StrolchModel.xsd" xsi:schemaLocation="https://www.strolch.li/xsd/StrolchModel.xsd StrolchModel.xsd">
<IncludeFile file="Include1.xml" />
<IncludeFile file="Include2.xml" />
<Order Id="@test1" Name="Test Order" Type="Order">
<Version Version="0" CreatedBy="test" CreatedAt="2012-11-30T18:12:05.628+01:00" Deleted="false" />
@ -9,6 +12,10 @@
<ParameterBag Id="@bag01" Name="Test Bag" Type="TestBag">
<Parameter Id="@param1" Name="Boolean Param" Type="Boolean" Value="true" />
</ParameterBag>
<Policies>
<Policy Type="PlanningPolicy" Value="key:SimplePlanning" />
<Policy Type="ConfirmationPolicy" Value="key:NoConfirmation" />
</Policies>
</Order>
<Resource Id="MyTestResource" Name="Test Name" Type="TestType">
@ -58,7 +65,7 @@
<Policy Type="PlanningPolicy" Value="key:SimplePlanning" />
<Policy Type="ConfirmationPolicy" Value="key:NoConfirmation" />
</Policies>
<Action Id="action_1" Name="Action 1" ResourceId="dummyId" ResourceType="dummyType" State="CREATED" Type="Use">
<Action Id="action_1" Name="Action 1" ResourceId="dummyId" ResourceType="dummyType" State="Created" Type="Use">
<ParameterBag Id="@bag01" Name="Test Bag" Type="TestBag">
<Parameter Id="@param1" Name="Boolean Param" Type="Boolean" Value="true" />
</ParameterBag>
@ -77,15 +84,12 @@
<Policy Type="PlanningPolicy" Value="key:SimplePlanning" />
<Policy Type="ConfirmationPolicy" Value="key:NoConfirmation" />
</Policies>
<Action Id="action_2" Name="Action 2" ResourceId="dummyId" ResourceType="dummyType" State="PLANNED" Type="Use">
<Action Id="action_2" Name="Action 2" ResourceId="dummyId" ResourceType="dummyType" State="Planned" Type="Use">
<ValueChange StateId="dummyId" Time="2012-11-30T18:12:05.628+01:00" Value="5" Type="Integer" />
<ValueChange StateId="dummyId" Time="2012-11-30T18:12:06.628+01:00" Value="6" Type="Integer" />
</Action>
<Action Id="action_3" Name="Action 3" ResourceId="dummyId" ResourceType="dummyType" State="CREATED" Type="Use" />
<Action Id="action_3" Name="Action 3" ResourceId="dummyId" ResourceType="dummyType" State="Created" Type="Use" />
</Activity>
</Activity>
<IncludeFile file="Include1.xml" />
<IncludeFile file="Include2.xml" />
</StrolchModel>

View File

@ -1,29 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<StrolchModel>
<Activity Id="activity_1" Name="Activity" Type="parentType">
<Activity Id="activity_1" Name="Activity" Type="parentType" TimeOrdering="Series">
<Policies>
<Policy Type="PlanningPolicy" Value="key:SimplePlanning" />
<Policy Type="ConfirmationPolicy" Value="key:NoConfirmation" />
</Policies>
<Action Id="action_1" Name="Action 1" ResourceId="dummyId" ResourceType="dummyType" State="CREATED" Type="Use">
<Action Id="action_1" Name="Action 1" ResourceId="dummyId" ResourceType="dummyType" State="Created" Type="Use">
<Policies>
<Policy Type="PlanningPolicy" Value="key:SimplePlanning" />
<Policy Type="ConfirmationPolicy" Value="key:NoConfirmation" />
</Policies>
<ValueChange StateId="dummyId" Time="2012-11-30T18:12:05.628+01:00" Value="5" Type="Integer" />
</Action>
<Activity Id="child_activity" Name="Child Activity" Type="childType">
<Activity Id="child_activity" Name="Child Activity" Type="childType" TimeOrdering="Series">
<Policies>
<Policy Type="PlanningPolicy" Value="key:SimplePlanning" />
<Policy Type="ConfirmationPolicy" Value="key:NoConfirmation" />
</Policies>
<Action Id="action_2" Name="Action 2" ResourceId="dummyId" ResourceType="dummyType" State="PLANNED" Type="Use" />
<Action Id="action_3" Name="Action 3" ResourceId="dummyId" ResourceType="dummyType" State="CREATED" Type="Use" />
<Action Id="action_2" Name="Action 2" ResourceId="dummyId" ResourceType="dummyType" State="Planned" Type="Use" />
<Action Id="action_3" Name="Action 3" ResourceId="dummyId" ResourceType="dummyType" State="Created" Type="Use" />
</Activity>
</Activity>
<Activity Id="activity_2" Name="Activity" Type="parentType">
<Activity Id="activity_2" Name="Activity" Type="parentType" TimeOrdering="Series">
<ParameterBag Id="@bag01" Name="Test Bag" Type="TestBag">
<Parameter Id="@param8" Name="Duration Param" Type="Duration" Value="P1D" />
<Parameter Id="@param7" Name="StringList Param" Type="StringList" Value="Hello;World" />
@ -34,7 +34,7 @@
<Parameter Id="@param2" Name="Float Param" Type="Float" Value="44.3" />
<Parameter Id="@param1" Name="Boolean Param" Type="Boolean" Value="true" />
</ParameterBag>
<Action Id="action_1" Name="Action 1" ResourceId="dummyId" ResourceType="dummyType" State="CREATED" Type="Use">
<Action Id="action_1" Name="Action 1" ResourceId="dummyId" ResourceType="dummyType" State="Created" Type="Use">
<ParameterBag Id="@bag01" Name="Test Bag" Type="TestBag">
<Parameter Id="@param8" Name="Duration Param" Type="Duration" Value="P1D" />
<Parameter Id="@param7" Name="StringList Param" Type="StringList" Value="Hello;World" />
@ -46,7 +46,7 @@
<Parameter Id="@param1" Name="Boolean Param" Type="Boolean" Value="true" />
</ParameterBag>
</Action>
<Activity Id="child_activity" Name="Child Activity" Type="childType">
<Activity Id="child_activity" Name="Child Activity" Type="childType" TimeOrdering="Series">
<ParameterBag Id="@bag01" Name="Test Bag" Type="TestBag">
<Parameter Id="@param8" Name="Duration Param" Type="Duration" Value="P1D" />
<Parameter Id="@param7" Name="StringList Param" Type="StringList" Value="Hello;World" />
@ -57,7 +57,7 @@
<Parameter Id="@param2" Name="Float Param" Type="Float" Value="44.3" />
<Parameter Id="@param1" Name="Boolean Param" Type="Boolean" Value="true" />
</ParameterBag>
<Action Id="action_2" Name="Action 2" ResourceId="dummyId" ResourceType="dummyType" State="PLANNED" Type="Use">
<Action Id="action_2" Name="Action 2" ResourceId="dummyId" ResourceType="dummyType" State="Planned" Type="Use">
<ParameterBag Id="@bag01" Name="Test Bag" Type="TestBag">
<Parameter Id="@param8" Name="Duration Param" Type="Duration" Value="P1D" />
<Parameter Id="@param7" Name="StringList Param" Type="StringList" Value="Hello;World" />
@ -69,7 +69,7 @@
<Parameter Id="@param1" Name="Boolean Param" Type="Boolean" Value="true" />
</ParameterBag>
</Action>
<Action Id="action_3" Name="Action 3" ResourceId="dummyId" ResourceType="dummyType" State="CREATED" Type="Use">
<Action Id="action_3" Name="Action 3" ResourceId="dummyId" ResourceType="dummyType" State="Created" Type="Use">
<ParameterBag Id="@bag01" Name="Test Bag" Type="TestBag">
<Parameter Id="@param8" Name="Duration Param" Type="Duration" Value="P1D" />
<Parameter Id="@param7" Name="StringList Param" Type="StringList" Value="Hello;World" />
@ -84,30 +84,30 @@
</Activity>
</Activity>
<Activity Id="activity_3" Name="Activity" Type="parentType">
<Activity Id="activity_3" Name="Activity" Type="parentType" TimeOrdering="Series">
<ParameterBag Id="@bag01" Name="Test Bag" Type="TestBag">
<Parameter Id="@param2" Name="Float Param" Type="Float" Value="44.3" />
<Parameter Id="@param1" Name="Boolean Param" Type="Boolean" Value="true" />
</ParameterBag>
<Action Id="action_1" Name="Action 1" ResourceId="dummyId" ResourceType="dummyType" State="CREATED" Type="Use">
<Action Id="action_1" Name="Action 1" ResourceId="dummyId" ResourceType="dummyType" State="Created" Type="Use">
<ParameterBag Id="@bag01" Name="Test Bag" Type="TestBag">
<Parameter Id="@param2" Name="Float Param" Type="Float" Value="44.3" />
<Parameter Id="@param1" Name="Boolean Param" Type="Boolean" Value="true" />
</ParameterBag>
</Action>
<Activity Id="child_activity" Name="Child Activity" Type="childType">
<Action Id="action_2" Name="Action 2" ResourceId="dummyId" ResourceType="dummyType" State="PLANNED" Type="Use">
<Activity Id="child_activity" Name="Child Activity" Type="childType" TimeOrdering="Series">
<Action Id="action_2" Name="Action 2" ResourceId="dummyId" ResourceType="dummyType" State="Planned" Type="Use">
<ParameterBag Id="@bag01" Name="Test Bag" Type="TestBag">
<Parameter Id="@param2" Name="Float Param" Type="Float" Value="44.3" />
<Parameter Id="@param1" Name="Boolean Param" Type="Boolean" Value="true" />
</ParameterBag>
</Action>
<Activity Id="child_child_activity" Name="Child Activity" Type="childType">
<Activity Id="child_child_activity" Name="Child Activity" Type="childType" TimeOrdering="Series">
<ParameterBag Id="@bag01" Name="Test Bag" Type="TestBag">
<Parameter Id="@param2" Name="Float Param" Type="Float" Value="44.3" />
<Parameter Id="@param1" Name="Boolean Param" Type="Boolean" Value="true" />
</ParameterBag>
<Action Id="action_3" Name="Action 3" ResourceId="dummyId" ResourceType="dummyType" State="CREATED" Type="Use">
<Action Id="action_3" Name="Action 3" ResourceId="dummyId" ResourceType="dummyType" State="Created" Type="Use">
<ParameterBag Id="@bag01" Name="Test Bag" Type="TestBag">
<Parameter Id="@param2" Name="Float Param" Type="Float" Value="44.3" />
<Parameter Id="@param1" Name="Boolean Param" Type="Boolean" Value="true" />

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<Action Id="action_1" Name="Action 1" ResourceId="dummyRe" ResourceType="dummyReType" State="CREATED" Type="Use">
<Action Id="action_1" Name="Action 1" ResourceId="dummyRe" ResourceType="dummyReType" State="Created" Type="Use">
<ValueChange Class="li.strolch.model.timevalue.impl.IntegerValue" StateId="@state2" Time="1970-01-01T01:00:00.010+01:00" Value="1" />
<ValueChange Class="li.strolch.model.timevalue.impl.IntegerValue" StateId="@state2" Time="1970-01-01T01:00:00.030+01:00" Value="-1" />
</Action>

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<Activity Id="activity" Name="Activity" Type="parentType">
<Action Id="action_1" Name="Action 1" ResourceId="dummyId" ResourceType="dummyType" State="CREATED" Type="Use" />
<Activity Id="child_activity" Name="Child Activity" Type="childType">
<Action Id="action_2" Name="Action 2" ResourceId="dummyId" ResourceType="dummyType" State="PLANNED" Type="Use" />
<Action Id="action_3" Name="Action 3" ResourceId="dummyId" ResourceType="dummyType" State="CREATED" Type="Use" />
<Activity Id="activity" Name="Activity" Type="parentType" TimeOrdering="Series">
<Action Id="action_1" Name="Action 1" ResourceId="dummyId" ResourceType="dummyType" State="Created" Type="Use" />
<Activity Id="child_activity" Name="Child Activity" Type="childType" TimeOrdering="Series">
<Action Id="action_2" Name="Action 2" ResourceId="dummyId" ResourceType="dummyType" State="Planned" Type="Use" />
<Action Id="action_3" Name="Action 3" ResourceId="dummyId" ResourceType="dummyType" State="Created" Type="Use" />
</Activity>
</Activity>

View File

@ -115,10 +115,10 @@ public class QueryTest {
OrderMap orderMap = tx.getOrderMap();
orderMap.add(tx, ModelGenerator.createOrder("@1", "Order 1", "MyType1", earlier, State.CREATED));
orderMap.add(tx, ModelGenerator.createOrder("@2", "Order 2", "MyType1", current, State.OPEN));
orderMap.add(tx, ModelGenerator.createOrder("@2", "Order 2", "MyType1", current, State.CLOSED));
orderMap.add(tx, ModelGenerator.createOrder("@3", "Order 3", "MyType1", later, State.CLOSED));
orderMap.add(tx, ModelGenerator.createOrder("@4", "Order 4", "MyType2", earlier, State.CREATED));
orderMap.add(tx, ModelGenerator.createOrder("@5", "Order 5", "MyType2", current, State.OPEN));
orderMap.add(tx, ModelGenerator.createOrder("@5", "Order 5", "MyType2", current, State.CLOSED));
orderMap.add(tx, ModelGenerator.createOrder("@6", "Order 6", "MyType2", later, State.CLOSED));
ResourceMap resourceMap = tx.getResourceMap();
@ -216,7 +216,7 @@ public class QueryTest {
performOrderQuery(query, Arrays.asList("@1"));
query = OrderQuery.query("MyType1");
query.and().with(new StateSelection(State.OPEN));
query.and().with(new StateSelection(State.CLOSED));
performOrderQuery(query, Arrays.<String> asList("@2"));
}

View File

@ -41,6 +41,7 @@ import li.strolch.model.State;
import li.strolch.model.Tags;
import li.strolch.model.activity.Action;
import li.strolch.model.activity.Activity;
import li.strolch.model.activity.TimeOrdering;
import li.strolch.model.parameter.IntegerParameter;
import li.strolch.model.parameter.Parameter;
import li.strolch.model.timedstate.IntegerTimedState;
@ -96,7 +97,7 @@ public class PlanActivityTest {
this.timedState3.applyChange(new ValueChange<>(STATE_TIME_0, new IntegerValue(STATE_INTEGER_TIME_0)));
// create activity element
this.activity = new Activity("activity", "Activity", "testType");
this.activity = new Activity("activity", "Activity", "testType", TimeOrdering.SERIES);
// create action 1
this.action1 = new Action("action_1", "Action 1", "Use");
@ -113,7 +114,7 @@ public class PlanActivityTest {
this.activity.addElement(this.action1);
// create child activity
this.childActivity = new Activity("childActivity", "Child Activity", "childType");
this.childActivity = new Activity("childActivity", "Child Activity", "childType", TimeOrdering.SERIES);
// create action 2
this.action2 = new Action("action_2", "Action 2", "Use");

View File

@ -18,6 +18,7 @@ package li.strolch.service;
import org.junit.Test;
import li.strolch.model.ModelGenerator;
import li.strolch.model.activity.TimeOrdering;
import li.strolch.service.AddActivityService.AddActivityArg;
import li.strolch.service.test.AbstractRealmServiceTest;
@ -30,7 +31,7 @@ public class AddActivityServiceTest extends AbstractRealmServiceTest {
public void runTest() {
AddActivityArg arg = new AddActivityArg();
arg.activity = ModelGenerator.createActivity("firstActivity", "First Activity", "AdditionalActivitys");
arg.activity = ModelGenerator.createActivity("firstActivity", "First Activity", "AdditionalActivitys", TimeOrdering.SERIES);
runServiceInAllRealmTypes(AddActivityService.class, arg);
}

View File

@ -18,6 +18,7 @@ package li.strolch.service;
import org.junit.Test;
import li.strolch.model.ModelGenerator;
import li.strolch.model.activity.TimeOrdering;
import li.strolch.service.UpdateActivityService.UpdateActivityArg;
import li.strolch.service.test.AbstractRealmServiceTest;
@ -30,7 +31,7 @@ public class UpdateActivityServiceTest extends AbstractRealmServiceTest {
public void runTest() {
UpdateActivityArg arg = new UpdateActivityArg();
arg.activity = ModelGenerator.createActivity("activity_1", "Modified Car Activity", "ActivityType");
arg.activity = ModelGenerator.createActivity("activity_1", "Modified Car Activity", "ActivityType", TimeOrdering.SERIES);
runServiceInAllRealmTypes(UpdateActivityService.class, arg);
}

View File

@ -199,7 +199,7 @@ public class LockingTest {
@Override
protected ServiceResult internalDoService(LockingArgumentTest arg) throws Exception {
try (StrolchTransaction tx = openTx(arg.realm)) {
try (StrolchTransaction tx = openArgOrUserTx(arg)) {
if (!arg.longRunning)
Thread.sleep(200l);

View File

@ -1,69 +1,69 @@
<?xml version="1.0" encoding="UTF-8"?>
<StrolchModel>
<Activity Id="activity_1" Name="Activity" Type="ActivityType">
<Activity Id="activity_1" Name="Activity" Type="ActivityType" TimeOrdering="Series">
<Policies>
<Policy Type="PlanningPolicy" Value="key:SimplePlanning" />
<Policy Type="ConfirmationPolicy" Value="key:NoConfirmation" />
</Policies>
<Action Id="action_1" Name="Action 1" ResourceId="dummyId" ResourceType="dummyType" State="CREATED" Type="Use">
<Action Id="action_1" Name="Action 1" ResourceId="dummyId" ResourceType="dummyType" State="Created" Type="Use">
<Policies>
<Policy Type="PlanningPolicy" Value="key:SimplePlanning" />
<Policy Type="ConfirmationPolicy" Value="key:NoConfirmation" />
</Policies>
<ValueChange StateId="dummyId" Time="2012-11-30T18:12:05.628+01:00" Value="5" Type="Integer" />
</Action>
<Activity Id="child_activity" Name="Child Activity" Type="childType">
<Activity Id="child_activity" Name="Child Activity" Type="childType" TimeOrdering="Series">
<Policies>
<Policy Type="PlanningPolicy" Value="key:SimplePlanning" />
<Policy Type="ConfirmationPolicy" Value="key:NoConfirmation" />
</Policies>
<Action Id="action_2" Name="Action 2" ResourceId="dummyId" ResourceType="dummyType" State="PLANNED" Type="Use" />
<Action Id="action_3" Name="Action 3" ResourceId="dummyId" ResourceType="dummyType" State="CREATED" Type="Use" />
<Action Id="action_2" Name="Action 2" ResourceId="dummyId" ResourceType="dummyType" State="Planned" Type="Use" />
<Action Id="action_3" Name="Action 3" ResourceId="dummyId" ResourceType="dummyType" State="Created" Type="Use" />
</Activity>
</Activity>
<Activity Id="activity_2" Name="Activity" Type="ActivityType">
<Activity Id="activity_2" Name="Activity" Type="ActivityType" TimeOrdering="Series">
<Policies>
<Policy Type="PlanningPolicy" Value="key:SimplePlanning" />
<Policy Type="ConfirmationPolicy" Value="key:NoConfirmation" />
</Policies>
<Action Id="action_1" Name="Action 1" ResourceId="dummyId" ResourceType="dummyType" State="CREATED" Type="Use">
<Action Id="action_1" Name="Action 1" ResourceId="dummyId" ResourceType="dummyType" State="Created" Type="Use">
<Policies>
<Policy Type="PlanningPolicy" Value="key:SimplePlanning" />
<Policy Type="ConfirmationPolicy" Value="key:NoConfirmation" />
</Policies>
<ValueChange StateId="dummyId" Time="2012-11-30T18:12:05.628+01:00" Value="5" Type="Integer" />
</Action>
<Activity Id="child_activity" Name="Child Activity" Type="childType">
<Activity Id="child_activity" Name="Child Activity" Type="childType" TimeOrdering="Series">
<Policies>
<Policy Type="PlanningPolicy" Value="key:SimplePlanning" />
<Policy Type="ConfirmationPolicy" Value="key:NoConfirmation" />
</Policies>
<Action Id="action_2" Name="Action 2" ResourceId="dummyId" ResourceType="dummyType" State="PLANNED" Type="Use" />
<Action Id="action_3" Name="Action 3" ResourceId="dummyId" ResourceType="dummyType" State="CREATED" Type="Use" />
<Action Id="action_2" Name="Action 2" ResourceId="dummyId" ResourceType="dummyType" State="Planned" Type="Use" />
<Action Id="action_3" Name="Action 3" ResourceId="dummyId" ResourceType="dummyType" State="Created" Type="Use" />
</Activity>
</Activity>
<Activity Id="activity_3" Name="Activity" Type="ActivityType">
<Activity Id="activity_3" Name="Activity" Type="ActivityType" TimeOrdering="Series">
<Policies>
<Policy Type="PlanningPolicy" Value="key:SimplePlanning" />
<Policy Type="ConfirmationPolicy" Value="key:NoConfirmation" />
</Policies>
<Action Id="action_1" Name="Action 1" ResourceId="dummyId" ResourceType="dummyType" State="CREATED" Type="Use">
<Action Id="action_1" Name="Action 1" ResourceId="dummyId" ResourceType="dummyType" State="Created" Type="Use">
<Policies>
<Policy Type="PlanningPolicy" Value="key:SimplePlanning" />
<Policy Type="ConfirmationPolicy" Value="key:NoConfirmation" />
</Policies>
<ValueChange StateId="dummyId" Time="2012-11-30T18:12:05.628+01:00" Value="5" Type="Integer" />
</Action>
<Activity Id="child_activity" Name="Child Activity" Type="childType">
<Activity Id="child_activity" Name="Child Activity" Type="childType" TimeOrdering="Series">
<Policies>
<Policy Type="PlanningPolicy" Value="key:SimplePlanning" />
<Policy Type="ConfirmationPolicy" Value="key:NoConfirmation" />
</Policies>
<Action Id="action_2" Name="Action 2" ResourceId="dummyId" ResourceType="dummyType" State="PLANNED" Type="Use" />
<Action Id="action_3" Name="Action 3" ResourceId="dummyId" ResourceType="dummyType" State="CREATED" Type="Use" />
<Action Id="action_2" Name="Action 2" ResourceId="dummyId" ResourceType="dummyType" State="Planned" Type="Use" />
<Action Id="action_3" Name="Action 3" ResourceId="dummyId" ResourceType="dummyType" State="Created" Type="Use" />
</Activity>
</Activity>

View File

@ -34,6 +34,7 @@ import java.util.Set;
import li.strolch.agent.api.ActivityMap;
import li.strolch.agent.impl.DataStoreMode;
import li.strolch.model.activity.Activity;
import li.strolch.model.activity.TimeOrdering;
import li.strolch.model.parameter.Parameter;
import li.strolch.persistence.api.StrolchTransaction;
import li.strolch.privilege.model.Certificate;
@ -61,7 +62,7 @@ public class ActivityModelTestRunner {
public void runCreateActivityTest() {
// create
Activity newActivity = createActivity("MyTestActivity", "Test Name", "TestType"); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
Activity newActivity = createActivity("MyTestActivity", "Test Name", "TestType", TimeOrdering.SERIES); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
try (StrolchTransaction tx = this.runtimeMock.getRealm(this.realmName).openTx(this.certificate, "test");) {
tx.getActivityMap().add(tx, newActivity);
tx.commitOnClose();
@ -77,9 +78,9 @@ public class ActivityModelTestRunner {
}
// create three activities
Activity activity1 = createActivity("myTestActivity1", "Test Name", "QTestType1"); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
Activity activity2 = createActivity("myTestActivity2", "Test Name", "QTestType2"); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
Activity activity3 = createActivity("myTestActivity3", "Test Name", "QTestType3"); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
Activity activity1 = createActivity("myTestActivity1", "Test Name", "QTestType1", TimeOrdering.SERIES); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
Activity activity2 = createActivity("myTestActivity2", "Test Name", "QTestType2", TimeOrdering.SERIES); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
Activity activity3 = createActivity("myTestActivity3", "Test Name", "QTestType3", TimeOrdering.SERIES); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
try (StrolchTransaction tx = this.runtimeMock.getRealm(this.realmName).openTx(this.certificate, "test");) {
tx.getActivityMap().add(tx, activity1);
tx.getActivityMap().add(tx, activity2);
@ -109,7 +110,7 @@ public class ActivityModelTestRunner {
public void runCrudTests() {
// create
Activity newActivity = createActivity(ID, NAME, TYPE);
Activity newActivity = createActivity(ID, NAME, TYPE, TimeOrdering.SERIES);
try (StrolchTransaction tx = this.runtimeMock.getRealm(this.realmName).openTx(this.certificate, "test");) {
tx.getActivityMap().add(tx, newActivity);
tx.commitOnClose();
@ -159,9 +160,11 @@ public class ActivityModelTestRunner {
// create 15 activities
List<Activity> activities = new ArrayList<>();
activities.addAll(createActivities(activities.size(), 5, "@", "My Activity", "MyType1"));
activities.addAll(createActivities(activities.size(), 5, "@", "Other Activity", "MyType2"));
activities.addAll(createActivities(activities.size(), 5, "@", "Further Activity", "MyType3"));
activities.addAll(createActivities(activities.size(), 5, "@", "My Activity", "MyType1", TimeOrdering.SERIES));
activities
.addAll(createActivities(activities.size(), 5, "@", "Other Activity", "MyType2", TimeOrdering.SERIES));
activities.addAll(
createActivities(activities.size(), 5, "@", "Further Activity", "MyType3", TimeOrdering.SERIES));
// sort them so we know which activity our objects are
Comparator<Activity> comparator = (o1, o2) -> o1.getId().compareTo(o2.getId());

View File

@ -31,6 +31,7 @@ import li.strolch.agent.api.StrolchAgent;
import li.strolch.agent.api.StrolchBootstrapper;
import li.strolch.agent.api.StrolchRealm;
import li.strolch.agent.api.StrolchVersion;
import li.strolch.persistence.api.StrolchTransaction;
import li.strolch.privilege.model.Certificate;
import li.strolch.runtime.privilege.PrivilegeHandler;
import li.strolch.service.api.Service;
@ -41,7 +42,7 @@ import li.strolch.service.api.ServiceResultState;
import li.strolch.utils.helper.FileHelper;
import li.strolch.utils.helper.StringHelper;
public final class RuntimeMock {
public class RuntimeMock {
private static final Logger logger = LoggerFactory.getLogger(RuntimeMock.class);
private static final String TARGET = "target"; //$NON-NLS-1$
@ -71,6 +72,10 @@ public final class RuntimeMock {
return this.container.getRealm(realm);
}
public StrolchTransaction openUserTx(Certificate certificate) {
return this.container.getRealm(certificate).openTx(certificate, getClass());
}
public Certificate loginAdmin() {
return getPrivilegeHandler().authenticate("admin", "admin".getBytes());
}

View File

@ -500,7 +500,7 @@ public class SetParameterCommand extends Command {
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<!-- Include all compiled plugins (below), or include individual xsd as needed -->
<script src="js/bootstrap.min.js"></script>
<!-- Piwik -->

View File

@ -566,7 +566,7 @@
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<!-- Include all compiled plugins (below), or include individual xsd as needed -->
<script src="js/bootstrap.min.js"></script>
<!-- Piwik -->

View File

@ -468,7 +468,7 @@ mvn clean install -DskipTests</pre>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<!-- Include all compiled plugins (below), or include individual xsd as needed -->
<script src="js/bootstrap.min.js"></script>
<!-- Piwik -->

View File

@ -129,7 +129,7 @@
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<!-- Include all compiled plugins (below), or include individual xsd as needed -->
<script src="js/bootstrap.min.js"></script>
<!-- Piwik -->

View File

@ -180,7 +180,7 @@ mailHandler.sendMail("My Subject", "Hello World", "test@test.ch");
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<!-- Include all compiled plugins (below), or include individual xsd as needed -->
<script src="js/bootstrap.min.js"></script>
<!-- Piwik -->

View File

@ -85,7 +85,7 @@
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<!-- Include all compiled plugins (below), or include individual xsd as needed -->
<script src="js/bootstrap.min.js"></script>
<!-- Piwik -->

View File

@ -0,0 +1,177 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="google-site-verification" content="CPhbjooaiTdROm7Vs4E7kuHZvBfkeLUtonGgcVUbTL8"/>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<link rel="shortcut icon" href="ico/favicon.ico">
<title>Strolch: Model</title>
<!-- Bootstrap core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="css/custom.css" rel="stylesheet">
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries --><!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script><![endif]-->
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<a class="navbar-brand" href="index.html">Strolch</a>
</div>
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="index.html">Overview</a></li>
<li><a href="api.html">API</a></li>
<li class="active"><a href="documentation.html">Documentation</a></li>
<li><a href="downloads.html">Downloads</a></li>
<li><a href="development.html">Development</a></li>
<li><a href="blog.html">Blog</a></li>
</ul>
</div>
<!--/.nav-collapse -->
</div>
</div>
<div class="container">
<div class="page-header">
<h1 class="page-title">Documentation: Model</h1>
<p class="lead page-description">This page discusses Strolch's model</p>
</div>
<div class="content">
<p>There is a XML Schema which defines the model in XML: <a href="xsd/StrolchModel.xsd">StrolchModel.xsd</a>
</p>
Here is an example of all the possible elements in Strolch:
<pre>
&lt;StrolchModel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://www.strolch.li/xsd/StrolchModel.xsd"
xsi:schemaLocation="https://www.strolch.li/xsd/StrolchModel.xsd StrolchModel.xsd"&gt;
&lt;IncludeFile file="Include1.xml"/&gt;
&lt;Order Id="@test1" Name="Test Order" Type="Order"&gt;
&lt;Version Version="0" CreatedBy="test" CreatedAt="2012-11-30T18:12:05.628+01:00" Deleted="false"/&gt;
&lt;ParameterBag Id="@bag01" Name="Test Bag" Type="TestBag"&gt;
&lt;Parameter Id="@param1" Name="Boolean Param" Type="Boolean" Value="true"/&gt;
&lt;/ParameterBag&gt;
&lt;ParameterBag Id="@bag01" Name="Test Bag" Type="TestBag"&gt;
&lt;Parameter Id="@param1" Name="Boolean Param" Type="Boolean" Value="true"/&gt;
&lt;/ParameterBag&gt;
&lt;Policies&gt;
&lt;Policy Type="PlanningPolicy" Value="key:SimplePlanning"/&gt;
&lt;Policy Type="ConfirmationPolicy" Value="key:NoConfirmation"/&gt;
&lt;/Policies&gt;
&lt;/Order&gt;
&lt;Resource Id="MyTestResource" Name="Test Name" Type="TestType"&gt;
&lt;Version Version="0" CreatedBy="test" CreatedAt="2012-11-30T18:12:05.628+01:00" Deleted="false"/&gt;
&lt;ParameterBag Id="@bag01" Name="Test Bag 01" Type="TestBag"&gt;
&lt;Parameter Id="@param1" Name="Boolean Param" Type="Boolean" Value="true"/&gt;
&lt;/ParameterBag&gt;
&lt;ParameterBag Id="@bag02" Name="Test Bag 02" Type="TestBag"&gt;
&lt;Parameter Id="@param1" Name="Boolean Param" Type="Boolean" Value="true"/&gt;
&lt;/ParameterBag&gt;
&lt;TimedState Id="@booleanState" Name="Boolean State" Type="Boolean"&gt;
&lt;Value Time="1970-01-01T00:02:00.000+01:00" Value="false"/&gt;
&lt;/TimedState&gt;
&lt;Policies&gt;
&lt;Policy Type="PlanningPolicy" Value="key:SimplePlanning"/&gt;
&lt;Policy Type="ConfirmationPolicy" Value="key:NoConfirmation"/&gt;
&lt;/Policies&gt;
&lt;/Resource&gt;
&lt;Activity Id="activity_1" Name="Activity" Type="parentType"&gt;
&lt;Version Version="0" CreatedBy="test" CreatedAt="2012-11-30T18:12:05.628+01:00" Deleted="false"/&gt;
&lt;ParameterBag Id="@bag01" Name="Test Bag" Type="TestBag"&gt;
&lt;Parameter Id="@param1" Name="Boolean Param" Type="Boolean" Value="true"/&gt;
&lt;/ParameterBag&gt;
&lt;Policies&gt;
&lt;Policy Type="PlanningPolicy" Value="key:SimplePlanning"/&gt;
&lt;Policy Type="ConfirmationPolicy" Value="key:NoConfirmation"/&gt;
&lt;/Policies&gt;
&lt;Action Id="action_1" Name="Action 1" ResourceId="dummyId" ResourceType="dummyType" State="Created" Type="Use"&gt;
&lt;ParameterBag Id="@bag01" Name="Test Bag" Type="TestBag"&gt;
&lt;Parameter Id="@param1" Name="Boolean Param" Type="Boolean" Value="true"/&gt;
&lt;/ParameterBag&gt;
&lt;Policies&gt;
&lt;Policy Type="PlanningPolicy" Value="key:SimplePlanning"/&gt;
&lt;Policy Type="ConfirmationPolicy" Value="key:NoConfirmation"/&gt;
&lt;/Policies&gt;
&lt;ValueChange StateId="dummyId" Time="2012-11-30T18:12:05.628+01:00" Value="5" Type="Integer"/&gt;
&lt;ValueChange StateId="dummyId" Time="2012-11-30T18:12:06.628+01:00" Value="6" Type="Integer"/&gt;
&lt;/Action&gt;
&lt;Activity Id="child_activity" Name="Child Activity" Type="childType"&gt;
&lt;ParameterBag Id="@bag01" Name="Test Bag" Type="TestBag"&gt;
&lt;Parameter Id="@param1" Name="Boolean Param" Type="Boolean" Value="true"/&gt;
&lt;/ParameterBag&gt;
&lt;Policies&gt;
&lt;Policy Type="PlanningPolicy" Value="key:SimplePlanning"/&gt;
&lt;Policy Type="ConfirmationPolicy" Value="key:NoConfirmation"/&gt;
&lt;/Policies&gt;
&lt;Action Id="action_2" Name="Action 2" ResourceId="dummyId" ResourceType="dummyType" State="Planned"
Type="Use"&gt;
&lt;ValueChange StateId="dummyId" Time="2012-11-30T18:12:05.628+01:00" Value="5" Type="Integer"/&gt;
&lt;ValueChange StateId="dummyId" Time="2012-11-30T18:12:06.628+01:00" Value="6" Type="Integer"/&gt;
&lt;/Action&gt;
&lt;Action Id="action_3" Name="Action 3" ResourceId="dummyId" ResourceType="dummyType" State="Created"
Type="Use"/&gt;
&lt;/Activity&gt;
&lt;/Activity&gt;
&lt;/StrolchModel&gt;</pre>
<!-- content here -->
</div>
<!-- /.content -->
<div id="footer">
<div class="container">
<p class="text-muted">&copy; Strolch / <a href="mailto:eitch@eitchnet.ch">Robert von Burg</a> / Hosting by
<a href="http://www.eitchnet.ch">eitchnet.ch</a></p>
</div>
</div>
</div>
<!-- /.container -->
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual xsd as needed -->
<script src="js/bootstrap.min.js"></script>
<!-- Piwik -->
<script type="text/javascript">
var _paq = _paq || [];
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function () {
var u = (("https:" == document.location.protocol) ? "https" : "http") + "://piwik.eitchnet.ch/";
_paq.push(['setTrackerUrl', u + 'piwik.php']);
_paq.push(['setSiteId', 2]);
var d = document, g = d.createElement('script'), s = d.getElementsByTagName('script')[0];
g.type = 'text/javascript';
g.defer = true;
g.async = true;
g.src = u + 'piwik.js';
s.parentNode.insertBefore(g, s);
})();
</script>
<noscript><p><img src="http://piwik.eitchnet.ch/piwik.php?idsite=2" style="border:0;" alt=""/></p></noscript>
<!-- End Piwik Code -->
</body>
</html>

View File

@ -122,7 +122,7 @@ observerHandler.registerObserver(Tags.RESOURCE, new Observer() {
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<!-- Include all compiled plugins (below), or include individual xsd as needed -->
<script src="js/bootstrap.min.js"></script>
<!-- Piwik -->

View File

@ -150,7 +150,7 @@ try (StrolchTransaction tx = openTx()) {
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<!-- Include all compiled plugins (below), or include individual xsd as needed -->
<script src="js/bootstrap.min.js"></script>
<!-- Piwik -->

View File

@ -171,7 +171,7 @@ try (StrolchTransaction tx = openTx()) {
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<!-- Include all compiled plugins (below), or include individual xsd as needed -->
<script src="js/bootstrap.min.js"></script>
<!-- Piwik -->

View File

@ -185,7 +185,7 @@ try(StrolchTransaction tx = realm.openTx()) {
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<!-- Include all compiled plugins (below), or include individual xsd as needed -->
<script src="js/bootstrap.min.js"></script>
<!-- Piwik -->

View File

@ -346,7 +346,7 @@ this.agent.start();
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<!-- Include all compiled plugins (below), or include individual xsd as needed -->
<script src="js/bootstrap.min.js"></script>
<!-- Piwik -->

View File

@ -185,7 +185,7 @@ public class AddOrderCommand extends Command {
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<!-- Include all compiled plugins (below), or include individual xsd as needed -->
<script src="js/bootstrap.min.js"></script>
<!-- Piwik -->

View File

@ -119,7 +119,7 @@ try (StrolchTransaction tx = openTx(...)) {
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<!-- Include all compiled plugins (below), or include individual xsd as needed -->
<script src="js/bootstrap.min.js"></script>
<!-- Piwik -->

View File

@ -119,7 +119,7 @@ List&lt;Resource&gt; versions = resourceMap.getVersionsFor(tx, "TestType", "MyTe
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<!-- Include all compiled plugins (below), or include individual xsd as needed -->
<script src="js/bootstrap.min.js"></script>
<!-- Piwik -->

View File

@ -55,17 +55,18 @@
<p>Currently we have the following topics of discussion:</p>
<ul>
<li><a href="documentation_architecture.html">Strolch Architecture</a></li>
<li><a href="documentation_do_and_dont.html">Strolch Do and Dont</a></li>
<li><a href="documentation_runtime.html">Strolch Runtime Configuration</a></li>
<li><a href="documentation_realms.html">Strolch Realms</a></li>
<li><a href="documentation_components.html">Strolch Components</a></li>
<li><a href="documentation_services_and_commands.html">Strolch Services and Commands</a></li>
<li><a href="documentation_queries.html">Strolch Queries</a></li>
<li><a href="documentation_transactions.html">Strolch Transactions</a></li>
<li><a href="documentation_policies.html">Strolch Policies</a></li>
<li><a href="documentation_observers.html">Strolch Observers</a></li>
<li><a href="documentation_versioning.html">Strolch Versioning</a></li>
<li><a href="documentation-architecture.html">Strolch Architecture</a></li>
<li><a href="documentation-model.html">Strolch Model</a></li>
<li><a href="documentation-do-and-dont.html">Strolch Do and Dont</a></li>
<li><a href="documentation-runtime.html">Strolch Runtime Configuration</a></li>
<li><a href="documentation-realms.html">Strolch Realms</a></li>
<li><a href="documentation-components.html">Strolch Components</a></li>
<li><a href="documentation-services-and-commands.html">Strolch Services and Commands</a></li>
<li><a href="documentation-queries.html">Strolch Queries</a></li>
<li><a href="documentation-transactions.html">Strolch Transactions</a></li>
<li><a href="documentation-policies.html">Strolch Policies</a></li>
<li><a href="documentation-observers.html">Strolch Observers</a></li>
<li><a href="documentation-versioning.html">Strolch Versioning</a></li>
<!--
<li><a href="documentation_privileges.html">Strolch Privileges</a></li>
<li><a href="documentation_audits.html">Strolch Audits</a></li>
@ -89,7 +90,7 @@
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<!-- Include all compiled plugins (below), or include individual xsd as needed -->
<script src="js/bootstrap.min.js"></script>
<!-- Piwik -->

View File

@ -180,7 +180,7 @@
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<!-- Include all compiled plugins (below), or include individual xsd as needed -->
<script src="js/bootstrap.min.js"></script>
<!-- Piwik -->

View File

@ -216,7 +216,7 @@
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<!-- Include all compiled plugins (below), or include individual xsd as needed -->
<script src="js/bootstrap.min.js"></script>
<!-- Piwik -->

View File

@ -0,0 +1,185 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="https://www.strolch.li/xsd/StrolchModel.xsd" xmlns="https://www.strolch.li/xsd/StrolchModel.xsd"
elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:annotation>
<xs:documentation>This is Version 1.4.0-SNAPSHOT of the StrolchModel XSD.</xs:documentation>
</xs:annotation>
<xs:element name="StrolchModel" type="StrolchModelType" />
<xs:complexType name="StrolchModelType">
<xs:sequence maxOccurs="unbounded" minOccurs="0">
<xs:choice>
<xs:element type="IncludeFileType" name="IncludeFile" maxOccurs="unbounded" minOccurs="0" />
<xs:element type="OrderType" name="Order" maxOccurs="unbounded" minOccurs="0" />
<xs:element type="ResourceType" name="Resource" maxOccurs="unbounded" minOccurs="0" />
<xs:element type="ActivityType" name="Activity" maxOccurs="unbounded" minOccurs="0" />
</xs:choice>
</xs:sequence>
</xs:complexType>
<xs:complexType name="IncludeFileType">
<xs:attribute type="xs:string" name="file" />
</xs:complexType>
<xs:complexType name="VersionType">
<xs:attribute type="xs:int" name="Version" />
<xs:attribute type="xs:string" name="CreatedBy" />
<xs:attribute type="xs:dateTime" name="CreatedAt" />
<xs:attribute type="xs:string" name="Deleted" />
</xs:complexType>
<xs:complexType name="OrderType">
<xs:sequence>
<xs:element type="VersionType" name="Version" maxOccurs="1" minOccurs="0" />
<xs:element type="ParameterBagType" name="ParameterBag" maxOccurs="unbounded" minOccurs="0" />
<xs:element type="PoliciesType" name="Policies" maxOccurs="1" minOccurs="0" />
</xs:sequence>
<xs:attribute type="xs:string" name="Id" />
<xs:attribute type="xs:string" name="Name" />
<xs:attribute type="xs:string" name="Type" />
<xs:attribute type="StateType" name="State" />
</xs:complexType>
<xs:complexType name="ResourceType">
<xs:sequence>
<xs:element type="VersionType" name="Version" maxOccurs="1" minOccurs="0" />
<xs:element type="ParameterBagType" name="ParameterBag" maxOccurs="unbounded" minOccurs="0" />
<xs:element type="TimedStateType" name="TimedState" maxOccurs="unbounded" minOccurs="0" />
<xs:element type="PoliciesType" name="Policies" maxOccurs="1" minOccurs="0" />
</xs:sequence>
<xs:attribute type="xs:string" name="Id" />
<xs:attribute type="xs:string" name="Name" />
<xs:attribute type="xs:string" name="Type" />
</xs:complexType>
<xs:complexType name="ActivityType">
<xs:sequence>
<xs:element type="VersionType" name="Version" maxOccurs="1" minOccurs="0" />
<xs:element type="ParameterBagType" name="ParameterBag" maxOccurs="unbounded" minOccurs="0" />
<xs:element type="PoliciesType" name="Policies" maxOccurs="1" minOccurs="0" />
<xs:sequence maxOccurs="unbounded" minOccurs="0">
<xs:choice>
<xs:element type="ActionType" name="Action" maxOccurs="unbounded" minOccurs="0" />
<xs:element type="ActivityType" name="Activity" maxOccurs="unbounded" minOccurs="0" />
</xs:choice>
</xs:sequence>
</xs:sequence>
<xs:attribute type="xs:string" name="Id" />
<xs:attribute type="xs:string" name="Name" />
<xs:attribute type="xs:string" name="Type" />
<xs:attribute type="StateType" name="State" />
<xs:attribute type="TimeOrderingType" name="TimeOrdering" />
</xs:complexType>
<xs:complexType name="ActionType">
<xs:sequence>
<xs:element type="ParameterBagType" name="ParameterBag" maxOccurs="unbounded" minOccurs="0" />
<xs:element type="PoliciesType" name="Policies" maxOccurs="1" minOccurs="0" />
<xs:element type="ValueChangeType" name="ValueChange" maxOccurs="unbounded" minOccurs="0" />
</xs:sequence>
<xs:attribute type="xs:string" name="Id" />
<xs:attribute type="xs:string" name="Name" />
<xs:attribute type="xs:string" name="ResourceId" />
<xs:attribute type="xs:string" name="ResourceType" />
<xs:attribute type="StateType" name="State" />
<xs:attribute type="xs:string" name="Type" />
</xs:complexType>
<xs:complexType name="ParameterBagType">
<xs:sequence>
<xs:element type="ParameterType" name="Parameter" maxOccurs="unbounded" minOccurs="0" />
</xs:sequence>
<xs:attribute type="xs:string" name="Id" />
<xs:attribute type="xs:string" name="Name" />
<xs:attribute type="xs:string" name="Type" />
</xs:complexType>
<xs:complexType name="ParameterType">
<xs:attribute type="xs:string" name="Id" />
<xs:attribute type="xs:string" name="Name" />
<xs:attribute type="ParameterValueType" name="Type" />
<xs:attribute type="xs:string" name="Value" />
<xs:attribute type="xs:string" name="Interpretation" use="optional" />
<xs:attribute type="xs:string" name="Uom" use="optional" />
<xs:attribute type="xs:boolean" name="Hidden" use="optional" />
<xs:attribute type="xs:int" name="Index" use="optional" />
</xs:complexType>
<xs:complexType name="PoliciesType">
<xs:sequence>
<xs:element type="PolicyType" name="Policy" maxOccurs="unbounded" minOccurs="0" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="PolicyType">
<xs:attribute type="xs:string" name="Type" />
<xs:attribute type="xs:string" name="Value" />
</xs:complexType>
<xs:complexType name="TimedStateType">
<xs:sequence>
<xs:element type="ValueType" name="Value" maxOccurs="unbounded" minOccurs="0" />
</xs:sequence>
<xs:attribute type="xs:string" name="Id" />
<xs:attribute type="xs:string" name="Name" />
<xs:attribute type="TimedStateTypeType" name="Type" />
</xs:complexType>
<xs:complexType name="ValueType">
<xs:attribute type="xs:dateTime" name="Time" />
<xs:attribute type="xs:string" name="Value" />
</xs:complexType>
<xs:complexType name="ValueChangeType">
<xs:attribute type="xs:string" name="StateId" />
<xs:attribute type="xs:dateTime" name="Time" />
<xs:attribute type="xs:string" name="Value" />
<xs:attribute type="TimedStateTypeType" name="Type" />
</xs:complexType>
<xs:simpleType name="StateType">
<xs:restriction base="xs:string">
<xs:enumeration value="Created" />
<xs:enumeration value="Planning" />
<xs:enumeration value="Planned" />
<xs:enumeration value="Execution" />
<xs:enumeration value="Stopped" />
<xs:enumeration value="Executed" />
<xs:enumeration value="Closed" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="TimeOrderingType">
<xs:restriction base="xs:string">
<xs:enumeration value="Series" />
<xs:enumeration value="Parallel" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="ParameterValueType">
<xs:restriction base="xs:string">
<xs:enumeration value="Boolean" />
<xs:enumeration value="String" />
<xs:enumeration value="Integer" />
<xs:enumeration value="Long" />
<xs:enumeration value="Float" />
<xs:enumeration value="Date" />
<xs:enumeration value="Duration" />
<xs:enumeration value="StringList" />
<xs:enumeration value="IntegerList" />
<xs:enumeration value="FloatList" />
<xs:enumeration value="LongList" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="TimedStateTypeType">
<xs:restriction base="xs:string">
<xs:enumeration value="Boolean" />
<xs:enumeration value="Integer" />
<xs:enumeration value="Float" />
<xs:enumeration value="StringSet" />
</xs:restriction>
</xs:simpleType>
</xs:schema>