use of com.qcadoo.model.api.search.SearchCriteriaBuilder in project mes by qcadoo.
the class TechnologyProductComponentsDataProvider method createGenerationModeBaseCriteria.
private SearchCriteriaBuilder createGenerationModeBaseCriteria(final String modelName, final String tocFieldName, final String productFieldName, final TechnologyId technologyId) {
DataDefinition dd = dataDefinitionService.get(TechnologiesConstants.PLUGIN_IDENTIFIER, modelName);
SearchCriteriaBuilder opicCriteria = dd.find();
opicCriteria.createCriteria(tocFieldName, "toc_alias", JoinType.INNER).createCriteria(TechnologyOperationComponentFields.TECHNOLOGY, "tech_alias", JoinType.INNER).add(idEq(technologyId.get()));
opicCriteria.createCriteria(productFieldName, "prod_alias", JoinType.INNER).add(eq(ProductFieldsTG.FROM_GENERATOR, true));
return opicCriteria;
}
use of com.qcadoo.model.api.search.SearchCriteriaBuilder in project mes by qcadoo.
the class TechnologyProductComponentsDataProvider method findOutputs.
public List<Entity> findOutputs(final TechnologyId technologyId, final Optional<OutputProductComponentId> excludedComponentId, boolean generationMode) {
SearchCriteriaBuilder scb = null;
if (generationMode) {
scb = createGenerationModeBaseCriteria(TechnologiesConstants.MODEL_OPERATION_PRODUCT_OUT_COMPONENT, OperationProductOutComponentFields.OPERATION_COMPONENT, OperationProductOutComponentFields.PRODUCT, technologyId);
} else {
scb = createBaseCriteria(TechnologiesConstants.MODEL_OPERATION_PRODUCT_OUT_COMPONENT, OperationProductOutComponentFields.OPERATION_COMPONENT, OperationProductOutComponentFields.PRODUCT, technologyId);
}
excludedComponentId.map(OutputProductComponentId::get).map(SearchRestrictions::idNe).ifPresent(scb::add);
return scb.list().getEntities();
}
use of com.qcadoo.model.api.search.SearchCriteriaBuilder in project mes by qcadoo.
the class TechnologyProductComponentsDataProvider method createBaseCriteria.
private SearchCriteriaBuilder createBaseCriteria(final String modelName, final String tocFieldName, final String productFieldName, final TechnologyId technologyId) {
DataDefinition dd = dataDefinitionService.get(TechnologiesConstants.PLUGIN_IDENTIFIER, modelName);
SearchCriteriaBuilder opicCriteria = dd.find();
opicCriteria.createCriteria(tocFieldName, "toc_alias", JoinType.INNER).createCriteria(TechnologyOperationComponentFields.TECHNOLOGY, "tech_alias", JoinType.INNER).add(idEq(technologyId.get()));
opicCriteria.createCriteria(productFieldName, "prod_alias", JoinType.INNER).add(eq(ProductFields.ENTITY_TYPE, ProductFamilyElementType.PRODUCTS_FAMILY.getStringValue()));
return opicCriteria;
}
use of com.qcadoo.model.api.search.SearchCriteriaBuilder in project mes by qcadoo.
the class TechnologyStructureTreeDataProvider method prepareExistingNodeSearchCriteria.
private SearchCriteriaBuilder prepareExistingNodeSearchCriteria(final ContextId contextId) {
SearchCriteriaBuilder scb = getGeneratorTreeNodeDD().find();
scb.add(isNotNull(GeneratorTreeNodeFields.PRODUCT_TECHNOLOGY));
scb.add(isNotNull(GeneratorTreeNodeFields.ORIGINAL_TECHNOLOGY));
scb.createCriteria(GeneratorTreeNodeFields.GENERATOR_CONTEXT, "generatorContext_alias", JoinType.INNER).add(idEq(contextId.get()));
scb.add(neField(GeneratorTreeNodeFields.PRODUCT_TECHNOLOGY, GeneratorTreeNodeFields.ORIGINAL_TECHNOLOGY));
return scb;
}
use of com.qcadoo.model.api.search.SearchCriteriaBuilder in project mes by qcadoo.
the class TechnologyStructureTreeDataProvider method findExistingCustomizedNodes.
public Map<TechnologyId, Entity> findExistingCustomizedNodes(final ContextId contextId) {
if (Objects.isNull(contextId)) {
return ImmutableMap.of();
}
SearchCriteriaBuilder scb = prepareExistingNodeSearchCriteria(contextId);
List<Entity> existingNodes = scb.list().getEntities();
return ImmutableMap.copyOf(Maps.uniqueIndex(existingNodes, n -> new TechnologyId(n.getBelongsToField(GeneratorTreeNodeFields.ORIGINAL_TECHNOLOGY).getId())));
}
Aggregations