bug fix
This commit is contained in:
parent
29af123e06
commit
60b7d82d47
|
@ -541,7 +541,7 @@ public class CommunityApiController {
|
|||
return communityService.getPropagationOrganizationCommunityMap();
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/community/{communityId}/propagationOrganizations", produces = {
|
||||
@RequestMapping(value = "/community/{id}/propagationOrganizations", produces = {
|
||||
"application/json"
|
||||
}, method = RequestMethod.GET)
|
||||
@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 = "500", description = "unexpected error")
|
||||
})
|
||||
public Set<String> getPropagationOrganizationsForCommunity(@PathVariable final String communityId) throws CommunityException {
|
||||
return communityService.getPropagationOrganizationsForCommunity(communityId);
|
||||
public Set<String> getPropagationOrganizationsForCommunity(@PathVariable final String id) throws CommunityException {
|
||||
return communityService.getPropagationOrganizationsForCommunity(id);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/community/{communityId}/propagationOrganizations", produces = {
|
||||
@RequestMapping(value = "/community/{id}/propagationOrganizations", produces = {
|
||||
"application/json"
|
||||
}, method = RequestMethod.POST)
|
||||
@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 = "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 {
|
||||
return communityService.addPropagationOrganizationForCommunity(communityId, organizationId);
|
||||
return communityService.addPropagationOrganizationForCommunity(id, organizationId);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/community/{communityId}/propagationOrganizations", produces = {
|
||||
@RequestMapping(value = "/community/{id}/propagationOrganizations", produces = {
|
||||
"application/json"
|
||||
}, method = RequestMethod.DELETE)
|
||||
@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 = "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 {
|
||||
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
|
||||
// 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
|
||||
private DbCommunityRepository dbCommunityRepository;
|
||||
|
|
|
@ -65,8 +65,13 @@ public class CommunityImporterController {
|
|||
@GetMapping("/community_importer/propagationOrgs")
|
||||
public List<DbOrganization> importPropagationOrgs(@RequestParam final String profileId,
|
||||
@RequestParam(required = false, defaultValue = "false") final boolean simulation) throws Exception {
|
||||
final String xml = isClient.getProfile(profileId);
|
||||
return importer.importPropagationOrganizationsFromProfile(xml, simulation);
|
||||
try {
|
||||
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 {
|
||||
|
|
|
@ -107,7 +107,6 @@ public class CommunityImporterService {
|
|||
|
||||
private static final Log log = LogFactory.getLog(CommunityImporterService.class);
|
||||
|
||||
@Transactional
|
||||
public List<DbOrganization> importPropagationOrganizationsFromProfile(final String xml, final boolean simulation) throws Exception {
|
||||
final String json = DocumentHelper.parseText(xml)
|
||||
.selectSingleNode("//NODE[@name='setPropagationOrganizationCommunityMap']//PARAM[@name='parameterValue']")
|
||||
|
@ -121,7 +120,13 @@ public class CommunityImporterService {
|
|||
.collect(Collectors.toList());
|
||||
|
||||
if (!simulation) {
|
||||
dbOrganizationRepository.saveAll(list);
|
||||
list.forEach(o -> {
|
||||
try {
|
||||
dbOrganizationRepository.save(o);
|
||||
} catch (final Throwable e) {
|
||||
log.error("ERROR saving org: " + o);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return list;
|
||||
|
|
Loading…
Reference in New Issue