private void createResources(Entity savedDocument) { DocumentType documentType = DocumentType.of(savedDocument); if (DocumentType.RECEIPT.equals(documentType) || DocumentType.INTERNAL_INBOUND.equals(documentType)) { resourceManagementService.createResourcesForReceiptDocuments(savedDocument); } else if (DocumentType.INTERNAL_OUTBOUND.equals(documentType) || DocumentType.RELEASE.equals(documentType)) { resourceManagementService.updateResourcesForReleaseDocuments(savedDocument); } else if (DocumentType.TRANSFER.equals(documentType)) { resourceManagementService.moveResourcesForTransferDocument(savedDocument); } else { throw new IllegalStateException("Unsupported document type"); } }
public DocumentBuilder transfer(Entity locationTo, Entity locationFrom) { document.setField(DocumentFields.LOCATION_TO, locationTo); document.setField(DocumentFields.LOCATION_FROM, locationFrom); document.setField(DocumentFields.TYPE, DocumentType.TRANSFER.getStringValue()); return this; }