Changeset 19585
- Timestamp:
- 01/30/12 20:51:52 (4 months ago)
- Location:
- trunk
- Files:
-
- 13 edited
-
Jav_AppBuilder/src/com/scenari/m/builder/gen/HModelGenerator.java (modified) (1 diff)
-
Jav_Orient/src/eu/scenari/orient/recordstruct/lib/primitive/ValueBoolean.java (modified) (1 diff)
-
Jav_Wsp/src/com/scenari/m/bdp/item/fs/WspHandler.java (modified) (1 diff)
-
Jav_Wsp/src/com/scenari/m/bdp/item/fs/WspHandlerMaster.java (modified) (1 diff)
-
Jav_Wsp/src/eu/scenari/wsp/provider/IWspDefinition.java (modified) (1 diff)
-
Jav_Wsp/src/eu/scenari/wsp/repos/wsptype/WspType.java (modified) (10 diffs)
-
Jav_Wsp/src/eu/scenari/wsp/repos/wsptype/WspTypeContentHandler.java (modified) (2 diffs)
-
Jav_Wsp/src/eu/scenari/wsp/service/importer/SvcImportDialog.java (modified) (1 diff)
-
Jav_WspFs/src/eu/scenari/wspfs/FsWspDefinition.java (modified) (1 diff)
-
Jav_WspFs/src/eu/scenari/wspfs/FsWspProvider.java (modified) (1 diff)
-
Jav_WspOdb/src/eu/scenari/wspodb/struct/lib/ValueWsp.java (modified) (7 diffs)
-
Jav_WspOdb/src/eu/scenari/wspodb/wsp/OdbWspDefinition.java (modified) (4 diffs)
-
Jav_WspOdb/src/eu/scenari/wspodb/wsp/OdbWspDefinitionDrv.java (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Jav_AppBuilder/src/com/scenari/m/builder/gen/HModelGenerator.java
r19374 r19585 2118 2118 vWspDefToSelect = vWspDef; 2119 2119 //Mise à jour wspMeta. 2120 vWspDefToSelect.writeWspMeta(vBuffWspMeta.getInputStream(false) );2120 vWspDefToSelect.writeWspMeta(vBuffWspMeta.getInputStream(false), vReposTest.parseWspType(vBuffWspMeta.getInputStream(false)).fillWspDefProperties(null)); 2121 2121 break; 2122 2122 } -
trunk/Jav_Orient/src/eu/scenari/orient/recordstruct/lib/primitive/ValueBoolean.java
r18986 r19585 48 48 public class ValueBoolean extends ValueAbstract<Boolean> { 49 49 50 public static final ValueBoolean TRUE = new ValueBoolean(true); 51 52 public static final ValueBoolean FALSE = new ValueBoolean(false); 53 50 54 protected boolean fValue; 51 55 -
trunk/Jav_Wsp/src/com/scenari/m/bdp/item/fs/WspHandler.java
r19181 r19585 658 658 vWriter.close(); 659 659 } 660 fWspDefinition.writeWspMeta(vStream.getInputStream(true)); 660 //Mise à jour du modèle 661 fWspDefinition.writeWspMeta(vStream.getInputStream(true), pWspType.fillWspDefProperties(null)); 662 // 661 663 fNeedSaveWspType = false; 662 664 } -
trunk/Jav_Wsp/src/com/scenari/m/bdp/item/fs/WspHandlerMaster.java
r18986 r19585 112 112 } 113 113 114 public void writeWspMeta(InputStream p NewWspMeta) throws Exception {114 public void writeWspMeta(InputStream pWspMetaStream, Map<String, Object> pWspMetaProps) throws Exception { 115 115 } 116 116 -
trunk/Jav_Wsp/src/eu/scenari/wsp/provider/IWspDefinition.java
r18986 r19585 133 133 134 134 /** 135 * <p>Modification des caractéristiques de l'atelier : mises à jour automatiques, 136 * changements d'options...</p> 135 * <p>Modification du modèle documentaire associé à cet atelier.</p> 136 * 137 * @param pWspMetaStream Flux du wspMeta. 138 * @param pWspMetaProps Propriétés extraites de ce wspMeta destinées à configurer cet atelier. 137 139 * 138 140 */ 139 public void writeWspMeta(InputStream p NewWspMeta) throws Exception;141 public void writeWspMeta(InputStream pWspMetaStream, Map<String, Object> pWspMetaProps) throws Exception; 140 142 141 143 /** -
trunk/Jav_Wsp/src/eu/scenari/wsp/repos/wsptype/WspType.java
r19084 r19585 40 40 41 41 import java.util.ArrayList; 42 import java.util.Collections; 43 import java.util.HashMap; 42 44 import java.util.List; 45 import java.util.Map; 43 46 44 47 import com.scenari.m.bdp.item.fs.XSsOverlay; … … 47 50 48 51 import eu.scenari.commons.initapp.ScVersion; 52 import eu.scenari.wsp.provider.IWspDefinition; 49 53 import eu.scenari.wsp.res.IRes; 50 54 import eu.scenari.wsp.res.IResMgr; … … 63 67 * Uri de l'espace système. 64 68 */ 65 public String fSpace = null;69 public String fSpace; 66 70 67 71 /** 68 72 * Clé de la ressource système du {@link IResMgr}. 69 73 */ 70 public IRes fRes = null;74 public IRes fRes; 71 75 72 76 /** 73 77 * Source de l'espace système (si l'updtateMgr et fUpdateKey non utilisés pour cet espace système). 74 78 */ 75 public ISrcSystem fSourceSystem = null;79 public ISrcSystem fSourceSystem; 76 80 77 81 /** 78 82 * Extrait xml de définition de fSource. 79 83 */ 80 public String fSourceXmlDef = null;84 public String fSourceXmlDef; 81 85 82 86 /** … … 85 89 * niveau de version spécifié (minor, medium, major). 86 90 */ 87 public String fLocalAutoUpdate = null;91 public String fLocalAutoUpdate; 88 92 89 93 /** … … 154 158 155 159 public static class EditionSheet { 156 public String fPack = null;157 158 public String fBrickSelector = null;159 160 public String fBrickProvider = null;160 public String fPack; 161 162 public String fBrickSelector; 163 164 public String fBrickProvider; 161 165 162 166 /** … … 172 176 } 173 177 174 protected IResMgr fResMgr = null;175 176 protected String fDefaultCode = null;177 178 protected String fUri = null;179 180 protected String fKey = null;181 182 protected String fLang = null;183 184 protected String fTitle = null;185 186 protected String fDescription = null;187 188 protected IRes fWspUpdateRes = null;178 protected IResMgr fResMgr; 179 180 protected String fDefaultCode; 181 182 protected String fUri; 183 184 protected String fKey; 185 186 protected String fLang; 187 188 protected String fTitle; 189 190 protected String fDescription; 191 192 protected IRes fWspUpdateRes; 189 193 190 194 protected ScVersion fWspVersion = ScVersion.UNDEFINED_VERSION; 191 195 192 protected String fConfig = null;196 protected String fConfig; 193 197 194 198 /** … … 197 201 * spécifié (minor, medium, major). 198 202 */ 199 protected String fLocalAutoUpdate = null;203 protected String fLocalAutoUpdate; 200 204 201 205 /** 202 206 * Root de l'atelier surchargé dans le wspMeta de l'atelier. 203 207 */ 204 protected ISrcSystem fContentRootSrcSystem = null;208 protected ISrcSystem fContentRootSrcSystem; 205 209 206 210 /** Espaces systèmes. */ … … 211 215 212 216 /** Surcharges des SS. */ 213 protected List<XSsOverlay> fOverlaysSs = null;217 protected List<XSsOverlay> fOverlaysSs; 214 218 215 219 /** Services. */ 216 protected List<IWspServiceInternal> fWspServices = null; 220 protected List<IWspServiceInternal> fWspServices; 221 222 /** Propriétés destinées au {@link IWspDefinition}. */ 223 protected Map<String, Object> fWspDefProperties; 217 224 218 225 /** Options de ce WspType. */ 219 protected List<WspOption> fOptions = null;226 protected List<WspOption> fOptions; 220 227 221 228 public WspType(IResMgr pResMgr) { … … 275 282 for (IWspServiceInternal vWspService : fWspServices) { 276 283 vWspService.writeXml(pWriter); 284 } 285 } 286 287 //WspDefProperties 288 if (fWspDefProperties != null) { 289 for (Map.Entry<String, Object> vEntry : fWspDefProperties.entrySet()) { 290 pWriter.writeStartTag("wspDefProperties"); 291 pWriter.writeAttribute("key", vEntry.getKey()); 292 pWriter.writeAttribute("value", vEntry.getValue().toString()); 293 pWriter.writeEndEmptyTag(); 277 294 } 278 295 } … … 380 397 } 381 398 399 public Map<String, Object> fillWspDefProperties(Map<String, Object> pProps) { 400 if (pProps == null) { 401 if (fOptions == null) { 402 //Cas simple : pas d'options 403 return (fWspDefProperties == null) ? Collections.EMPTY_MAP : fWspDefProperties; 404 } 405 //Cas plus élaboré : on merge plusieurs options 406 pProps = new HashMap<String, Object>(); 407 } 408 if (fWspDefProperties != null) pProps.putAll(fWspDefProperties); 409 if (fOptions != null) { 410 for (WspOption vWspOption : fOptions) { 411 vWspOption.fillWspDefProperties(pProps); 412 } 413 } 414 return pProps; 415 } 416 382 417 public IResMgr getResMgr() { 383 418 return fResMgr; -
trunk/Jav_Wsp/src/eu/scenari/wsp/repos/wsptype/WspTypeContentHandler.java
r19084 r19585 40 40 41 41 import java.util.ArrayList; 42 import java.util.HashMap; 42 43 import java.util.List; 43 44 import java.util.Map; … … 243 244 vEditionSheet.fBrickSelector = pAttributes.getValue("brickSelector"); 244 245 vEditionSheet.fBrickProvider = pAttributes.getValue("brickProvider"); 246 } else if (pLocalName == "wspDefProperties") { 247 String vKey = pAttributes.getValue("key"); 248 String vValue = pAttributes.getValue("value"); 249 if (fWspType.fWspDefProperties == null) fWspType.fWspDefProperties = new HashMap<String, Object>(); 250 fWspType.fWspDefProperties.put(vKey, vValue); 245 251 } else if (pLocalName == "wspOption") { 246 252 if (fWspType != null) { -
trunk/Jav_Wsp/src/eu/scenari/wsp/service/importer/SvcImportDialog.java
r19163 r19585 255 255 } else { 256 256 if (fParamUpdateWspMeta) { 257 fWspTarget.getWspDefinition().writeWspMeta(new InputCloseEntry(vZipIn)); 257 //TODO A revoir : à parser, à évaluer si le modèle existe... 258 //fWspTarget.getWspDefinition().writeWspMeta(new InputCloseEntry(vZipIn), null); 258 259 } else { 259 260 while (vZipIn.read() >= 0) { -
trunk/Jav_WspFs/src/eu/scenari/wspfs/FsWspDefinition.java
r18986 r19585 148 148 } 149 149 150 public void writeWspMeta(InputStream p NewWspMeta) throws Exception {150 public void writeWspMeta(InputStream pWspMetaStream, Map<String, Object> pWspMetaProps) throws Exception { 151 151 OutputStream vOut = fWspProvider.buildWspMetaSrc(this).newOutputStream(false); 152 152 try { 153 StreamUtils.write(p NewWspMeta, vOut);153 StreamUtils.write(pWspMetaStream, vOut); 154 154 } finally { 155 155 vOut.close(); -
trunk/Jav_WspFs/src/eu/scenari/wspfs/FsWspProvider.java
r18986 r19585 507 507 if (vWspDef.fSrcRootGen == null) vWspDef.fSrcRootGen = buildDefaultWspRootGen(pCode); 508 508 509 vWspDef.writeWspMeta(pXmlWspType );509 vWspDef.writeWspMeta(pXmlWspType, null); 510 510 511 511 appendWspDef(vWspDef); -
trunk/Jav_WspOdb/src/eu/scenari/wspodb/struct/lib/ValueWsp.java
r19070 r19585 50 50 import eu.scenari.orient.recordstruct.impl.StructReader; 51 51 import eu.scenari.orient.recordstruct.lib.base.ValueBlob; 52 import eu.scenari.orient.recordstruct.lib.base.ValueDictionary; 52 53 import eu.scenari.orient.recordstruct.struct.ConversionException; 53 54 import eu.scenari.orient.recordstruct.struct.Struct; … … 62 63 protected static final byte VERS_SER_WSP = Byte.MIN_VALUE; 63 64 65 protected static final byte VERS_SER_WSP_1 = Byte.MIN_VALUE + 1; 66 64 67 protected String fTitle = ""; 65 68 … … 69 72 70 73 protected IValueStamp fStamp; 74 75 protected ValueDictionary<IValue<?>> fProperties; 71 76 72 77 /** Ne pas utiliser. Usage interne cf {@link Struct}. */ … … 108 113 unmarshall(); 109 114 return fWspMeta; 115 } 116 117 public ValueDictionary<IValue<?>> getProperties() { 118 unmarshall(); 119 return fProperties; 120 } 121 122 public ValueDictionary<IValue<?>> getOrCreateProperties() { 123 unmarshall(); 124 if (fProperties == null) fProperties = new ValueDictionary<IValue<?>>(this); 125 return fProperties; 110 126 } 111 127 … … 167 183 protected void writeToStream(IStructWriter pWriter) { 168 184 pWriter.startValue(getStruct(), IStruct.DYNAMICLENGTH_MAX_FOR_2_BYTES); 169 pWriter.addAsByte(VERS_SER_WSP );185 pWriter.addAsByte(VERS_SER_WSP_1); 170 186 pWriter.addAsString(getTitle()); 171 187 pWriter.addAsString(getDescription()); 172 188 fWspMeta.writeValue(pWriter); 173 189 pWriter.addAsValueOrNull(fStamp); 190 pWriter.addAsValueOrNull(fProperties == null || fProperties.isEmpty() ? null : fProperties); 174 191 pWriter.endValue(getStruct()); 175 192 } … … 185 202 186 203 protected void readFromStream(StructReader pReader, int pLen, boolean pInitFromDb) { 187 pReader.skipByte();//versSer204 byte vVers = pReader.getAsByte();//versSer 188 205 pReader.pushOwner(this); 189 206 fTitle = pReader.getAsString(); … … 191 208 fWspMeta = pReader.getAsValue(); 192 209 fStamp = pReader.getAsValueOrNull(); 210 if (vVers >= VERS_SER_WSP_1) { 211 fProperties = pReader.getAsValueOrNull(); 212 } 193 213 pReader.popOwner(); 194 214 fDirty = !pInitFromDb; -
trunk/Jav_WspOdb/src/eu/scenari/wspodb/wsp/OdbWspDefinition.java
r19581 r19585 78 78 import eu.scenari.orient.IDbDriver; 79 79 import eu.scenari.orient.recordstruct.IRecordStruct; 80 import eu.scenari.orient.recordstruct.IValue; 80 81 import eu.scenari.orient.recordstruct.lib.link.ValueLinkPropsBsp; 81 82 import eu.scenari.orient.recordstruct.lib.link.ValueRevLinksIBspU; 82 83 import eu.scenari.orient.recordstruct.lib.link.named.ValueRevLinksNamed; 84 import eu.scenari.orient.recordstruct.lib.primitive.ValueBoolean; 83 85 import eu.scenari.orient.recordstruct.lib.primitive.ValueString; 84 86 import eu.scenari.orient.recordstruct.link.ILink; … … 101 103 import eu.scenari.wspodb.struct.IValueWsp; 102 104 import eu.scenari.wspodb.struct.lib.ValueSrcContentId; 105 import eu.scenari.wspodb.struct.lib.ValueWsp; 103 106 import eu.scenari.wspodb.struct.lib.drv.ValueDrvSrcContent; 104 107 import eu.scenari.wspodb.wsp.act.OdbWspSrcAnnot; … … 197 200 fSrcRootContent = new OdbVersionWspSrcNode(this, ISrcServer.URI_ROOT); 198 201 } 199 // Par défaut config des extItems issu du WspProv.200 fExternalItemsAllowed = pWspProvider.isExternalItemsAllowed();202 //Init par rapport aux props du wspMeta. 203 initWspMetaProps(pValueSrcContent.getExtension(WspOdbTypes.WSP)); 201 204 } 202 205 … … 315 318 } 316 319 317 public void writeWspMeta(InputStream p NewWspMeta) throws Exception {320 public void writeWspMeta(InputStream pWspMetaStream, Map<String, Object> pWspMetaProps) throws Exception { 318 321 IRecordStruct<IValueSrcContent<?>> vRecordWsp = getDbDriver().getThreadLocalDatabase().load(fWspRid); 319 vRecordWsp.getValue().getOrCreateExtension(WspOdbTypes.WSP).getWspMeta().writeFrom(pNewWspMeta, false, true); 322 ValueWsp vWsp = vRecordWsp.getValue().getOrCreateExtension(WspOdbTypes.WSP); 323 vWsp.getWspMeta().writeFrom(pWspMetaStream, false, true); 324 Boolean vAllowExternalItems = getBooleanFromProps(pWspMetaProps, OdbWspProviderLoader.ATT_EXTITEMALLOWED); 325 if (vAllowExternalItems == Boolean.TRUE) { 326 vWsp.getOrCreateProperties().put(OdbWspProviderLoader.ATT_EXTITEMALLOWED, ValueBoolean.TRUE); 327 } else if (vAllowExternalItems == Boolean.FALSE) { 328 vWsp.getOrCreateProperties().put(OdbWspProviderLoader.ATT_EXTITEMALLOWED, ValueBoolean.FALSE); 329 } else { 330 Map<String, IValue<?>> vProps = vWsp.getProperties(); 331 if (vProps != null) vProps.remove(OdbWspProviderLoader.ATT_EXTITEMALLOWED); 332 } 320 333 vRecordWsp.save(); 334 initWspMetaProps(vWsp); 321 335 fWspProvider.fWspDefEventManager.dispatchEvent(new WspDefEvent(WspDefEvent.TYPE_PROPERTIES_UPDATED, this)); 336 } 337 338 protected void initWspMetaProps(ValueWsp pValueWsp) { 339 Map<String, IValue<?>> vProps = pValueWsp.getProperties(); 340 if (vProps == null) { 341 fExternalItemsAllowed = fWspProvider.isExternalItemsAllowed(); 342 return; 343 } 344 ValueBoolean vAllowExternalItems = (ValueBoolean) vProps.get(OdbWspProviderLoader.ATT_EXTITEMALLOWED); 345 if (vAllowExternalItems == null) { 346 fExternalItemsAllowed = fWspProvider.isExternalItemsAllowed(); 347 } else { 348 fExternalItemsAllowed = vAllowExternalItems.getPojo() == true; 349 } 350 } 351 352 private Boolean getBooleanFromProps(Map<String, Object> pWspMetaProps, String pKey) { 353 if (pWspMetaProps == null) return null; 354 Object vVal = pWspMetaProps.get(pKey); 355 if (vVal == null) return null; 356 return Boolean.parseBoolean(vVal.toString()); 322 357 } 323 358 -
trunk/Jav_WspOdb/src/eu/scenari/wspodb/wsp/OdbWspDefinitionDrv.java
r19348 r19585 55 55 refreshWsp(pValueSrcContent); 56 56 fSrcRootContent = new OdbWspSrcNode(this, ISrcServer.URI_ROOT); 57 //Init par rapport aux props du wspMeta. 58 initWspMetaProps(pValueSrcContent.getExtension(WspOdbTypes.WSP)); 57 59 } 58 60
Note: See TracChangeset
for help on using the changeset viewer.