bug fix
This commit is contained in:
parent
29af123e06
commit
60b7d82d47
|
@ -541,7 +541,7 @@ public class CommunityApiController {
|
||||||
return communityService.getPropagationOrganizationCommunityMap();
|
return communityService.getPropagationOrganizationCommunityMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = "/community/{communityId}/propagationOrganizations", produces = {
|
@RequestMapping(value = "/community/{id}/propagationOrganizations", produces = {
|
||||||
"application/json"
|
"application/json"
|
||||||
}, method = RequestMethod.GET)
|
}, method = RequestMethod.GET)
|
||||||
@Operation(summary = "return the propagation organizations of a community", description = "return the propagation organizations of a community", tags = {
|
@Operation(summary = "return the propagation organizations of a community", description = "return the propagation organizations of a community", tags = {
|
||||||
|
@ -552,11 +552,11 @@ public class CommunityApiController {
|
||||||
@ApiResponse(responseCode = "404", description = "not found"),
|
@ApiResponse(responseCode = "404", description = "not found"),
|
||||||
@ApiResponse(responseCode = "500", description = "unexpected error")
|
@ApiResponse(responseCode = "500", description = "unexpected error")
|
||||||
})
|
})
|
||||||
public Set<String> getPropagationOrganizationsForCommunity(@PathVariable final String communityId) throws CommunityException {
|
public Set<String> getPropagationOrganizationsForCommunity(@PathVariable final String id) throws CommunityException {
|
||||||
return communityService.getPropagationOrganizationsForCommunity(communityId);
|
return communityService.getPropagationOrganizationsForCommunity(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = "/community/{communityId}/propagationOrganizations", produces = {
|
@RequestMapping(value = "/community/{id}/propagationOrganizations", produces = {
|
||||||
"application/json"
|
"application/json"
|
||||||
}, method = RequestMethod.POST)
|
}, method = RequestMethod.POST)
|
||||||
@Operation(summary = "add an organization to the propagationOrganizationCommunityMap", description = "add an organization to the propagationOrganizationCommunityMap", tags = {
|
@Operation(summary = "add an organization to the propagationOrganizationCommunityMap", description = "add an organization to the propagationOrganizationCommunityMap", tags = {
|
||||||
|
@ -567,12 +567,12 @@ public class CommunityApiController {
|
||||||
@ApiResponse(responseCode = "404", description = "not found"),
|
@ApiResponse(responseCode = "404", description = "not found"),
|
||||||
@ApiResponse(responseCode = "500", description = "unexpected error")
|
@ApiResponse(responseCode = "500", description = "unexpected error")
|
||||||
})
|
})
|
||||||
public Set<String> addPropagationOrganizationForCommunity(@PathVariable final String communityId,
|
public Set<String> addPropagationOrganizationForCommunity(@PathVariable final String id,
|
||||||
@RequestParam final String organizationId) throws CommunityException {
|
@RequestParam final String organizationId) throws CommunityException {
|
||||||
return communityService.addPropagationOrganizationForCommunity(communityId, organizationId);
|
return communityService.addPropagationOrganizationForCommunity(id, organizationId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = "/community/{communityId}/propagationOrganizations", produces = {
|
@RequestMapping(value = "/community/{id}/propagationOrganizations", produces = {
|
||||||
"application/json"
|
"application/json"
|
||||||
}, method = RequestMethod.DELETE)
|
}, method = RequestMethod.DELETE)
|
||||||
@Operation(summary = "delete an organization to the propagationOrganizationCommunityMap", description = "delete an organization to the propagationOrganizationCommunityMap", tags = {
|
@Operation(summary = "delete an organization to the propagationOrganizationCommunityMap", description = "delete an organization to the propagationOrganizationCommunityMap", tags = {
|
||||||
|
@ -583,9 +583,9 @@ public class CommunityApiController {
|
||||||
@ApiResponse(responseCode = "404", description = "not found"),
|
@ApiResponse(responseCode = "404", description = "not found"),
|
||||||
@ApiResponse(responseCode = "500", description = "unexpected error")
|
@ApiResponse(responseCode = "500", description = "unexpected error")
|
||||||
})
|
})
|
||||||
public Set<String> removePropagationOrganizationForCommunity(@PathVariable final String communityId,
|
public Set<String> removePropagationOrganizationForCommunity(@PathVariable final String id,
|
||||||
@RequestParam final String organizationId) throws CommunityException {
|
@RequestParam final String organizationId) throws CommunityException {
|
||||||
return communityService.removePropagationOrganizationForCommunity(communityId, organizationId);
|
return communityService.removePropagationOrganizationForCommunity(id, organizationId);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,6 +52,7 @@ public class CommunityService {
|
||||||
|
|
||||||
// TODO: Verificare Tickets: #8835, #8854, #6483, #3259, #3494
|
// TODO: Verificare Tickets: #8835, #8854, #6483, #3259, #3494
|
||||||
// L'IMPORT DI ALCUNI PROGETTI FALLISCE perche' non hanno openaireID
|
// L'IMPORT DI ALCUNI PROGETTI FALLISCE perche' non hanno openaireID
|
||||||
|
// L'IMPORT DI ALCUNE ORGS DAL PROVISION WF FALLISCE perche' il communityID non esiste
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private DbCommunityRepository dbCommunityRepository;
|
private DbCommunityRepository dbCommunityRepository;
|
||||||
|
|
|
@ -65,8 +65,13 @@ public class CommunityImporterController {
|
||||||
@GetMapping("/community_importer/propagationOrgs")
|
@GetMapping("/community_importer/propagationOrgs")
|
||||||
public List<DbOrganization> importPropagationOrgs(@RequestParam final String profileId,
|
public List<DbOrganization> importPropagationOrgs(@RequestParam final String profileId,
|
||||||
@RequestParam(required = false, defaultValue = "false") final boolean simulation) throws Exception {
|
@RequestParam(required = false, defaultValue = "false") final boolean simulation) throws Exception {
|
||||||
final String xml = isClient.getProfile(profileId);
|
try {
|
||||||
return importer.importPropagationOrganizationsFromProfile(xml, simulation);
|
final String xml = isClient.getProfile(profileId);
|
||||||
|
return importer.importPropagationOrganizationsFromProfile(xml, simulation);
|
||||||
|
} catch (final Throwable e) {
|
||||||
|
log.error("Error importing communities", e);
|
||||||
|
throw new CommunityException(e.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map<String, Context> getContextMap() throws CommunityException {
|
private Map<String, Context> getContextMap() throws CommunityException {
|
||||||
|
|
|
@ -107,7 +107,6 @@ public class CommunityImporterService {
|
||||||
|
|
||||||
private static final Log log = LogFactory.getLog(CommunityImporterService.class);
|
private static final Log log = LogFactory.getLog(CommunityImporterService.class);
|
||||||
|
|
||||||
@Transactional
|
|
||||||
public List<DbOrganization> importPropagationOrganizationsFromProfile(final String xml, final boolean simulation) throws Exception {
|
public List<DbOrganization> importPropagationOrganizationsFromProfile(final String xml, final boolean simulation) throws Exception {
|
||||||
final String json = DocumentHelper.parseText(xml)
|
final String json = DocumentHelper.parseText(xml)
|
||||||
.selectSingleNode("//NODE[@name='setPropagationOrganizationCommunityMap']//PARAM[@name='parameterValue']")
|
.selectSingleNode("//NODE[@name='setPropagationOrganizationCommunityMap']//PARAM[@name='parameterValue']")
|
||||||
|
@ -121,7 +120,13 @@ public class CommunityImporterService {
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
if (!simulation) {
|
if (!simulation) {
|
||||||
dbOrganizationRepository.saveAll(list);
|
list.forEach(o -> {
|
||||||
|
try {
|
||||||
|
dbOrganizationRepository.save(o);
|
||||||
|
} catch (final Throwable e) {
|
||||||
|
log.error("ERROR saving org: " + o);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
|
|
Loading…
Reference in New Issue