Changeset 30360
- Timestamp:
- 02/20/08 12:20:56 (9 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
org.nuxeo.ecm.platform/branches/5.1/nuxeo-platform-webapp-core/src/main/java/org/nuxeo/ecm/webapp/liveedit/LiveEditBootstrapHelper.java
r30298 r30360 347 347 // Document related informations 348 348 Element docInfo = root.addElement(documentTag); 349 Element docRefT = docInfo.addElement(docRefTag); 350 if (docRef != null) { 351 docRefT.setText(docRef.toString()); 352 } 349 addTextElement(docInfo, docRefTag, docRef); 353 350 Element docPathT = docInfo.addElement(docPathTag); 354 351 if (doc != null) { 355 352 docPathT.setText(doc.getPathAsString()); 356 353 } 357 Element docRepoT = docInfo.addElement(docRepositoryTag); 358 docRepoT.setText(repoID); 359 Element docSchemaT = docInfo.addElement(docSchemaNameTag); 360 docSchemaT.setText(schema); 361 Element docFieldT = docInfo.addElement(docFieldNameTag); 362 docFieldT.setText(blobField); 354 addTextElement(docInfo, docRepositoryTag, repoID); 355 addTextElement(docInfo, docSchemaNameTag, schema); 356 addTextElement(docInfo, docRepositoryTag, repoID); 357 addTextElement(docInfo, docFieldNameTag, blobField); 363 358 Element docFieldPathT = docInfo.addElement(docfieldPathTag); 364 docFieldPathT.setText(schema + "/" + blobField); 365 Element docFileNameT = docInfo.addElement(docfileNameTag); 366 if (filename != null) { 367 docFileNameT.setText(filename); 368 } 369 Element docTypeT = docInfo.addElement(docTypeTag); 370 docTypeT.setText(docType); 371 Element docMimeT = docInfo.addElement(docMimetypeTag); 372 docMimeT.setText(mimetype); 359 if (schema != null && blobField != null) { 360 docFieldPathT.setText(schema + "/" + blobField); 361 } 362 addTextElement(docInfo, docfileNameTag, filename); 363 addTextElement(docInfo, docTypeTag, docType); 364 addTextElement(docInfo, docMimetypeTag, mimetype); 373 365 374 366 Element docIsVersionT = docInfo.addElement(docIsVersionTag); … … 381 373 // template information for ACTION_CREATE_DOCUMENT_FROM_TEMPLATE 382 374 Element templateDocInfo = root.addElement(templateDocumentTag); 383 docRefT = templateDocInfo.addElement(docRefTag); 384 if (templateDocRef != null) { 385 docRefT.setText(templateDocRef.toString()); 386 } 375 addTextElement(templateDocInfo, docRefTag, templateDocRef); 387 376 docPathT = templateDocInfo.addElement(docPathTag); 388 377 if (templateDoc != null) { 389 378 docPathT.setText(templateDoc.getPathAsString()); 390 379 } 391 docRepoT = templateDocInfo.addElement(docRepositoryTag); 392 393 docRepoT.setText(templateRepoID); 394 docSchemaT = templateDocInfo.addElement(docSchemaNameTag); 395 docSchemaT.setText(templateSchema); 396 docFieldT = templateDocInfo.addElement(docFieldNameTag); 397 docFieldT.setText(templateBlobField); 380 addTextElement(templateDocInfo, docRepositoryTag, templateRepoID); 381 addTextElement(templateDocInfo, docSchemaNameTag, templateSchema); 382 addTextElement(templateDocInfo, docFieldNameTag, templateBlobField); 398 383 docFieldPathT = templateDocInfo.addElement(docfieldPathTag); 399 docFieldPathT.setText(templateSchema + "/" + templateBlobField); 384 if (templateSchema != null && templateBlobField != null) { 385 docFieldPathT.setText(templateSchema + "/" + templateBlobField); 386 } 400 387 401 388 // Browser request related informations … … 418 405 } 419 406 } 420 Element baseURLT = requestInfo.addElement(requestBaseURLTag);421 baseURLT.setText(BaseURL.getBaseURL(request));407 addTextElement(requestInfo, requestBaseURLTag, 408 BaseURL.getBaseURL(request)); 422 409 423 410 // User related informations 424 411 String username = context.getExternalContext().getUserPrincipal().getName(); 425 412 Element userInfo = root.addElement(userInfoTag); 426 Element userNameT = userInfo.addElement(userNameTag); 427 userNameT.setText(username); 428 Element userPasswordT = userInfo.addElement(userPasswordTag); 429 userPasswordT.setText(""); 430 Element userTokenT = userInfo.addElement(userTokenTag); 431 userTokenT.setText(""); 432 Element userLocaleT = userInfo.addElement(userLocaleTag); 433 userLocaleT.setText(context.getViewRoot().getLocale().toString()); 434 413 addTextElement(userInfo, userNameTag, username); 414 addTextElement(userInfo, userPasswordTag, ""); 415 addTextElement(userInfo, userTokenTag, ""); 416 addTextElement(userInfo, userLocaleTag, 417 context.getViewRoot().getLocale().toString()); 435 418 // Rux NXP-1882: the wsdl locations 436 419 String baseUrl = BaseURL.getBaseURL(request); … … 444 427 Element serverInfo = root.addElement(serverInfoTag); 445 428 Element serverVersionT = serverInfo.addElement(serverVersionTag); 446 serverVersionT.setText("5.1"); 429 serverVersionT.setText("5.1"); // TODO: use a buildtime generated 430 // version tag instead 447 431 448 432 // Client related informations … … 466 450 } 467 451 } 452 } 453 454 private static Element addTextElement(Element parent, QName newElementName, 455 String value) { 456 Element element = parent.addElement(newElementName); 457 if (value != null) { 458 element.setText(value.toString()); 459 } 460 return element; 468 461 } 469 462
