use of com.qcadoo.model.api.DataDefinition in project qcadoo by qcadoo.
the class BelongingTo method equals.
@Override
public boolean equals(final Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
BelongingTo that = (BelongingTo) o;
DataDefinition thisDataDef = this.entity.getDataDefinition();
DataDefinition thatDataDef = that.entity.getDataDefinition();
return new EqualsBuilder().append(this.fieldName, that.fieldName).append(this.entity.getId(), that.entity.getId()).append(thisDataDef.getName(), thatDataDef.getName()).append(thisDataDef.getPluginIdentifier(), thatDataDef.getPluginIdentifier()).isEquals();
}
use of com.qcadoo.model.api.DataDefinition in project qcadoo by qcadoo.
the class SearchCriteriaImpl method getDataDefinitionBelongsToForField.
private DataDefinition getDataDefinitionBelongsToForField(final String field) {
String[] path = field.split("\\.");
DataDefinition parentDataDefinition = sourceDataDefinition;
for (int i = 0; i < path.length; i++) {
parentDataDefinition = ((BelongsToType) parentDataDefinition.getField(path[i]).getType()).getDataDefinition();
}
return parentDataDefinition;
}
use of com.qcadoo.model.api.DataDefinition in project qcadoo by qcadoo.
the class DefaultEntityTest method shouldGetDataDefinitionReturnDataDefinition.
@Test
public final void shouldGetDataDefinitionReturnDataDefinition() throws Exception {
// when
DataDefinition returnedDataDefinition = defaultEntity.getDataDefinition();
// then
assertEquals(dataDefinition, returnedDataDefinition);
}
use of com.qcadoo.model.api.DataDefinition in project qcadoo by qcadoo.
the class GridComponentFilterUtilsTest method shouldFilterColumnWithThreeLevelsDeepPathInExpressionWithBrackets.
@Test
public final void shouldFilterColumnWithThreeLevelsDeepPathInExpressionWithBrackets() throws GridComponentFilterException {
// given
DataDefinition firstBtDataDef = mock(DataDefinition.class);
FieldDefinition firstBtFieldDef = mockBelongsToField("firstBt", dataDefinition, firstBtDataDef);
DataDefinition secondBtDataDef = mock(DataDefinition.class);
mockBelongsToField("secondBt", firstBtDataDef, secondBtDataDef);
DataDefinition thirdBtDataDef = mock(DataDefinition.class);
mockBelongsToField("thirdBt", secondBtDataDef, thirdBtDataDef);
mockFieldDefinition(TEST_FIELD, Integer.class, thirdBtDataDef);
// when
performFiltering("3", buildGridComponentColumn(TEST_COL, firstBtFieldDef, "#firstBt['secondBt'].get('thirdBt').get('" + TEST_FIELD + "')"));
// then
PowerMockito.verifyStatic();
SearchRestrictions.eq("thirdBt_a." + TEST_FIELD, 3);
PowerMockito.verifyStatic(never());
SearchRestrictions.eq(TEST_FIELD, 3);
SearchRestrictions.eq("firstBt_a." + TEST_FIELD, 3);
SearchRestrictions.eq("secondBt_a." + TEST_FIELD, 3);
}
use of com.qcadoo.model.api.DataDefinition in project qcadoo by qcadoo.
the class GridComponentFilterUtilsTest method shouldFilterColumnWithTwoLevelsDeepPathInExpressionWithBrackets.
@Test
public final void shouldFilterColumnWithTwoLevelsDeepPathInExpressionWithBrackets() throws GridComponentFilterException {
// given
DataDefinition firstBtDataDef = mock(DataDefinition.class);
FieldDefinition firstBtFieldDef = mockBelongsToField("firstBt", dataDefinition, firstBtDataDef);
DataDefinition secondBtDataDef = mock(DataDefinition.class);
mockBelongsToField("secondBt", firstBtDataDef, secondBtDataDef);
mockFieldDefinition(TEST_FIELD, Integer.class, secondBtDataDef);
// when
performFiltering("3", buildGridComponentColumn(TEST_COL, firstBtFieldDef, "#firstBt['secondBt'].get('" + TEST_FIELD + "')"));
// then
PowerMockito.verifyStatic();
SearchRestrictions.eq("secondBt_a." + TEST_FIELD, 3);
PowerMockito.verifyStatic(never());
SearchRestrictions.eq(TEST_FIELD, 3);
SearchRestrictions.eq("firstBt_a." + TEST_FIELD, 3);
}
Aggregations