本文整理了Java中com.qcadoo.model.api.Entity.setNotValid()
方法的一些代码示例,展示了Entity.setNotValid()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Entity.setNotValid()
方法的具体详情如下:
包路径:com.qcadoo.model.api.Entity
类名称:Entity
方法名:setNotValid
暂无
代码示例来源:origin: qcadoo/mes
private void addPositionErrors(final Entity document, final Entity saved) {
if (!saved.isValid()) {
document.setNotValid();
saved.getGlobalErrors().forEach(e -> document.addGlobalError(e.getMessage(), e.getAutoClose(), e.getVars()));
if (!saved.getErrors().isEmpty()) {
document.addGlobalError("materialFlow.document.fillResources.global.error.positionNotValid", false, saved
.getBelongsToField(PositionFields.PRODUCT).getStringField(ProductFields.NUMBER));
}
}
}
代码示例来源:origin: qcadoo/mes
private Entity validateDailyProgressesFor(final Entity progressForDay, final Entity pps,
final boolean hasCorrections) {
Either<? extends List<Entity>, Void> validationResults = validateDailyProgressesFor(progressForDay);
if (validationResults.isLeft()) {
progressForDay.setField(ProgressForDayFields.DAILY_PROGRESS, validationResults.getLeft());
progressForDay.setNotValid();
return progressForDay;
} else {
progressForDay.setField(ProgressForDayFields.CORRECTED, hasCorrections);
progressForDay.setField(ProgressForDayFields.PRODUCTION_PER_SHIFT, pps.getId());
return progressForDay;
}
}
代码示例来源:origin: qcadoo/mes
@Override
@Transactional
public void createResourcesForReceiptDocuments(final Entity document) {
Entity warehouse = document.getBelongsToField(DocumentFields.LOCATION_TO);
Object date = document.getField(DocumentFields.TIME);
for (Entity position : document.getHasManyField(DocumentFields.POSITIONS)) {
createResource(document, warehouse, position, date);
position = position.getDataDefinition().save(position);
if (!position.isValid()) {
document.setNotValid();
position.getGlobalErrors().forEach(e -> document.addGlobalError(e.getMessage(), e.getAutoClose(), e.getVars()));
position.getErrors().values()
.forEach(e -> document.addGlobalError(e.getMessage(), e.getAutoClose(), e.getVars()));
}
}
}
代码示例来源:origin: qcadoo/mes
if (!p.isValid()) {
invalidPositions.add(p);
savedDocument.setNotValid();
p.getGlobalErrors()
.forEach(e -> savedDocument.addGlobalError(e.getMessage(), e.getAutoClose(), e.getVars()));
代码示例来源:origin: qcadoo/mes
@Transactional
public void createResourcesForDocuments(final ViewDefinitionState view, final GridComponent gridComponent,
final DataDefinition documentDD, List<Entity> documents) {
for (Entity document : documents) {
document.setField(DocumentFields.STATE, DocumentState.ACCEPTED.getStringValue());
document.setField(DocumentFields.ACCEPTATION_IN_PROGRESS, false);
document = documentDD.save(document);
if (!document.isValid()) {
continue;
}
if (!document.getHasManyField(DocumentFields.POSITIONS).isEmpty()) {
resourceManagementService.createResources(document);
} else {
document.setNotValid();
gridComponent.addMessage("materialFlow.document.validate.global.error.emptyPositions",
ComponentState.MessageType.FAILURE);
}
if (!document.isValid()) {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
documentErrorsLogger.saveResourceStockLackErrorsToSystemLogs(document);
document.getGlobalErrors().forEach(gridComponent::addMessage);
document.getErrors().values().forEach(gridComponent::addMessage);
} else {
if (receiptDocumentForReleaseHelper.buildConnectedPZDocument(document)) {
receiptDocumentForReleaseHelper.tryBuildPZ(document, view);
}
}
}
}
代码示例来源:origin: qcadoo/mes
public void onSave(DataDefinition subassemblyToWorkstationHelperDD, Entity subassemblyToWorkstationHelper) {
DataDefinition subassemblyDD = dataDefinitionService.get(BasicConstants.PLUGIN_IDENTIFIER, BasicConstants.MODEL_SUBASSEMBLY);
Entity subassembly = subassemblyToWorkstationHelper.getBelongsToField(SubassemblyToWorkstationHelperFields.SUBASSEMBLY);
if (subassembly != null) {
subassembly.setField(SubassemblyFields.WORKSTATION, subassemblyToWorkstationHelper.getField(SubassemblyToWorkstationHelperFields.WORKSTATION));
subassembly.setField(SubassemblyFields.TYPE, subassemblyToWorkstationHelper.getField(SubassemblyToWorkstationHelperFields.TYPE));
subassembly = subassemblyDD.save(subassembly);
if (!subassembly.isValid()) {
for (Map.Entry<String, ErrorMessage> entry : subassembly.getErrors().entrySet()) {
subassemblyToWorkstationHelper.addGlobalError(entry.getValue().getMessage(), entry.getValue().getAutoClose(), entry.getValue().getVars());
subassemblyToWorkstationHelper.addError(subassemblyToWorkstationHelperDD.getField(SubassemblyToWorkstationHelperFields.TYPE), entry.getValue().getMessage());
}
for (ErrorMessage msg : subassembly.getGlobalErrors()) {
subassemblyToWorkstationHelper.addGlobalError(msg.getMessage(), msg.getAutoClose(), msg.getVars());
subassemblyToWorkstationHelper.addError(subassemblyToWorkstationHelperDD.getField(SubassemblyToWorkstationHelperFields.TYPE), msg.getMessage());
}
subassemblyToWorkstationHelper.setNotValid();
}
}
}
代码示例来源:origin: qcadoo/mes
resourceManagementService.createResources(document);
} catch (InvalidResourceException ire) {
document.setNotValid();
document.setNotValid();
代码示例来源:origin: qcadoo/mes
@Transactional
private <M extends StateService> Entity performChangeState(List<M> services, Entity entity, Entity stateChangeEntity,
StateChangeEntityDescriber describer) {
LOG.info(String.format("Change state. Entity name : %S id : %d. Target state : %S", entity.getDataDefinition().getName(),
entity.getId(), stateChangeEntity.getStringField(describer.getTargetStateFieldName())));
if (!canChangeState(describer, entity, stateChangeEntity.getStringField(describer.getTargetStateFieldName()))) {
entity.setNotValid();
return entity;
}
entity = hookOnValidate(entity, services, stateChangeEntity.getStringField(describer.getSourceStateFieldName()),
stateChangeEntity.getStringField(describer.getTargetStateFieldName()), stateChangeEntity, describer);
if (!entity.isValid()) {
// copyErrorMessages(entity);
return entity;
}
entity = changeState(entity, stateChangeEntity.getStringField(describer.getTargetStateFieldName()));
entity = hookOnBeforeSave(entity, services, stateChangeEntity.getStringField(describer.getSourceStateFieldName()),
stateChangeEntity.getStringField(describer.getTargetStateFieldName()), stateChangeEntity, describer);
if (!entity.isValid()) {
throw new EntityRuntimeException(entity);
}
entity = entity.getDataDefinition().save(entity);
if (!hookOnAfterSave(entity, services, stateChangeEntity.getStringField(describer.getSourceStateFieldName()),
stateChangeEntity.getStringField(describer.getTargetStateFieldName()), stateChangeEntity, describer)) {
throw new EntityRuntimeException(entity);
}
return entity;
}
代码示例来源:origin: qcadoo/mes
if (palletsLimit != null && palletsInStorageLocation.compareTo(palletsLimit) > 0) {
resource.addGlobalError("materialFlow.error.correction.invalidStorageLocation");
resource.setNotValid();
return false;
内容来源于网络,如有侵权,请联系作者删除!