aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-be/src/main
diff options
context:
space:
mode:
authorMichael Lando <ml636r@att.com>2017-08-07 10:19:02 +0000
committerGerrit Code Review <gerrit@onap.org>2017-08-07 10:19:02 +0000
commit976626d62ae4f55f9d9f0e96bc954102dd38e726 (patch)
tree881b58240dd6add92d01ac140f89c305fa0cda06 /catalog-be/src/main
parent3b1119ca51ea0de0ff28b76b916fa8b0cba54fcf (diff)
parentb2c60183d5d654b945a24ec5564807e4f691c6e8 (diff)
Merge "[SDC] code sync"
Diffstat (limited to 'catalog-be/src/main')
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogic.java31
1 files changed, 14 insertions, 17 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogic.java
index 902bc8a298..61f0c02d10 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogic.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogic.java
@@ -619,7 +619,7 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic {
}
return Either.left(new ImmutablePair<String, byte[]>(csarArtifact.getArtifactName(), generated.left().value()));
}
- return downloadArtifact(csarArtifact);
+ return downloadArtifact(csarArtifact, component);
}
public Either<ImmutablePair<String, byte[]>, ResponseFormat> handleDownloadRequestById(String componentId, String artifactId, String userId, ComponentTypeEnum componentType, String parentId, String containerComponentType) {
@@ -640,7 +640,7 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic {
if (artifactDefinition.getPayloadData() != null) {
return Either.left(new ImmutablePair<String, byte[]>(artifactDefinition.getArtifactName(), artifactDefinition.getPayloadData()));
}
- return downloadArtifact(artifactDefinition);
+ return downloadArtifact(artifactDefinition, null);
}
public Either<Map<String, ArtifactDefinition>, ResponseFormat> handleGetArtifactsByType(String containerComponentType, String parentId, ComponentTypeEnum componentType, String componentId, String artifactGroupType, String userId) {
@@ -1526,14 +1526,8 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic {
handleAuditing(auditingAction, parent, componentId, user, null, null, artifactId, responseFormat, componentType, null);
return Either.right(responseFormat);
}
- if(artifactDefinition.getPayloadData() == null) {
- log.debug("Empty payload data returned from DB by artifat id {}", artifactId);
- ResponseFormat responseFormat = componentsUtils.getResponseFormat(ActionStatus.ARTIFACT_NOT_FOUND, artifactId);
- handleAuditing(auditingAction, parent, componentId, user, null, null, artifactId, responseFormat, componentType, null);
- return Either.right(responseFormat);
- }
- Either<ArtifactDefinition, Operation> insideEither = Either.left(artifactDefinition);
+ Either<ArtifactDefinition, Operation> insideEither = Either.left(artifactDefinition);
ResponseFormat responseFormat = componentsUtils.getResponseFormat(ActionStatus.OK);
handleAuditing(auditingAction, parent, componentId, user, artifactDefinition, null, artifactId, responseFormat, componentType, null);
return Either.left(insideEither);
@@ -3008,7 +3002,7 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic {
}
// Downloading the artifact
- Either<ImmutablePair<String, byte[]>, ResponseFormat> downloadArtifactEither = downloadArtifact(deploymentArtifact);
+ Either<ImmutablePair<String, byte[]>, ResponseFormat> downloadArtifactEither = downloadArtifact(deploymentArtifact, null);
if (downloadArtifactEither.isRight()) {
log.debug("Download artifact {} failed", artifactName);
return Either.right(downloadArtifactEither.right().value());
@@ -3069,7 +3063,7 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic {
log.debug("Found deployment artifact {}", artifactName);
deployableArtifact = artifacts.values().stream().filter(filterArtifactByName).findFirst().get();
// Downloading the artifact
- Either<ImmutablePair<String, byte[]>, ResponseFormat> downloadArtifactEither = downloadArtifact(deployableArtifact);
+ Either<ImmutablePair<String, byte[]>, ResponseFormat> downloadArtifactEither = downloadArtifact(deployableArtifact, service );
if (downloadArtifactEither.isRight()) {
log.debug("Download artifact {} failed", artifactName);
@@ -3174,7 +3168,7 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic {
}
log.debug("Found deployment artifact {}", normalizedArtifactName);
// Downloading the artifact
- Either<ImmutablePair<String, byte[]>, ResponseFormat> downloadArtifactEither = downloadArtifact(foundArtifactOptl.get());
+ Either<ImmutablePair<String, byte[]>, ResponseFormat> downloadArtifactEither = downloadArtifact(foundArtifactOptl.get(), service);
if (downloadArtifactEither.isRight()) {
log.debug("Download artifact {} failed", normalizedArtifactName);
return Either.right(downloadArtifactEither.right().value());
@@ -3197,7 +3191,7 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic {
return Either.right(componentsUtils.getResponseFormat(ActionStatus.ARTIFACT_NOT_FOUND, ""));
}
- return downloadArtifact(artifactDefinition);
+ return downloadArtifact(artifactDefinition, null);
}
private boolean checkArtifactInComponent(org.openecomp.sdc.be.model.Component component, String artifactId) {
@@ -3377,7 +3371,7 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic {
return auditingAction;
}
- private Either<ImmutablePair<String, byte[]>, ResponseFormat> downloadArtifact(ArtifactDefinition artifactDefinition) {
+ private Either<ImmutablePair<String, byte[]>, ResponseFormat> downloadArtifact(ArtifactDefinition artifactDefinition, Component component) {
String esArtifactId = artifactDefinition.getEsId();
Either<ESArtifactData, CassandraOperationStatus> artifactfromES = artifactCassandraDao.getArtifact(esArtifactId);
if (artifactfromES.isRight()) {
@@ -3385,7 +3379,10 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic {
StorageOperationStatus storageResponse = DaoStatusConverter.convertCassandraStatusToStorageStatus(resourceUploadStatus);
ActionStatus actionStatus = componentsUtils.convertFromStorageResponse(storageResponse);
log.debug("Error when getting artifact from ES, error: {}", actionStatus.name());
- return Either.right(componentsUtils.getResponseFormatByArtifactId(actionStatus, artifactDefinition.getArtifactDisplayName()));
+ ResponseFormat responseFormat = componentsUtils.getResponseFormatByArtifactId(actionStatus, artifactDefinition.getArtifactDisplayName());
+ handleAuditing(AuditingActionEnum.DOWNLOAD_ARTIFACT, component, null, null, artifactDefinition, null, artifactDefinition.getArtifactUUID(), responseFormat, null, null);
+
+ return Either.right(responseFormat);
}
ESArtifactData esArtifactData = artifactfromES.left().value();
@@ -3871,7 +3868,7 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic {
}
}
}
- currArtifact.setHeatParamsUpdateDate(System.currentTimeMillis());
+ //currArtifact.setHeatParamsUpdateDate(System.currentTimeMillis());
currArtifact.setListHeatParameters(currentHeatEnvParams);
Either<ArtifactDefinition, StorageOperationStatus> updateArifactRes = artifactToscaOperation.updateArifactOnResource(currArtifact, parent.getUniqueId(), currArtifact.getUniqueId(), componentType.getNodeType(), componentId);
@@ -4783,7 +4780,7 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic {
}
if (errorWrapper.isEmpty()) {
deploymentArtifact = artifactsList.get(0);
- downloadArtifactEither = downloadArtifact(deploymentArtifact);
+ downloadArtifactEither = downloadArtifact(deploymentArtifact, null);
if (downloadArtifactEither.isRight()) {
log.debug("Failed to download artifact {}. ", deploymentArtifact.getArtifactName());
errorWrapper.setInnerElement(downloadArtifactEither.right().value());