本文整理了Java中com.qcadoo.model.api.Entity.getBelongsToField()
方法的一些代码示例,展示了Entity.getBelongsToField()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Entity.getBelongsToField()
方法的具体详情如下:
包路径:com.qcadoo.model.api.Entity
类名称:Entity
方法名:getBelongsToField
暂无
代码示例来源:origin: qcadoo/mes
private boolean deliveryHasLocationSet(Entity deliveredProductMulti) {
Entity delivery = deliveredProductMulti.getBelongsToField(DeliveredProductMultiFields.DELIVERY);
Entity location = delivery.getBelongsToField(DeliveryFields.LOCATION);
if (location == null) {
deliveredProductMulti.addGlobalError("deliveries.deliveredProductMultiPosition.error.locationRequired");
return false;
}
return true;
}
代码示例来源:origin: qcadoo/mes
public void updateRequestForQuotationProductCatalogNumber(final DataDefinition requestForQuotationProductDD,
final Entity requestForQuotationProduct) {
Entity requestForQuotation = requestForQuotationProduct.getBelongsToField(REQUEST_FOR_QUOTATION);
Entity supplier = requestForQuotation.getBelongsToField(SUPPLIER);
Entity product = requestForQuotationProduct.getBelongsToField(PRODUCT);
Entity productCatalogNumber = productCatalogNumbersService.getProductCatalogNumber(product, supplier);
if (productCatalogNumber != null) {
requestForQuotationProduct.setField(PRODUCT_CATALOG_NUMBER, productCatalogNumber);
}
}
代码示例来源:origin: qcadoo/mes
private boolean hasSupplierChanged(final Long deliveryId, final Entity supplier) {
Entity existingDelivery = deliveriesService.getDelivery(deliveryId);
Entity existingSupplier = existingDelivery.getBelongsToField(SUPPLIER);
return !existingSupplier.equals(supplier);
}
代码示例来源:origin: qcadoo/mes
private Multimap<Long, Entity> groupMachinePartsByLocation(final List<Entity> machinePartsForEvent) {
Multimap<Long, Entity> groupedMachineParts = ArrayListMultimap.create();
machinePartsForEvent.stream().forEach(
part -> groupedMachineParts.put(part.getBelongsToField(MachinePartForEventFields.WAREHOUSE).getId(), part));
return groupedMachineParts;
}
代码示例来源:origin: qcadoo/mes
private boolean locationUniqueToDelivery(Entity orderedProductReservation) {
Entity orderedProduct = orderedProductReservation.getBelongsToField(OrderedProductReservationFields.ORDERED_PRODUCT);
Entity delivery = orderedProduct.getBelongsToField(OrderedProductFields.DELIVERY);
Entity deliveryLocation = delivery.getBelongsToField(DeliveryFields.LOCATION);
Entity reservationLocation = orderedProductReservation.getBelongsToField(OrderedProductReservationFields.LOCATION);
boolean locationOtherThenDelivery = deliveryLocation == null || !deliveryLocation.getId().equals(reservationLocation.getId());
if (!locationOtherThenDelivery) {
FieldDefinition locationField = orderedProductReservation.getDataDefinition().getField(OrderedProductReservationFields.LOCATION);
orderedProductReservation.addError(locationField, "deliveries.deliveredProductReservation.error.locationNotUniqueToDelivery");
}
return locationOtherThenDelivery;
}
代码示例来源:origin: qcadoo/mes
public boolean validatePalletForResource(Entity resource) {
Entity palletNumberEntity = resource.getBelongsToField(ResourceFields.PALLET_NUMBER);
Entity storageLocationEntity = resource.getBelongsToField(ResourceFields.STORAGE_LOCATION);
String palletType = resource.getStringField(ResourceFields.TYPE_OF_PALLET);
String palletNumber = palletNumberEntity != null ? palletNumberEntity.getStringField(PalletNumberFields.NUMBER) : null;
String storageLocation = storageLocationEntity != null ? storageLocationEntity
.getStringField(StorageLocationFields.NUMBER) : null;
Entity location = resource.getBelongsToField(ResourceFields.LOCATION);
return validatePallet(palletNumber, palletType, storageLocation, resource, location);
}
代码示例来源:origin: qcadoo/mes
private void fillBasicProductionCounting(final Entity productionCountingQuantity) {
if (productionCountingQuantity.getBelongsToField(ProductionCountingQuantityFields.BASIC_PRODUCTION_COUNTING) == null) {
Entity order = productionCountingQuantity.getBelongsToField(ProductionCountingQuantityFields.ORDER);
Entity product = productionCountingQuantity.getBelongsToField(ProductionCountingQuantityFields.PRODUCT);
String typeOfMaterial = productionCountingQuantity.getStringField(ProductionCountingQuantityFields.TYPE_OF_MATERIAL);
String role = productionCountingQuantity.getStringField(ProductionCountingQuantityFields.ROLE);
if (checkIfShouldFillBasicProductionCounting(order, product, typeOfMaterial, role)) {
productionCountingQuantity.setField(ProductionCountingQuantityFields.BASIC_PRODUCTION_COUNTING,
fillBasicProductionCounting(order, product));
}
}
}
代码示例来源:origin: qcadoo/mes
private static Entity getBatchFrom(final Entity entity, final String batchFieldName) {
if (entity == null) {
return null;
}
checkField(entity.getDataDefinition(), batchFieldName);
return entity.getBelongsToField(batchFieldName);
}
代码示例来源:origin: qcadoo/mes
private void toggleEnabledForSubassembly(final ViewDefinitionState view, final Entity event) {
boolean enabled = event.getBelongsToField(MaintenanceEventFields.WORKSTATION) != null;
LookupComponent subassemblyLookup = (LookupComponent) view.getComponentByReference(MaintenanceEventFields.SUBASSEMBLY);
subassemblyLookup.setEnabled(enabled);
}
代码示例来源:origin: qcadoo/mes
private boolean offerTheSame(final Entity offer, final Entity deliveredProduct) {
if (!PluginUtils.isEnabled("supplyNegotiations")) {
return true;
}
Entity deliveredProductOffer = deliveredProduct.getBelongsToField("offer");
return isOfferTheSame(offer, deliveredProductOffer);
}
代码示例来源:origin: qcadoo/mes
public void fillCurrencyFields(final ViewDefinitionState view) {
List<String> referenceNames = Lists.newArrayList("totalPriceCurrency", "pricePerUnitCurrency");
FormComponent form = (FormComponent) view.getComponentByReference(L_FORM);
Entity deliveredProduct = form.getEntity();
Entity delivery = deliveredProduct.getBelongsToField(DeliveredProductFields.DELIVERY);
deliveriesService.fillCurrencyFieldsForDelivery(view, referenceNames, delivery);
}
代码示例来源:origin: qcadoo/mes
public void fillCurrencyFields(final ViewDefinitionState view) {
List<String> referenceNames = Lists.newArrayList("totalPriceCurrency", "pricePerUnitCurrency");
FormComponent orderedProductForm = (FormComponent) view.getComponentByReference(L_FORM);
Entity orderedProduct = orderedProductForm.getEntity();
Entity delivery = orderedProduct.getBelongsToField(OrderedProductFields.DELIVERY);
deliveriesService.fillCurrencyFieldsForDelivery(view, referenceNames, delivery);
}
代码示例来源:origin: qcadoo/mes
public void restrictToUserLocations(final SearchCriteriaBuilder scb, final FilterValueHolder filterValue) {
Long currentUserId = securityService.getCurrentUserId();
if (Objects.nonNull(currentUserId)) {
EntityList userLocations = userDataDefinition().get(currentUserId).getHasManyField(UserFieldsMF.USER_LOCATIONS);
if (!userLocations.isEmpty()) {
Set<Long> locationIds = userLocations.stream().map(ul -> ul.getBelongsToField(UserLocationFields.LOCATION))
.map(Entity::getId).collect(Collectors.toSet());
scb.add(SearchRestrictions.in("location.id", locationIds));
}
}
}
代码示例来源:origin: qcadoo/mes
public boolean checkIfParentIsFamily(final DataDefinition productDD, final Entity product) {
Entity parent = product.getBelongsToField(ProductFields.PARENT);
if (parent == null) {
return true;
}
if (ProductFamilyElementType.PRODUCTS_FAMILY.getStringValue().equals(parent.getStringField(ProductFields.ENTITY_TYPE))) {
return true;
} else {
product.addError(productDD.getField(PARENT), "basic.product.parent.parentIsNotFamily");
return false;
}
}
代码示例来源:origin: qcadoo/mes
private void restrictToUserLocations(SearchCriteriaBuilder scb) {
Long currentUserId = securityService.getCurrentUserId();
if (Objects.nonNull(currentUserId)) {
EntityList userLocations = userDataDefinition().get(currentUserId).getHasManyField(UserFieldsMF.USER_LOCATIONS);
if (!userLocations.isEmpty()) {
Set<Integer> locationIds = userLocations.stream().map(ul -> ul.getBelongsToField(UserLocationFields.LOCATION))
.mapToInt(e -> e.getId().intValue()).boxed().collect(Collectors.toSet());
scb.add(SearchRestrictions.or(SearchRestrictions.in(LOCATION_TO_ID, locationIds),
SearchRestrictions.in(LOCATION_FROM_ID, locationIds)));
}
}
}
代码示例来源:origin: qcadoo/mes
private void changeToNew(final Entity order) {
Entity masterOrder = order.getBelongsToField(OrderFieldsMO.MASTER_ORDER);
if(Objects.isNull(masterOrder)) {
return;
}
String masterOrderStatus = masterOrder.getStringField(MasterOrderFields.STATE);
if (MasterOrderState.IN_EXECUTION.getStringValue().equals(masterOrderStatus)
&& masterOrder.getHasManyField(MasterOrderFields.ORDERS).size() == 1) {
masterOrder.setField(MasterOrderFields.STATE, MasterOrderState.NEW.getStringValue());
masterOrder.getDataDefinition().save(masterOrder);
}
}
代码示例来源:origin: qcadoo/mes
private void generateNumber(final ViewDefinitionState view) {
FormComponent addressForm = (FormComponent) view.getComponentByReference(L_FORM);
FieldComponent numberField = (FieldComponent) view.getComponentByReference(AddressFields.NUMBER);
Entity address = addressForm.getPersistedEntityWithIncludedFormValues();
String number = address.getStringField(AddressFields.NUMBER);
if ((address.getId() == null) && StringUtils.isEmpty(number)) {
Entity company = address.getBelongsToField(AddressFields.COMPANY);
numberField.setFieldValue(basicService.generateAddressNumber(company));
numberField.requestComponentUpdateState();
}
}
代码示例来源:origin: qcadoo/mes
private void disableFields(final ViewDefinitionState view) {
FormComponent form = (FormComponent) view.getComponentByReference(L_FORM);
Entity masterOrder = form.getEntity();
Entity company = masterOrder.getBelongsToField(MasterOrderFields.COMPANY);
LookupComponent addressLookup = (LookupComponent) view.getComponentByReference(MasterOrderFields.ADDRESS);
if (company == null) {
addressLookup.setFieldValue(null);
addressLookup.setEnabled(false);
} else {
addressLookup.setEnabled(true);
}
}
代码示例来源:origin: qcadoo/mes
public void fillFilterValues(final ViewDefinitionState view) {
FormComponent form = (FormComponent) view.getComponentByReference("form");
Entity productSubstitute = form.getPersistedEntityWithIncludedFormValues();
Entity product = productSubstitute.getBelongsToField(SubstituteFields.BASE_PRODUCT);
if (product != null) {
LookupComponent productLookup = (LookupComponent) view.getComponentByReference(SubstituteFields.PRODUCT);
FilterValueHolder filter = productLookup.getFilterValue();
filter.put(SubstituteFields.PRODUCT, product.getId());
productLookup.setFilterValue(filter);
}
}
}
代码示例来源:origin: qcadoo/mes
private Entity createAverageWithDataFromOrder(final Entity order, final DataDefinition avgLaborCostCalcForOrderDD) {
Entity avgLaborCostCalcForOrder = avgLaborCostCalcForOrderDD.create();
avgLaborCostCalcForOrder.setField(ORDER, order);
avgLaborCostCalcForOrder.setField(START_DATE, order.getField(OrderFields.START_DATE));
avgLaborCostCalcForOrder.setField(FINISH_DATE, order.getField(OrderFields.FINISH_DATE));
avgLaborCostCalcForOrder.setField(PRODUCTION_LINE, order.getBelongsToField(OrderFields.PRODUCTION_LINE));
avgLaborCostCalcForOrder.setField(BASED_ON, "01assignment");
return avgLaborCostCalcForOrder.getDataDefinition().save(avgLaborCostCalcForOrder);
}
内容来源于网络,如有侵权,请联系作者删除!