minor changes

This commit is contained in:
Cyrus 2022-07-06 08:37:46 -04:00
parent 2971459f32
commit 1df40473bd
4 changed files with 16 additions and 134 deletions

View File

@ -1,7 +1,7 @@
package hirs.attestationca.portal.page;
import hirs.attestationca.portal.datatables.DataTableView;
import hirs.attestationca.portal.persistence.PersistenceConfiguration;
import hirs.persist.PersistenceConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

View File

@ -1,118 +0,0 @@
package hirs.attestationca.portal.persistence;
import hirs.data.persist.SupplyChainValidationSummary;
import hirs.persist.AppraiserManager;
import hirs.persist.CrudManager;
import hirs.persist.DBAppraiserManager;
import hirs.persist.DBCertificateManager;
import hirs.persist.DBDeviceGroupManager;
import hirs.persist.DBDeviceManager;
import hirs.persist.DBManager;
import hirs.persist.DBPolicyManager;
import hirs.persist.DBReferenceEventManager;
import hirs.persist.DBReferenceManifestManager;
import hirs.persist.DeviceGroupManager;
import hirs.persist.DeviceManager;
import hirs.persist.HibernateConfiguration;
import hirs.persist.PolicyManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.orm.hibernate5.LocalSessionFactoryBean;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.EnableTransactionManagement;
/**
* Spring configuration class for persistence beans used by the Attestation CA Portal.
*/
@Repository
@Configuration
@EnableTransactionManagement
@Import({ HibernateConfiguration.class })
public class PersistenceConfiguration {
@Autowired
private LocalSessionFactoryBean sessionFactory;
/**
* Creates a {@link PolicyManager} ready to use.
*
* @return {@link PolicyManager}
*/
@Bean
public PolicyManager policyManager() {
return new DBPolicyManager(sessionFactory.getObject());
}
/**
* Creates a {@link DeviceManager} ready to use.
*
* @return {@link DeviceManager}
*/
@Bean
public DeviceManager deviceManager() {
return new DBDeviceManager(sessionFactory.getObject());
}
/**
* Creates a {@link DBCertificateManager} ready to use.
*
* @return {@link DBCertificateManager}
*/
@Bean
public DBCertificateManager certificateManager() {
return new DBCertificateManager(sessionFactory.getObject());
}
/**
* Creates a {@link DBReferenceManifestManager} ready to use.
*
* @return {@link DBReferenceManifestManager}
*/
@Bean
public DBReferenceManifestManager referenceManifestManager() {
return new DBReferenceManifestManager(sessionFactory.getObject());
}
/**
* Creates a {@link DBReferenceEventManager} ready to use.
*
* @return {@link DBReferenceEventManager}
*/
@Bean
public DBReferenceEventManager referenceEventManager() {
return new DBReferenceEventManager(sessionFactory.getObject());
}
/**
* Creates a {@link AppraiserManager} ready to use.
*
* @return {@link AppraiserManager}
*/
@Bean
public AppraiserManager appraiserManager() {
return new DBAppraiserManager(sessionFactory.getObject());
}
/**
* Creates a {@link DeviceGroupManager} ready to use.
*
* @return {@link DeviceGroupManager}
*/
@Bean
public DeviceGroupManager deviceGroupManager() {
return new DBDeviceGroupManager(sessionFactory.getObject());
}
/**
* Creates a {@link DBManager} for SupplyChainValidationSummary persistence, ready for use.
*
* @return {@link DBManager}
*/
@Bean
public CrudManager<SupplyChainValidationSummary> supplyChainValidationSummaryManager() {
return new DBManager<>(SupplyChainValidationSummary.class, sessionFactory.getObject());
}
}

View File

@ -47,9 +47,9 @@ public abstract class RepoPackage {
@Column
private String architecture;
@ManyToOne
@JoinColumn(name = "sourceRepository")
private Repository<?> sourceRepository;
// @ManyToOne
// @JoinColumn(name = "sourceRepository")
// private Repository<?> sourceRepository;
@Column
private boolean measured = false;
@ -105,7 +105,7 @@ public abstract class RepoPackage {
this.version = version;
this.release = release;
this.architecture = architecture;
this.sourceRepository = sourceRepository;
// this.sourceRepository = sourceRepository;
this.id = UUID.randomUUID();
}
@ -157,9 +157,9 @@ public abstract class RepoPackage {
*
* @return this package's source repository
*/
public final Repository<?> getSourceRepository() {
return sourceRepository;
}
// public final Repository<?> getSourceRepository() {
// return sourceRepository;
// }
/**
* Sets the measurements of the package. Must be only called on a package that has not yet
@ -270,9 +270,9 @@ public abstract class RepoPackage {
return false;
}
if (!sourceRepository.equals(that.sourceRepository)) {
return false;
}
// if (!sourceRepository.equals(that.sourceRepository)) {
// return false;
// }
return true;
}
@ -284,14 +284,13 @@ public abstract class RepoPackage {
result = prime * result + version.hashCode();
result = prime * result + release.hashCode();
result = prime * result + architecture.hashCode();
result = prime * result + sourceRepository.hashCode();
return result;
}
@Override
public final String toString() {
return String.format(
"RepoPackage{name=%s, version=%s, release=%s, architecture=%s, sourceRepository=%s",
name, version, release, architecture, sourceRepository);
"RepoPackage{name=%s, version=%s, release=%s, architecture=%s",
name, version, release, architecture);
}
}

View File

@ -106,9 +106,10 @@ subprojects {
findbugs: 'com.google.code.findbugs:findbugs:3.0.0',
gson: 'com.google.code.gson:gson:2.9.0',
guava: 'com.google.guava:guava:31.1-jre',
hibernate: [ 'org.hibernate.common:hibernate-commons-annotations:5.1.1.Final',
'org.hibernate:hibernate-core:5.2.4.Final',
hibernate: [ 'org.hibernate:hibernate-core:5.4.24.Final',
'org.hibernate.common:hibernate-commons-annotations:5.1.1.Final',
'org.hibernate:hibernate-hikaricp:5.2.4.Final'],
hikari: 'com.zaxxer:HikariCP:3.4.5',
hsqldb: 'org.hsqldb:hsqldb:2.6.1',
http: 'org.apache.httpcomponents:httpclient:4.5.13',
jackson: [ 'com.fasterxml.jackson.core:jackson-core:2.13.2',