new_model_for_communities #15
|
@ -346,7 +346,7 @@ public class CommunityApiController {
|
|||
})
|
||||
public void removeCommunityOrganization(
|
||||
@PathVariable final String id,
|
||||
@RequestBody final String organizationId) throws CommunityException {
|
||||
@RequestParam final String organizationId) throws CommunityException {
|
||||
|
||||
communityService.removeCommunityOrganizations(id, organizationId);
|
||||
}
|
||||
|
@ -514,6 +514,40 @@ public class CommunityApiController {
|
|||
return communityService.removeCommunityAdvancedConstraint(id);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/community/{id}/removeConstraint", produces = {
|
||||
"application/json"
|
||||
}, method = RequestMethod.POST)
|
||||
@Operation(summary = "the set of constraints to be used to remove the association between result and community", description = "the set of constraints to be used to remove the association between result and community", tags = {
|
||||
C, W
|
||||
})
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(responseCode = "200", description = "OK"),
|
||||
@ApiResponse(responseCode = "404", description = "not found"),
|
||||
@ApiResponse(responseCode = "500", description = "unexpected error")
|
||||
})
|
||||
public CommunityDetails addRemoveConstraint(
|
||||
@PathVariable final String id,
|
||||
@RequestBody final SelectionCriteria removeConstraint) throws CommunityException {
|
||||
|
||||
return communityService.addCommunityRemoveConstraint(id, removeConstraint);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/community/{id}/removeConstraint", produces = {
|
||||
"application/json"
|
||||
}, method = RequestMethod.DELETE)
|
||||
@Operation(summary = "remove the constraints to remove the association beetween result and community", description = "remove the constraints to remove the association beetween result and community", tags = {
|
||||
C, W
|
||||
})
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(responseCode = "200", description = "OK"),
|
||||
@ApiResponse(responseCode = "404", description = "not found"),
|
||||
@ApiResponse(responseCode = "500", description = "unexpected error")
|
||||
})
|
||||
public CommunityDetails removeRemoveConstraint(@PathVariable final String id) throws CommunityException {
|
||||
|
||||
return communityService.removeCommunityRemoveConstraint(id);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/community/{id}/zenodocommunities", produces = {
|
||||
"application/json"
|
||||
}, method = RequestMethod.POST)
|
||||
|
|
|
@ -365,6 +365,32 @@ public class CommunityService {
|
|||
}
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public CommunityDetails addCommunityRemoveConstraint(final String id, final SelectionCriteria removeConstraint) throws CommunityException {
|
||||
try {
|
||||
final DbCommunity dbEntry = dbCommunityRepository.findById(id).orElseThrow(() -> new ResourceNotFoundException("Community not found: " + id));
|
||||
dbEntry.setRemoveConstraints(removeConstraint);
|
||||
dbCommunityRepository.save(dbEntry);
|
||||
return getCommunity(id);
|
||||
} catch (final Throwable e) {
|
||||
log.error(e);
|
||||
throw new CommunityException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public CommunityDetails removeCommunityRemoveConstraint(final String id) throws CommunityException {
|
||||
try {
|
||||
final DbCommunity dbEntry = dbCommunityRepository.findById(id).orElseThrow(() -> new ResourceNotFoundException("Community not found: " + id));
|
||||
dbEntry.setRemoveConstraints(null);
|
||||
dbCommunityRepository.save(dbEntry);
|
||||
return getCommunity(id);
|
||||
} catch (final Throwable e) {
|
||||
log.error(e);
|
||||
throw new CommunityException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public CommunityDetails removeCommunityZenodoCommunity(final String id, final String zenodoCommunity, final boolean isMain)
|
||||
throws CommunityException {
|
||||
if (isMain) {
|
||||
|
|
Loading…
Reference in New Issue