use of org.eclipse.scout.rt.shared.data.form.fields.composer.ComposerAttributeNodeData in project scout.rt by eclipse.
the class FormDataStatementBuilder method getAttributeKind.
public AttributeKind getAttributeKind(TreeNodeData node) {
if (!(node instanceof ComposerAttributeNodeData)) {
return AttributeKind.Undefined;
}
//
ComposerAttributeNodeData attributeNode = (ComposerAttributeNodeData) node;
Integer agg = attributeNode.getAggregationType();
if (agg == null || agg == AGGREGATION_NONE) {
if (!isZeroTraversingAttribute(attributeNode.getOperator(), attributeNode.getValues().toArray())) {
return AttributeKind.NonAggregationNonZeroTraversing;
}
return AttributeKind.NonAggregation;
}
//
if (!isZeroTraversingAttribute(attributeNode.getOperator(), attributeNode.getValues().toArray())) {
return AttributeKind.AggregationNonZeroTraversing;
}
return AttributeKind.Aggregation;
}
use of org.eclipse.scout.rt.shared.data.form.fields.composer.ComposerAttributeNodeData in project scout.rt by eclipse.
the class FormDataStatementBuilderWithComposerTest method testBuildComposerAttributeNodeStrategyBuildConstraintOfAttributeWithContextAggregationSum.
@Test
public void testBuildComposerAttributeNodeStrategyBuildConstraintOfAttributeWithContextAggregationSum() throws Exception {
ComposerAttributeNodeData subAttributeNode = prepareComposer(DataModelConstants.AGGREGATION_SUM);
m_builder.getAliasMapper().setNodeAlias(subAttributeNode.getParentNode(), "Table", "T");
EntityContribution attributeContribution = m_builder.buildComposerAttributeNode(subAttributeNode, AttributeStrategy.BuildConstraintOfAttributeWithContext);
assertNotNull(attributeContribution);
assertTrue(attributeContribution.getSelectParts().isEmpty());
assertTrue(attributeContribution.getFromParts().isEmpty());
assertTrue(attributeContribution.getGroupByParts().isEmpty());
assertTrue(attributeContribution.getHavingParts().isEmpty());
assertFalse(attributeContribution.getWhereParts().isEmpty());
assertEquals(1, attributeContribution.getWhereParts().size());
assertEquals("SUM(T.SUB_ATTRIBUTE)=:__a1", attributeContribution.getWhereParts().get(0));
}
use of org.eclipse.scout.rt.shared.data.form.fields.composer.ComposerAttributeNodeData in project scout.rt by eclipse.
the class FormDataStatementBuilderWithComposerTest method testBuildComposerEntityNodeStrategyBuildConstraintsAggregationNone.
@Test
public void testBuildComposerEntityNodeStrategyBuildConstraintsAggregationNone() throws Exception {
ComposerAttributeNodeData subAttributeNode = prepareComposer(DataModelConstants.AGGREGATION_NONE);
ComposerEntityNodeData subEntityNode = (ComposerEntityNodeData) subAttributeNode.getParentNode();
m_builder.getAliasMapper().setNodeAlias(subEntityNode.getParentNode(), "Table", "T");
EntityContribution entityContribution = m_builder.buildComposerEntityNodeContribution(subEntityNode, EntityStrategy.BuildConstraints);
assertNotNull(entityContribution);
assertTrue(entityContribution.getSelectParts().isEmpty());
assertTrue(entityContribution.getFromParts().isEmpty());
assertTrue(entityContribution.getGroupByParts().isEmpty());
assertTrue(entityContribution.getHavingParts().isEmpty());
assertFalse(entityContribution.getWhereParts().isEmpty());
assertEquals(1, entityContribution.getWhereParts().size());
assertEquals("EXISTS ( SELECT 1 FROM TABLE a0001 WHERE a0001.PRIMARY_KEY=T.PRIMARY_KEY AND a0001.SUB_ATTRIBUTE=:__a2 )", StringUtility.cleanup(entityContribution.getWhereParts().get(0)));
}
Aggregations