Removed further unnedded repo methods.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>
This commit is contained in:
kaizimmerm
2016-10-20 14:57:07 +02:00
parent 0332d31146
commit e2281ac67b
22 changed files with 82 additions and 176 deletions

View File

@@ -19,6 +19,7 @@ import static org.mockito.Mockito.when;
import java.net.URI; import java.net.URI;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
@@ -112,7 +113,7 @@ public class AmqpMessageDispatcherServiceTest extends AbstractIntegrationTest {
@Description("Verfies that download and install event with no software modul works") @Description("Verfies that download and install event with no software modul works")
public void testSendDownloadRequesWithEmptySoftwareModules() { public void testSendDownloadRequesWithEmptySoftwareModules() {
final TargetAssignDistributionSetEvent targetAssignDistributionSetEvent = new TargetAssignDistributionSetEvent( final TargetAssignDistributionSetEvent targetAssignDistributionSetEvent = new TargetAssignDistributionSetEvent(
1L, TENANT, testTarget, 1L, new ArrayList<SoftwareModule>()); 1L, TENANT, testTarget, 1L, Collections.emptyList());
amqpMessageDispatcherService.targetAssignDistributionSet(targetAssignDistributionSetEvent); amqpMessageDispatcherService.targetAssignDistributionSet(targetAssignDistributionSetEvent);
final Message sendMessage = createArgumentCapture( final Message sendMessage = createArgumentCapture(
targetAssignDistributionSetEvent.getTarget().getTargetInfo().getAddress()); targetAssignDistributionSetEvent.getTarget().getTargetInfo().getAddress());

View File

@@ -15,7 +15,6 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonValue;
/** /**
* A json annotated rest model for Artifact to RESTful API representation. * A json annotated rest model for Artifact to RESTful API representation.
@@ -24,9 +23,6 @@ import com.fasterxml.jackson.annotation.JsonValue;
@JsonIgnoreProperties(ignoreUnknown = true) @JsonIgnoreProperties(ignoreUnknown = true)
public class MgmtArtifact extends MgmtBaseEntity { public class MgmtArtifact extends MgmtBaseEntity {
@JsonProperty(required = true)
private ArtifactType type;
@JsonProperty("id") @JsonProperty("id")
private Long artifactId; private Long artifactId;
@@ -40,18 +36,9 @@ public class MgmtArtifact extends MgmtBaseEntity {
private Long size; private Long size;
public MgmtArtifact() { public MgmtArtifact() {
super();
// need for json encoder // need for json encoder
} }
/**
* @param type
* the type to set
*/
public void setType(final ArtifactType type) {
this.type = type;
}
/** /**
* @param hashes * @param hashes
* the hashes to set * the hashes to set
@@ -70,13 +57,6 @@ public class MgmtArtifact extends MgmtBaseEntity {
this.artifactId = artifactId; this.artifactId = artifactId;
} }
/**
* @return the type
*/
public ArtifactType getType() {
return type;
}
/** /**
* @return the artifactId * @return the artifactId
*/ */
@@ -107,27 +87,6 @@ public class MgmtArtifact extends MgmtBaseEntity {
this.providedFilename = providedFilename; this.providedFilename = providedFilename;
} }
/**
* Type maps to either local artifact} or external artifact.
*/
public enum ArtifactType {
LOCAL("local"), EXTERNAL("external");
private final String name;
private ArtifactType(final String name) {
this.name = name;
}
/**
* @return the name
*/
@JsonValue
public String getName() {
return name;
}
}
/** /**
* @return the size * @return the size
*/ */

View File

@@ -155,11 +155,7 @@ public final class MgmtSoftwareModuleMapper {
* @return * @return
*/ */
static MgmtArtifact toResponse(final Artifact artifact) { static MgmtArtifact toResponse(final Artifact artifact) {
final MgmtArtifact.ArtifactType type = artifact instanceof Artifact ? MgmtArtifact.ArtifactType.LOCAL
: MgmtArtifact.ArtifactType.EXTERNAL;
final MgmtArtifact artifactRest = new MgmtArtifact(); final MgmtArtifact artifactRest = new MgmtArtifact();
artifactRest.setType(type);
artifactRest.setArtifactId(artifact.getId()); artifactRest.setArtifactId(artifact.getId());
artifactRest.setSize(artifact.getSize()); artifactRest.setSize(artifact.getSize());
artifactRest.setHashes(new MgmtArtifactHash(artifact.getSha1Hash(), artifact.getMd5Hash())); artifactRest.setHashes(new MgmtArtifactHash(artifact.getSha1Hash(), artifact.getMd5Hash()));
@@ -171,10 +167,8 @@ public final class MgmtSoftwareModuleMapper {
artifactRest.add(linkTo(methodOn(MgmtSoftwareModuleRestApi.class) artifactRest.add(linkTo(methodOn(MgmtSoftwareModuleRestApi.class)
.getArtifact(artifact.getSoftwareModule().getId(), artifact.getId())).withRel("self")); .getArtifact(artifact.getSoftwareModule().getId(), artifact.getId())).withRel("self"));
if (artifact instanceof Artifact) { artifactRest.add(linkTo(methodOn(MgmtDownloadArtifactResource.class)
artifactRest.add(linkTo(methodOn(MgmtDownloadArtifactResource.class) .downloadArtifact(artifact.getSoftwareModule().getId(), artifact.getId())).withRel("download"));
.downloadArtifact(artifact.getSoftwareModule().getId(), artifact.getId())).withRel("download"));
}
return artifactRest; return artifactRest;
} }

View File

@@ -139,7 +139,7 @@ public class MgmtSoftwareModuleResourceTest extends AbstractRestIntegrationTestW
.accept(MediaType.APPLICATION_JSON)) .accept(MediaType.APPLICATION_JSON))
.andDo(MockMvcResultPrinter.print()).andExpect(status().isCreated()) .andDo(MockMvcResultPrinter.print()).andExpect(status().isCreated())
.andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andExpect(jsonPath("$.type", equalTo("local"))).andExpect(jsonPath("$.hashes.md5", equalTo(md5sum))) .andExpect(jsonPath("$.hashes.md5", equalTo(md5sum)))
.andExpect(jsonPath("$.hashes.sha1", equalTo(sha1sum))) .andExpect(jsonPath("$.hashes.sha1", equalTo(sha1sum)))
.andExpect(jsonPath("$.size", equalTo(random.length))) .andExpect(jsonPath("$.size", equalTo(random.length)))
.andExpect(jsonPath("$.providedFilename", equalTo("origFilename"))).andReturn(); .andExpect(jsonPath("$.providedFilename", equalTo("origFilename"))).andReturn();
@@ -147,7 +147,7 @@ public class MgmtSoftwareModuleResourceTest extends AbstractRestIntegrationTestW
// check rest of response compared to DB // check rest of response compared to DB
final MgmtArtifact artResult = ResourceUtility final MgmtArtifact artResult = ResourceUtility
.convertArtifactResponse(mvcResult.getResponse().getContentAsString()); .convertArtifactResponse(mvcResult.getResponse().getContentAsString());
final Long artId = softwareManagement.findSoftwareModuleWithDetails(sm.getId()).getArtifacts().get(0).getId(); final Long artId = softwareManagement.findSoftwareModuleById(sm.getId()).getArtifacts().get(0).getId();
assertThat(artResult.getArtifactId()).as("Wrong artifact id").isEqualTo(artId); assertThat(artResult.getArtifactId()).as("Wrong artifact id").isEqualTo(artId);
assertThat(JsonPath.compile("$._links.self.href").read(mvcResult.getResponse().getContentAsString()).toString()) assertThat(JsonPath.compile("$._links.self.href").read(mvcResult.getResponse().getContentAsString()).toString())
.as("Link contains no self url") .as("Link contains no self url")
@@ -167,8 +167,9 @@ public class MgmtSoftwareModuleResourceTest extends AbstractRestIntegrationTestW
// binary // binary
assertTrue("Wrong artifact content", assertTrue("Wrong artifact content",
IOUtils.contentEquals(new ByteArrayInputStream(random), IOUtils.contentEquals(new ByteArrayInputStream(random),
artifactManagement.loadArtifactBinary( artifactManagement
softwareManagement.findSoftwareModuleWithDetails(sm.getId()).getArtifacts().get(0)) .loadArtifactBinary(
softwareManagement.findSoftwareModuleById(sm.getId()).getArtifacts().get(0))
.getFileInputStream())); .getFileInputStream()));
// hashes // hashes
@@ -179,7 +180,7 @@ public class MgmtSoftwareModuleResourceTest extends AbstractRestIntegrationTestW
.isEqualTo(HashGeneratorUtils.generateMD5(random)); .isEqualTo(HashGeneratorUtils.generateMD5(random));
// metadata // metadata
assertThat(softwareManagement.findSoftwareModuleWithDetails(sm.getId()).getArtifacts().get(0).getFilename()) assertThat(softwareManagement.findSoftwareModuleById(sm.getId()).getArtifacts().get(0).getFilename())
.as("wrong metadata of the filename").isEqualTo("origFilename"); .as("wrong metadata of the filename").isEqualTo("origFilename");
} }
@@ -213,7 +214,7 @@ public class MgmtSoftwareModuleResourceTest extends AbstractRestIntegrationTestW
mvc.perform(fileUpload("/rest/v1/softwaremodules/{smId}/artifacts", sm.getId()).file(file) mvc.perform(fileUpload("/rest/v1/softwaremodules/{smId}/artifacts", sm.getId()).file(file)
.accept(MediaType.APPLICATION_JSON)).andDo(MockMvcResultPrinter.print()).andExpect(status().isCreated()) .accept(MediaType.APPLICATION_JSON)).andDo(MockMvcResultPrinter.print()).andExpect(status().isCreated())
.andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andExpect(jsonPath("$.type", equalTo("local"))).andExpect(jsonPath("$.hashes.md5", equalTo(md5sum))) .andExpect(jsonPath("$.hashes.md5", equalTo(md5sum)))
.andExpect(jsonPath("$.hashes.sha1", equalTo(sha1sum))) .andExpect(jsonPath("$.hashes.sha1", equalTo(sha1sum)))
.andExpect(jsonPath("$.providedFilename", equalTo("orig"))).andExpect(status().isCreated()); .andExpect(jsonPath("$.providedFilename", equalTo("orig"))).andExpect(status().isCreated());
@@ -342,7 +343,7 @@ public class MgmtSoftwareModuleResourceTest extends AbstractRestIntegrationTestW
.accept(MediaType.APPLICATION_JSON)).andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) .accept(MediaType.APPLICATION_JSON)).andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andExpect(jsonPath("$.id", equalTo(artifact.getId().intValue()))) .andExpect(jsonPath("$.id", equalTo(artifact.getId().intValue())))
.andExpect(jsonPath("$.type", equalTo("local"))).andExpect(jsonPath("$.size", equalTo(random.length))) .andExpect(jsonPath("$.size", equalTo(random.length)))
.andExpect(jsonPath("$.hashes.md5", equalTo(artifact.getMd5Hash()))) .andExpect(jsonPath("$.hashes.md5", equalTo(artifact.getMd5Hash())))
.andExpect(jsonPath("$.hashes.sha1", equalTo(artifact.getSha1Hash()))) .andExpect(jsonPath("$.hashes.sha1", equalTo(artifact.getSha1Hash())))
.andExpect(jsonPath("$.providedFilename", equalTo("file1"))) .andExpect(jsonPath("$.providedFilename", equalTo("file1")))
@@ -370,7 +371,6 @@ public class MgmtSoftwareModuleResourceTest extends AbstractRestIntegrationTestW
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andExpect(jsonPath("$.[0].id", equalTo(artifact.getId().intValue()))) .andExpect(jsonPath("$.[0].id", equalTo(artifact.getId().intValue())))
.andExpect(jsonPath("$.[0].type", equalTo("local")))
.andExpect(jsonPath("$.[0].size", equalTo(random.length))) .andExpect(jsonPath("$.[0].size", equalTo(random.length)))
.andExpect(jsonPath("$.[0].hashes.md5", equalTo(artifact.getMd5Hash()))) .andExpect(jsonPath("$.[0].hashes.md5", equalTo(artifact.getMd5Hash())))
.andExpect(jsonPath("$.[0].hashes.sha1", equalTo(artifact.getSha1Hash()))) .andExpect(jsonPath("$.[0].hashes.sha1", equalTo(artifact.getSha1Hash())))
@@ -382,7 +382,6 @@ public class MgmtSoftwareModuleResourceTest extends AbstractRestIntegrationTestW
equalTo("http://localhost/rest/v1/softwaremodules/" + sm.getId() + "/artifacts/" equalTo("http://localhost/rest/v1/softwaremodules/" + sm.getId() + "/artifacts/"
+ artifact.getId()))) + artifact.getId())))
.andExpect(jsonPath("$.[1].id", equalTo(artifact2.getId().intValue()))) .andExpect(jsonPath("$.[1].id", equalTo(artifact2.getId().intValue())))
.andExpect(jsonPath("$.[1].type", equalTo("local")))
.andExpect(jsonPath("$.[1].hashes.md5", equalTo(artifact2.getMd5Hash()))) .andExpect(jsonPath("$.[1].hashes.md5", equalTo(artifact2.getMd5Hash())))
.andExpect(jsonPath("$.[1].hashes.sha1", equalTo(artifact2.getSha1Hash()))) .andExpect(jsonPath("$.[1].hashes.sha1", equalTo(artifact2.getSha1Hash())))
.andExpect(jsonPath("$.[1].providedFilename", equalTo("file2"))) .andExpect(jsonPath("$.[1].providedFilename", equalTo("file2")))
@@ -908,7 +907,7 @@ public class MgmtSoftwareModuleResourceTest extends AbstractRestIntegrationTestW
// check repo before delete // check repo before delete
assertThat(softwareManagement.findSoftwareModulesAll(pageReq)).hasSize(1); assertThat(softwareManagement.findSoftwareModulesAll(pageReq)).hasSize(1);
assertThat(softwareManagement.findSoftwareModuleWithDetails(sm.getId()).getArtifacts()).hasSize(2); assertThat(softwareManagement.findSoftwareModuleById(sm.getId()).getArtifacts()).hasSize(2);
assertThat(artifactManagement.countArtifactsAll()).isEqualTo(2); assertThat(artifactManagement.countArtifactsAll()).isEqualTo(2);
// delete // delete
@@ -919,7 +918,7 @@ public class MgmtSoftwareModuleResourceTest extends AbstractRestIntegrationTestW
assertThat(softwareManagement.findSoftwareModulesAll(pageReq)).as("After the sm should be marked as deleted") assertThat(softwareManagement.findSoftwareModulesAll(pageReq)).as("After the sm should be marked as deleted")
.hasSize(1); .hasSize(1);
assertThat(artifactManagement.countArtifactsAll()).isEqualTo(1); assertThat(artifactManagement.countArtifactsAll()).isEqualTo(1);
assertThat(softwareManagement.findSoftwareModuleWithDetails(sm.getId()).getArtifacts()) assertThat(softwareManagement.findSoftwareModuleById(sm.getId()).getArtifacts())
.as("After delete artifact should available for marked as deleted sm's").hasSize(1); .as("After delete artifact should available for marked as deleted sm's").hasSize(1);
} }

