@@ -481,6 +481,39 @@ class PortfolioItem_Initiative(PortfolioItem): pass
481481class PortfolioItem_Theme (PortfolioItem ): pass
482482class PortfolioItem_Feature (PortfolioItem ): pass
483483
484+ class Connection (WorkspaceDomainObject ):
485+
486+ MINIMAL_WDO_ATTRIBUTES = ['_type' ,
487+ 'oid' , 'ref' , 'ObjectID' , 'ObjectUUID' , '_ref' ,
488+ '_CreatedAt' , '_hydrated' , 'Subscription' , 'Workspace' ]
489+ CONNECTION_INFO_ATTRS = ['ExternalId' , 'ExternalFormattedId' , 'Name' , 'Description' , 'Url' , 'Artifact' ]
490+
491+ def details (self ):
492+ tank = ['%s' % self ._type ]
493+ for attribute_name in (Connection .MINIMAL_WDO_ATTRIBUTES + Connection .CONNECTION_INFO_ATTRIBUTES ):
494+ try :
495+ value = getattr (self , attribute_name )
496+ except AttributeError :
497+ continue
498+ if value is None :
499+ continue
500+ if 'pyral.entity.' not in str (type (value )):
501+ anv = ' %-24s : %s' % (attribute_name , value )
502+ else :
503+ mo = re .search (r' \'pyral.entity.(\w+)\'>' , str (type (value )))
504+ if mo :
505+ cln = mo .group (1 )
506+ anv = " %-24s : %-20.20s (OID %s Name: %s)" % \
507+ (attribute_name , cln + '.ref' , value .oid , value .Name )
508+ else :
509+ anv = " %-24s : %s" % (attribute_name , value )
510+ tank .append (anv )
511+ tank .append ("" )
512+ return tank
513+
514+
515+ class PullRequest (Connection ): pass
516+
484517class CustomField (object ):
485518 """
486519 For non-Rally originated entities
@@ -614,6 +647,8 @@ def __setattr__(self, item, value):
614647 'IterationCumulativeFlowData' : IterationCumulativeFlowData ,
615648 'RecycleBinEntry' : RecycleBinEntry ,
616649 'SearchObject' : SearchObject ,
650+ 'Connection' : Connection ,
651+ 'PullRequest' : PullRequest ,
617652 }
618653
619654for entity_name , entity_class in list (classFor .items ()):
@@ -956,6 +991,73 @@ def processSchemaInfo(workspace, schema_info):
956991 rally_entity_class = _createClass (pyralized_class_name , parentClass )
957992 classFor [typePath ] = rally_entity_class
958993
994+ augmentSchemaWithPullRequestInfo (workspace )
995+
996+
997+ def puff (attr_name , attr_type , attr_required ):
998+ ad = {'_ref' : 'attributedefinition/123456' ,
999+ '_refObjectName' : attr_name ,
1000+ 'ElementName' : attr_name ,
1001+ 'Name' : attr_name ,
1002+ 'AttributeType' : attr_type ,
1003+ 'Custom' : False ,
1004+ 'Required' : attr_required ,
1005+ 'ReadOnly' : False ,
1006+ 'Filterable' : True ,
1007+ 'SchemaType' : 'abc' ,
1008+ 'Hidden' : False ,
1009+ 'Constrained' : False ,
1010+ 'AllowedValueType' : False ,
1011+ 'AllowedValues' : [],
1012+ 'MaxLength' : 255 ,
1013+ 'MaxFractionalDigits' : 1
1014+ }
1015+ return ad
1016+
1017+
1018+ def augmentSchemaWithPullRequestInfo (workspace ):
1019+ wksp_name , wksp_ref = workspace
1020+ global _rally_schema
1021+ global _rally_entity_cache
1022+
1023+ pr_data = {'_ref' : 'pullrequest/1233456789' ,
1024+ '_refObjectName' : 'Pull Request' ,
1025+ 'ElementName' : 'PullRequest' ,
1026+ 'Name' : 'pullRequest' ,
1027+ 'DisplayName' : 'PullRequest' ,
1028+ 'TypePath' : 'PullRequest' ,
1029+ 'IDPrefix' : 'PR' ,
1030+ 'Abstract' : False ,
1031+ #'Parent' : 'Connection',
1032+ 'Parent' : None ,
1033+ 'Creatable' : True ,
1034+ 'ReadOnly' : False ,
1035+ 'Queryable' : False ,
1036+ 'Deletable' : True ,
1037+ 'Restorable' : False ,
1038+ 'Ordinal' : 1 ,
1039+ 'RevisionHistory' : 'putrid' ,
1040+ 'Attributes' : [],
1041+ }
1042+ pr_attr_names = [('ExternalId' , 'STRING' , True ),
1043+ ('ExternalFormattedId' , 'STRING' , True ),
1044+ ('Name' , 'STRING' , True ),
1045+ ('Description' , 'TEXT' , False ),
1046+ ('Url' , 'STRING' , True ),
1047+ ('Artifact' , 'OBJECT' , True )]
1048+ #pr_attr_names = ['ExternalId',
1049+ # 'ExternalFormattedId',
1050+ # 'Name',
1051+ # 'Description',
1052+ # 'Url',
1053+ # 'Artifact',
1054+ # ]
1055+ #pr_data['Attributes'] = pr_attr_names
1056+ for pr_attr , pr_type , pr_reqd in pr_attr_names :
1057+ pr_data ['Attributes' ].append (puff (pr_attr , pr_type , pr_reqd ))
1058+ _rally_schema [wksp_ref ]['PullRequest' ] = SchemaItem (pr_data )
1059+ _rally_schema [wksp_ref ]['PullRequest' ].completed = True
1060+
9591061
9601062def getSchemaItem (workspace , entity_name ):
9611063 wksp_name , wksp_ref = workspace
0 commit comments