コード例 #1
0
 private MaterialRevision filterUnsaved(MaterialRevision materialRevision) {
   ArrayList<Modification> unsavedModifications = new ArrayList<>();
   for (Modification modification : materialRevision.getModifications()) {
     if (!modification.hasId()) {
       unsavedModifications.add(modification);
     }
   }
   return new MaterialRevision(materialRevision.getMaterial(), unsavedModifications);
 }
コード例 #2
0
 public MaterialRevision addRevisionsWithModifications(
     Material material, Modification... modifications) {
   final MaterialRevision revision = filterUnsaved(new MaterialRevision(material, modifications));
   if (revision.getModifications().isEmpty()) {
     return revision;
   }
   transactionTemplate.execute(
       new TransactionCallbackWithoutResult() {
         @Override
         protected void doInTransactionWithoutResult(TransactionStatus status) {
           materialRepository.saveMaterialRevision(revision);
         }
       });
   return revision;
 }