Ejemplo n.º 1
0
class SequenceFlow(FlowElement):
    source_id = StringAttribute('sourceRef', required=True)
    target_id = StringAttribute('targetRef', required=True)
    isImmediate = BooleanAttribute('isImmediate', default=False)

    def process_refs(self, objects):
        self.sourceRef = objects[self.source_id]
        self.targetRef = objects[self.target_id]
        assert isinstance(self.sourceRef, FlowNode)
        assert isinstance(self.targetRef, FlowNode)
        self.targetRef.incoming.append(self)
        self.sourceRef.outgoing.append(self)

    def condition_ok(self):
        return False
Ejemplo n.º 2
0
class ResourceParameterBinding(BaseElement):
    parameterRef = StringAttribute('parameterRef', required=True)
    expression = SingleAssociation(Expression, required=True)

    @property
    def parameter(self):
        return engine.db[self.parameterRef]
Ejemplo n.º 3
0
class ScriptTask(Task):
    SCRIPTFORMAT = "application/x-pybpmn"
    script = StringAttribute('script')
    scriptFormat = StringAttribute('scriptFormat')

    def validate(self):
        super(ScriptTask, self).validate()
        if self.script:
            if not self.scriptFormat:
                raise XMLFormatError(
                    _("ScriptTask must have scriptFormat attribute if script attribute exists."
                      ))
            if self.scriptFormat <> self.SCRIPTFORMAT:
                raise XMLFormatError(
                    _("ScriptTask support only application/x-pybpmn language.")
                )

    def wait_for_complete(self):
        super(ScriptTask, self).wait_for_complete()
        if not self.script:
            return
        if self.scriptFormat == self.SCRIPTFORMAT:
            exec(self.script)
Ejemplo n.º 4
0
class ResourceRole(BaseElement):
    name = StringAttribute('name')
    resourceRef = SingleAssociation('ResourceRef')
    resourceAssignmentExpression = SingleAssociation(
        ResourceAssignmentExpression)
    resourceParameterBindings = MultiAssociation(ResourceParameterBinding)

    def validate(self):
        if self.resourceRef and self.resourceAssignmentExpression:
            raise XMLFormatError(
                'resourceRef and resourceAssignmentExpression should not exists together.'
            )
        if self.resourceParameterBindings and not self.resourceRef:
            raise XMLFormatError(
                'resourceParameterBindings is only applicable if a resourceRef is specified.'
            )

    @property
    def resource(self):
        return engine.db[self.resourceRef.refid]
Ejemplo n.º 5
0
class ServiceTask(Task):
    implementation = StringAttribute('implementation', default='##WebService')
Ejemplo n.º 6
0
class CallableElement(RootElement):
    name = StringAttribute('name', required=True)
Ejemplo n.º 7
0
class Resource(RootElement):
    name = StringAttribute('name', required=True)
    resourceParameters = MultiAssociation(ResourceParameter)
Ejemplo n.º 8
0
class ResourceParameter(BaseElement):
    name = StringAttribute('name', required=True)
    isRequired = BooleanAttribute('isRequired', required=True)
Ejemplo n.º 9
0
class Message(RootElement):
    name = StringAttribute('name', required=True)
Ejemplo n.º 10
0
class Documentation(BaseElement):
    text = StringAttribute('text', required=True)
    textFormat = StringAttribute('textFormat', required=True)
Ejemplo n.º 11
0
class FormalExpression(Expression):
    language = StringAttribute('language')
    evaluatesTypeRef = SingleAssociation('ItemDefinition')
    body = XMLTagText()
Ejemplo n.º 12
0
class Extension(XMLBaseElement):
    definition = StringAttribute('definition')
    mustUnderstand = BooleanAttribute('mustUnderstand', False)
    documentation = MultiAssociation('Documentation')
Ejemplo n.º 13
0
class Target(XMLBaseElement):
    ref = StringAttribute('ref', required=True)
Ejemplo n.º 14
0
class Source(XMLBaseElement):
    ref = StringAttribute('ref', required=True)
Ejemplo n.º 15
0
class Relationship(BaseElement):
    type = StringAttribute('type', required=True)
    direction = StringAttribute('direction')
    source = MultiAssociation('Source', required=True)
    target = MultiAssociation('Target', required=True)
Ejemplo n.º 16
0
class FlowElement(BaseElement):
    auto_instantiate = False
    name = StringAttribute('name', default='')

    def instantiate(self):
        return self
Ejemplo n.º 17
0
class BaseElement(XMLBaseElement):
    id = StringAttribute('id', default=lambda: uuid.uuid1().hex)
    documentation = MultiAssociation('Documentation')