Skip to content

Commit c2b0976

Browse files
author
Open Lowcode SAS
committed
Close #279
1 parent 3fa51b1 commit c2b0976

File tree

3 files changed

+34
-3
lines changed

3 files changed

+34
-3
lines changed

src/org/openlowcode/design/data/DataObjectDefinitionOtherActions.java

+8-1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import org.openlowcode.design.generation.SourceGenerator;
3232
import org.openlowcode.design.generation.StringFormatter;
3333
import org.openlowcode.design.module.Module;
34+
import org.openlowcode.module.system.data.choice.BooleanChoiceDefinition;
3435

3536
/**
3637
* This class gathers automatically generated actions for a data object.
@@ -781,6 +782,7 @@ public static void generateRepairMultiDimensionChildrenToFile(
781782
sg.wl("");
782783
sg.wl("import java.util.function.Function;");
783784
sg.wl("");
785+
sg.wl("import org.openlowcode.module.system.data.choice.BooleanChoiceDefinition;");
784786
sg.wl("import org.openlowcode.server.data.properties.DataObjectId;");
785787
sg.wl("import org.openlowcode.server.data.storage.QueryFilter;");
786788
sg.wl("import org.openlowcode.server.data.storage.TableAlias;");
@@ -806,8 +808,13 @@ public static void generateRepairMultiDimensionChildrenToFile(
806808
sg.wl(" Function<TableAlias, QueryFilter> datafilter) {");
807809
sg.wl(" " + parentclass + " " + parentvariable + " = " + parentclass + ".readone(" + parentvariable
808810
+ "id);");
809-
sg.wl(" " + parentvariable + ".repairfor" + hasmultidimensionchild.getInstancename().toLowerCase()
811+
if (hasmultidimensionchild.IsDeleteOnRepairAllowed()) {
812+
sg.wl(" " + parentvariable + ".repairfor" + hasmultidimensionchild.getInstancename().toLowerCase()
813+
+ "(BooleanChoiceDefinition.get().YES);");
814+
} else {
815+
sg.wl(" " + parentvariable + ".repairfor" + hasmultidimensionchild.getInstancename().toLowerCase()
810816
+ "(null);");
817+
}
811818
sg.wl(" return new ActionOutputData(" + parentvariable + "id);");
812819
sg.wl(" }");
813820
sg.wl("");

src/org/openlowcode/design/data/properties/basic/HasMultiDimensionalChild.java

+15-1
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,23 @@ public class HasMultiDimensionalChild
4141
private DataObjectDefinition childobjectforlink;
4242
private MultiDimensionChild<?> originobjectproperty;
4343

44+
4445
public MultiDimensionChild<?> getOriginMultiDimensionChildProperty() {
4546
return this.originobjectproperty;
4647
}
4748

49+
/**
50+
* @return true if delete of elements is allowed on repairing an item
51+
*/
52+
public boolean IsDeleteOnRepairAllowed() {
53+
return originobjectproperty.isDeleteAllowedOnRepair();
54+
}
55+
56+
/**
57+
* @param name unique name of the property for the object
58+
* @param childobjectforlink definition of the child object
59+
* @param originobjectproperty multi dimension child property on the child object
60+
*/
4861
public HasMultiDimensionalChild(
4962
String name,
5063
DataObjectDefinition childobjectforlink,
@@ -53,9 +66,10 @@ public HasMultiDimensionalChild(
5366
this.childobjectforlink = childobjectforlink;
5467
this.originobjectproperty = originobjectproperty;
5568
this.addPropertyGenerics(new PropertyGenerics("CHILDOBJECTFORLINK", childobjectforlink, originobjectproperty));
56-
69+
5770
}
5871

72+
5973
@Override
6074
public void controlAfterParentDefinition() {
6175
this.addDependentProperty(originobjectproperty.getLinkedToParent().getLinkedFromChildren());

src/org/openlowcode/design/data/properties/basic/MultiDimensionChild.java

+11-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ public class MultiDimensionChild<E extends DataObjectDefinition>
5151
private Field firstaxisvalue;
5252
private Field[] secondaxisvalues;
5353
private Field[] payloadvalues;
54-
54+
private boolean isdeleteallowedonrepair;
55+
5556
public Field getFirstAxisValue() {
5657
return firstaxisvalue;
5758
}
@@ -79,6 +80,15 @@ public MultiDimensionChild(
7980
this.secondaxisvalues = secondaxisvalues;
8081
this.payloadvalues = payloadvalues;
8182
this.linkedtoparent.setMultiDimensionChild(this);
83+
isdeleteallowedonrepair=false;
84+
}
85+
86+
public boolean isDeleteAllowedOnRepair() {
87+
return this.isdeleteallowedonrepair;
88+
}
89+
90+
public void setAllowsDeleteOnRepair() {
91+
this.isdeleteallowedonrepair=true;
8292
}
8393

8494
@Override

0 commit comments

Comments
 (0)