Removed further unnedded repo methods.
Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>
This commit is contained in:
@@ -118,7 +118,7 @@ public interface SoftwareManagement {
|
||||
*
|
||||
* @param types
|
||||
* to create
|
||||
* @return created {@link Entity}
|
||||
* @return created Entity
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_REPOSITORY)
|
||||
List<SoftwareModuleType> createSoftwareModuleType(@NotNull Collection<SoftwareModuleType> types);
|
||||
@@ -128,13 +128,13 @@ public interface SoftwareManagement {
|
||||
*
|
||||
* @param type
|
||||
* to create
|
||||
* @return created {@link Entity}
|
||||
* @return created Entity
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_REPOSITORY)
|
||||
SoftwareModuleType createSoftwareModuleType(@NotNull SoftwareModuleType type);
|
||||
|
||||
/**
|
||||
* Deletes the given {@link SoftwareModule} {@link Entity}.
|
||||
* Deletes the given {@link SoftwareModule} Entity.
|
||||
*
|
||||
* @param moduleId
|
||||
* is the {@link SoftwareModule} to be deleted
|
||||
@@ -256,7 +256,7 @@ public interface SoftwareManagement {
|
||||
/**
|
||||
* finds all meta data by the given software module id.
|
||||
*
|
||||
* @param softwareModuleId
|
||||
* @param moduleId
|
||||
* the software module id to retrieve the meta data from
|
||||
* @param rsqlParam
|
||||
* filter definition in RSQL syntax
|
||||
@@ -272,7 +272,7 @@ public interface SoftwareManagement {
|
||||
* if the RSQL syntax is wrong
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Page<SoftwareModuleMetadata> findSoftwareModuleMetadataBySoftwareModuleId(@NotNull Long softwareModuleId,
|
||||
Page<SoftwareModuleMetadata> findSoftwareModuleMetadataBySoftwareModuleId(@NotNull Long moduleId,
|
||||
@NotNull String rsqlParam, @NotNull Pageable pageable);
|
||||
|
||||
/**
|
||||
@@ -407,19 +407,6 @@ public interface SoftwareManagement {
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Page<SoftwareModuleType> findSoftwareModuleTypesAll(@NotNull String rsqlParam, @NotNull Pageable pageable);
|
||||
|
||||
/**
|
||||
* Retrieves software module including details (
|
||||
* {@link SoftwareModule#getArtifacts()}).
|
||||
*
|
||||
* @param id
|
||||
* parameter
|
||||
* @param isDeleted
|
||||
* parameter
|
||||
* @return the found {@link SoftwareModule}s
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
SoftwareModule findSoftwareModuleWithDetails(@NotNull Long id);
|
||||
|
||||
/**
|
||||
* Updates existing {@link SoftwareModule}. Update-able values are
|
||||
* {@link SoftwareModule#getDescription()}
|
||||
@@ -428,7 +415,7 @@ public interface SoftwareManagement {
|
||||
* @param sm
|
||||
* to update
|
||||
*
|
||||
* @return the saved {@link Entity}.
|
||||
* @return the saved Entity.
|
||||
*
|
||||
* @throws NullPointerException
|
||||
* of {@link SoftwareModule#getId()} is <code>null</code>
|
||||
@@ -456,7 +443,7 @@ public interface SoftwareManagement {
|
||||
*
|
||||
* @param sm
|
||||
* to update
|
||||
* @return updated {@link Entity}
|
||||
* @return updated Entity
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
||||
SoftwareModuleType updateSoftwareModuleType(@NotNull SoftwareModuleType sm);
|
||||
@@ -476,6 +463,6 @@ public interface SoftwareManagement {
|
||||
* @return result of all meta data entries for a given software module id.
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
List<SoftwareModuleMetadata> findSoftwareModuleMetadataBySoftwareModuleId(Long softwareModuleId);
|
||||
List<SoftwareModuleMetadata> findSoftwareModuleMetadataBySoftwareModuleId(@NotNull Long moduleId);
|
||||
|
||||
}
|
||||
|
||||
@@ -16,13 +16,12 @@ import java.util.Optional;
|
||||
*
|
||||
*/
|
||||
public interface SoftwareModule extends NamedVersionedEntity {
|
||||
|
||||
/**
|
||||
* @param artifact
|
||||
* is added to the assigned {@link Artifact}s.
|
||||
*/
|
||||
void addArtifact(Artifact artifact);
|
||||
|
||||
|
||||
/**
|
||||
* @param artifactId
|
||||
* to look for
|
||||
@@ -66,12 +65,6 @@ public interface SoftwareModule extends NamedVersionedEntity {
|
||||
*/
|
||||
void setVendor(String vendor);
|
||||
|
||||
/**
|
||||
* @param artifact
|
||||
* is removed from the assigned {@link Artifact}s.
|
||||
*/
|
||||
void removeArtifact(Artifact artifact);
|
||||
|
||||
/**
|
||||
* @return the type of the software module
|
||||
*/
|
||||
@@ -83,26 +76,12 @@ public interface SoftwareModule extends NamedVersionedEntity {
|
||||
*/
|
||||
boolean isDeleted();
|
||||
|
||||
/**
|
||||
* Marks or un-marks this software module as deleted.
|
||||
*
|
||||
* @param deleted
|
||||
* {@code true} if the software module should be marked as
|
||||
* deleted otherwise {@code false}
|
||||
*/
|
||||
void setDeleted(boolean deleted);
|
||||
|
||||
/**
|
||||
* @param type
|
||||
* the module type for this software module
|
||||
*/
|
||||
void setType(SoftwareModuleType type);
|
||||
|
||||
/**
|
||||
* @return immutable list of meta data elements.
|
||||
*/
|
||||
List<SoftwareModuleMetadata> getMetadata();
|
||||
|
||||
/**
|
||||
* @return immutable list of {@link DistributionSet}s the module is assigned
|
||||
* to
|
||||
|
||||
@@ -135,7 +135,7 @@ public class JpaArtifactManagement implements ArtifactManagement {
|
||||
|
||||
clearArtifactBinary(existing);
|
||||
|
||||
existing.getSoftwareModule().removeArtifact(existing);
|
||||
((JpaSoftwareModule) existing.getSoftwareModule()).removeArtifact(existing);
|
||||
softwareModuleRepository.save((JpaSoftwareModule) existing.getSoftwareModule());
|
||||
localArtifactRepository.delete(id);
|
||||
}
|
||||
|
||||
@@ -207,9 +207,7 @@ public class JpaSoftwareManagement implements SoftwareManagement {
|
||||
|
||||
@Override
|
||||
public SoftwareModule findSoftwareModuleById(final Long id) {
|
||||
final Specification<JpaSoftwareModule> spec = SoftwareModuleSpecification.byId(id);
|
||||
|
||||
return softwareModuleRepository.findOne(spec);
|
||||
return softwareModuleRepository.findOne(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -297,16 +295,6 @@ public class JpaSoftwareManagement implements SoftwareManagement {
|
||||
return countSwModuleByCriteriaAPI(Lists.newArrayList(spec));
|
||||
}
|
||||
|
||||
@Override
|
||||
public SoftwareModule findSoftwareModuleWithDetails(final Long id) {
|
||||
final SoftwareModule result = findSoftwareModuleById(id);
|
||||
if (result != null) {
|
||||
result.getArtifacts().size();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<SoftwareModule> findSoftwareModulesByPredicate(final String rsqlParam, final Pageable pageable) {
|
||||
final Specification<JpaSoftwareModule> spec = RSQLUtility.parse(rsqlParam, SoftwareModuleFields.class,
|
||||
|
||||
@@ -71,7 +71,8 @@ public class JpaSoftwareModule extends AbstractJpaNamedVersionedEntity implement
|
||||
private String vendor;
|
||||
|
||||
@CascadeOnDelete
|
||||
@OneToMany(mappedBy = "softwareModule", cascade = { CascadeType.ALL }, targetEntity = JpaArtifact.class)
|
||||
@OneToMany(fetch = FetchType.LAZY, mappedBy = "softwareModule", cascade = {
|
||||
CascadeType.ALL }, targetEntity = JpaArtifact.class)
|
||||
private List<Artifact> artifacts;
|
||||
|
||||
@CascadeOnDelete
|
||||
@@ -107,10 +108,6 @@ public class JpaSoftwareModule extends AbstractJpaNamedVersionedEntity implement
|
||||
this.type = (JpaSoftwareModuleType) type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param artifact
|
||||
* is added to the assigned {@link Artifact}s.
|
||||
*/
|
||||
@Override
|
||||
public void addArtifact(final Artifact artifact) {
|
||||
if (null == artifacts) {
|
||||
@@ -145,7 +142,6 @@ public class JpaSoftwareModule extends AbstractJpaNamedVersionedEntity implement
|
||||
* @param artifact
|
||||
* is removed from the assigned {@link LocalArtifact}s.
|
||||
*/
|
||||
@Override
|
||||
public void removeArtifact(final Artifact artifact) {
|
||||
if (artifacts != null) {
|
||||
artifacts.remove(artifact);
|
||||
@@ -167,7 +163,13 @@ public class JpaSoftwareModule extends AbstractJpaNamedVersionedEntity implement
|
||||
return deleted;
|
||||
}
|
||||
|
||||
@Override
|
||||
/**
|
||||
* Marks or un-marks this software module as deleted.
|
||||
*
|
||||
* @param deleted
|
||||
* {@code true} if the software module should be marked as
|
||||
* deleted otherwise {@code false}
|
||||
*/
|
||||
public void setDeleted(final boolean deleted) {
|
||||
this.deleted = deleted;
|
||||
}
|
||||
@@ -177,7 +179,6 @@ public class JpaSoftwareModule extends AbstractJpaNamedVersionedEntity implement
|
||||
this.type = (JpaSoftwareModuleType) type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SoftwareModuleMetadata> getMetadata() {
|
||||
if (metadata == null) {
|
||||
return Collections.emptyList();
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
DROP TABLE sp_external_artifact;
|
||||
DROP TABLE sp_external_provider;
|
||||
DROP TABLE sp_external_artifact;
|
||||
@@ -1,2 +1,2 @@
|
||||
DROP TABLE sp_external_artifact;
|
||||
DROP TABLE sp_external_provider;
|
||||
DROP TABLE sp_external_artifact;
|
||||
@@ -104,7 +104,7 @@ public class ArtifactManagementTest extends AbstractJpaIntegrationTestWithMongoD
|
||||
assertThat(artifactRepository.findAll()).hasSize(4);
|
||||
assertThat(softwareModuleRepository.findAll()).hasSize(3);
|
||||
|
||||
assertThat(softwareManagement.findSoftwareModuleWithDetails(sm.getId()).getArtifacts()).hasSize(3);
|
||||
assertThat(softwareManagement.findSoftwareModuleById(sm.getId()).getArtifacts()).hasSize(3);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -478,7 +478,7 @@ public class SoftwareManagementTest extends AbstractJpaIntegrationTestWithMongoD
|
||||
|
||||
// [STEP2]: Create newArtifactX and add it to SoftwareModuleX
|
||||
artifactManagement.createArtifact(new ByteArrayInputStream(source), moduleX.getId(), "artifactx", false);
|
||||
moduleX = softwareManagement.findSoftwareModuleWithDetails(moduleX.getId());
|
||||
moduleX = softwareManagement.findSoftwareModuleById(moduleX.getId());
|
||||
final Artifact artifactX = moduleX.getArtifacts().iterator().next();
|
||||
|
||||
// [STEP3]: Create SoftwareModuleY and add the same ArtifactX
|
||||
@@ -486,7 +486,7 @@ public class SoftwareManagementTest extends AbstractJpaIntegrationTestWithMongoD
|
||||
|
||||
// [STEP4]: Assign the same ArtifactX to SoftwareModuleY
|
||||
artifactManagement.createArtifact(new ByteArrayInputStream(source), moduleY.getId(), "artifactx", false);
|
||||
moduleY = softwareManagement.findSoftwareModuleWithDetails(moduleY.getId());
|
||||
moduleY = softwareManagement.findSoftwareModuleById(moduleY.getId());
|
||||
final Artifact artifactY = moduleY.getArtifacts().iterator().next();
|
||||
|
||||
// verify: that only one entry was created in mongoDB
|
||||
@@ -530,14 +530,14 @@ public class SoftwareManagementTest extends AbstractJpaIntegrationTestWithMongoD
|
||||
SoftwareModule moduleX = createSoftwareModuleWithArtifacts(osType, "modulex", "v1.0", 0);
|
||||
|
||||
artifactManagement.createArtifact(new ByteArrayInputStream(source), moduleX.getId(), "artifactx", false);
|
||||
moduleX = softwareManagement.findSoftwareModuleWithDetails(moduleX.getId());
|
||||
moduleX = softwareManagement.findSoftwareModuleById(moduleX.getId());
|
||||
final Artifact artifactX = moduleX.getArtifacts().iterator().next();
|
||||
|
||||
// [STEP2]: Create SoftwareModuleY and add the same ArtifactX
|
||||
SoftwareModule moduleY = createSoftwareModuleWithArtifacts(osType, "moduley", "v1.0", 0);
|
||||
|
||||
artifactManagement.createArtifact(new ByteArrayInputStream(source), moduleY.getId(), "artifactx", false);
|
||||
moduleY = softwareManagement.findSoftwareModuleWithDetails(moduleY.getId());
|
||||
moduleY = softwareManagement.findSoftwareModuleById(moduleY.getId());
|
||||
final Artifact artifactY = moduleY.getArtifacts().iterator().next();
|
||||
|
||||
// verify: that only one entry was created in mongoDB
|
||||
@@ -591,7 +591,7 @@ public class SoftwareManagementTest extends AbstractJpaIntegrationTestWithMongoD
|
||||
}
|
||||
|
||||
// Verify correct Creation of SoftwareModule and corresponding artifacts
|
||||
softwareModule = softwareManagement.findSoftwareModuleWithDetails(softwareModule.getId());
|
||||
softwareModule = softwareManagement.findSoftwareModuleById(softwareModule.getId());
|
||||
assertThat(softwareModuleRepository.findAll()).hasSize((int) countSoftwareModule + 1);
|
||||
|
||||
final List<Artifact> artifacts = softwareModule.getArtifacts();
|
||||
@@ -935,13 +935,13 @@ public class SoftwareManagementTest extends AbstractJpaIntegrationTestWithMongoD
|
||||
ah = softwareManagement.createSoftwareModuleMetadata(new JpaSoftwareModuleMetadata(knownKey1, ah, knownValue1))
|
||||
.getSoftwareModule();
|
||||
|
||||
assertThat(softwareManagement.findSoftwareModuleById(ah.getId()).getMetadata())
|
||||
assertThat(softwareManagement.findSoftwareModuleMetadataBySoftwareModuleId(ah.getId()))
|
||||
.as("Contains the created metadata element")
|
||||
.containsExactly(new JpaSoftwareModuleMetadata(knownKey1, ah, knownValue1));
|
||||
|
||||
softwareManagement.deleteSoftwareModuleMetadata(ah.getId(), knownKey1);
|
||||
assertThat(softwareManagement.findSoftwareModuleById(ah.getId()).getMetadata()).as("Metadata elemenets are")
|
||||
.isEmpty();
|
||||
assertThat(softwareManagement.findSoftwareModuleMetadataBySoftwareModuleId(ah.getId()))
|
||||
.as("Metadata elemenets are").isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -25,6 +25,11 @@ spring.datasource.driverClassName=org.h2.Driver
|
||||
spring.datasource.username=sa
|
||||
spring.datasource.password=sa
|
||||
|
||||
spring.datasource.eclipselink.logging.logger=JavaLogger
|
||||
spring.jpa.properties.eclipselink.logging.level=FINE
|
||||
spring.jpa.properties.eclipselink.logging.level.sql=FINE
|
||||
spring.jpa.properties.eclipselink.logging.parameters=true
|
||||
|
||||
flyway.enabled=true
|
||||
flyway.sqlMigrationSuffix=${spring.jpa.database}.sql
|
||||
#spring.jpa.show-sql=true
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
-->
|
||||
<configuration>
|
||||
<include resource="org/springframework/boot/logging/logback/base.xml" />
|
||||
|
||||
<!-- <logger name="org.eclipse.persistence" level="DEBUG" /> -->
|
||||
|
||||
<Root level="INFO">
|
||||
<appender-ref ref="CONSOLE" />
|
||||
|
||||
Reference in New Issue
Block a user