diff options
author | ayalaben <ayala.benzvi@amdocs.com> | 2018-07-22 15:39:00 +0300 |
---|---|---|
committer | ayalaben <ayala.benzvi@amdocs.com> | 2018-07-22 15:39:00 +0300 |
commit | ad596fe3499e28070dcdff886dd3a8113780e220 (patch) | |
tree | ccdf3eb0af3f3af4addf5389597e767d0c85e365 /workflow | |
parent | 2b995d1eeb30216170afc41c279269d1344c7205 (diff) |
Logging
Change-Id: I28395f345a26992adac5e1f32dea97979dc3b3dc
Issue-ID: SDC-1518
Signed-off-by: ayalaben <ayala.benzvi@amdocs.com>
Diffstat (limited to 'workflow')
2 files changed, 24 insertions, 2 deletions
diff --git a/workflow/workflow-designer-be/src/main/java/org/onap/sdc/workflow/services/impl/WorkflowManagerImpl.java b/workflow/workflow-designer-be/src/main/java/org/onap/sdc/workflow/services/impl/WorkflowManagerImpl.java index 2cb897fe..97d81689 100644 --- a/workflow/workflow-designer-be/src/main/java/org/onap/sdc/workflow/services/impl/WorkflowManagerImpl.java +++ b/workflow/workflow-designer-be/src/main/java/org/onap/sdc/workflow/services/impl/WorkflowManagerImpl.java @@ -15,6 +15,8 @@ import org.onap.sdc.workflow.services.WorkflowManager; import org.onap.sdc.workflow.services.WorkflowNameComparator; import org.onap.sdc.workflow.services.exceptions.EntityNotFoundException; import org.onap.sdc.workflow.services.impl.mappers.WorkflowMapper; +import org.openecomp.sdc.logging.api.Logger; +import org.openecomp.sdc.logging.api.LoggerFactory; import org.openecomp.sdc.versioning.ItemManager; import org.openecomp.sdc.versioning.types.Item; import org.openecomp.sdc.versioning.types.ItemStatus; @@ -35,6 +37,7 @@ public class WorkflowManagerImpl implements WorkflowManager { private final ItemManager itemManager; private final UniqueValueService uniqueValueService; private final WorkflowMapper workflowMapper; + private static final Logger LOGGER = LoggerFactory.getLogger(WorkflowManagerImpl.class); @Autowired public WorkflowManagerImpl(ItemManager itemManager, @@ -56,6 +59,7 @@ public class WorkflowManagerImpl implements WorkflowManager { public Workflow get(Workflow workflow) { Item retrievedItem = itemManager.get(workflow.getId()); if (retrievedItem == null) { + LOGGER.error(String.format("Workflow with id %s was not found",workflow.getId())); throw new EntityNotFoundException(String.format(WORKFLOW_NOT_FOUND_ERROR_MSG, workflow.getId())); } return this.workflowMapper.itemToWorkflow(retrievedItem); @@ -76,6 +80,7 @@ public class WorkflowManagerImpl implements WorkflowManager { public void update(Workflow workflow) { Item retrievedItem = itemManager.get(workflow.getId()); if (retrievedItem == null) { + LOGGER.error(String.format("Workflow with id %s was not found",workflow.getId())); throw new EntityNotFoundException(String.format(WORKFLOW_NOT_FOUND_ERROR_MSG, workflow.getId())); } diff --git a/workflow/workflow-designer-be/src/main/java/org/onap/sdc/workflow/services/impl/WorkflowVersionManagerImpl.java b/workflow/workflow-designer-be/src/main/java/org/onap/sdc/workflow/services/impl/WorkflowVersionManagerImpl.java index 0f88d37f..de9c8dd3 100644 --- a/workflow/workflow-designer-be/src/main/java/org/onap/sdc/workflow/services/impl/WorkflowVersionManagerImpl.java +++ b/workflow/workflow-designer-be/src/main/java/org/onap/sdc/workflow/services/impl/WorkflowVersionManagerImpl.java @@ -31,6 +31,8 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.StringUtils; import org.springframework.web.multipart.MultipartFile; +import org.openecomp.sdc.logging.api.Logger; +import org.openecomp.sdc.logging.api.LoggerFactory; @Service("workflowVersionManager") public class WorkflowVersionManagerImpl implements WorkflowVersionManager { @@ -41,7 +43,7 @@ public class WorkflowVersionManagerImpl implements WorkflowVersionManager { private final ParameterRepository parameterRepository; private final VersionMapper versionMapper; private final VersionStateMapper versionStateMapper; - + private static final Logger LOGGER = LoggerFactory.getLogger(WorkflowVersionManagerImpl.class); @Autowired public WorkflowVersionManagerImpl(VersioningManager versioningManager, ArtifactRepository artifactRepository, @@ -130,6 +132,9 @@ public class WorkflowVersionManagerImpl implements WorkflowVersionManager { WorkflowVersionState retrievedState = versionStateMapper.versionStatusToWorkflowVersionState(retrievedVersion.getStatus()); if (WorkflowVersionState.CERTIFIED.equals(retrievedState) || retrievedState.equals(state)) { + LOGGER.error(String.format( + "Workflow Version is certified and can not be edited.Workflow id %s and version id %s", workflowId, + versionId)); throw new VersionStateModificationException(workflowId, versionId, retrievedState, state); } @@ -144,6 +149,8 @@ public class WorkflowVersionManagerImpl implements WorkflowVersionManager { Version retrievedVersion = getVersion(workflowId, versionId); if (WorkflowVersionState.CERTIFIED .equals(versionStateMapper.versionStatusToWorkflowVersionState(retrievedVersion.getStatus()))) { + LOGGER.error(String.format("Workflow Version Artifact was not found for workflow id %s and version id %s", + workflowId, versionId)); throw new VersionModificationException(workflowId, versionId); } @@ -154,6 +161,8 @@ public class WorkflowVersionManagerImpl implements WorkflowVersionManager { versioningManager.publish(workflowId, new Version(versionId), "Update Artifact"); } catch (IOException e) { + LOGGER.error(String.format("Upload Artifact failed for workflow id %s and version id %s", + workflowId, versionId),e); throw new InvalidArtifactException(e.getMessage()); } } @@ -163,8 +172,10 @@ public class WorkflowVersionManagerImpl implements WorkflowVersionManager { getVersion(workflowId, versionId); Optional<ArtifactEntity> artifactOptional = artifactRepository.get(workflowId, versionId); if (!artifactOptional.isPresent()) { + LOGGER.error(String.format("Workflow Version Artifact was not found for workflow id %s and version id %s", + workflowId, versionId)); throw new EntityNotFoundException( - String.format("Artifact for workflow id %S version id %S was not found", workflowId, versionId)); + String.format("Artifact for workflow id %S version id %S was not found", workflowId, versionId)); } return artifactOptional.get(); } @@ -173,6 +184,9 @@ public class WorkflowVersionManagerImpl implements WorkflowVersionManager { public void deleteArtifact(String workflowId, String versionId) { WorkflowVersion retrievedVersion = get(workflowId, versionId); if (WorkflowVersionState.CERTIFIED.equals(retrievedVersion.getState())) { + LOGGER.error(String.format( + "Workflow Version is certified and can not be edited.Workflow id %s and version id %s", workflowId, + versionId)); throw new VersionModificationException(workflowId, versionId); } @@ -198,6 +212,9 @@ public class WorkflowVersionManagerImpl implements WorkflowVersionManager { } return version; } catch (Exception e) { + LOGGER.error(String.format( + "Workflow Version was not found.Workflow id %s and version id %s", workflowId, + versionId),e); throw new EntityNotFoundException(String.format(VERSION_NOT_EXIST_MSG, versionId, workflowId)); } } |