Advertisement
Guest User

Untitled

a guest
Mar 6th, 2015
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.32 KB | None | 0 0
  1. Say we have product p0001 that we want to append 2 pages from products p0002 and p0003
  2.  
  3.  
  4. This is resources of p0001
  5.  
  6. [res00001] => Array
  7. (
  8. [prodId] => p0001
  9. [fqfn] => html/page001.html
  10. [mimeType] => text/html
  11. [label] => page_001
  12. [s3Obj] => ....html
  13. [id] => res00001
  14. [url] => https://....
  15. )
  16.  
  17. This is resources of p0002
  18.  
  19. [res00002] => Array
  20. (
  21. [prodId] => p0002
  22. [fqfn] => html/page001.html
  23. [mimeType] => text/html
  24. [label] => page_001
  25. [s3Obj] => ....html
  26. [id] => res00002
  27. [url] => https://....
  28. )
  29.  
  30. This is resources of p0003
  31.  
  32. [res00003] => Array
  33. (
  34. [prodId] => p0003
  35. [fqfn] => html/page001.html
  36. [mimeType] => text/html
  37. [label] => page_001
  38. [s3Obj] => ....html
  39. [id] => res00003
  40. [url] => https://....
  41. )
  42.  
  43. Pages json of `p001` look like this
  44.  
  45. "pages": [
  46. {
  47. "id": "page001",
  48. "title": "page_001",
  49. "html": {
  50. "id": "page001_html",
  51. "cont": "html\/page001.html"
  52. }
  53. }
  54.  
  55. We now copyResources of p0002 and p0003 to p0001
  56. All prodIds get overriden by `p0001` value
  57.  
  58. So we get following resource list for p0001
  59. [res00001] => Array
  60. (
  61. [prodId] => p0001
  62. [fqfn] => html/page001.html
  63. [mimeType] => text/html
  64. [label] => page_001
  65. [s3Obj] => ....html
  66. [id] => res00001
  67. [url] => https://....
  68. )
  69. [res00005] => Array
  70. (
  71. [prodId] => p0001
  72. [fqfn] => html/page001.html
  73. [mimeType] => text/html
  74. [label] => page_001
  75. [s3Obj] => ....html
  76. [id] => res00005
  77. [url] => https://....
  78. )
  79.  
  80. This is resources of p0003
  81.  
  82. [res00006] => Array
  83. (
  84. [prodId] => p0001
  85. [fqfn] => html/page001.html
  86. [mimeType] => text/html
  87. [label] => page_001
  88. [s3Obj] => ....html
  89. [id] => res00006
  90. [url] => https://....
  91. )
  92.  
  93. And json for pages is
  94. "pages": [
  95. {
  96. "id": "page001",
  97. "title": "page_001",
  98. "html": {
  99. "id": "page001_html",
  100. "cont": "html\/page001.html"
  101. }
  102. } {
  103. "id": "clone_1",
  104. "title": "page_001",
  105. "html": {
  106. "id": "page001_html",
  107. "cont": "html\/page001.html"
  108. }
  109. } {
  110. "id": "clone_2",
  111. "title": "page_001",
  112. "html": {
  113. "id": "page001_html",
  114. "cont": "html\/page001.html"
  115. }
  116. }
  117.  
  118. And this is a simple issue. Actually colliding resources can be references from .html bodies, not just from TOC json
  119.  
  120. So what I'm changing
  121. 1. when I drop a page from different product, I remember where page comes from, so pages json becomes like that:
  122.  
  123. "pages": [
  124. {
  125. "id": "page001",
  126. "title": "page_001",
  127. "html": {
  128. "id": "page001_html",
  129. "cont": "html\/page001.html"
  130. },
  131. productId: p0001,
  132. vcode: X0001
  133. } {
  134. "id": "clone_1",
  135. "title": "page_001",
  136. "html": {
  137. "id": "page001_html",
  138. "cont": "html\/page001.html"
  139. }
  140. productId: p0002,
  141. vcode: X0002
  142. } {
  143. "id": "clone_2",
  144. "title": "page_001",
  145. "html": {
  146. "id": "page001_html",
  147. "cont": "html\/page001.html"
  148. }
  149. productId: p0002,
  150. vcode: X0002
  151. }
  152.  
  153. But resource list is still bad
  154. So when I do 'please clone r0002 of product p0002 to p0001' I do:
  155. 1. Clone resource to new id, say r0005, set it's prodId = p0001
  156. 2 (NEW STEP) Add field to r0005 originalProdId = p0002
  157.  
  158. Now I have following resource list for p0001
  159.  
  160. [res00001] => Array
  161. (
  162. [prodId] => p0001
  163. [fqfn] => html/page001.html
  164. [mimeType] => text/html
  165. [label] => page_001
  166. [s3Obj] => ....html
  167. [id] => res00001
  168. [url] => https://....
  169. )
  170. [res00005] => Array
  171. (
  172. [prodId] => p0001
  173. [originalProdId] => p0002
  174. [fqfn] => html/page001.html
  175. [mimeType] => text/html
  176. [label] => page_001
  177. [s3Obj] => ....html
  178. [id] => res00005
  179. [url] => https://....
  180. )
  181.  
  182. This is resources of p0003
  183.  
  184. [res00006] => Array
  185. (
  186. [prodId] => p0001
  187. [originalProdId] => p0003
  188. [fqfn] => html/page001.html
  189. [mimeType] => text/html
  190. [label] => page_001
  191. [s3Obj] => ....html
  192. [id] => res00006
  193. [url] => https://....
  194. )
  195.  
  196. And I can easily identify what goes where
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement