Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public final class RallyConstants {
public static final String NAME = "name";
public static final String ERROR_NOTIFICATION_SUBJECT_KEY = "errorInJiraProcessor";
public static final String ERROR_MAIL_TEMPLATE_KEY = "Error_In_Jira_Processor";
public static final String HIERARCHY_REVISION_HISTORY = "HierarchyRevisionHistory";

static {
ISSUE_FIELD_SET.add("*all,-attachment,-worklog,-comment,-votes,-watches");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/*******************************************************************************
* Copyright 2014 CapitalOne, LLC.
* Further development Copyright 2022 Sapient Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
******************************************************************************/
package com.publicissapient.kpidashboard.rally.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.publicissapient.kpidashboard.rally.model.ReleaseDataResponse;
import com.publicissapient.kpidashboard.rally.service.ReleaseDataService;

import lombok.extern.slf4j.Slf4j;

/**
* REST API controller for fetching Rally Release data for frequency calculation
*/
@RestController
@RequestMapping("/rally/release")
@Slf4j
public class ReleaseFrequencyController {

private final ReleaseDataService releaseDataService;

/**
* Constructor for dependency injection
*
* @param releaseDataService Service for handling release data operations
*/
@Autowired
public ReleaseFrequencyController(ReleaseDataService releaseDataService) {
this.releaseDataService = releaseDataService;
}

/**
* Fetch release data from Rally for a project
* This endpoint fetches release data from Rally and stores it in the project_release collection
*
* @param projectId Project ID
* @return Response containing success message or error details
*/
@GetMapping("/fetch-data")
public ResponseEntity<ReleaseDataResponse> fetchReleaseData(@RequestParam String projectId) {
log.info("Received request to fetch release data for project ID: {}", projectId);
return releaseDataService.fetchAndProcessReleaseData(projectId);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ public class RallyProcessorJob {
@Autowired
SprintReportTasklet sprintReportTasklet;

@Autowired
SprintReportDataTasklet sprintReportDataTasklet;

@Autowired
ScrumReleaseDataTasklet scrumReleaseDataTasklet;

Expand Down Expand Up @@ -110,7 +113,7 @@ private Step scrumReleaseDataStep() {
@Bean
public Job fetchIssueScrumRqlJob(@Qualifier("fetchIssueSprintJob") Job fetchIssueScrumRqlJob) {
return builderFactory.getJobBuilder("FetchIssueScrum RQL Job", jobRepository).incrementer(new RunIdIncrementer())
.start(metaDataStep()).next(processProjectStatusStep()).next(fetchIssueScrumRqlChunkStep())
.start(metaDataStep()).next(processProjectStatusStep()).next(fetchIssueScrumRqlChunkStep()).next(fetchSprintDataStep())
.next(scrumReleaseDataStep()).listener(jobListenerScrum).build();
}

Expand All @@ -120,6 +123,10 @@ private Step fetchIssueScrumRqlChunkStep() {
.<ReadData, CompositeResult>chunk(getChunkSize(), this.transactionManager).reader(issueRqlReader)
.processor(issueScrumProcessor).writer(issueScrumWriter).listener(jiraIssueJqlWriterListener).build();
}
private Step fetchSprintDataStep() {
return builderFactory.getStepBuilder("Fetch Sprint Data", jobRepository)
.tasklet(sprintReportDataTasklet, transactionManager).listener(jobStepProgressListener).build();
}

/**
* This method is setup job for fetching sprint details based on sprint id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,14 @@
package com.publicissapient.kpidashboard.rally.model;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import lombok.Data;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
* @author girpatha
*/
Expand Down Expand Up @@ -58,5 +62,10 @@ public class HierarchicalRequirement {
private String objectID;
private String currentIteration;
private List<String> pastIterations; // Track spillover
@JsonProperty("RevisionHistory")
private Map<String, String> revisionHistory;
@JsonProperty("Description")
private String description;
private Map<String, Object> additionalProperties = new HashMap<>();
// Add a field to store linked defects
}
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
package com.publicissapient.kpidashboard.rally.model;

import org.joda.time.DateTime;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
/**
* @author girpatha
*/
@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class RallyReleaseResponse {
@JsonProperty("QueryResult")
private QueryResult queryResult;

@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public static class QueryResult {
@JsonProperty("_rallyAPIMajor")
private String rallyAPIMajor;
Expand All @@ -33,6 +35,7 @@ public static class QueryResult {
}

@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public static class Release {
@JsonProperty("_rallyAPIMajor")
private String rallyAPIMajor;
Expand All @@ -53,9 +56,9 @@ public static class Release {
@JsonProperty("Description")
private String description;
@JsonProperty("ReleaseStartDate")
private DateTime releaseStartDate;
private String releaseStartDate;
@JsonProperty("ReleaseDate")
private DateTime releaseDate;
private String releaseDate;
@JsonProperty("State")
private String state;
@JsonProperty("Project")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/*******************************************************************************
* Copyright 2014 CapitalOne, LLC.
* Further development Copyright 2022 Sapient Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
******************************************************************************/
package com.publicissapient.kpidashboard.rally.model;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
* Response model for release data operations
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ReleaseDataResponse {

private String message;
private String error;
private boolean success;

/**
* Create a success response
*
* @param message Success message
* @return ReleaseDataResponse with success flag set to true
*/
public static ReleaseDataResponse success(String message) {
return ReleaseDataResponse.builder()
.message(message)
.success(true)
.build();
}

/**
* Create an error response
*
* @param errorMessage Error message
* @return ReleaseDataResponse with success flag set to false
*/
public static ReleaseDataResponse error(String errorMessage) {
return ReleaseDataResponse.builder()
.error(errorMessage)
.success(false)
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,12 @@
package com.publicissapient.kpidashboard.rally.processor;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;

import com.publicissapient.kpidashboard.rally.model.CompositeResult;
import com.publicissapient.kpidashboard.rally.model.HierarchicalRequirement;
import com.publicissapient.kpidashboard.rally.model.ReadData;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
Expand Down Expand Up @@ -59,14 +62,17 @@ public class IssueScrumProcessor implements ItemProcessor<ReadData, CompositeRes
@Autowired
private SprintDataProcessor sprintDataProcessor;

List<HierarchicalRequirement> hierarchicalRequirements = new ArrayList<>();

/*
* (non-Javadoc)
*
* @see org.springframework.batch.item.ItemProcessor#process(java.lang.Object)
*/
@Override
public CompositeResult process(ReadData readData) throws Exception {
log.debug("Scrum processing started for the project : {}", readData.getProjectConfFieldMapping().getProjectName());
log.debug("Scrum processing started for the project : {}",
readData.getProjectConfFieldMapping().getProjectName());
CompositeResult compositeResult = null;
JiraIssue jiraIssue = convertIssueToJiraIssue(readData);
if (null != jiraIssue) {
Expand Down
Loading