Commit 4c7d9383 by Kunj Gupta

Fixed - handle the null value.

parent d094cfdb
...@@ -186,6 +186,8 @@ public class CatalogueVariableScreen extends HandleNotificationActivity { ...@@ -186,6 +186,8 @@ public class CatalogueVariableScreen extends HandleNotificationActivity {
if (mApplication.isNetConnected()) { if (mApplication.isNetConnected()) {
isProgressRequire = mCatalogueVariableList.isEmpty(); isProgressRequire = mCatalogueVariableList.isEmpty();
new FetchCatalogueVariable().execute(); new FetchCatalogueVariable().execute();
} else if(mCatalogueVariableList.isEmpty()) {
DialogUtils.showNoConnectionDialog(CatalogueVariableScreen.this);
} }
} }
...@@ -1145,19 +1147,24 @@ public class CatalogueVariableScreen extends HandleNotificationActivity { ...@@ -1145,19 +1147,24 @@ public class CatalogueVariableScreen extends HandleNotificationActivity {
continue; continue;
} }
boolean conditionsSatisfied = true; boolean conditionsSatisfied = true;
for(int j=0; j<item.getPartialConditions().size(); j++) { for (int j = 0; j < item.getPartialConditions().size(); j++) {
PartialCondition partialCondition = item.getPartialConditions().get(j); PartialCondition partialCondition = item.getPartialConditions().get(j);
CatalogueVariable variable = getVariableForSysId(partialCondition.getViewSysId()); CatalogueVariable variable = getVariableForSysId(partialCondition.getViewSysId());
VariableViewContainer variableViewContainer = mVariableViewMap.get(variable.getSysId()); VariableViewContainer variableViewContainer;
if(variableViewContainer == null || variableViewContainer.getInputView() == null) { if (variable == null) {
continue;
} else {
variableViewContainer = mVariableViewMap.get(variable.getSysId());
}
if (variableViewContainer == null || variableViewContainer.getInputView() == null) {
continue; continue;
} }
String value = Util.getVariableViewValueForUIPolicy(variableViewContainer.getInputView(), variable); String value = Util.getVariableViewValueForUIPolicy(variableViewContainer.getInputView(), variable);
switch(partialCondition.getOperator()) { switch (partialCondition.getOperator()) {
case EQUAL: case EQUAL:
conditionsSatisfied = conditionsSatisfied && value.equals(partialCondition.getOperatorValue()); conditionsSatisfied = conditionsSatisfied && value.equals(partialCondition.getOperatorValue());
break; break;
case IS_NOT_EMPTY: case IS_NOT_EMPTY:
conditionsSatisfied = conditionsSatisfied && !TextUtils.isEmpty(value); conditionsSatisfied = conditionsSatisfied && !TextUtils.isEmpty(value);
break; break;
} }
......
...@@ -64,6 +64,7 @@ import com.vsoft.servicenow.db.managers.HRCaseUiPolicyActionManager; ...@@ -64,6 +64,7 @@ import com.vsoft.servicenow.db.managers.HRCaseUiPolicyActionManager;
import com.vsoft.servicenow.db.managers.HRCaseUiPolicyItemManager; import com.vsoft.servicenow.db.managers.HRCaseUiPolicyItemManager;
import com.vsoft.servicenow.db.managers.HRCaseVariableChoiceManager; import com.vsoft.servicenow.db.managers.HRCaseVariableChoiceManager;
import com.vsoft.servicenow.db.managers.HRCaseVariableManager; import com.vsoft.servicenow.db.managers.HRCaseVariableManager;
import com.vsoft.servicenow.db.models.CatalogueVariable;
import com.vsoft.servicenow.db.models.HRCaseAttachment; import com.vsoft.servicenow.db.models.HRCaseAttachment;
import com.vsoft.servicenow.db.models.HRCaseItem; import com.vsoft.servicenow.db.models.HRCaseItem;
import com.vsoft.servicenow.db.models.HRCaseItemInput; import com.vsoft.servicenow.db.models.HRCaseItemInput;
...@@ -185,6 +186,8 @@ public class HRCaseVariableScreen extends HandleNotificationActivity { ...@@ -185,6 +186,8 @@ public class HRCaseVariableScreen extends HandleNotificationActivity {
if (mApplication.isNetConnected()) { if (mApplication.isNetConnected()) {
isProgressRequire = mHRCaseVariableList.isEmpty(); isProgressRequire = mHRCaseVariableList.isEmpty();
new FetchCatalogueVariable().execute(); new FetchCatalogueVariable().execute();
} else if(mHRCaseVariableList.isEmpty()) {
DialogUtils.showNoConnectionDialog(HRCaseVariableScreen.this);
} }
} }
...@@ -1144,19 +1147,24 @@ public class HRCaseVariableScreen extends HandleNotificationActivity { ...@@ -1144,19 +1147,24 @@ public class HRCaseVariableScreen extends HandleNotificationActivity {
continue; continue;
} }
boolean conditionsSatisfied = true; boolean conditionsSatisfied = true;
for(int j=0; j<item.getPartialConditions().size(); j++) { for (int j = 0; j < item.getPartialConditions().size(); j++) {
PartialCondition partialCondition = item.getPartialConditions().get(j); PartialCondition partialCondition = item.getPartialConditions().get(j);
HRCaseVariable variable = getVariableForSysId(partialCondition.getViewSysId()); HRCaseVariable variable = getVariableForSysId(partialCondition.getViewSysId());
VariableViewContainer variableViewContainer = mVariableViewMap.get(variable.getSysId()); VariableViewContainer variableViewContainer;
if(variableViewContainer == null || variableViewContainer.getInputView() == null) { if (variable == null) {
continue;
} else {
variableViewContainer = mVariableViewMap.get(variable.getSysId());
}
if (variableViewContainer == null || variableViewContainer.getInputView() == null) {
continue; continue;
} }
String value = Util.getVariableViewValueForUIPolicy(variableViewContainer.getInputView(), variable); String value = Util.getVariableViewValueForUIPolicy(variableViewContainer.getInputView(), variable);
switch(partialCondition.getOperator()) { switch (partialCondition.getOperator()) {
case EQUAL: case EQUAL:
conditionsSatisfied = conditionsSatisfied && value.equals(partialCondition.getOperatorValue()); conditionsSatisfied = conditionsSatisfied && value.equals(partialCondition.getOperatorValue());
break; break;
case IS_NOT_EMPTY: case IS_NOT_EMPTY:
conditionsSatisfied = conditionsSatisfied && !TextUtils.isEmpty(value); conditionsSatisfied = conditionsSatisfied && !TextUtils.isEmpty(value);
break; break;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment