- Timestamp:
- 03/14/10 09:12:55 (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Jav_Wsp/src/com/scenari/m/bdp/item/fs/XItemCache.java
r14479 r15098 44 44 import java.util.Date; 45 45 import java.util.Iterator; 46 import java.util.Map; 46 47 47 48 import org.xml.sax.Attributes; … … 149 150 if (pItemPtd != null) { 150 151 //Mutualisation des instances d'objets en mémoire 151 fRefUriPtd = pItemPtd.getUri(); 152 if (fRefUriPtd.equals(pItemPtd.getUri())) { 153 fRefUriPtd = pItemPtd.getUri(); 154 } else if (fRefUriPtd.equals(pItemPtd.getId())) { 155 fRefUriPtd = pItemPtd.getId(); 156 } 152 157 } 153 158 } … … 348 353 protected XLink fFirstPointer = null; 349 354 350 /** Liste chainée d'items en cache (champ géré par la classe XSpace). */351 protected XItemCache fNextItem = null;352 353 355 /** Uri de cet item. */ 354 356 protected String fUri = IHItem.URI_NULL; 357 358 /** Id de cet item. */ 359 protected String fId = null; 355 360 356 361 /** ItemType de cette item. */ … … 398 403 public String getUri() { 399 404 return fUri; 405 } 406 407 public String getId() { 408 return fId; 400 409 } 401 410 … … 645 654 } 646 655 ISrcNode vSrc = vDatas.getWspSrcNodeItem().getSubSrcNode(); 656 //Refresh de l'ID. 657 this.setId(vSrc); 647 658 if (fStatusItem == IHItem.STATUS_UNKNOWN) { 648 659 xLoadItemFromSource(false, vSrc, vSrc.getLastModifWithChildren(), IContextBdp.CLIENTID_NONE); … … 834 845 XItemCacheData vItemData = getDatas(); 835 846 vItemData.fLastRefresh = System.currentTimeMillis(); 836 fMemLastModif = vItemData.getWspSrcNodeItem().getSubSrcNode().getLastModifWithChildren(); 847 ISrcNode vSubSrcNode = vItemData.getWspSrcNodeItem().getSubSrcNode(); 848 fMemLastModif = vSubSrcNode.getLastModifWithChildren(); 849 } 850 851 /** 852 * Affectation / mise à jour de l'index par ID. 853 */ 854 public void setId(ISrcNode pSrcNode) throws Exception { 855 assert Thread.holdsLock(getWsp()); 856 String vNewId = SrcFeatureIds.getSrcId(pSrcNode); 857 if (fId == null && vNewId == null) return; 858 if (fId == null && vNewId != null) { 859 getWsp().fItemsById.put(vNewId, this); 860 } else if (vNewId == null) { 861 getWsp().fItemsById.remove(fId); 862 } else if (vNewId.equals(fId)) { 863 return; 864 } else { 865 Map<String, XItemCache> vMap = getWsp().fItemsById; 866 vMap.remove(fId); 867 vMap.put(vNewId, this); 868 } 869 fId = vNewId; 837 870 } 838 871 … … 924 957 } 925 958 } 926 x RecalStatusItem();959 xComputeItemStatus(); 927 960 } 928 961 … … 997 1030 * Recalcul du status global de l'item après validation des liens notemment. 998 1031 */ 999 protected void x RecalStatusItem() {1032 protected void xComputeItemStatus() { 1000 1033 //Si les liens n'ont pas été calculés on ne fait rien. 1001 1034 boolean fHasWarning = (fFirstContentProblem != null); … … 1047 1080 public void xUnlinkChilds() throws Exception { 1048 1081 if (fAttrs == null || fStatusItem == STATUS_INTERNAL_NOTLINKED) { return; } 1049 if (fAttrs != null) { 1050 for (int i = 0; i < fAttrs.length; i = i + 4) { 1051 if (fAttrs[i] == IHAttr.TYPE_REF || fAttrs[i] == IHAttr.TYPE_LINK) { 1052 XLink vLink = (XLink) fAttrs[i + 3]; 1053 XItemCache vPtd = vLink.fPtd; 1054 if (vPtd == null) { 1055 continue; 1082 for (int i = 0; i < fAttrs.length; i = i + 4) { 1083 if (fAttrs[i] == IHAttr.TYPE_REF || fAttrs[i] == IHAttr.TYPE_LINK) { 1084 XLink vLink = (XLink) fAttrs[i + 3]; 1085 XItemCache vPtd = vLink.fPtd; 1086 if (vPtd == null) { 1087 continue; 1088 } 1089 XLink vPrec = null; 1090 XLink vCurr = vPtd.fFirstPointer; 1091 while (vCurr != null) { 1092 //On recherche ce pointeur dans le Ptd 1093 if (vCurr == vLink) { 1094 //Trouvé 1095 if (vPrec != null) { 1096 vPrec.fNextPointer = vCurr.fNextPointer; 1097 } else { 1098 vPtd.fFirstPointer = vCurr.fNextPointer; 1099 } 1100 break; 1056 1101 } 1057 XLink vPrec = null; 1058 XLink vCurr = vPtd.fFirstPointer; 1059 while (vCurr != null) { 1060 //On recherche ce pointeur dans le Ptd 1061 if (vCurr == vLink) { 1062 //Trouvé 1063 if (vPrec != null) { 1064 vPrec.fNextPointer = vCurr.fNextPointer; 1065 } else { 1066 vPtd.fFirstPointer = vCurr.fNextPointer; 1067 } 1068 break; 1069 } 1070 vPrec = vCurr; 1071 vCurr = vCurr.fNextPointer; 1072 } 1102 vPrec = vCurr; 1103 vCurr = vCurr.fNextPointer; 1073 1104 } 1074 1105 } … … 1106 1137 //On recaclule le satus de l'item pointeur si il a déjà été linké (sinon perte de ref lors de XSpace.xLinkAllItems). 1107 1138 if (vPointer.fItem.fStatusItem != STATUS_INTERNAL_NOTLINKED) { 1108 vPointer.fItem.x RecalStatusItem();1139 vPointer.fItem.xComputeItemStatus(); 1109 1140 if (pFireEventUpdated && vOldStatus != vPointer.fItem.fStatusItem) getWsp().xFireEventItemStatus(vPointer.fItem); 1110 1141 }
Note: See TracChangeset
for help on using the changeset viewer.