From: pascale.noyret Date: Tue, 3 Dec 2019 14:36:58 +0000 (+0100) Subject: key pour les ASSD X-Git-Tag: V200520bis~92 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=c3cd956a7e80cbc4aa50cec5b7a6d19649a5e48b;p=tools%2Feficas.git key pour les ASSD --- diff --git a/Efi2Xsd/AccasXsd.py b/Efi2Xsd/AccasXsd.py index 6f2dec88..90f9e4d7 100755 --- a/Efi2Xsd/AccasXsd.py +++ b/Efi2Xsd/AccasXsd.py @@ -36,6 +36,16 @@ class X_definition: self.nomDuCodeDumpe = obj.nomDuCodeDumpe self.code=obj.code + def getXPath(self): + obj=self + textePath=self.nom + while ( hasattr(obj,'pere') ): + obj=obj.pere + if isinstance(obj, X_BLOC) : continue + textePath= obj.nom + '/' + textePath + textePath='./'+ self.code + ":" + textePath + return textePath + #def genealogie(self,n): # texte=self.nom # obj=self @@ -159,14 +169,18 @@ class X_FACT (X_definitionComposee): class X_OPER (X_definitionComposee): # --------------------------------- def dumpXsd(self): -# X_definitionComposee.dumpXsd(self, inExtension) X_definitionComposee.dumpXsd(self) self.texteComplexe += finTypeCompoSeq self.texteComplexe += operAttributeName self.texteComplexe += attributeTypeForASSD self.texteComplexe += attributeTypeUtilisateurName.format(self.sd_prod.__name__) self.texteComplexe += finTypeCompo - + cata = CONTEXT.getCurrentCata() + if self.sd_prod.__name__ not in list(cata.dictTypesASSDorUserASSDCrees) : + cata.dictTypesASSDorUserASSDCrees[self.sd_prod.__name__]=[self,] + else : + cata.dictTypesASSDorUserASSDCrees[self.sd_prod.__name__].append(self) + # ---------------------------------- class X_PROC (X_definitionComposee): @@ -294,7 +308,14 @@ class X_SIMP (X_definition): else : typeATraduire=self.type[0] if not (typeATraduire in list(dictNomsDesTypes.keys())) : - if (isinstance(typeATraduire, Accas.ASSD) or issubclass(typeATraduire, Accas.ASSD)) : return 'xs:string' + if (isinstance(typeATraduire, Accas.ASSD) or issubclass(typeATraduire, Accas.ASSD)) : + cata = CONTEXT.getCurrentCata() + cata.dictTypesASSDorUserASSDUtilises[typeATraduire]=self + if typeATraduire not in list(cata.dictTypesASSDorUserASSDCrees) : + cata.dictTypesASSDorUserASSDUtilises[typeATraduire]=[self,] + else : + cata.dictTypesASSDorUserASSDUtilises[typeATraduire].append(self,) + return 'xs:string' else : return ('YYYYY') return dictNomsDesTypes[typeATraduire] @@ -368,6 +389,28 @@ class X_JDC_CATA : if self.texteTypeAbstrait != "" : self.texteXSD += self.texteTypeAbstrait self.texteXSD += self.texteCata self.texteXSD += self.texteElt + + texteKeyRef = "" + for clef in self.dictTypesASSDorUserASSDCrees: + texteDesFields="" + for unOper in self.dictTypesASSDorUserASSDCrees[clef]: + texteDesFields+=texteFieldUnitaire.format(self.code, unOper.nom) + texteDesFields=texteDesFields[0:-2] + if texteDesFields != "" : + texteKeyRef += producingASSDkeyRefDeclaration.format( clef ,texteDesFields) + + + for clef in self.dictTypesASSDorUserASSDUtilises: + for unSimp in self.dictTypesASSDorUserASSDUtilises[clef]: + # il faut la genealogie + print (unSimp.getXPath()) + texteKeyRef += UsingASSDkeyRefDeclaration.format(unSimp.nom, unSimp.type[0].__name__,self.code, unSimp.type[0].__name__,unSimp.getXPath() ) + + if texteKeyRef != '' : + self.texteXSD = self.texteXSD[0:-3]+'>\n' + self.texteXSD += texteKeyRef + self.texteXSD += fermeEltCata + self.texteXSD += texteFin #if not PourTraduction : print (self.texteXSD) @@ -443,4 +486,4 @@ class X_JDC_CATA : self.texteSimple += c.texteSimple self.texteComplexe += c.texteComplexe c.texteElt=eltCompoDsSequenceInExtension.format(c.nom,self.code,c.nomDuTypePyxb) - self.texteCata += c.texteElt + self.texteCata += c.texteElt