add multiple propagation orgs (comma separeted)
This commit is contained in:
parent
14e54a5140
commit
096b229c5a
|
@ -664,7 +664,8 @@ public class CommunityApiController {
|
|||
})
|
||||
public Set<String> addPropagationOrganizationForCommunity(@PathVariable final String id,
|
||||
@RequestParam final String organizationId) throws CommunityException {
|
||||
return communityService.addPropagationOrganizationForCommunity(id, organizationId);
|
||||
|
||||
return communityService.addPropagationOrganizationForCommunity(id, organizationId.split(","));
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/community/{id}/propagationOrganizations", produces = {
|
||||
|
@ -680,7 +681,8 @@ public class CommunityApiController {
|
|||
})
|
||||
public Set<String> removePropagationOrganizationForCommunity(@PathVariable final String id,
|
||||
@RequestParam final String organizationId) throws CommunityException {
|
||||
return communityService.removePropagationOrganizationForCommunity(id, organizationId);
|
||||
|
||||
return communityService.removePropagationOrganizationForCommunity(id, organizationId.split(","));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -512,10 +512,12 @@ public class CommunityService {
|
|||
}
|
||||
|
||||
@Transactional
|
||||
public Set<String> addPropagationOrganizationForCommunity(final String communityId, final String organizationId) throws CommunityException {
|
||||
public Set<String> addPropagationOrganizationForCommunity(final String communityId, final String... organizationIds) throws CommunityException {
|
||||
try {
|
||||
final DbOrganization o = new DbOrganization(communityId, organizationId);
|
||||
dbOrganizationRepository.save(o);
|
||||
for (final String orgId : organizationIds) {
|
||||
final DbOrganization o = new DbOrganization(communityId.trim(), orgId.trim());
|
||||
dbOrganizationRepository.save(o);
|
||||
}
|
||||
return getPropagationOrganizationsForCommunity(communityId);
|
||||
} catch (final Throwable e) {
|
||||
log.error(e);
|
||||
|
@ -524,10 +526,12 @@ public class CommunityService {
|
|||
}
|
||||
|
||||
@Transactional
|
||||
public Set<String> removePropagationOrganizationForCommunity(final String communityId, final String organizationId) throws CommunityException {
|
||||
public Set<String> removePropagationOrganizationForCommunity(final String communityId, final String... organizationIds) throws CommunityException {
|
||||
try {
|
||||
final DbOrganization o = new DbOrganization(communityId, organizationId);
|
||||
dbOrganizationRepository.delete(o);
|
||||
for (final String orgId : organizationIds) {
|
||||
final DbOrganization o = new DbOrganization(communityId.trim(), orgId.trim());
|
||||
dbOrganizationRepository.delete(o);
|
||||
}
|
||||
return getPropagationOrganizationsForCommunity(communityId);
|
||||
} catch (final Throwable e) {
|
||||
log.error(e);
|
||||
|
|
Loading…
Reference in New Issue