use of org.whole.lang.artifacts.visitors.ArtifactsSynchronizerVisitor.Synchronize in project whole by wholeplatform.
the class WorkflowsInterpreterVisitor method visit.
@Override
public void visit(LoadArtifacts entity) {
try {
IArtifactsEntity model = null;
Variable variable = entity.getModel();
String variableName = variable.getValue();
boolean isDefined = getBindings().wIsSet(variableName);
if (isDefined) {
variable.accept(this);
model = (IArtifactsEntity) getResult();
}
entity.getRootResource().accept(this);
String resource = getResultString();
ResourceKind resourceKind = entity.getRootResourceKind();
Traverse traverse = Traverse.valueOf(DataTypeUtils.getAsPersistenceString(entity.getTraversalStrategy()));
Synchronize synchronize = Synchronize.valueOf(DataTypeUtils.getAsPersistenceString(entity.getSynchronizeStrategy()));
IPersistenceKit defaultPersistenceKit = getPersistenceKit(entity.getDefaultPersistence());
IArtifactsEntity result = ArtifactsSynchronizerVisitor.synchronize(model, traverse, synchronize, createArtifactsBindings(resource, resourceKind), defaultPersistenceKit, true);
if (isDefined) {
if (EntityUtils.hasParent(model))
model.wGetParent().wSet(model, result);
getBindings().wSet(variableName, result);
} else
getBindings().wDef(variableName, result);
setResult(result);
} catch (Exception e) {
throw IWholeRuntimeException.asWholeException(e, entity, getBindings());
}
}
use of org.whole.lang.artifacts.visitors.ArtifactsSynchronizerVisitor.Synchronize in project whole by wholeplatform.
the class WorkflowsInterpreterVisitor method visit.
@Override
public void visit(SaveArtifacts entity) {
try {
entity.getModel().accept(this);
IArtifactsEntity model = (IArtifactsEntity) getResult();
entity.getRootResource().accept(this);
String resource = getResultString();
ResourceKind resourceKind = entity.getRootResourceKind();
Traverse traverse = Traverse.valueOf(DataTypeUtils.getAsPersistenceString(entity.getTraversalStrategy()));
Synchronize synchronize = Synchronize.valueOf(DataTypeUtils.getAsPersistenceString(entity.getSynchronizeStrategy()));
IPersistenceKit defaultPersistenceKit = getPersistenceKit(entity.getDefaultPersistence());
ArtifactsSynchronizerVisitor.synchronize(model, traverse, synchronize, createArtifactsBindings(resource, resourceKind), defaultPersistenceKit, false);
} catch (Exception e) {
throw IWholeRuntimeException.asWholeException(e, entity, getBindings());
}
}
Aggregations