From version 33.2
edited by Vincent Massol
on 2019/01/29 11:49
To version 34.1
edited by Adel Atallah
on 2019/02/09 16:45
Change comment: There is no comment for this version

Summary

Details

Page properties
Author
... ... @@ -1,1 +1,1 @@
1 -xwiki:XWiki.VincentMassol
1 +xwiki:XWiki.atallahade
ExtensionCode.ExtensionClass[0]
Description
... ... @@ -58,15 +58,14 @@
58 58   };
59 59  
60 60   /**
61 - * The name of the document to include.
61 + * The entity reference to include.
62 62   */
63 - private String document;
63 + private String reference;
64 64  
65 65   /**
66 - * Defines whether the included page is executed in its separated execution context or whether it's executed in the
67 - * context of the current page.
66 + * Type of the entity to include.
68 68   */
69 - private Context context;
68 + private EntityType type = EntityType.DOCUMENT;
70 70  
71 71   private String hiddenProperty;
72 72  
... ... @@ -73,24 +73,54 @@
73 73   public int publicField;
74 74  
75 75   /**
76 - * @param document the name of the document to include.
75 + * @param reference the reference of the resource to include
77 77   */
78 - @PropertyMandatory
79 - @PropertyDescription("the name of the document to include")
80 - public void setDocument(String document)
77 + @PropertyDescription("the reference of the resource to display")
78 + @PropertyGroup("stringReference")
79 + @PropertyFeature("reference")
80 + public void setReference(String reference)
81 81   {
82 - this.document = document;
82 + this.reference = reference;
83 83   }
84 84  
85 85   /**
86 - * @return the name of the document to include.
86 + * @return the reference of the resource to include
87 87   */
88 - public String getDocument()
88 + public String getReference()
89 89   {
90 - return this.document;
90 + return this.reference;
91 91   }
92 92  
93 93   /**
94 + * @return the type of the reference
95 + */
96 + @PropertyDescription("the type of the reference")
97 + @PropertyGroup("stringReference")
98 + public EntityType getType()
99 + {
100 + return this.type;
101 + }
102 +
103 + /**
104 + * @param type the type of the reference
105 + */
106 + public void setType(EntityType type)
107 + {
108 + this.type = type;
109 + }
110 +
111 + /**
112 + * @param page the reference of the page to include
113 + */
114 + @PropertyDescription("The reference of the page to include")
115 + @PropertyFeature("reference")
116 + public void setPage(String page)
117 + {
118 + this.reference = page;
119 + this.type = EntityType.PAGE;
120 + }
121 +
122 + /**
94 94   * @param context defines whether the included page is executed in its separated execution context or whether it's
95 95   * executed in the context of the current page.
96 96   */
... ... @@ -111,10 +111,10 @@
111 111   }
112 112  
113 113   @PropertyHidden
114 - public void setHiddenProperty(String hiddenProperty)
115 - {
116 - this.hiddenProperty = hiddenProperty;
117 - }
143 + public void setHiddenProperty(String hiddenProperty)
144 + {
145 + this.hiddenProperty = hiddenProperty;
146 + }
118 118  
119 119   public String getHiddenProperty()
120 120   {
... ... @@ -126,7 +126,7 @@
126 126  {{code language="java"}}
127 127  Map<String, String> values = new HashMap<String, String>();
128 128  
129 -values.put("document", "Space.Page");
158 +values.put("reference", "Space.Page");
130 130  values.put("context", "new");
131 131  values.put("publicField", "42");
132 132  values.put("hiddenProperty", "hiddenPropertyvalue");
... ... @@ -136,7 +136,7 @@
136 136  BeanManager beanManager = componentManager.getInstance(BeanManager.class);
137 137  beanManager.populate(bean, values);
138 138  
139 -assertEquals("Space.Page", bean.getDocument());
168 +assertEquals("Space.Page", bean.getReference());
140 140  assertEquals(Context.NEW, bean.getContext());
141 141  assertEquals(42, bean.publicField);
142 142  assertNull(bean.getHiddenProperty());

Get Connected