]> SALOME platform Git repositories - tools/eficas.git/commitdiff
Salome HOME
maj du 09/12 keyref
authorpascale.noyret <pascale.noyret@edf.fr>
Mon, 9 Dec 2019 10:11:07 +0000 (11:11 +0100)
committerpascale.noyret <pascale.noyret@edf.fr>
Mon, 9 Dec 2019 10:11:07 +0000 (11:11 +0100)
Efi2Xsd/AccasXsd.py
Efi2Xsd/balisesXSD.py

index 90f9e4d726957feace78e0502d5c372e474bf803..2262ee798c8d9132f34a49f1b7e4d0caf7bc2824 100755 (executable)
@@ -68,7 +68,6 @@ class X_definition:
        self.aCreer = False
        if nom == 'T_Consigne' : return nom
        listePossible=cata.dictTypesXSD[nom]
-       print (listePossible)
        indice=0
        while (indice < len(listePossible)) :
           objAComparer=listePossible[indice]
@@ -309,9 +308,17 @@ class X_SIMP (X_definition):
              typeATraduire=self.type[0]
        if not (typeATraduire in list(dictNomsDesTypes.keys())) :
           if (isinstance(typeATraduire, Accas.ASSD) or issubclass(typeATraduire, Accas.ASSD)) : 
+             # cas d une creation
              cata = CONTEXT.getCurrentCata() 
-             cata.dictTypesASSDorUserASSDUtilises[typeATraduire]=self
-             if typeATraduire not in list(cata.dictTypesASSDorUserASSDCrees) :
+             if len(self.type) == 2 and self.type[1]=='createObject' : 
+                if typeATraduire.__name__ not in list(cata.dictTypesASSDorUserASSDCrees) :
+                    cata.dictTypesASSDorUserASSDCrees[typeATraduire.__name__]=[self,]
+                else :
+                    cata.dictTypesASSDorUserASSDCrees[typeATraduire.__name__].append(self)
+                return 'xs:string'
+
+             # cas d une consommation
+             if typeATraduire not in list(cata.dictTypesASSDorUserASSDUtilises) :
                 cata.dictTypesASSDorUserASSDUtilises[typeATraduire]=[self,]
              else :
                 cata.dictTypesASSDorUserASSDUtilises[typeATraduire].append(self,)
@@ -392,18 +399,33 @@ class X_JDC_CATA :
        
         texteKeyRef = ""
         for clef in self.dictTypesASSDorUserASSDCrees:
+            print ('---- En creation',  clef, '__________________')
+            existeASSD=0
             texteDesFields=""
             for unOper in self.dictTypesASSDorUserASSDCrees[clef]: 
+                if  not(isinstance(unOper, Accas.OPER)) : continue
+                existeASSD=1
                 texteDesFields+=texteFieldUnitaire.format(self.code, unOper.nom)
-            texteDesFields=texteDesFields[0:-2]
+            if existeASSD : texteDesFields=texteDesFields[0:-2]
+            texteDesUserASSD=''
+            existeunUserASSD=0
+            for unSimp in self.dictTypesASSDorUserASSDCrees[clef]: 
+                if not (isinstance(unSimp, Accas.SIMP)) : continue
+                texteDesUserASSD +="\n\t\t<xs:field xpath="+self.code+":"+unSimp.getXPath()
+                existeunUserASSD=1
+            if existeunUserASSD:
+               if existeASSD : texteDesFields = texteDesFields + "/>\n\t\t"+texteDesUserASSD
+               else: texteDesFields = texteDesUserASSD[19:]
+            #print (texteDesUserASSD)
+            #print (texteDesFields)
             if texteDesFields != "" :
+               #print (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 != '' : 
index eff5d5684f66629e4766ec980252d756b2554f52..e4c6059a57ad60a5daf8bb15108aa6ccca9205cb 100644 (file)
@@ -21,6 +21,13 @@ maxLengthTypeSimple = '\t\t\t<xs:maxLength value = "{}"/>\n'
 minLengthTypeSimple = '\t\t\t<xs:minLength value = "{}"/>\n'
 eltDsSequence = '\t\t\t<xs:element name="{}" type="{}:{}" minOccurs="{}" maxOccurs="{}"/>\n'
 eltWithDefautDsSequence = '\t\t\t<xs:element name="{}" type="{}:{}" minOccurs="{}" maxOccurs="{}" default="{}"/>\n'
+UsingASSDkeyRefDeclaration ='\n\t<xs:keyref name="{}_Name_ref_a{}" refer="{}:Key_Name_For_{}"> \n\t\t<xs:selector xpath="{}"/>\n\t\t<xs:field xpath="."/>\n\t</xs:keyref>\n'
+
+     #<xs:keyref name="MyField_Ref_A_CreateMesh" refer="Test1:Key_Name_In_ReadMesh_CreateMesh">
+     #<xs:selector xpath="./Test1:MyField/Test1:onMesh"/>
+
+
+
 
 # COMPO
 debutTypeCompo    = '\t<xs:complexType name="{}" >\n'
@@ -40,7 +47,8 @@ substDsSequence = '\t\t\t<xs:group ref="{}:{}"  minOccurs="{}" maxOccurs="{}"/>\
 operAttributeName    = '\t\t<xs:attribute name="name" type="xs:string"/>\n'
 attributeTypeForASSD = '\t\t<xs:attribute name="accasType" type="xs:string" fixed="ASSD"/>\n'
 attributeTypeUtilisateurName = '\t\t<xs:attribute name="typeUtilisateur" type="xs:string" fixed="{}"/>\n'
-#keyRefDeclaration ='\n\t<xs:keyref name="{}_Name_ref" refer="Key_Name_In_{}"> \n\t\t<xs:selector xpath="{}:{}_Name"/>\n\t\t<xs:field xpath="."/>\n\t</xs:keyref>\n'
+producingASSDkeyRefDeclaration='\t<xs:key name="Key_Name_For_{}">\n\t\t<xs:selector xpath="."/>\n\t\t<xs:field xpath="{}"/>\n\t</xs:key>\n'
+texteFieldUnitaire="./{}:{}/@name |"
 
 # CATA
 debutTypeCata = '\t<xs:complexType name="T_{}">\n\t\t<xs:choice minOccurs="0" maxOccurs="unbounded">\n'
@@ -50,6 +58,7 @@ finSchema     = '</xs:schema>'
 eltCata = '\t<xs:element name="{}" type="{}:{}"/>\n'
 EltCodeSpecDsCata='\t\t\t<xs:element ref="{}_Abstract" minOccurs="0" maxOccurs="1"/>\n'
 includeCata = '<xs:include schemaLocation="cata_{}_genere.xsd" />\n\n'
+fermeEltCata   = '\t</xs:element>\n'
 
 # EXTENSION
 debutExtension = '\t\t<xs:complexContent>\n\t\t<xs:extension base="{}:T_{}_Abstract">\n\t\t<xs:choice minOccurs="0" maxOccurs="unbounded">\n'