Changes for page Properties Module

Last modified by Vincent Massol on 2021/03/17 21:12

<
From version < 33.2 >
edited by Vincent Massol
on 2019/01/29 11:49
To version < 35.1 >
edited by Vincent Massol
on 2020/04/24 14:32
>
Change comment: There is no comment for this version

Summary

Details

ExtensionCode.ExtensionClass[0]
Description
... ... @@ -33,6 +33,7 @@
33 33  * {{info}}since 10.11{{/info}} ##org.xwiki.properties.annotation.PropertyGroup##: used to group properties together
34 34  * {{info}}since 10.11{{/info}} ##org.xwiki.properties.annotation.PropertyFeature##: binds a property to a feature (two properties can be used for the same feature)
35 35  * {{info}}since 11.0{{/info}} ##org.xwiki.properties.annotation.PropertyDisplayType##: overrides the type of the property for display only (e.g. WYSIWYG)
36 +* {{info}}since 12.4RC1{{/info}} ##org.xwiki.properties.annotation.PropertyDisplayHidden##: indicates that the property should not be displayed in UIs (e.g. in the WYSIWYG macro editor)
36 36  
37 37  Finally default implementation of BeanManager support [[JSR 303 (Bean Validation)>>http://jcp.org/en/jsr/detail?id=303]] if an implementation can be found.
38 38  
... ... @@ -58,11 +58,16 @@
58 58   };
59 59  
60 60   /**
61 - * The name of the document to include.
62 + * The entity reference to include.
62 62   */
63 - private String document;
64 + private String reference;
64 64  
65 65   /**
67 + * Type of the entity to include.
68 + */
69 + private EntityType type = EntityType.DOCUMENT;
70 +
71 + /**
66 66   * Defines whether the included page is executed in its separated execution context or whether it's executed in the
67 67   * context of the current page.
68 68   */
... ... @@ -73,24 +73,54 @@
73 73   public int publicField;
74 74  
75 75   /**
76 - * @param document the name of the document to include.
82 + * @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)
84 + @PropertyDescription("the reference of the resource to display")
85 + @PropertyGroup("stringReference")
86 + @PropertyFeature("reference")
87 + public void setReference(String reference)
81 81   {
82 - this.document = document;
89 + this.reference = reference;
83 83   }
84 84  
85 85   /**
86 - * @return the name of the document to include.
93 + * @return the reference of the resource to include
87 87   */
88 - public String getDocument()
95 + public String getReference()
89 89   {
90 - return this.document;
97 + return this.reference;
91 91   }
92 92  
93 93   /**
101 + * @return the type of the reference
102 + */
103 + @PropertyDescription("the type of the reference")
104 + @PropertyGroup("stringReference")
105 + public EntityType getType()
106 + {
107 + return this.type;
108 + }
109 +
110 + /**
111 + * @param type the type of the reference
112 + */
113 + public void setType(EntityType type)
114 + {
115 + this.type = type;
116 + }
117 +
118 + /**
119 + * @param page the reference of the page to include
120 + */
121 + @PropertyDescription("The reference of the page to include")
122 + @PropertyFeature("reference")
123 + public void setPage(String page)
124 + {
125 + this.reference = page;
126 + this.type = EntityType.PAGE;
127 + }
128 +
129 + /**
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 - }
150 + public void setHiddenProperty(String hiddenProperty)
151 + {
152 + this.hiddenProperty = hiddenProperty;
153 + }
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");
165 +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());
175 +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