mirror of
https://github.com/nsacyber/HIRS.git
synced 2024-12-21 05:53:27 +00:00
Additional changes to handle subclasses
This commit is contained in:
parent
d80af7bc9e
commit
4e70141df0
@ -12,4 +12,6 @@ import java.util.UUID;
|
||||
@Repository
|
||||
public interface PolicyRepository<T extends Policy> extends JpaRepository<T, UUID> {
|
||||
T save(T policy);
|
||||
|
||||
T updatePolicy(T policy, UUID uuid);
|
||||
}
|
||||
|
@ -16,4 +16,10 @@ public interface ReferenceDigestValueRepository extends JpaRepository<ReferenceD
|
||||
List<ReferenceDigestValue> findValuesByBaseRimId(UUID uuid);
|
||||
|
||||
List<ReferenceDigestValue> findValuesBySupportRimId(UUID uuid);
|
||||
|
||||
/**
|
||||
* List<String> results = session.createCriteria(User.class).add(Projections.projectionList().add(Projections.property("id")).add()....).list();
|
||||
*
|
||||
* List<Object[]> result = session.createCriteria(User.class).setProjection(Projections.projectionList().add(Projections.groupProperty("lastName")).add(Projections.rowCount())).list();
|
||||
*/
|
||||
}
|
||||
|
@ -10,5 +10,7 @@ import java.util.UUID;
|
||||
* Setting up for new creation for CRUD operations.
|
||||
*/
|
||||
@Repository
|
||||
public interface ReferenceManifestRepository extends JpaRepository<ReferenceManifest, UUID> {
|
||||
public interface ReferenceManifestRepository<T extends ReferenceManifest>
|
||||
extends JpaRepository<ReferenceManifest, UUID> {
|
||||
T saveRIM(T rim);
|
||||
}
|
||||
|
@ -113,7 +113,7 @@ public class PolicyServiceImpl extends DbServiceImpl<Policy> 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
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ public class ReferenceManifestServiceImpl extends DbServiceImpl<ReferenceManifes
|
||||
@Override
|
||||
public ReferenceManifest doWithRetry(final RetryContext context)
|
||||
throws DBManagerException {
|
||||
return referenceManifestRepository.save(rim);
|
||||
return referenceManifestRepository.saveRIM(rim);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -6,7 +6,6 @@ import hirs.attestationca.portal.model.PolicyPageModel;
|
||||
import hirs.attestationca.portal.page.PageController;
|
||||
import hirs.attestationca.portal.page.PageMessages;
|
||||
import hirs.attestationca.portal.page.params.NoPageParams;
|
||||
import hirs.data.persist.policy.Policy;
|
||||
import hirs.data.persist.policy.SupplyChainPolicy;
|
||||
import hirs.persist.PolicyManagerException;
|
||||
import hirs.persist.service.AppraiserService;
|
||||
@ -963,7 +962,7 @@ public class PolicyPageController extends PageController<NoPageParams> {
|
||||
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);
|
||||
|
@ -219,7 +219,7 @@ public abstract class ReferenceManifestSelector<T extends ReferenceManifest> {
|
||||
|
||||
// construct and execute query
|
||||
private Set<T> execute() {
|
||||
Set<T> results = this.referenceManifestService.get(this);
|
||||
Set<T> results = this.referenceManifestService.get;
|
||||
return results;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user