IClass, IPackage, IInterface, IInterfaceRealization, IDependency, IProperty, IAssociation, ) class PackagesAndEggsScope(Scope): def __call__(self, node): return node.stereotype("pyegg:pythonegg") is not None or node.stereotype("pyegg:pymodule") is not None registerScope("packagesandeggs", "uml2fs", [IPackage], PackagesAndEggsScope) registerScope("classesandpackages", "uml2fs", [IClass, IPackage], Scope) class ServiceScope(Scope): def __call__(self, node): return node.stereotype("cornice:service") is not None registerScope("cornice_service", "uml2fs", [IClass], ServiceScope) class GETScope(Scope): def __call__(self, node): return node.stereotype("cornice:get") is not None
IOperation, IClass, IPackage, IInterface, IInterfaceRealization, IDependency, IProperty, IAssociation, ) class pyramid_configuration(Scope): def __call__(self, node): return node.stereotype('pyramid:configuration') is not None registerScope('pyramid_configuration', 'uml2fs', [IPackage], pyramid_configuration) class pyramid_static_view(Scope): def __call__(self, node): return node.stereotype('pyramid:static_view') is not None registerScope('pyramid_static_view', 'uml2fs', [IClass], pyramid_static_view) class pyramid_buildout(Scope): def __call__(self, node): return node.stereotype('pyramid:buildout') is not None registerScope('pyramid_buildout', 'uml2fs', [IPackage], pyramid_buildout)
def __call__(self, node): return ( node.stereotype("dexterity:Int") or node.stereotype("dexterity:Float") or node.stereotype("dexterity:Date") or node.stereotype("dexterity:Datetime") or node.stereotype("dexterity:Timedelta") or node.stereotype("dexterity:Decimal") ) class ObjectScope(Scope): def __call__(self, node): return node.stereotype("dexterity:Object") class BehaviorScope(Scope): def __call__(self, node): return node.stereotype("dexterity:behavior") registerScope("association", "uml2fs", [IAssociation], Scope) registerScope("dxcollection", "uml2fs", None, CollectionScope) registerScope("dxminmaxlen", "uml2fs", None, MinMaxLenScope) registerScope("dxdict", "uml2fs", None, DictScope) registerScope("dxfield", "uml2fs", None, FieldScope) registerScope("dxrichtext", "uml2fs", None, RichTextScope) registerScope("dxminmax", "uml2fs", None, MinMaxScope) registerScope("dxobject", "uml2fs", None, ObjectScope) registerScope("dxbehavior", "uml2fs", None, BehaviorScope)
ComplexDirective, ) from node.ext.python.nodes import Module from node.ext.template import JinjaTemplate from node.ext.python import Import from agx.generator.pyegg.utils import egg_source from agx.generator.zca import utils as zcautils from agx.generator.sql.scope import ( SqlContentScope, SqlTableScope, SqlSAConfigScope, SqlConcreteTableInheritanceScope, SqlJoinedTableInheritanceScope, ) registerScope('sqlcontent', 'uml2fs', [IClass] , SqlContentScope) registerScope('sqlconcretetableinheritance', 'uml2fs', [IClass], SqlConcreteTableInheritanceScope) registerScope('sqljoinedtableinheritance', 'uml2fs', [IClass], SqlJoinedTableInheritanceScope) registerScope('sql_config', 'uml2fs', [IPackage] , SqlSAConfigScope) registerScope('sqlassociation', 'uml2fs', [IAssociation], Scope) registerScope('sqlassociationclass', 'uml2fs', [IAssociationClass], Scope) def templatepath(name): return os.path.join(os.path.dirname(__file__), 'templates/%s' % name) def get_pks(klass): """gets the pks of an uml class.
"""Covers view and dynamic_view. """ def __call__(self, node): if not (IClass.providedBy(node) or IInterface.providedBy(node)): return False return node.stereotype('plone:view') or \ node.stereotype('plone:dynamic_view') is not None class DynamicViewScope(Scope): def __call__(self, node): return node.stereotype('plone:dynamic_view') is not None class BrowserPageScope(Scope): def __call__(self, node): if not IDependency.providedBy(node): return False return node.stereotype('plone:view') is not None registerScope('gsprofile', 'uml2fs', None, ProfileScope) registerScope('contenttype', 'uml2fs', None, ContentTypeScope) registerScope('viewclass', 'uml2fs', None, ViewClassScope) registerScope('dynamicview', 'uml2fs', None, DynamicViewScope) registerScope('dependency', 'uml2fs', [IDependency], Scope) registerScope('browserpage', 'uml2fs', None, BrowserPageScope)
ZCMLFile, SimpleDirective, ComplexDirective, ) from node.ext.uml.utils import ( TaggedValues, UNSET, ) from agx.generator.pyegg.utils import ( class_base_name, templatepath, set_copyright, ) registerScope('zcainterface', 'uml2fs', [IInterface], Scope) registerScope('zcarealize', 'uml2fs', [IInterfaceRealization], Scope) registerScope('zcaadapts', 'uml2fs', None, AdaptsScope) registerScope('zcapermits', 'uml2fs', None, PermitsScope) registerScope('zcapermission', 'uml2fs', None, PermissionScope) registerScope('zcasubscriber', 'uml2fs', None, SubscriberScope) registerScope('eventfor', 'uml2fs', None, EventForScope) @handler('interfacegeneralization', 'uml2fs', 'connectorgenerator', 'zcainterface', order=10) def interfacegeneralization(self, source, target): """Create generalization between interfaces . """ inheritance = Inheritance(source) targetclass = read_target_node(source, target.target)
def __call__(self, node): return node.stereotype('sql:sql_content') is not None \ and node.stereotype('sql:concrete_table_inheritance') is not None class SqlJoinedTableInheritanceScope(Scope): def __call__(self, node): return node.stereotype('sql:sql_content') is not None \ and node.stereotype('sql:joined_table_inheritance') is not None class SqlTableScope(Scope): def __call__(self, node): return node.stereotype('sql:sql_table') is not None class SqlSAConfigScope(Scope): def __call__(self, node): return node.stereotype('sql:z3c_saconfig') is not None class SqlPyramidIncludeConfigScope(Scope): def __call__(self, node): return node.stereotype('sql:pyramid_include') is not None registerScope('sql_pyramid_include', 'uml2fs', [IPackage], SqlPyramidIncludeConfigScope)
IPackage, IInterface, IInterfaceRealization, IDependency, IProperty, IAssociation, ) class ClassScopeScope(Scope): def __call__(self, node): return node.stereotype('generator:class_scope') is not None registerScope('classscope', 'uml2fs', [IClass] , ClassScopeScope) class SimpleScopeScope(Scope): def __call__(self, node): return node.stereotype('generator:simple_scope') is not None registerScope('simplescope', 'uml2fs', None , SimpleScopeScope) class GeneratorScope(Scope): def __call__(self, node): return node.stereotype('generator:generator') is not None
return True class AutoimportScope(PackageScope): def __call__(self, node): if node.stereotype("pyegg:autoimport") is None: return False return True class ConsoleScriptScope(Scope): def __call__(self, node): return node.stereotype("pyegg:console_script") is not None registerScope("console_script", "uml2fs", None, ConsoleScriptScope) class SimpleBuildoutScope(Scope): def __call__(self, node): return node.stereotype("pyegg:simple_buildout") is not None registerScope("simple_buildout", "uml2fs", None, SimpleBuildoutScope) registerScope("pythonegg", "uml2fs", None, EggScope) registerScope("pypackage", "uml2fs", None, PackageScope) registerScope("pymodule", "uml2fs", None, ModuleScope) registerScope("pyclass", "uml2fs", [IClass], Scope) registerScope("pyfunction", "uml2fs", [IOperation], Scope)
IClass, IPackage, IInterface, IInterfaceRealization, IDependency, IProperty, IAssociation, ) class ClassScopeScope(Scope): def __call__(self, node): return node.stereotype('generator:class_scope') is not None registerScope('classscope', 'uml2fs', [IClass], ClassScopeScope) class SimpleScopeScope(Scope): def __call__(self, node): return node.stereotype('generator:simple_scope') is not None registerScope('simplescope', 'uml2fs', None, SimpleScopeScope) class GeneratorScope(Scope): def __call__(self, node): return node.stereotype('generator:generator') is not None
class ViewClassScope(Scope): """Covers view and dynamic_view. """ def __call__(self, node): if not (IClass.providedBy(node) or IInterface.providedBy(node)): return False return node.stereotype('plone:view') or \ node.stereotype('plone:dynamic_view') is not None class DynamicViewScope(Scope): def __call__(self, node): return node.stereotype('plone:dynamic_view') is not None class BrowserPageScope(Scope): def __call__(self, node): if not IDependency.providedBy(node): return False return node.stereotype('plone:view') is not None registerScope('gsprofile', 'uml2fs', None, ProfileScope) registerScope('contenttype', 'uml2fs', None, ContentTypeScope) registerScope('viewclass', 'uml2fs', None, ViewClassScope) registerScope('dynamicview', 'uml2fs', None, DynamicViewScope) registerScope('dependency', 'uml2fs', [IDependency], Scope) registerScope('browserpage', 'uml2fs', None, BrowserPageScope)
class MinMaxScope(Scope): def __call__(self, node): return node.stereotype('dexterity:Int') \ or node.stereotype('dexterity:Float') \ or node.stereotype('dexterity:Date') \ or node.stereotype('dexterity:Datetime') \ or node.stereotype('dexterity:Timedelta') \ or node.stereotype('dexterity:Decimal') class ObjectScope(Scope): def __call__(self, node): return node.stereotype('dexterity:Object') class BehaviorScope(Scope): def __call__(self, node): return node.stereotype('dexterity:behavior') registerScope('association', 'uml2fs', [IAssociation], Scope) registerScope('dxcollection', 'uml2fs', None, CollectionScope) registerScope('dxminmaxlen', 'uml2fs', None, MinMaxLenScope) registerScope('dxdict', 'uml2fs', None, DictScope) registerScope('dxfield', 'uml2fs', None, FieldScope) registerScope('dxrichtext', 'uml2fs', None, RichTextScope) registerScope('dxminmax', 'uml2fs', None, MinMaxScope) registerScope('dxobject', 'uml2fs', None, ObjectScope) registerScope('dxbehavior', 'uml2fs', None, BehaviorScope)