Skip to content

Commit

Permalink
Merge pull request #1339 from dimagi/revert-1337-fieldAction
Browse files Browse the repository at this point in the history
Revert "Xml Model Change: Adds action in detail field"
  • Loading branch information
shubham1g5 authored Oct 3, 2023
2 parents 7e44fda + 342bbba commit ffd5e12
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 37 deletions.
11 changes: 0 additions & 11 deletions src/main/java/org/commcare/suite/model/DetailField.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ public class DetailField implements Externalizable {
private String verticalAlign;
private String fontSize;
private String cssID;
private Action action;

public DetailField() {
}
Expand Down Expand Up @@ -202,7 +201,6 @@ public void readExternal(DataInputStream in, PrototypeFactory pf) throws IOExcep
horizontalAlign = ExtUtil.nullIfEmpty(ExtUtil.readString(in));
verticalAlign = ExtUtil.nullIfEmpty(ExtUtil.readString(in));
cssID = ExtUtil.nullIfEmpty(ExtUtil.readString(in));
action = (Action)ExtUtil.read(in, new ExtWrapNullable(new ExtWrapTagged()), pf);
}

@Override
Expand Down Expand Up @@ -232,7 +230,6 @@ public void writeExternal(DataOutputStream out) throws IOException {
ExtUtil.writeString(out, ExtUtil.emptyIfNull(horizontalAlign));
ExtUtil.writeString(out, ExtUtil.emptyIfNull(verticalAlign));
ExtUtil.writeString(out, ExtUtil.emptyIfNull(cssID));
ExtUtil.write(out, new ExtWrapNullable(action == null ? null : new ExtWrapTagged(action)));
}

public int getGridX() {
Expand Down Expand Up @@ -267,10 +264,6 @@ public String getCssId() {
return cssID;
}

public Action getAction() {
return action;
}

public static class Builder {
final DetailField field;

Expand Down Expand Up @@ -389,9 +382,5 @@ public void setFontSize(String fontSize) {
public void setCssID(String id) {
field.cssID = id;
}

public void setAction(Action action) {
field.action = action;
}
}
}
7 changes: 2 additions & 5 deletions src/main/java/org/commcare/xml/DetailFieldParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ public DetailField parse() throws InvalidStructureException, IOException, XmlPul
} else {
throw new InvalidStructureException("detail <field> with no <template>!", parser);
}
while(nextTagInBlock("field")) {
if (nextTagInBlock("field")) {
//sort details
checkNode(new String[]{"sort", "background", "action"});
checkNode(new String[]{"sort", "background"});

String name = parser.getName().toLowerCase();

Expand All @@ -84,9 +84,6 @@ public DetailField parse() throws InvalidStructureException, IOException, XmlPul
} else if (name.equals("background")) {
// background tag in fields is deprecated
skipBlock("background");
} else if (name.equals(ActionParser.NAME_ACTION)) {
checkNode(ActionParser.NAME_ACTION);
builder.setAction(new ActionParser(parser).parse());
}
}
return builder.build();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package org.commcare.backend.suite.model.test;

import org.commcare.resources.model.UnresolvedResourceException;
import org.commcare.suite.model.Action;
import org.commcare.suite.model.AssertionSet;
import org.commcare.suite.model.Callout;
import org.commcare.suite.model.Detail;
import org.commcare.suite.model.DetailField;
import org.commcare.suite.model.GeoOverlay;
import org.commcare.suite.model.Global;
Expand All @@ -22,7 +20,6 @@
import io.reactivex.observers.TestObserver;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;

/**
Expand Down Expand Up @@ -93,13 +90,6 @@ public void testDetailWithFocusFunction() {
Assert.assertTrue(focusFunction != null);
}

@Test
public void testDetailWithFieldAction() {
Detail detail = mApp.getSession().getPlatform().getDetail("m0_case_short");
DetailField field = detail.getFields()[0];
assertNotNull(field.getAction());
}

@Test
public void testDetailWithoutFocusFunction() {
XPathExpression focusFunction =
Expand Down
11 changes: 0 additions & 11 deletions src/test/resources/app_structure/suite.xml
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,6 @@
<xpath function="case_name"/>
</text>
</sort>
<action>
<display>
<text>Action Form</text>
</display>
<stack>
<push>
<command value="'m0-f0'"/>
<datum id="case_id_new_case_0" value="uuid()"/>
</push>
</stack>
</action>
</field>
</detail>
<detail id="m0_case_long">
Expand Down

0 comments on commit ffd5e12

Please sign in to comment.