@@ -50,9 +50,6 @@ public class GithubQueries {
5050 private static final TypeReference <@ NotNull List <ProjectDocumentation >> DOCUMENTATION_LIST = new TypeReference <>() {
5151 };
5252
53- private static final TypeReference <List <ProjectSupport >> SUPPORT_LIST = new TypeReference <>() {
54- };
55-
5653 private static final String GITHUB_URI = "https://api.github.com/repos/spring-io/spring-website-content/contents" ;
5754
5855 private static final Logger logger = LoggerFactory .getLogger (GithubOperations .class );
@@ -85,28 +82,28 @@ public GithubQueries(RestTemplateBuilder restTemplateBuilder, ObjectMapper objec
8582 ProjectData getData () {
8683 Map <String , Project > projects = new LinkedHashMap <>();
8784 Map <String , List <ProjectDocumentation >> documentation = new LinkedHashMap <>();
88- Map <String , List < ProjectSupport >> support = new LinkedHashMap <>();
85+ Map <String , ProjectGeneration > generation = new LinkedHashMap <>();
8986 Map <String , String > supportPolicy = new LinkedHashMap <>();
9087 try {
9188 RequestEntity <Void > request = RequestEntity .get ("/project?ref=" + this .branch ).build ();
9289 ResponseEntity <List <Map <String , Object >>> exchange = this .restTemplate .exchange (request ,
9390 STRING_OBJECT_MAP_LIST );
9491 InvalidGithubResponseException .throwIfInvalid (exchange );
9592 List <Map <String , Object >> body = exchange .getBody ();
96- body .forEach ((project ) -> populateData (project , projects , documentation , support , supportPolicy ));
93+ body .forEach ((project ) -> populateData (project , projects , documentation , generation , supportPolicy ));
9794 }
9895 catch (Exception ex ) {
9996 logger .debug ("Could not get projects due to '%s'" .formatted (ex .getMessage ()));
10097 // Return empty list
10198 }
102- return new ProjectData (projects , documentation , support , supportPolicy );
99+ return new ProjectData (projects , documentation , generation , supportPolicy );
103100 }
104101
105102 ProjectData updateData (ProjectData data , List <String > changes ) {
106103 Assert .notNull (data , "Project data should not be null" );
107104 Map <String , Project > projects = new LinkedHashMap <>(data .project ());
108105 Map <String , List <ProjectDocumentation >> documentation = new LinkedHashMap <>(data .documentation ());
109- Map <String , List < ProjectSupport >> support = new LinkedHashMap <>(data .support ());
106+ Map <String , ProjectGeneration > generation = new LinkedHashMap <>(data .generation ());
110107 Map <String , String > supportPolicy = new LinkedHashMap <>(data .supportPolicy ());
111108 Map <String , Boolean > checkedProjects = new LinkedHashMap <>();
112109 try {
@@ -115,18 +112,18 @@ ProjectData updateData(ProjectData data, List<String> changes) {
115112 if (ProjectFile .OTHER .equals (file )) {
116113 return ;
117114 }
118- updateData (change , file , projects , supportPolicy , documentation , support , checkedProjects );
115+ updateData (change , file , projects , supportPolicy , documentation , generation , checkedProjects );
119116 });
120117 }
121118 catch (Exception ex ) {
122119 logger .debug ("Could not update data due to '%s'" .formatted (ex .getMessage ()));
123120 }
124- return new ProjectData (projects , documentation , support , supportPolicy );
121+ return new ProjectData (projects , documentation , generation , supportPolicy );
125122 }
126123
127124 private void updateData (String change , ProjectFile file , Map <String , Project > projects ,
128125 Map <String , String > supportPolicy , Map <String , List <ProjectDocumentation >> documentation ,
129- Map <String , List < ProjectSupport >> support , Map <String , Boolean > checkedprojects ) {
126+ Map <String , ProjectGeneration > generation , Map <String , Boolean > checkedprojects ) {
130127 Matcher matcher = PROJECT_FILE .matcher (change );
131128 if (!matcher .matches ()) {
132129 return ;
@@ -138,18 +135,18 @@ private void updateData(String change, ProjectFile file, Map<String, Project> pr
138135 if (checkedprojects .get (slug )) {
139136 updateFromIndex (file , projects , supportPolicy , slug );
140137 updateDocumentation (file , documentation , slug );
141- updateSupport (file , support , slug );
138+ updateGeneration (file , generation , slug );
142139 return ;
143140 }
144141 projects .remove (slug );
145142 documentation .remove (slug );
146- support .remove (slug );
143+ generation .remove (slug );
147144 supportPolicy .remove (slug );
148145 }
149146
150- private void updateSupport (ProjectFile file , Map <String , List < ProjectSupport > > support , String slug ) {
147+ private void updateGeneration (ProjectFile file , Map <String , ProjectGeneration > support , String slug ) {
151148 if (ProjectFile .SUPPORT .equals (file )) {
152- List < ProjectSupport > projectSupports = getProjectSupports (slug );
149+ ProjectGeneration projectSupports = getProjectSupports (slug );
153150 support .put (slug , projectSupports );
154151 }
155152 }
@@ -192,7 +189,7 @@ private boolean doesProjectExist(String projectSlug) {
192189 }
193190
194191 private void populateData (Map <String , Object > project , Map <String , Project > projects ,
195- Map <String , List <ProjectDocumentation >> documentation , Map <String , List < ProjectSupport > > support ,
192+ Map <String , List <ProjectDocumentation >> documentation , Map <String , ProjectGeneration > support ,
196193 Map <String , String > supportPolicy ) {
197194 String projectSlug = (String ) project .get ("name" );
198195 ResponseEntity <Map <String , Object >> response = getFile (projectSlug , "index.md" );
@@ -202,7 +199,7 @@ private void populateData(Map<String, Object> project, Map<String, Project> proj
202199 }
203200 List <ProjectDocumentation > projectDocumentations = getProjectDocumentations (projectSlug );
204201 documentation .put (projectSlug , projectDocumentations );
205- List < ProjectSupport > projectSupports = getProjectSupports (projectSlug );
202+ ProjectGeneration projectSupports = getProjectSupports (projectSlug );
206203 support .put (projectSlug , projectSupports );
207204 String policy = getProjectSupportPolicy (response , projectSlug );
208205 supportPolicy .put (projectSlug , policy );
@@ -234,16 +231,17 @@ private List<ProjectDocumentation> getProjectDocumentations(String projectSlug)
234231 return Collections .emptyList ();
235232 }
236233
237- private List < ProjectSupport > getProjectSupports (String projectSlug ) {
234+ private ProjectGeneration getProjectSupports (String projectSlug ) {
238235 try {
239- ResponseEntity <Map <String , Object >> response = getFile (projectSlug , "support .json" );
236+ ResponseEntity <Map <String , Object >> response = getFile (projectSlug , "generations .json" );
240237 String contents = getFileContent (response );
241- return List . copyOf ( readValue (contents , SUPPORT_LIST ) );
238+ return this . objectMapper . readValue (contents , ProjectGeneration . class );
242239 }
243240 catch (Exception ex ) {
244- logger .debug ("Could not get project support for '%s' due to '%s'" .formatted (projectSlug , ex .getMessage ()));
241+ logger
242+ .debug ("Could not get project generation for '%s' due to '%s'" .formatted (projectSlug , ex .getMessage ()));
245243 }
246- return Collections .emptyList ();
244+ return new ProjectGeneration ( Collections .emptyList () );
247245 }
248246
249247 private String getProjectSupportPolicy (ResponseEntity <Map <String , Object >> response , String projectSlug ) {
@@ -255,7 +253,7 @@ private String getProjectSupportPolicy(ResponseEntity<Map<String, Object>> respo
255253 return (supportPolicy != null ) ? supportPolicy : DEFAULT_SUPPORT_POLICY ;
256254 }
257255 catch (Exception ex ) {
258- logger .debug ("Could not get project support policy for '%s' due to '%s'" .formatted (projectSlug ,
256+ logger .debug ("Could not get project generation policy for '%s' due to '%s'" .formatted (projectSlug ,
259257 ex .getMessage ()));
260258 }
261259 return DEFAULT_SUPPORT_POLICY ;
@@ -300,7 +298,7 @@ static ProjectFile from(String fileName) {
300298 if (fileName .contains ("documentation.json" )) {
301299 return DOCUMENTATION ;
302300 }
303- if (fileName .contains ("support .json" )) {
301+ if (fileName .contains ("generations .json" )) {
304302 return SUPPORT ;
305303 }
306304 return OTHER ;
0 commit comments