View File

@@ -118,7 +118,7 @@ public interface SoftwareManagement {
* *
* @param types * @param types
* to create * to create
* @return created {@link Entity} * @return created Entity
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_REPOSITORY) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_REPOSITORY)
List<SoftwareModuleType> createSoftwareModuleType(@NotNull Collection<SoftwareModuleType> types); List<SoftwareModuleType> createSoftwareModuleType(@NotNull Collection<SoftwareModuleType> types);
@@ -128,13 +128,13 @@ public interface SoftwareManagement {
* *
* @param type * @param type
* to create * to create
* @return created {@link Entity} * @return created Entity
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_REPOSITORY) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_REPOSITORY)
SoftwareModuleType createSoftwareModuleType(@NotNull SoftwareModuleType type); SoftwareModuleType createSoftwareModuleType(@NotNull SoftwareModuleType type);
/** /**
* Deletes the given {@link SoftwareModule} {@link Entity}. * Deletes the given {@link SoftwareModule} Entity.
* *
* @param moduleId * @param moduleId
* is the {@link SoftwareModule} to be deleted * is the {@link SoftwareModule} to be deleted
@@ -256,7 +256,7 @@ public interface SoftwareManagement {
/** /**
* finds all meta data by the given software module id. * finds all meta data by the given software module id.
* *
* @param softwareModuleId * @param moduleId
* the software module id to retrieve the meta data from * the software module id to retrieve the meta data from
* @param rsqlParam * @param rsqlParam
* filter definition in RSQL syntax * filter definition in RSQL syntax
@@ -272,7 +272,7 @@ public interface SoftwareManagement {
* if the RSQL syntax is wrong * if the RSQL syntax is wrong
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
Page<SoftwareModuleMetadata> findSoftwareModuleMetadataBySoftwareModuleId(@NotNull Long softwareModuleId, Page<SoftwareModuleMetadata> findSoftwareModuleMetadataBySoftwareModuleId(@NotNull Long moduleId,
@NotNull String rsqlParam, @NotNull Pageable pageable); @NotNull String rsqlParam, @NotNull Pageable pageable);
/** /**
@@ -407,19 +407,6 @@ public interface SoftwareManagement {
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
Page<SoftwareModuleType> findSoftwareModuleTypesAll(@NotNull String rsqlParam, @NotNull Pageable pageable); 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 * Updates existing {@link SoftwareModule}. Update-able values are
* {@link SoftwareModule#getDescription()} * {@link SoftwareModule#getDescription()}
@@ -428,7 +415,7 @@ public interface SoftwareManagement {
* @param sm * @param sm
* to update * to update
* *
* @return the saved {@link Entity}. * @return the saved Entity.
* *
* @throws NullPointerException * @throws NullPointerException
* of {@link SoftwareModule#getId()} is <code>null</code> * of {@link SoftwareModule#getId()} is <code>null</code>
@@ -456,7 +443,7 @@ public interface SoftwareManagement {
* *
* @param sm * @param sm
* to update * to update
* @return updated {@link Entity} * @return updated Entity
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
SoftwareModuleType updateSoftwareModuleType(@NotNull SoftwareModuleType sm); 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. * @return result of all meta data entries for a given software module id.
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
List<SoftwareModuleMetadata> findSoftwareModuleMetadataBySoftwareModuleId(Long softwareModuleId); List<SoftwareModuleMetadata> findSoftwareModuleMetadataBySoftwareModuleId(@NotNull Long moduleId);
} }

View File

@@ -16,13 +16,12 @@ import java.util.Optional;
* *
*/ */
public interface SoftwareModule extends NamedVersionedEntity { public interface SoftwareModule extends NamedVersionedEntity {
/** /**
* @param artifact * @param artifact
* is added to the assigned {@link Artifact}s. * is added to the assigned {@link Artifact}s.
*/ */
void addArtifact(Artifact artifact); void addArtifact(Artifact artifact);
/** /**
* @param artifactId * @param artifactId
* to look for * to look for
@@ -66,12 +65,6 @@ public interface SoftwareModule extends NamedVersionedEntity {
*/ */
void setVendor(String vendor); 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 * @return the type of the software module
*/ */
@@ -83,26 +76,12 @@ public interface SoftwareModule extends NamedVersionedEntity {
*/ */
boolean isDeleted(); 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 * @param type
* the module type for this software module * the module type for this software module
*/ */
void setType(SoftwareModuleType type); 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 * @return immutable list of {@link DistributionSet}s the module is assigned
* to * to

View File

@@ -135,7 +135,7 @@ public class JpaArtifactManagement implements ArtifactManagement {
clearArtifactBinary(existing); clearArtifactBinary(existing);
existing.getSoftwareModule().removeArtifact(existing); ((JpaSoftwareModule) existing.getSoftwareModule()).removeArtifact(existing);
softwareModuleRepository.save((JpaSoftwareModule) existing.getSoftwareModule()); softwareModuleRepository.save((JpaSoftwareModule) existing.getSoftwareModule());
localArtifactRepository.delete(id); localArtifactRepository.delete(id);
} }

View File

@@ -207,9 +207,7 @@ public class JpaSoftwareManagement implements SoftwareManagement {
@Override @Override
public SoftwareModule findSoftwareModuleById(final Long id) { public SoftwareModule findSoftwareModuleById(final Long id) {
final Specification<JpaSoftwareModule> spec = SoftwareModuleSpecification.byId(id); return softwareModuleRepository.findOne(id);
return softwareModuleRepository.findOne(spec);
} }
@Override @Override
@@ -297,16 +295,6 @@ public class JpaSoftwareManagement implements SoftwareManagement {
return countSwModuleByCriteriaAPI(Lists.newArrayList(spec)); 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 @Override
public Page<SoftwareModule> findSoftwareModulesByPredicate(final String rsqlParam, final Pageable pageable) { public Page<SoftwareModule> findSoftwareModulesByPredicate(final String rsqlParam, final Pageable pageable) {
final Specification<JpaSoftwareModule> spec = RSQLUtility.parse(rsqlParam, SoftwareModuleFields.class, final Specification<JpaSoftwareModule> spec = RSQLUtility.parse(rsqlParam, SoftwareModuleFields.class,

View File

@@ -71,7 +71,8 @@ public class JpaSoftwareModule extends AbstractJpaNamedVersionedEntity implement
private String vendor; private String vendor;
@CascadeOnDelete @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; private List<Artifact> artifacts;
@CascadeOnDelete @CascadeOnDelete
@@ -107,10 +108,6 @@ public class JpaSoftwareModule extends AbstractJpaNamedVersionedEntity implement
this.type = (JpaSoftwareModuleType) type; this.type = (JpaSoftwareModuleType) type;
} }
/**
* @param artifact
* is added to the assigned {@link Artifact}s.
*/
@Override @Override
public void addArtifact(final Artifact artifact) { public void addArtifact(final Artifact artifact) {
if (null == artifacts) { if (null == artifacts) {
@@ -145,7 +142,6 @@ public class JpaSoftwareModule extends AbstractJpaNamedVersionedEntity implement
* @param artifact * @param artifact
* is removed from the assigned {@link LocalArtifact}s. * is removed from the assigned {@link LocalArtifact}s.
*/ */
@Override
public void removeArtifact(final Artifact artifact) { public void removeArtifact(final Artifact artifact) {
if (artifacts != null) { if (artifacts != null) {
artifacts.remove(artifact); artifacts.remove(artifact);
@@ -167,7 +163,13 @@ public class JpaSoftwareModule extends AbstractJpaNamedVersionedEntity implement
return deleted; 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) { public void setDeleted(final boolean deleted) {
this.deleted = deleted; this.deleted = deleted;
} }
@@ -177,7 +179,6 @@ public class JpaSoftwareModule extends AbstractJpaNamedVersionedEntity implement
this.type = (JpaSoftwareModuleType) type; this.type = (JpaSoftwareModuleType) type;
} }
@Override
public List<SoftwareModuleMetadata> getMetadata() { public List<SoftwareModuleMetadata> getMetadata() {
if (metadata == null) { if (metadata == null) {
return Collections.emptyList(); return Collections.emptyList();

View File

@@ -1,2 +1,2 @@
DROP TABLE sp_external_artifact;
DROP TABLE sp_external_provider; DROP TABLE sp_external_provider;
DROP TABLE sp_external_artifact;

View File

@@ -1,2 +1,2 @@
DROP TABLE sp_external_artifact;
DROP TABLE sp_external_provider; DROP TABLE sp_external_provider;
DROP TABLE sp_external_artifact;

View File

@@ -104,7 +104,7 @@ public class ArtifactManagementTest extends AbstractJpaIntegrationTestWithMongoD
assertThat(artifactRepository.findAll()).hasSize(4); assertThat(artifactRepository.findAll()).hasSize(4);
assertThat(softwareModuleRepository.findAll()).hasSize(3); assertThat(softwareModuleRepository.findAll()).hasSize(3);
assertThat(softwareManagement.findSoftwareModuleWithDetails(sm.getId()).getArtifacts()).hasSize(3); assertThat(softwareManagement.findSoftwareModuleById(sm.getId()).getArtifacts()).hasSize(3);
} }
@Test @Test

View File

@@ -478,7 +478,7 @@ public class SoftwareManagementTest extends AbstractJpaIntegrationTestWithMongoD
// [STEP2]: Create newArtifactX and add it to SoftwareModuleX // [STEP2]: Create newArtifactX and add it to SoftwareModuleX
artifactManagement.createArtifact(new ByteArrayInputStream(source), moduleX.getId(), "artifactx", false); 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(); final Artifact artifactX = moduleX.getArtifacts().iterator().next();
// [STEP3]: Create SoftwareModuleY and add the same ArtifactX // [STEP3]: Create SoftwareModuleY and add the same ArtifactX
@@ -486,7 +486,7 @@ public class SoftwareManagementTest extends AbstractJpaIntegrationTestWithMongoD
// [STEP4]: Assign the same ArtifactX to SoftwareModuleY // [STEP4]: Assign the same ArtifactX to SoftwareModuleY
artifactManagement.createArtifact(new ByteArrayInputStream(source), moduleY.getId(), "artifactx", false); 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(); final Artifact artifactY = moduleY.getArtifacts().iterator().next();
// verify: that only one entry was created in mongoDB // 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); SoftwareModule moduleX = createSoftwareModuleWithArtifacts(osType, "modulex", "v1.0", 0);
artifactManagement.createArtifact(new ByteArrayInputStream(source), moduleX.getId(), "artifactx", false); 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(); final Artifact artifactX = moduleX.getArtifacts().iterator().next();
// [STEP2]: Create SoftwareModuleY and add the same ArtifactX // [STEP2]: Create SoftwareModuleY and add the same ArtifactX
SoftwareModule moduleY = createSoftwareModuleWithArtifacts(osType, "moduley", "v1.0", 0); SoftwareModule moduleY = createSoftwareModuleWithArtifacts(osType, "moduley", "v1.0", 0);
artifactManagement.createArtifact(new ByteArrayInputStream(source), moduleY.getId(), "artifactx", false); 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(); final Artifact artifactY = moduleY.getArtifacts().iterator().next();
// verify: that only one entry was created in mongoDB // 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 // 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); assertThat(softwareModuleRepository.findAll()).hasSize((int) countSoftwareModule + 1);
final List<Artifact> artifacts = softwareModule.getArtifacts(); final List<Artifact> artifacts = softwareModule.getArtifacts();
@@ -935,13 +935,13 @@ public class SoftwareManagementTest extends AbstractJpaIntegrationTestWithMongoD
ah = softwareManagement.createSoftwareModuleMetadata(new JpaSoftwareModuleMetadata(knownKey1, ah, knownValue1)) ah = softwareManagement.createSoftwareModuleMetadata(new JpaSoftwareModuleMetadata(knownKey1, ah, knownValue1))
.getSoftwareModule(); .getSoftwareModule();
assertThat(softwareManagement.findSoftwareModuleById(ah.getId()).getMetadata()) assertThat(softwareManagement.findSoftwareModuleMetadataBySoftwareModuleId(ah.getId()))
.as("Contains the created metadata element") .as("Contains the created metadata element")
.containsExactly(new JpaSoftwareModuleMetadata(knownKey1, ah, knownValue1)); .containsExactly(new JpaSoftwareModuleMetadata(knownKey1, ah, knownValue1));
softwareManagement.deleteSoftwareModuleMetadata(ah.getId(), knownKey1); softwareManagement.deleteSoftwareModuleMetadata(ah.getId(), knownKey1);
assertThat(softwareManagement.findSoftwareModuleById(ah.getId()).getMetadata()).as("Metadata elemenets are") assertThat(softwareManagement.findSoftwareModuleMetadataBySoftwareModuleId(ah.getId()))
.isEmpty(); .as("Metadata elemenets are").isEmpty();
} }
@Test @Test

View File

@@ -25,6 +25,11 @@ spring.datasource.driverClassName=org.h2.Driver
spring.datasource.username=sa spring.datasource.username=sa
spring.datasource.password=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.enabled=true
flyway.sqlMigrationSuffix=${spring.jpa.database}.sql flyway.sqlMigrationSuffix=${spring.jpa.database}.sql
#spring.jpa.show-sql=true #spring.jpa.show-sql=true

View File

@@ -11,6 +11,8 @@
--> -->
<configuration> <configuration>
<include resource="org/springframework/boot/logging/logback/base.xml" /> <include resource="org/springframework/boot/logging/logback/base.xml" />
<!-- <logger name="org.eclipse.persistence" level="DEBUG" /> -->
<Root level="INFO"> <Root level="INFO">
<appender-ref ref="CONSOLE" /> <appender-ref ref="CONSOLE" />

View File

@@ -8,9 +8,10 @@
*/ */
package org.eclipse.hawkbit.ui.artifacts.smtable; package org.eclipse.hawkbit.ui.artifacts.smtable;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;
import org.eclipse.hawkbit.repository.OffsetBasedPageRequest; import org.eclipse.hawkbit.repository.OffsetBasedPageRequest;
import org.eclipse.hawkbit.repository.SoftwareManagement; import org.eclipse.hawkbit.repository.SoftwareManagement;
@@ -37,8 +38,8 @@ import com.google.common.base.Strings;
public class BaseSwModuleBeanQuery extends AbstractBeanQuery<ProxyBaseSoftwareModuleItem> { public class BaseSwModuleBeanQuery extends AbstractBeanQuery<ProxyBaseSoftwareModuleItem> {
private static final long serialVersionUID = 4362142538539335466L; private static final long serialVersionUID = 4362142538539335466L;
private transient SoftwareManagement softwareManagementService; private transient SoftwareManagement softwareManagementService;
private SoftwareModuleType type; private Long type;
private String searchText = null; private String searchText;
private final Sort sort = new Sort(Direction.ASC, "name", "version"); private final Sort sort = new Sort(Direction.ASC, "name", "version");
/** /**
@@ -57,7 +58,8 @@ public class BaseSwModuleBeanQuery extends AbstractBeanQuery<ProxyBaseSoftwareMo
final Object[] sortIds, final boolean[] sortStates) { final Object[] sortIds, final boolean[] sortStates) {
super(definition, queryConfig, sortIds, sortStates); super(definition, queryConfig, sortIds, sortStates);
if (HawkbitCommonUtil.isNotNullOrEmpty(queryConfig)) { if (HawkbitCommonUtil.isNotNullOrEmpty(queryConfig)) {
type = (SoftwareModuleType) queryConfig.get(SPUIDefinitions.BY_SOFTWARE_MODULE_TYPE); type = Optional.ofNullable((SoftwareModuleType) queryConfig.get(SPUIDefinitions.BY_SOFTWARE_MODULE_TYPE))
.map(type -> type.getId()).orElse(null);
searchText = (String) queryConfig.get(SPUIDefinitions.FILTER_BY_TEXT); searchText = (String) queryConfig.get(SPUIDefinitions.FILTER_BY_TEXT);
if (!Strings.isNullOrEmpty(searchText)) { if (!Strings.isNullOrEmpty(searchText)) {
searchText = String.format("%%%s%%", searchText); searchText = String.format("%%%s%%", searchText);
@@ -73,22 +75,17 @@ public class BaseSwModuleBeanQuery extends AbstractBeanQuery<ProxyBaseSoftwareMo
@Override @Override
protected List<ProxyBaseSoftwareModuleItem> loadBeans(final int startIndex, final int count) { protected List<ProxyBaseSoftwareModuleItem> loadBeans(final int startIndex, final int count) {
final Slice<SoftwareModule> swModuleBeans; final Slice<SoftwareModule> swModuleBeans;
final List<ProxyBaseSoftwareModuleItem> proxyBeans = new ArrayList<>();
if (type == null && Strings.isNullOrEmpty(searchText)) { if (type == null && Strings.isNullOrEmpty(searchText)) {
swModuleBeans = getSoftwareManagementService() swModuleBeans = getSoftwareManagementService()
.findSoftwareModulesAll(new OffsetBasedPageRequest(startIndex, count, sort)); .findSoftwareModulesAll(new OffsetBasedPageRequest(startIndex, count, sort));
} else { } else {
swModuleBeans = getSoftwareManagementService().findSoftwareModuleByFilters( swModuleBeans = getSoftwareManagementService()
new OffsetBasedPageRequest(startIndex, count, sort), searchText, type.getId()); .findSoftwareModuleByFilters(new OffsetBasedPageRequest(startIndex, count, sort), searchText, type);
} }
for (final SoftwareModule swModule : swModuleBeans) { return swModuleBeans.getContent().stream().map(this::getProxyBean).collect(Collectors.toList());
proxyBeans.add(getProxyBean(swModule));
}
return proxyBeans;
} }
private ProxyBaseSoftwareModuleItem getProxyBean(final SoftwareModule bean) { private ProxyBaseSoftwareModuleItem getProxyBean(final SoftwareModule bean) {
@@ -113,7 +110,7 @@ public class BaseSwModuleBeanQuery extends AbstractBeanQuery<ProxyBaseSoftwareMo
if (type == null && Strings.isNullOrEmpty(searchText)) { if (type == null && Strings.isNullOrEmpty(searchText)) {
size = getSoftwareManagementService().countSoftwareModulesAll(); size = getSoftwareManagementService().countSoftwareModulesAll();
} else { } else {
size = getSoftwareManagementService().countSoftwareModuleByFilters(searchText, type.getId()); size = getSoftwareManagementService().countSoftwareModuleByFilters(searchText, type);
} }
if (size > Integer.MAX_VALUE) { if (size > Integer.MAX_VALUE) {

View File

@@ -209,7 +209,7 @@ public class SoftwareModuleDetails extends AbstractNamedVersionedEntityTableDeta
@Override @Override
protected void showMetadata(final ClickEvent event) { protected void showMetadata(final ClickEvent event) {
final SoftwareModule swmodule = softwareManagement.findSoftwareModuleWithDetails(getSelectedBaseEntityId()); final SoftwareModule swmodule = softwareManagement.findSoftwareModuleById(getSelectedBaseEntityId());
/* display the window */ /* display the window */
UI.getCurrent().addWindow(swMetadataPopupLayout.getWindow(swmodule, null)); UI.getCurrent().addWindow(swMetadataPopupLayout.getWindow(swmodule, null));
} }

View File

@@ -245,7 +245,7 @@ public class SoftwareModuleTable extends AbstractNamedVersionTable<SoftwareModul
} }
private void showMetadataDetails(final Long itemId) { private void showMetadataDetails(final Long itemId) {
final SoftwareModule swmodule = softwareManagement.findSoftwareModuleWithDetails(itemId); final SoftwareModule swmodule = softwareManagement.findSoftwareModuleById(itemId);
/* display the window */ /* display the window */
UI.getCurrent().addWindow(swMetadataPopupLayout.getWindow(swmodule, null)); UI.getCurrent().addWindow(swMetadataPopupLayout.getWindow(swmodule, null));
} }

View File

@@ -71,7 +71,7 @@ public class SwMetadataPopupLayout extends AbstractMetadataPopupLayout<SoftwareM
@Override @Override
protected List<SoftwareModuleMetadata> getMetadataList() { protected List<SoftwareModuleMetadata> getMetadataList() {
return getSelectedEntity().getMetadata(); return softwareManagement.findSoftwareModuleMetadataBySoftwareModuleId(getSelectedEntity().getId());
} }
/** /**

View File

@@ -8,9 +8,10 @@
*/ */
package org.eclipse.hawkbit.ui.distributions.smtable; package org.eclipse.hawkbit.ui.distributions.smtable;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;
import org.eclipse.hawkbit.repository.OffsetBasedPageRequest; import org.eclipse.hawkbit.repository.OffsetBasedPageRequest;
import org.eclipse.hawkbit.repository.SoftwareManagement; import org.eclipse.hawkbit.repository.SoftwareManagement;
@@ -22,7 +23,6 @@ import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
import org.eclipse.hawkbit.ui.utils.SPDateTimeUtil; import org.eclipse.hawkbit.ui.utils.SPDateTimeUtil;
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions; import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
import org.eclipse.hawkbit.ui.utils.SpringContextHelper; import org.eclipse.hawkbit.ui.utils.SpringContextHelper;
import org.springframework.data.domain.Slice;
import org.vaadin.addons.lazyquerycontainer.AbstractBeanQuery; import org.vaadin.addons.lazyquerycontainer.AbstractBeanQuery;
import org.vaadin.addons.lazyquerycontainer.QueryDefinition; import org.vaadin.addons.lazyquerycontainer.QueryDefinition;
@@ -36,9 +36,9 @@ import com.google.common.base.Strings;
public class SwModuleBeanQuery extends AbstractBeanQuery<ProxyBaseSwModuleItem> { public class SwModuleBeanQuery extends AbstractBeanQuery<ProxyBaseSwModuleItem> {
private static final long serialVersionUID = 4362142538539335466L; private static final long serialVersionUID = 4362142538539335466L;
private transient SoftwareManagement softwareManagementService; private transient SoftwareManagement softwareManagementService;
private SoftwareModuleType type; private Long type;
private String searchText = null; private String searchText;
private Long orderByDistId = 0L; private Long orderByDistId;
/** /**
* Parametric Constructor. * Parametric Constructor.
@@ -56,7 +56,8 @@ public class SwModuleBeanQuery extends AbstractBeanQuery<ProxyBaseSwModuleItem>
final Object[] sortIds, final boolean[] sortStates) { final Object[] sortIds, final boolean[] sortStates) {
super(definition, queryConfig, sortIds, sortStates); super(definition, queryConfig, sortIds, sortStates);
if (HawkbitCommonUtil.isNotNullOrEmpty(queryConfig)) { if (HawkbitCommonUtil.isNotNullOrEmpty(queryConfig)) {
type = (SoftwareModuleType) queryConfig.get(SPUIDefinitions.BY_SOFTWARE_MODULE_TYPE); type = Optional.ofNullable((SoftwareModuleType) queryConfig.get(SPUIDefinitions.BY_SOFTWARE_MODULE_TYPE))
.map(type -> type.getId()).orElse(null);
searchText = (String) queryConfig.get(SPUIDefinitions.FILTER_BY_TEXT); searchText = (String) queryConfig.get(SPUIDefinitions.FILTER_BY_TEXT);
if (!Strings.isNullOrEmpty(searchText)) { if (!Strings.isNullOrEmpty(searchText)) {
searchText = String.format("%%%s%%", searchText); searchText = String.format("%%%s%%", searchText);
@@ -75,17 +76,10 @@ public class SwModuleBeanQuery extends AbstractBeanQuery<ProxyBaseSwModuleItem>
@Override @Override
protected List<ProxyBaseSwModuleItem> loadBeans(final int startIndex, final int count) { protected List<ProxyBaseSwModuleItem> loadBeans(final int startIndex, final int count) {
final Slice<AssignedSoftwareModule> swModuleBeans; return getSoftwareManagement()
final List<ProxyBaseSwModuleItem> proxyBeans = new ArrayList<>(); .findSoftwareModuleOrderBySetAssignmentAndModuleNameAscModuleVersionAsc(
new OffsetBasedPageRequest(startIndex, count), orderByDistId, searchText, type)
swModuleBeans = getSoftwareManagement().findSoftwareModuleOrderBySetAssignmentAndModuleNameAscModuleVersionAsc( .getContent().stream().map(this::getProxyBean).collect(Collectors.toList());
new OffsetBasedPageRequest(startIndex, count), orderByDistId, searchText, type.getId());
for (final AssignedSoftwareModule swModule : swModuleBeans) {
proxyBeans.add(getProxyBean(swModule));
}
return proxyBeans;
} }
private ProxyBaseSwModuleItem getProxyBean(final AssignedSoftwareModule customSoftwareModule) { private ProxyBaseSwModuleItem getProxyBean(final AssignedSoftwareModule customSoftwareModule) {
@@ -114,7 +108,7 @@ public class SwModuleBeanQuery extends AbstractBeanQuery<ProxyBaseSwModuleItem>
if (type == null && Strings.isNullOrEmpty(searchText)) { if (type == null && Strings.isNullOrEmpty(searchText)) {
size = getSoftwareManagement().countSoftwareModulesAll(); size = getSoftwareManagement().countSoftwareModulesAll();
} else { } else {
size = getSoftwareManagement().countSoftwareModuleByFilters(searchText, type.getId()); size = getSoftwareManagement().countSoftwareModuleByFilters(searchText, type);
} }
if (size > Integer.MAX_VALUE) { if (size > Integer.MAX_VALUE) {

View File

@@ -153,7 +153,7 @@ public class SwModuleDetails extends AbstractNamedVersionedEntityTableDetailsLay
if (getSelectedBaseEntity().getType().getMaxAssignments() == 1) { if (getSelectedBaseEntity().getType().getMaxAssignments() == 1) {
maxAssign = getI18n().get("label.singleAssign.type"); maxAssign = getI18n().get("label.singleAssign.type");
} else { } else {
maxAssign = getI18n().get("label.multiAssign.type"); maxAssign = getI18n().get("label.multiAssign.type");
} }
updateSwModuleDetailsLayout(getSelectedBaseEntity().getType().getName(), updateSwModuleDetailsLayout(getSelectedBaseEntity().getType().getName(),
getSelectedBaseEntity().getVendor(), maxAssign); getSelectedBaseEntity().getVendor(), maxAssign);
@@ -217,7 +217,7 @@ public class SwModuleDetails extends AbstractNamedVersionedEntityTableDetailsLay
@Override @Override
protected void showMetadata(final ClickEvent event) { protected void showMetadata(final ClickEvent event) {
final SoftwareModule swmodule = softwareManagement.findSoftwareModuleWithDetails(getSelectedBaseEntityId()); final SoftwareModule swmodule = softwareManagement.findSoftwareModuleById(getSelectedBaseEntityId());
UI.getCurrent().addWindow(swMetadataPopupLayout.getWindow(swmodule, null)); UI.getCurrent().addWindow(swMetadataPopupLayout.getWindow(swmodule, null));
} }
} }

View File

@@ -27,11 +27,11 @@ import org.eclipse.hawkbit.ui.distributions.event.DistributionsViewAcceptCriteri
import org.eclipse.hawkbit.ui.distributions.event.SaveActionWindowEvent; import org.eclipse.hawkbit.ui.distributions.event.SaveActionWindowEvent;
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState; import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil; import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions; import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions; import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions; import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
import org.eclipse.hawkbit.ui.utils.TableColumn; import org.eclipse.hawkbit.ui.utils.TableColumn;
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory; import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
import org.vaadin.addons.lazyquerycontainer.LazyQueryContainer; import org.vaadin.addons.lazyquerycontainer.LazyQueryContainer;
@@ -118,7 +118,7 @@ public class SwModuleTable extends AbstractNamedVersionTable<SoftwareModule, Lon
@EventBusListenerMethod(scope = EventScope.SESSION) @EventBusListenerMethod(scope = EventScope.SESSION)
void onEvent(final SaveActionWindowEvent event) { void onEvent(final SaveActionWindowEvent event) {
if (event == SaveActionWindowEvent.DELETE_ALL_SOFWARE) { if (event == SaveActionWindowEvent.DELETE_ALL_SOFWARE) {
UI.getCurrent().access(() -> refreshFilter()); UI.getCurrent().access(this::refreshFilter);
} }
} }
@@ -400,7 +400,7 @@ public class SwModuleTable extends AbstractNamedVersionTable<SoftwareModule, Lon
} }
private void showMetadataDetails(final Long itemId) { private void showMetadataDetails(final Long itemId) {
final SoftwareModule swmodule = softwareManagement.findSoftwareModuleWithDetails(itemId); final SoftwareModule swmodule = softwareManagement.findSoftwareModuleById(itemId);
UI.getCurrent().addWindow(swMetadataPopupLayout.getWindow(swmodule, null)); UI.getCurrent().addWindow(swMetadataPopupLayout.getWindow(swmodule, null));
} }