Ignore:
Timestamp:
11/23/06 18:21:31 (6 years ago)
Author:
sys
Message:

api Data + AgentLinker

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Jav_CO/com/scenari/m/co/agent/sortie/HAgentSortie.java

    r7458 r7466  
    5252import com.scenari.m.co.donnee.IComputedData; 
    5353import com.scenari.m.co.instance.IWInstFormation; 
     54import com.scenari.s.fw.log.HLogMgr; 
    5455import com.scenari.s.fw.log.HTrace; 
    5556import com.scenari.s.fw.log.HTraceMgr; 
     
    6162 
    6263        /** Cache en mémoire du résultat. */ 
    63         protected transient IComputedData fResultatCache = null; 
     64        protected transient IComputedData fDataCache = null; 
    6465 
    6566        /** Trace. */ 
     
    8384        public IComputedData computeAsData(IHDialog pDialog, Object pArguments) throws Exception { 
    8485 
    85                 if (fResultatCache != null) return fResultatCache; 
     86                if (fDataCache != null) return fDataCache; 
    8687 
    8788                IComputedData vResult = IComputedData.NULL; 
     
    102103 
    103104                String vCache = ((HComposantTypeSortie) fComposant.hGetComposantType()).hGetResultatCache(); 
    104                 if(vCache != null) { 
     105                if (vCache != null) { 
    105106                        if ("*".equals(vCache)) { 
    106                                 fResultatCache = new DataVolatileString(vResult.getString(), vResult.getMime()); 
    107                                 return fResultatCache; 
     107                                fDataCache = new DataVolatileString(vResult.getString(), vResult.getMime()); 
     108                                return fDataCache; 
    108109                        } else if ("node".equals(vCache)) { 
    109                                 fResultatCache = new DataVolatileNode(vResult.getNode(), vResult.getMime()); 
    110                                 return fResultatCache; 
     110                                fDataCache = new DataVolatileNode(vResult.getNode(), vResult.getMime()); 
     111                                return fDataCache; 
    111112                        } 
    112113                } 
     
    115116 
    116117        public Node computeAsNode(IHDialog pDialog, Object pArguments) throws Exception { 
    117                 return computeAsData(pDialog, pArguments).getNode(); 
     118 
     119                if (fDataCache != null) return fDataCache.getNode(); 
     120                String vCache = ((HComposantTypeSortie) fComposant.hGetComposantType()).hGetResultatCache(); 
     121                if (vCache != null) { 
     122                        xComputeCache(vCache, pDialog, pArguments); 
     123                        return fDataCache.getNode(); 
     124                } 
     125 
     126                IData vSource = ((WComposantSortie) fComposant).hGetSource(); 
     127 
     128                if (!hIsActif(pDialog)) { 
     129                        return IData.NULL_NODE; 
     130                } else if (vSource.getLevel() <= IData.LEVEL_STATIQUE) { 
     131                        return ((WComposantSortie) fComposant).hGetSource().getNode(pDialog, this, pArguments); 
     132                } else { 
     133                        if (((HComposantTypeSortie) fComposant.hGetComposantType()).hGetTransformsList() == null) { 
     134                                return vSource.getNode(pDialog, this, pArguments); 
     135                        } else { 
     136                                return new XDonneeResultatSortie(this, pDialog, pArguments).getNode(); 
     137                        } 
     138                } 
    118139        } 
    119140 
     
    122143         */ 
    123144        public String computeAsString(IHDialog pDialog, Object pArguments) throws Exception { 
    124                 return computeAsData(pDialog, pArguments).getString(); 
     145 
     146                if (fDataCache != null) return fDataCache.getString(); 
     147 
     148                String vCache = ((HComposantTypeSortie) fComposant.hGetComposantType()).hGetResultatCache(); 
     149                if (vCache != null) { 
     150                        xComputeCache(vCache, pDialog, pArguments); 
     151                        return fDataCache.getString(); 
     152                } 
     153 
     154                IData vSource = ((WComposantSortie) fComposant).hGetSource(); 
     155 
     156                if (!hIsActif(pDialog)) { 
     157                        return IData.NULL_STRING; 
     158                } else if (vSource.getLevel() <= IData.LEVEL_STATIQUE) { 
     159                        return ((WComposantSortie) fComposant).hGetSource().getString(pDialog, this, pArguments); 
     160                } else { 
     161                        if (((HComposantTypeSortie) fComposant.hGetComposantType()).hGetTransformsList() == null) { 
     162                                return vSource.getString(pDialog, this, pArguments); 
     163                        } else { 
     164                                return new XDonneeResultatSortie(this, pDialog, pArguments).getString(); 
     165                        } 
     166                } 
     167        } 
     168 
     169        protected void xComputeCache(String pCache, IHDialog pDialog, Object pArguments) throws Exception { 
     170                if (!hIsActif(pDialog)) { 
     171                        fDataCache = IComputedData.NULL; 
     172                } 
     173                IData vSource = ((WComposantSortie) fComposant).hGetSource(); 
     174                if ("*".equals(pCache)) { 
     175                        if (vSource.getLevel() <= IData.LEVEL_STATIQUE) { 
     176                                fDataCache = new DataVolatileString(vSource.getString(pDialog, this, pArguments)); 
     177                        } else { 
     178                                if (((HComposantTypeSortie) fComposant.hGetComposantType()).hGetTransformsList() == null) { 
     179                                        try { 
     180                                                pDialog.hExecStackPush(this); 
     181                                                fDataCache = new DataVolatileString(vSource.getString(pDialog, this, pArguments)); 
     182                                        } finally { 
     183                                                pDialog.hExecStackPop(); 
     184                                        } 
     185                                } else { 
     186                                        fDataCache = new DataVolatileString(new XDonneeResultatSortie(this, pDialog, pArguments).getString()); 
     187                                } 
     188                        } 
     189                } else if ("node".equals(pCache)) { 
     190                        if (vSource.getLevel() <= IData.LEVEL_STATIQUE) { 
     191                                fDataCache = new DataVolatileNode(vSource.getNode(pDialog, this, pArguments)); 
     192                        } else { 
     193                                if (((HComposantTypeSortie) fComposant.hGetComposantType()).hGetTransformsList() == null) { 
     194                                        try { 
     195                                                pDialog.hExecStackPush(this); 
     196                                                fDataCache = new DataVolatileNode(vSource.getNode(pDialog, this, pArguments)); 
     197                                        } finally { 
     198                                                pDialog.hExecStackPop(); 
     199                                        } 
     200                                } else { 
     201                                        fDataCache = new DataVolatileNode(new XDonneeResultatSortie(this, pDialog, pArguments).getNode()); 
     202                                } 
     203                        } 
     204                } else { 
     205                        throw HLogMgr.hNewException("Valeur de cache inconnue '" + pCache + "' définie dans " + this); 
     206                } 
    125207        } 
    126208 
Note: See TracChangeset for help on using the changeset viewer.