Skip to content

Commit

Permalink
pr review comments
Browse files Browse the repository at this point in the history
Signed-off-by: mehab <[email protected]>
  • Loading branch information
mehab committed Oct 6, 2023
1 parent 6fb2abf commit b4e7579
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import javax.jdo.Transaction;
import java.sql.SQLException;
import java.util.Date;
import java.util.Optional;

/**
* A {@link Processor} responsible for processing result of component repository meta analyses.
Expand Down Expand Up @@ -162,19 +163,19 @@ private IntegrityMetaComponent synchronizeIntegrityMetaResult(final Record<Strin
if (result.hasIntegrityMeta()) {
if (result.getIntegrityMeta().hasMd5() || result.getIntegrityMeta().hasSha1() || result.getIntegrityMeta().hasSha256()
|| result.getIntegrityMeta().hasSha512() || result.getIntegrityMeta().hasCurrentVersionPublished()) {
persistentIntegrityMetaComponent.setMd5(result.getIntegrityMeta().getMd5());
persistentIntegrityMetaComponent.setSha256(result.getIntegrityMeta().getSha256());
persistentIntegrityMetaComponent.setSha1(result.getIntegrityMeta().getSha1());
persistentIntegrityMetaComponent.setSha512(result.getIntegrityMeta().getSha512());
Optional.ofNullable(result.getIntegrityMeta().getMd5()).ifPresent(persistentIntegrityMetaComponent::setMd5);
Optional.ofNullable(result.getIntegrityMeta().getSha1()).ifPresent(persistentIntegrityMetaComponent::setSha1);
Optional.ofNullable(result.getIntegrityMeta().getSha256()).ifPresent(persistentIntegrityMetaComponent::setSha256);
Optional.ofNullable(result.getIntegrityMeta().getSha512()).ifPresent(persistentIntegrityMetaComponent::setSha512);
persistentIntegrityMetaComponent.setPurl(result.getComponent().getPurl());
persistentIntegrityMetaComponent.setRepositoryUrl(result.getIntegrityMeta().getIntegrityMetaSourceUrl());
persistentIntegrityMetaComponent.setPublishedAt(new Date(result.getIntegrityMeta().getCurrentVersionPublished().getSeconds() * 1000));
persistentIntegrityMetaComponent.setPublishedAt(result.getIntegrityMeta().hasCurrentVersionPublished() ? new Date(result.getIntegrityMeta().getCurrentVersionPublished().getSeconds() * 1000) : null);
persistentIntegrityMetaComponent.setStatus(FetchStatus.PROCESSED);
} else {
persistentIntegrityMetaComponent.setMd5("");
persistentIntegrityMetaComponent.setSha256("");
persistentIntegrityMetaComponent.setSha1("");
persistentIntegrityMetaComponent.setSha512("");
persistentIntegrityMetaComponent.setMd5(null);
persistentIntegrityMetaComponent.setSha256(null);
persistentIntegrityMetaComponent.setSha1(null);
persistentIntegrityMetaComponent.setSha512(null);
persistentIntegrityMetaComponent.setPurl(purl.toString());
persistentIntegrityMetaComponent.setRepositoryUrl(result.getIntegrityMeta().getIntegrityMetaSourceUrl());
persistentIntegrityMetaComponent.setStatus(FetchStatus.NOT_AVAILABLE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ message IntegrityMeta {
optional string sha1 = 2;
optional string sha256 = 3;
optional string sha512 = 4;
string integrity_meta_source_url = 5;
// When the component current version last modified.
optional google.protobuf.Timestamp current_version_published = 6;
optional google.protobuf.Timestamp current_version_last_modified = 5;
string meta_source_url = 6;
}

message Component {
Expand Down

0 comments on commit b4e7579

Please sign in to comment.