Skip to content

Commit

Permalink
Merge pull request #224 from overture-stack/develop
Browse files Browse the repository at this point in the history
Release Candidate 3.11.0
  • Loading branch information
Buwujiu authored Jan 21, 2022
2 parents 3d49354 + 5e46213 commit af62bc7
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .mvn/maven.config
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
-Drevision=3.10.0
-Drevision=3.11.0
-Dsha1=
-Dchangelist=-SNAPSHOT
Original file line number Diff line number Diff line change
Expand Up @@ -146,17 +146,24 @@ private List<AnalysisCentricDocument> getAnalysisCentricDocuments(
private UpdateRequest mapAnalysisToUpsertRepositoryQuery(
AnalysisCentricDocument analysisCentricDocument) {
val mapper = new ObjectMapper().setPropertyNamingStrategy(PropertyNamingStrategy.SNAKE_CASE);

val paramsBuilder = new HashMap<String, Object>();
paramsBuilder.put(
"repository",
mapper.convertValue(analysisCentricDocument.getRepositories().get(0), Map.class));
paramsBuilder.put("analysis_state", analysisCentricDocument.getAnalysisState());
paramsBuilder.put("updated_at", getDateIso(analysisCentricDocument.getUpdatedAt()));
if (analysisCentricDocument.getPublishedAt()
!= null) { // Nullable as may not have been published

if (analysisCentricDocument.getPublishedAt() != null) {
// Nullable as may not have been published
paramsBuilder.put("published_at", getDateIso(analysisCentricDocument.getPublishedAt()));
}

if (analysisCentricDocument.getFirstPublishedAt() != null) {
paramsBuilder.put(
"first_published_at", getDateIso(analysisCentricDocument.getFirstPublishedAt()));
}

val parameters = unmodifiableMap(paramsBuilder);
val inline = getInline(parameters);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,12 +277,19 @@ private UpdateRequest mapFileToUpsertRepositoryQuery(FileCentricDocument fileCen
"repository", mapper.convertValue(fileCentricDocument.getRepositories().get(0), Map.class));
paramsBuilder.put("analysis_state", fileCentricDocument.getAnalysis().getAnalysisState());
paramsBuilder.put("updated_at", getDateIso(fileCentricDocument.getAnalysis().getUpdatedAt()));
if (fileCentricDocument.getAnalysis().getPublishedAt()
!= null) { // Nullable as may not have been published

if (fileCentricDocument.getAnalysis().getPublishedAt() != null) {
// Nullable as may not have been published
paramsBuilder.put(
"published_at", getDateIso(fileCentricDocument.getAnalysis().getPublishedAt()));
}

if (fileCentricDocument.getAnalysis().getFirstPublishedAt() != null) {
paramsBuilder.put(
"first_published_at",
getDateIso(fileCentricDocument.getAnalysis().getFirstPublishedAt()));
}

val parameters = unmodifiableMap(paramsBuilder);
val inline = getInlineForFile(parameters);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,8 @@ public static Script getInline(Map<String, Object> parameters) {
"if (!ctx._source.repositories.contains(params.repository)) { ctx._source.repositories.add(params.repository) } \n"
+ "ctx._source.analysis_state = params.analysis_state;\n"
+ "ctx._source.updated_at = ZonedDateTime.parse(params.updated_at).toInstant().toEpochMilli();\n"
+ "if (params.published_at != null) { ctx._source.published_at = ZonedDateTime.parse(params.published_at).toInstant().toEpochMilli(); }\n",
+ "if (params.published_at != null) { ctx._source.published_at = ZonedDateTime.parse(params.published_at).toInstant().toEpochMilli(); }\n"
+ "if (params.first_published_at != null) { ctx._source.first_published_at = ZonedDateTime.parse(params.first_published_at).toInstant().toEpochMilli(); }\n",
parameters);
return inline;
}
Expand All @@ -224,7 +225,8 @@ public static Script getInlineForFile(Map<String, Object> parameters) {
"if (!ctx._source.repositories.contains(params.repository)) { ctx._source.repositories.add(params.repository) }\n"
+ "ctx._source.analysis.analysis_state = params.analysis_state;\n"
+ "ctx._source.analysis.updated_at = ZonedDateTime.parse(params.updated_at).toInstant().toEpochMilli();\n"
+ "if (params.published_at != null) { ctx._source.analysis.published_at = ZonedDateTime.parse(params.published_at).toInstant().toEpochMilli(); }\n",
+ "if (params.published_at != null) { ctx._source.analysis.published_at = ZonedDateTime.parse(params.published_at).toInstant().toEpochMilli(); }\n"
+ "if (params.first_published_at != null) { ctx._source.analysis.first_published_at = ZonedDateTime.parse(params.first_published_at).toInstant().toEpochMilli(); }\n",
parameters);
return inline;
}
Expand Down

0 comments on commit af62bc7

Please sign in to comment.