def feature_group_assignment(kls, **params): """Decorator for domain types that support "group_assignment" feature. """ interface.classImplements(kls, interfaces.IFeatureGroupAssignment) add_container_property_to_model( kls, "group_assignments", "bungeni.models.domain.GroupDocumentAssignmentContainer", "doc_id")
def feature_event(kls, **params): """Decorator for domain types to support "event" feature. For Doc types (other than Event itself). """ # domain.Event itself may NOT support events assert not interfaces.IEvent.implementedBy(kls) interface.classImplements(kls, interfaces.IFeatureEvent) add_container_property_to_model(kls, "events", "bungeni.models.domain.EventContainer", "head_id")
def feature_signatory(kls, **params): """Decorator for domain types to support "signatory" feature. For Doc types. """ interface.classImplements(kls, interfaces.IFeatureSignatory) add_container_property_to_model(kls, "signatories", "bungeni.models.domain.SignatoryContainer", "head_id") import bungeni.models.signatories bungeni.models.signatories.createManagerFactory(kls, **params)
def feature_group_assignment(kls, feature): """Decorator for domain types that support "group_assignment" feature. """ # !+QUALIFIED_FEATURES(mr, apr-2013) may need to "qualify" each assignment! # Or, alternatively, each "group_assignment" enabling needs to be "part of" # a qualified "event" feature. interface.classImplements(kls, interfaces.IFeatureGroupAssignment) add_container_property_to_model(kls, "group_assignments", "bungeni.models.domain.GroupDocumentAssignmentContainer", "doc_id")
def feature_signatory(kls, feature): """Decorator for domain types to support "signatory" feature. For Doc types. """ interface.classImplements(kls, interfaces.IFeatureSignatory) add_container_property_to_model(kls, "signatories", "bungeni.models.domain.SignatoryContainer", "head_id") import bungeni.models.signatories bungeni.models.signatories.createManagerFactory(kls, **feature.params)
def feature_attachment(kls, feature): """Decorator for domain types to support "attachment" feature. !+ currently assumes that kls is versionable. """ # domain.Attachment itself may NOT support attachments assert not interfaces.IAttachment.implementedBy(kls) interface.classImplements(kls, interfaces.IFeatureAttachment) add_container_property_to_model(kls, "files", "bungeni.models.domain.AttachmentContainer", "head_id")
def feature_event(kls, **params): """Decorator for domain types to support "event" feature. For Doc types (other than Event itself). """ # domain.Event itself may NOT support events assert not interfaces.IEvent.implementedBy(kls) interface.classImplements(kls, interfaces.IFeatureEvent) add_container_property_to_model(kls, "events", "bungeni.models.domain.EventContainer", "head_id")
def feature_address(kls, **params): """Decorator for domain types to support "address" feature. For User and Group types, means support for possibility to have addresses. """ interface.classImplements(kls, interfaces.IFeatureAddress) if issubclass(kls, domain.Group): add_container_property_to_model(kls, "addresses", "bungeni.models.domain.GroupAddressContainer", "group_id") elif issubclass(kls, domain.User): add_container_property_to_model(kls, "addresses", "bungeni.models.domain.UserAddressContainer", "user_id")
def feature_address(kls, feature): """Decorator for domain types to support "address" feature. For User and Group types, means support for possibility to have addresses. """ interface.classImplements(kls, interfaces.IFeatureAddress) if issubclass(kls, domain.Group): add_container_property_to_model(kls, "addresses", "bungeni.models.domain.GroupAddressContainer", "principal_id") elif issubclass(kls, domain.User): add_container_property_to_model(kls, "addresses", "bungeni.models.domain.UserAddressContainer", "principal_id")
def feature_event(kls, feature): """Decorator for domain types to support "event" feature. For Doc types (other than Event itself). """ # !+ feature "descriptor/processing/validation", move elsewhere? # parameter "types": # - may "allow" multiple event types # - if none specified, "event" is assumed as the default. feature.params["types"] = feature.params.get("types", "event").split() # domain.Event itself may NOT support events assert not interfaces.IEvent.implementedBy(kls) interface.classImplements(kls, interfaces.IFeatureEvent) # container property per enabled event type for event_type_key in feature.params["types"]: if capi.has_type_info(event_type_key): container_property_name = naming.plural(event_type_key) container_class_name = naming.container_class_name(event_type_key) add_container_property_to_model(kls, container_property_name, "bungeni.models.domain.%s" % (container_class_name), "head_id") else: log.warn('IGNORING feature "event" ref to disabled type %r', event_type_key)
def feature_group_assignment(kls, **params): """Decorator for domain types that support "group_assignment" feature. """ interface.classImplements(kls, interfaces.IFeatureGroupAssignment) add_container_property_to_model(kls, "group_assignments", "bungeni.models.domain.GroupDocumentAssignmentContainer", "doc_id")