本文整理了Java中com.qcadoo.model.api.Entity.getDataDefinition()
方法的一些代码示例,展示了Entity.getDataDefinition()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Entity.getDataDefinition()
方法的具体详情如下:
包路径:com.qcadoo.model.api.Entity
类名称:Entity
方法名:getDataDefinition
暂无
代码示例来源:origin: qcadoo/mes
public void saveRegistryEntries(List<Entity> entries) {
for (Entity entry : entries) {
entry.getDataDefinition().save(entry);
}
}
代码示例来源:origin: qcadoo/mes
@Override
public String apply(final Entity from) {
return from.getDataDefinition().getName();
}
};
代码示例来源:origin: qcadoo/mes
private boolean areEntitiesEqual(final Entity firstEntity, final Entity secondEntity) {
return firstEntity.getDataDefinition().getName().equals(secondEntity.getDataDefinition().getName())
&& firstEntity.getDataDefinition().getPluginIdentifier()
.equals(secondEntity.getDataDefinition().getPluginIdentifier())
&& firstEntity.getId().equals(secondEntity.getId());
}
}
代码示例来源:origin: qcadoo/mes
private Optional<Entity> saveCoverage(Entity mcfo) {
mcfo = mcfo.getDataDefinition().save(mcfo);
if (!mcfo.isValid()) {
mcfo = null;
}
return Optional.fromNullable(mcfo);
}
代码示例来源:origin: qcadoo/mes
private Entity saveAndValidate(final Entity entity) {
if (entity == null) {
return null;
}
Entity saved = entity.getDataDefinition().save(entity);
if (!saved.isValid()) {
throw new RuntimeException(String.format("Error on save state entity: %s", saved.getErrors()));
}
return saved;
}
代码示例来源:origin: qcadoo/mes
private void reduceReservationFor(Entity reservation, BigDecimal forQuantity) {
BigDecimal newReservationQuantity = reservation.getDecimalField(ReservationFields.QUANTITY).subtract(forQuantity);
if (newReservationQuantity.compareTo(BigDecimal.ZERO) > 0) {
reservation.setField(ReservationFields.QUANTITY, newReservationQuantity);
reservation.getDataDefinition().save(reservation);
} else {
reservation.setField(ReservationFields.QUANTITY, BigDecimal.ZERO);
reservation.getDataDefinition().save(reservation);
}
}
代码示例来源:origin: qcadoo/mes
public void tryToDispose(Entity palletNumber) {
if (palletNumber != null) {
DataDefinition palletNumberDataDefinition = palletNumber.getDataDefinition();
Assert.isTrue(palletNumberDataDefinition.getPluginIdentifier().equals(BasicConstants.PLUGIN_IDENTIFIER));
Assert.isTrue(palletNumberDataDefinition.getName().equals(BasicConstants.MODEL_PALLET_NUMBER));
if (canDisposePalletNumber(palletNumber)) {
palletNumber.setField(PalletNumberFields.ISSUE_DATE_TIME, new Date());
palletNumberDataDefinition.save(palletNumber);
}
}
}
代码示例来源:origin: qcadoo/mes
@Transactional
public void regenerateForOrder(Entity order) {
registerService.removeEntriesForOrder(order, true);
registerEvents.createRegistryEntriesForOrder(order, false);
order.getDataDefinition().save(order);
}
代码示例来源:origin: qcadoo/mes
private Integer getWorkstationsQuantityFromMap(final Map<Long, Integer> workstations, final Entity operationComponent) {
Entity operComp = operationComponent;
String entityType = operationComponent.getDataDefinition().getName();
if (!TechnologiesConstants.MODEL_TECHNOLOGY_OPERATION_COMPONENT.equals(entityType)) {
operComp = operComp.getBelongsToField(L_TECHNOLOGY_OPERATION_COMPONENT).getDataDefinition()
.get(operComp.getBelongsToField(L_TECHNOLOGY_OPERATION_COMPONENT).getId());
}
return workstations.get(operComp.getId());
}
代码示例来源:origin: qcadoo/mes
private BigDecimal getOperationRunsFromMap(final Map<Long, BigDecimal> operationRuns, final Entity operationComponent) {
Entity operComp = operationComponent;
String entityType = operationComponent.getDataDefinition().getName();
if (!TechnologiesConstants.MODEL_TECHNOLOGY_OPERATION_COMPONENT.equals(entityType)) {
operComp = operComp.getBelongsToField(L_TECHNOLOGY_OPERATION_COMPONENT).getDataDefinition()
.get(operComp.getBelongsToField(L_TECHNOLOGY_OPERATION_COMPONENT).getId());
}
return BigDecimalUtils.convertNullToZero(operationRuns.get(operComp.getId()));
}
代码示例来源:origin: qcadoo/mes
public boolean hasUnitChangedOnUpdate(final Entity product) {
final Entity existingProduct = product.getDataDefinition().get(product.getId());
final String existingProductUnit = existingProduct.getStringField(ProductFields.UNIT);
final String currentUnit = product.getStringField(ProductFields.UNIT);
if (existingProductUnit == null) {
return currentUnit != null;
} else {
return !existingProductUnit.equals(currentUnit);
}
}
代码示例来源:origin: qcadoo/mes
private void changeVisibility(ViewDefinitionState view, boolean visibility) {
GridComponent grid = (GridComponent) view.getComponentByReference("grid");
for (Entity entity : grid.getEntities()) {
entity.setField("checked", visibility);
entity.getDataDefinition().save(entity);
}
}
代码示例来源:origin: qcadoo/mes
private void changeToInExecution(final Entity order) {
Entity masterOrder = order.getBelongsToField(OrderFieldsMO.MASTER_ORDER);
if(Objects.isNull(masterOrder)) {
return;
}
String masterOrderStatus = masterOrder.getStringField(MasterOrderFields.STATE);
if (MasterOrderState.NEW.getStringValue().equals(masterOrderStatus)) {
masterOrder.setField(MasterOrderFields.STATE, MasterOrderState.IN_EXECUTION.getStringValue());
masterOrder = masterOrder.getDataDefinition().save(masterOrder);
order.setField(OrderFieldsMO.MASTER_ORDER, masterOrder);
}
}
代码示例来源:origin: qcadoo/mes
private Entity createCalculationOperationComponent(final EntityTreeNode sourceTreeNode, final Entity parent,
final DataDefinition calculationOperationComponentDD, final Entity parentEntity) {
Entity calculationOperationComponent = calculationOperationComponentDD.create();
calculationOperationComponent.setField("parent", parent);
calculationOperationComponent.setField(parentEntity.getDataDefinition().getName(), parentEntity);
createOrCopyCalculationOperationComponent(sourceTreeNode, calculationOperationComponent, parentEntity);
return calculationOperationComponent;
}
代码示例来源:origin: qcadoo/mes
private boolean mustRebuildSetTrackingOperationProductsComponents(Entity productionTracking) {
if (productionTracking.getId() == null) {
return true;
}
Long previousOrderId = productionTracking.getDataDefinition().get(productionTracking.getId())
.getBelongsToField(ProductionTrackingFields.ORDER).getId();
return !previousOrderId.equals(productionTracking.getBelongsToField(ProductionTrackingFields.ORDER).getId());
}
}
代码示例来源:origin: qcadoo/mes
private boolean checkReasonNeeded(final Entity order, final String dateFieldName, final String reasonTypeFieldName,
final String messageTranslationKey) {
if (order.getField(dateFieldName) != null && order.getHasManyField(reasonTypeFieldName).isEmpty()) {
order.addError(order.getDataDefinition().getField(reasonTypeFieldName), messageTranslationKey);
return false;
}
return true;
}
代码示例来源:origin: qcadoo/mes
private void addColumnForRequests(final Map<String, String> columnAttributes) {
Entity column = columnExtensionService.addColumn(SupplyNegotiationsConstants.PLUGIN_IDENTIFIER,
SupplyNegotiationsConstants.MODEL_COLUMN_FOR_REQUESTS, columnAttributes);
Entity parameter = parameterService.getParameter();
column.setField("parameter", parameter);
column.getDataDefinition().save(column);
addParameterColumnForRequests(column);
}
代码示例来源:origin: qcadoo/mes
private Entity copyTechnology(final Entity technologyPrototype, final Entity order) {
String number = technologyServiceO.generateNumberForTechnologyInOrder(order, technologyPrototype);
Entity copyOfTechnology = technologyServiceO.getTechnologyDD().copy(technologyPrototype.getId()).get(0);
copyOfTechnology.setField(TechnologyFields.NUMBER, number);
copyOfTechnology.setField(TechnologyFields.TECHNOLOGY_PROTOTYPE, technologyPrototype);
copyOfTechnology.setField(TechnologyFields.TECHNOLOGY_TYPE, getTechnologyType(order));
copyOfTechnology = copyOfTechnology.getDataDefinition().save(copyOfTechnology);
return copyOfTechnology;
}
代码示例来源:origin: qcadoo/mes
public void completeWithoutIssue(final ViewDefinitionState view, final ComponentState state, final String[] args) {
FormComponent form = (FormComponent) view.getComponentByReference(L_FORM);
Entity anomaly = form.getEntity();
if (anomaly.getId() == null) {
return;
}
anomaly.setField(AnomalyFields.STATE, AnomalyFields.State.COMPLETED);
anomaly.setField(AnomalyFields.ISSUED, false);
anomaly.getDataDefinition().save(anomaly);
state.performEvent(view, "reset", new String[0]);
}
}
代码示例来源:origin: qcadoo/mes
private void fillForComponentsOne(final Entity technology) {
List<Entity> opics = operationComponentDataProvider.getOperationProductsForTechnology(technology.getId());
Entity componentsLocation = technology.getBelongsToField(OperationProductOutComponentFieldsPFTD.COMPONENTS_LOCATION);
Entity componentsOutputLocation = technology.getBelongsToField(TechnologyFieldsPFTD.COMPONENTS_OUTPUT_LOCATION);
for (Entity op : opics) {
cleanOperationProduct(op);
op.setField(OperationProductInComponentFieldsPFTD.COMPONENTS_LOCATION, componentsLocation);
op.setField(OperationProductInComponentFieldsPFTD.COMPONENTS_OUTPUT_LOCATION, componentsOutputLocation);
op.getDataDefinition().fastSave(op);
}
}
内容来源于网络,如有侵权,请联系作者删除!