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 release(Entity locationFrom) { document.setField(DocumentFields.LOCATION_FROM, locationFrom); document.setField(DocumentFields.TYPE, DocumentType.RELEASE.getStringValue()); return this; }