4343 * @param <F> object at left of link
4444 * @param <G> object at right of link
4545 */
46- public class LinkobjectDefinition <E extends DataObject <E > & LinkobjectInterface <E , F , G >, F extends DataObject <F > & UniqueidentifiedInterface <F >, G extends DataObject <G > & UniqueidentifiedInterface <G >>
47- extends DataObjectPropertyDefinition <E > {
46+ public class LinkobjectDefinition <
47+ E extends DataObject <E > & LinkobjectInterface <E , F , G >,
48+ F extends DataObject <F > & UniqueidentifiedInterface <F >,
49+ G extends DataObject <G > & UniqueidentifiedInterface <G >>
50+ extends
51+ DataObjectPropertyDefinition <E > {
4852 private DataObjectDefinition <F > leftobjectdefinition ;
4953 private DataObjectDefinition <G > rightobjectdefinition ;
5054 private StringStoredField leftid ;
@@ -65,6 +69,7 @@ public class LinkobjectDefinition<E extends DataObject<E> & LinkobjectInterface<
6569 private boolean showfieldsforrightobject ;
6670 private int minpriorityforleftobjectfields ;
6771 private int minpriorityforrightobjectfields ;
72+ private boolean makesidmodifiable = false ;
6873 private static Logger logger = Logger .getLogger (LinkobjectDefinition .class .getName ());
6974
7075 /**
@@ -165,11 +170,18 @@ public boolean isReplaceifmorethanonefromleft() {
165170 * shown on the link
166171 * @param showrightfieldswithpriority if set, right fields above the priority
167172 * are shown on the link
173+ * @param makesidmodifiable if true, the ids of links can be sent to a
174+ * client before having been persisted. This may be
175+ * a security risk that the data is tampered on the
176+ * client side
168177 */
169- public LinkobjectDefinition (DataObjectDefinition <E > parentobject , DataObjectDefinition <F > leftobjectdefinition ,
170- DataObjectDefinition <G > rightobjectdefinition , int showleftfieldswithpriority ,
171- int showrightfieldswithpriority ) {
172- this (parentobject , leftobjectdefinition , rightobjectdefinition );
178+ public LinkobjectDefinition (
179+ DataObjectDefinition <E > parentobject ,
180+ DataObjectDefinition <F > leftobjectdefinition ,
181+ DataObjectDefinition <G > rightobjectdefinition ,
182+ int showleftfieldswithpriority ,
183+ int showrightfieldswithpriority ,boolean makesidmodifiable ) {
184+ this (parentobject , leftobjectdefinition , rightobjectdefinition ,makesidmodifiable );
173185 if (showleftfieldswithpriority < 1000 ) {
174186 this .showfieldsforleftobject = true ;
175187 this .minpriorityforleftobjectfields = showleftfieldswithpriority ;
@@ -189,9 +201,16 @@ public LinkobjectDefinition(DataObjectDefinition<E> parentobject, DataObjectDefi
189201 * @param parentobject parent object definition
190202 * @param leftobjectdefinition definition of the left object for link
191203 * @param rightobjectdefinition definition of the right object for link
204+ * @param makesidmodifiable if true, the ids of links can be sent to a
205+ * client before having been persisted. This may be
206+ * a security risk that the data is tampered on the
207+ * client side
192208 */
193- public LinkobjectDefinition (DataObjectDefinition <E > parentobject , DataObjectDefinition <F > leftobjectdefinition ,
194- DataObjectDefinition <G > rightobjectdefinition ) {
209+ public LinkobjectDefinition (
210+ DataObjectDefinition <E > parentobject ,
211+ DataObjectDefinition <F > leftobjectdefinition ,
212+ DataObjectDefinition <G > rightobjectdefinition ,
213+ boolean makesidmodifiable ) {
195214 super (parentobject , "LINKOBJECT" );
196215 this .leftobjectdefinition = leftobjectdefinition ;
197216 this .rightobjectdefinition = rightobjectdefinition ;
@@ -217,6 +236,7 @@ public LinkobjectDefinition(DataObjectDefinition<E> parentobject, DataObjectDefi
217236 this .replaceifmorethanonefromleft = false ;
218237 this .showfieldsforleftobject = false ;
219238 this .showfieldsforrightobject = false ;
239+ this .makesidmodifiable =makesidmodifiable ;
220240 }
221241
222242 /**
@@ -287,7 +307,9 @@ public UniqueidentifiedDefinition<G> getRightuniqueidentifieddefinition() {
287307
288308 /**
289309 * sets the dependent property unique identified for the link object
290- * @param uniqueidentifieddefinition unique identified property for the left object
310+ *
311+ * @param uniqueidentifieddefinition unique identified property for the left
312+ * object
291313 */
292314 public void setDependentDefinitionUniqueidentified (UniqueidentifiedDefinition <E > uniqueidentifieddefinition ) {
293315 this .uniqueidentifieddefinition = uniqueidentifieddefinition ;
@@ -327,8 +349,8 @@ public ArrayList<ExternalFieldSchema<?>> generateExternalSchema() {
327349 }
328350 // get named property for left object
329351 if (leftobjectdefinition .hasProperty ("NUMBERED" )) {
330- NumberedDefinition <F > numbereddefinition = ( NumberedDefinition < F >) leftobjectdefinition
331- .getProperty ("NUMBERED" );
352+ NumberedDefinition <
353+ F > numbereddefinition = ( NumberedDefinition < F >) leftobjectdefinition .getProperty ("NUMBERED" );
332354 boolean orderedasnumber = false ;
333355 int numberoffset = 0 ;
334356 if (numbereddefinition .getAutonumberingRule () != null )
@@ -355,8 +377,8 @@ public ArrayList<ExternalFieldSchema<?>> generateExternalSchema() {
355377 // get state property for left object
356378
357379 if (leftobjectdefinition .hasProperty ("LIFECYCLE" )) {
358- LifecycleDefinition <?, ?> lifecycle = ( LifecycleDefinition <?, ?>) ( leftobjectdefinition
359- .getProperty ("LIFECYCLE" ));
380+ LifecycleDefinition <
381+ ?, ?> lifecycle = ( LifecycleDefinition <?, ?>) ( leftobjectdefinition .getProperty ("LIFECYCLE" ));
360382 ExternalFieldSchema <?> leftexternalfield = leftobjectdefinition .generateExternalField (
361383 this .getName () + "LEFTSTATE" , "Left state" , "this is a stupid comment" , "LIFECYCLE" , "STATE" ,
362384 lifecycle .getLifecycleHelper (), leftjoincondition , this .displayprofilehideleftobjectfields , 500 ,
@@ -408,8 +430,8 @@ public ArrayList<ExternalFieldSchema<?>> generateExternalSchema() {
408430 // adds an external field is the target object is named -- currently, there is
409431 // an error
410432 @ SuppressWarnings ("unchecked" )
411- NumberedDefinition <F > numbereddefinition = ( NumberedDefinition < F >) rightobjectdefinition
412- .getProperty ("NUMBERED" );
433+ NumberedDefinition <
434+ F > numbereddefinition = ( NumberedDefinition < F >) rightobjectdefinition .getProperty ("NUMBERED" );
413435 boolean orderedasnumber = false ;
414436 int numberoffset = 0 ;
415437 if (numbereddefinition .getAutonumberingRule () != null )
@@ -436,8 +458,8 @@ public ArrayList<ExternalFieldSchema<?>> generateExternalSchema() {
436458 externalfieldlist .add (rightexternalfield );
437459 }
438460 if (rightobjectdefinition .hasProperty ("LIFECYCLE" )) {
439- LifecycleDefinition <?, ?> lifecycle = ( LifecycleDefinition <?, ?>) ( rightobjectdefinition
440- .getProperty ("LIFECYCLE" ));
461+ LifecycleDefinition <
462+ ?, ?> lifecycle = ( LifecycleDefinition <?, ?>) ( rightobjectdefinition .getProperty ("LIFECYCLE" ));
441463 ExternalFieldSchema <?> rightexternalfield = rightobjectdefinition .generateExternalField (
442464 this .getName () + "RIGHTSTATE" , "Right object state" , "this is a stupid comment" , "LIFECYCLE" ,
443465 "STATE" , lifecycle .getLifecycleHelper (), rightjoincondition ,
@@ -473,11 +495,11 @@ public FieldSchemaForDisplay<E>[] setFieldSchemaToDisplay() {
473495 @ SuppressWarnings ("unchecked" )
474496 FieldSchemaForDisplay <E >[] returnvalue = new FieldSchemaForDisplay [2 ];
475497 returnvalue [0 ] = new FieldSchemaForDisplay <E >("Left id" ,
476- "the technical id generated by the system for the left object of the part" , leftid , false , true , - 200 ,
477- 16 , this .parentobject );
498+ "the technical id generated by the system for the left object of the part" , leftid , false , true ,
499+ ! makesidmodifiable , - 200 , 16 , this .parentobject );
478500 returnvalue [1 ] = new FieldSchemaForDisplay <E >("Right id" ,
479- "the technical id generated by the system for the right object of the part" , rightid , false , true , - 200 ,
480- 16 , this .parentobject );
501+ "the technical id generated by the system for the right object of the part" , rightid , false , true ,
502+ ! makesidmodifiable , - 200 , 16 , this .parentobject );
481503
482504 return returnvalue ;
483505 }
@@ -495,8 +517,10 @@ public QueryCondition getUniversalQueryCondition(String alias) {
495517 }
496518
497519 @ Override
498- public FlatFileLoaderColumn <E > getFlatFileLoaderColumn (DataObjectDefinition <E > objectdefinition ,
499- String [] columnattributes , PropertyExtractor <E > propertyextractor ,
520+ public FlatFileLoaderColumn <E > getFlatFileLoaderColumn (
521+ DataObjectDefinition <E > objectdefinition ,
522+ String [] columnattributes ,
523+ PropertyExtractor <E > propertyextractor ,
500524 ChoiceValue <ApplocaleChoiceDefinition > locale ) {
501525 throw new RuntimeException ("Not yet implemented" );
502526 }
0 commit comments