示例#1
0
 def __call__(self, node, aspect=None):
     name = self.__class__.__name__.lower()
     if name.endswith("aspect"):
         name = name[:-len("aspect")]
     factory = zope.component.getUtility(IAspectDefinitionClass, name=name)
     aspect = factory()
     configure_attributes(node, aspect, self.attributes)
     return [aspect]
示例#2
0
    def __call__(self, node, activity=None):
        name = self.__class__.__name__.lower()
        factory = zope.component.getUtility(IActivityClass, name=name)
        activity = factory()
        configure_attributes(node, activity, self.attributes)

        for descriptor in self.checkpoints:
            descriptor.apply(node, activity)

        return [activity]
示例#3
0
文件: core.py 项目: gocept/alphaflow
    def __call__(self, process_node):
        process = ProcessVersion()

        # Configure the process' simple attributes
        configure_attributes(process_node, process, self.attributes)

        # Import all activities
        for node in get_element_children(process_node):
            activity_importer = zope.component.getAdapter(
                process, IDOMImporter, name=node.nodeName)
            for activity in activity_importer(node):
                process[activity.getId()] = activity

        return [process]
示例#4
0
 def __call__(self, node, recipient=None):
     notify = Products.AlphaFlow.activities.notify
     recipient_type = node.getAttribute("type")
     if recipient_type == "owner":
         recipient = notify.RecipientOwner()
     elif recipient_type == "next_assignees":
         recipient = notify.RecipientNextAssignees()
     elif recipient_type == "current_assignees":
         recipient = notify.RecipientCurrentAssignees()
     elif recipient_type == "previous_assignees":
         recipient = notify.RecipientPreviousAssignees()
     elif recipient_type == "actual_role":
         recipient = notify.RecipientActualRole()
         configure_attributes(node, recipient, self.actual_role)
     else:
         raise ConfigurationError("Unknown recipient type: " +
                                  recipient_type)
     return [recipient]
示例#5
0
    def _parse_assignee(self, assignee, obj):
        has = assignee.hasAttribute
        get = assignee.getAttribute

        configure_attributes(assignee, obj, self.assigneesKind)
        kind = obj.assigneesKind

        statements = has('roles') + has('expression') + has('groups')

        if statements > 1:
            raise ConfigurationError(
                '<assignees> can only have one of roles or expression.')
        if statements < 1:
            raise ConfigurationError(
                '<assignees> must have one of roles or expression.')
        if has('roles'):
            configure_attributes(assignee, obj, self.roles)
        elif has('groups'):
            configure_attributes(assignee, obj, self.groups)
        elif has('expression'):
            if kind == 'possible':
                raise NotImplementedError(
                    "Can not combine `possible` and `expression`.")
            configure_attributes(assignee, obj, self.assigneesExpression)
示例#6
0
 def __call__(self, node, checkpoint=None):
     if not checkpoint:
         checkpoint = self.factory()
     configure_attributes(node, checkpoint, self.attributes)
     add_child_elements(node, checkpoint, "Aspect")
     return [checkpoint]
示例#7
0
 def __call__(self, node, setting=None):
     # XXX feed the factory with dummy values, should be refactored
     setting = self._factory(None, None, None)
     configure_attributes(node, setting, self.attributes)
     return [setting]