diff --git a/HIRS_AttestationCA/src/main/java/hirs/attestationca/repository/PolicyRepository.java b/HIRS_AttestationCA/src/main/java/hirs/attestationca/repository/PolicyRepository.java index 20d0df66..f9e27837 100644 --- a/HIRS_AttestationCA/src/main/java/hirs/attestationca/repository/PolicyRepository.java +++ b/HIRS_AttestationCA/src/main/java/hirs/attestationca/repository/PolicyRepository.java @@ -12,4 +12,6 @@ import java.util.UUID; @Repository public interface PolicyRepository extends JpaRepository { T save(T policy); + + T updatePolicy(T policy, UUID uuid); } diff --git a/HIRS_AttestationCA/src/main/java/hirs/attestationca/repository/ReferenceDigestValueRepository.java b/HIRS_AttestationCA/src/main/java/hirs/attestationca/repository/ReferenceDigestValueRepository.java index b98b5a47..370df59e 100644 --- a/HIRS_AttestationCA/src/main/java/hirs/attestationca/repository/ReferenceDigestValueRepository.java +++ b/HIRS_AttestationCA/src/main/java/hirs/attestationca/repository/ReferenceDigestValueRepository.java @@ -16,4 +16,10 @@ public interface ReferenceDigestValueRepository extends JpaRepository findValuesByBaseRimId(UUID uuid); List findValuesBySupportRimId(UUID uuid); + + /** + * List results = session.createCriteria(User.class).add(Projections.projectionList().add(Projections.property("id")).add()....).list(); + * + * List result = session.createCriteria(User.class).setProjection(Projections.projectionList().add(Projections.groupProperty("lastName")).add(Projections.rowCount())).list(); + */ } diff --git a/HIRS_AttestationCA/src/main/java/hirs/attestationca/repository/ReferenceManifestRepository.java b/HIRS_AttestationCA/src/main/java/hirs/attestationca/repository/ReferenceManifestRepository.java index ae926020..b912a549 100644 --- a/HIRS_AttestationCA/src/main/java/hirs/attestationca/repository/ReferenceManifestRepository.java +++ b/HIRS_AttestationCA/src/main/java/hirs/attestationca/repository/ReferenceManifestRepository.java @@ -10,5 +10,7 @@ import java.util.UUID; * Setting up for new creation for CRUD operations. */ @Repository -public interface ReferenceManifestRepository extends JpaRepository { +public interface ReferenceManifestRepository + extends JpaRepository { + T saveRIM(T rim); } diff --git a/HIRS_AttestationCA/src/main/java/hirs/attestationca/service/PolicyServiceImpl.java b/HIRS_AttestationCA/src/main/java/hirs/attestationca/service/PolicyServiceImpl.java index a575c98f..7b5d19b5 100644 --- a/HIRS_AttestationCA/src/main/java/hirs/attestationca/service/PolicyServiceImpl.java +++ b/HIRS_AttestationCA/src/main/java/hirs/attestationca/service/PolicyServiceImpl.java @@ -113,7 +113,7 @@ public class PolicyServiceImpl extends DbServiceImpl implements DefaultS dbPolicy = policy; } else { // will not return null, throws and exception - dbPolicy = policyRepository.getReferenceById(uuid); + dbPolicy = (Policy) policyRepository.getReferenceById(uuid); // run through things that aren't equal and update } diff --git a/HIRS_AttestationCA/src/main/java/hirs/attestationca/service/ReferenceManifestServiceImpl.java b/HIRS_AttestationCA/src/main/java/hirs/attestationca/service/ReferenceManifestServiceImpl.java index 0b244510..e61003ca 100644 --- a/HIRS_AttestationCA/src/main/java/hirs/attestationca/service/ReferenceManifestServiceImpl.java +++ b/HIRS_AttestationCA/src/main/java/hirs/attestationca/service/ReferenceManifestServiceImpl.java @@ -50,7 +50,7 @@ public class ReferenceManifestServiceImpl extends DbServiceImpl { final PageMessages messages, final String successMessage, final SupplyChainPolicy policy) { // save the policy to the DB - policyService.updatePolicy(policy); + policyService.updatePolicy(policy, policy.getId()); // Log and set the success message messages.addSuccess(successMessage); diff --git a/HIRS_Utils/src/main/java/hirs/persist/ReferenceManifestSelector.java b/HIRS_Utils/src/main/java/hirs/persist/ReferenceManifestSelector.java index 5397b184..a26d7a5e 100644 --- a/HIRS_Utils/src/main/java/hirs/persist/ReferenceManifestSelector.java +++ b/HIRS_Utils/src/main/java/hirs/persist/ReferenceManifestSelector.java @@ -219,7 +219,7 @@ public abstract class ReferenceManifestSelector { // construct and execute query private Set execute() { - Set results = this.referenceManifestService.get(this); + Set results = this.referenceManifestService.get; return results; }