Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update organization fields (unmap from zoho or permanently remove) #289

Merged
merged 24 commits into from
Feb 6, 2024

Conversation

SrdjanStevanetic
Copy link
Contributor

No description provided.

@@ -151,6 +151,9 @@ public class EntityManagementConfiguration implements InitializingBean {

@Value("${spring.profiles.active:}")
private String activeProfileString;

@Value("${zoho.country.mapping.file:#{null}}")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not needed to be configurable, it can be placed in resources as it doesn't contain sentitive or dinamic information

@@ -360,6 +363,10 @@ public boolean isGenerateOrganizationEuropeanaId() {
return generateOrganizationEuropeanaId;
}

public String getZohoCountryMappingFile() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not needed, it is sufficient to have it in the services that reads the file


Address that = (Address) o;

if (!Objects.equals(about, that.getAbout())) return false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

objects.equals takes care of the null values, therefore the if statements and returns are redundant, it is sufficient to bind these stamenetns with && operator

}

public int hashCode() {
final int prime = 31;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to complicated, it is sufficient to have the hascode based on the ones of locality, streetaddress and hasGeo, and also it is sufficient to sumup the hasCodes of the 3 fields if they exists (they are uniquely identifying the place, and if not, the equals is used anyway)


public static String getEntityUriFromName(List<CountryMapping> list ,String name) {
for(CountryMapping cm : list) {
List<String> splittedAndTrimmed = Arrays.stream(cm.getZohoLabel().split(",")).map(String::trim).toList();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this method used anywehre? If not, please remove

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is used (you can see it by right click on the method name in eclipse and then "open call hierarchy")

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well, I don't have the branch yet in eclipse ..

@@ -170,7 +170,12 @@ private String getEntityFromURL(String urlToRead) throws WikidataAccessException
}

private WikidataOrganization parse(String xml) throws JAXBException {
//this commented out code caused exception, i.e. Caused by: org.xml.sax.SAXParseException: Premature end of file.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please remove the commented out code

// if (StringUtils.isBlank(organizationCountry)) {
// return null;
// } else {
// String isoCode = null;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this implementation doesn't look correct, please completely remove the code

.accept(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
.andExpect(jsonPath("$.id", is(entityId)))
.andExpect(jsonPath("$.type", is(EntityTypes.Organization.getEntityType())))
.andExpect(jsonPath("$.sameAs").isNotEmpty());
.andExpect(jsonPath("$.sameAs").isNotEmpty())
.andExpect(jsonPath("$.countryId").isNotEmpty())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use the exact value for comparison instead of not empty

.andExpect(jsonPath("$.sameAs").isNotEmpty());
.andExpect(jsonPath("$.sameAs").isNotEmpty())
.andExpect(jsonPath("$.countryId").isNotEmpty())
.andExpect(jsonPath("$.countryPlace").isNotEmpty());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use the exact value for comparison instead of not empty

@@ -504,12 +509,14 @@ public void retrieveOrganizationJsonExternalShouldBeSuccessful() throws Exceptio
mockMvc
.perform(
get(IntegrationTestUtils.BASE_SERVICE_URL + "/" + requestPath + ".jsonld")
.param(WebEntityConstants.QUERY_PARAM_PROFILE, "external")
.param(WebEntityConstants.QUERY_PARAM_PROFILE, "external, dereference")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please ad a test without dereference profile and verify that the dereferencing is not performed

@gsergiu
Copy link
Contributor

gsergiu commented Feb 6, 2024

the integration tests are working locally, but fails to load country mapping in github, still it should load from test country mapping and not from resources, will need to fix this later

@gsergiu gsergiu merged commit 9d286cf into develop Feb 6, 2024
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants