[CommunityAPIExtention] added bulk deletion and addition for datasouces. Added the possibility to insert a pram in the cntext if it is not already present. Useful not to be forced to modify all the profiles by hand to insert new params for fos, sdg and advancedContraints
This commit is contained in:
parent
3549fdebf9
commit
2a937cc4ae
|
@ -20,9 +20,7 @@ public interface ISClient {
|
||||||
|
|
||||||
Map<String, Context> getContextMap(final List<String> type) throws IOException;
|
Map<String, Context> getContextMap(final List<String> type) throws IOException;
|
||||||
|
|
||||||
void updateContextParam(String id, String name, String value);
|
void updateContextParam(String id, String name, String value, boolean toEscape);
|
||||||
|
|
||||||
void updateContextParamNoEscape(String id, String name, String value);
|
|
||||||
|
|
||||||
void updateContextAttribute(String id, String name, String value);
|
void updateContextAttribute(String id, String name, String value);
|
||||||
|
|
||||||
|
|
|
@ -105,28 +105,38 @@ public class ISClientImpl implements ISClient {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@CacheEvict(value = {
|
@CacheEvict(value = {
|
||||||
"context-cache", "context-cache-funder"
|
"context-cache", "context-cache-funder"
|
||||||
}, allEntries = true)
|
}, allEntries = true)
|
||||||
public void updateContextParam(final String id, final String name, final String value) {
|
public void updateContextParam(final String id, final String name, final String value, boolean toEscape) {
|
||||||
try {
|
if(getSize(id, name) > 0){
|
||||||
_quickSeachProfile(getXQuery(id, name, value));
|
try {
|
||||||
} catch (final ISLookUpException e) {
|
_quickSeachProfile(getXQuery(id, name, value, toEscape));
|
||||||
throw new DsmRuntimeException(String.format("unable update context param [id: %s, name: %s, value: %s]", id, name, value), e);
|
} catch (final ISLookUpException e) {
|
||||||
|
throw new DsmRuntimeException(String.format("unable to update context param [id: %s, name: %s, value: %s]", id, name, value), e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else{
|
||||||
|
try {
|
||||||
|
_quickSeachProfile(getInsertXQuery(id, name, value,toEscape));
|
||||||
|
} catch (final ISLookUpException e) {
|
||||||
|
throw new DsmRuntimeException(String.format("unable to insert context param [id: %s, name: %s, value: %s]", id, name, value), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
private int getSize(String id, String name) {
|
||||||
@CacheEvict(value = {
|
int size = 0;
|
||||||
"context-cache", "context-cache-funder"
|
|
||||||
}, allEntries = true)
|
|
||||||
public void updateContextParamNoEscape(final String id, final String name, final String value) {
|
|
||||||
try {
|
try {
|
||||||
_quickSeachProfile(getXQueryNoEscape(id, name, value));
|
size = _quickSeachProfile(String.format("for $x in collection('/db/DRIVER/ContextDSResources/ContextDSResourceType') where $x//context[@id='%s']/param[@name='%s'] return $x", id, name)).size();
|
||||||
} catch (final ISLookUpException e) {
|
} catch (ISLookUpException e) {
|
||||||
throw new DsmRuntimeException(String.format("unable update context param [id: %s, name: %s, value: %s]", id, name, value), e);
|
throw new DsmRuntimeException("unable to execute search query", e);
|
||||||
}
|
}
|
||||||
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -212,26 +222,45 @@ public class ISClientImpl implements ISClient {
|
||||||
|
|
||||||
/// HELPERS
|
/// HELPERS
|
||||||
|
|
||||||
private String getXQuery(final String id, final String name, final String value) {
|
|
||||||
final Escaper esc = XmlEscapers.xmlContentEscaper();
|
private String getInsertXQuery(final String id, final String paramName, final String paramValue, final boolean toEscape) {
|
||||||
|
String value;
|
||||||
|
if(toEscape)
|
||||||
|
value = escape(XmlEscapers.xmlContentEscaper(), paramValue);
|
||||||
|
else
|
||||||
|
value = paramValue;
|
||||||
|
if (StringUtils.isNotBlank(value)) {
|
||||||
|
return String.format("update insert <param name='%s'>%s</param> into collection('/db/DRIVER/ContextDSResources/ContextDSResourceType')" +
|
||||||
|
"/RESOURCE_PROFILE/BODY/CONFIGURATION/context[./@id = '%s']", paramName, value, id);
|
||||||
|
} else {
|
||||||
|
return String.format("update insert <param name='%s'/> into collection('/db/DRIVER/ContextDSResources/ContextDSResourceType')" +
|
||||||
|
"/RESOURCE_PROFILE/BODY/CONFIGURATION/context[./@id = '%s']", paramName, id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getXQuery(final String id, final String name, final String paramValue, final boolean toEscape) {
|
||||||
|
String value = paramValue;
|
||||||
|
if (toEscape)
|
||||||
|
value = escape(XmlEscapers.xmlContentEscaper(), paramValue);
|
||||||
|
|
||||||
if (StringUtils.isNotBlank(value)) {
|
if (StringUtils.isNotBlank(value)) {
|
||||||
return String.format("update replace collection('/db/DRIVER/ContextDSResources/ContextDSResourceType')" +
|
return String.format("update replace collection('/db/DRIVER/ContextDSResources/ContextDSResourceType')" +
|
||||||
"/RESOURCE_PROFILE/BODY/CONFIGURATION/context[./@id = '%s']/param[./@name = '%s'] with <param name='%s'>%s</param>", id, name, name, escape(esc, value));
|
"/RESOURCE_PROFILE/BODY/CONFIGURATION/context[./@id = '%s']/param[./@name = '%s'] with <param name='%s'>%s</param>", id, name, name, value);
|
||||||
} else {
|
} else {
|
||||||
return String.format("update replace collection('/db/DRIVER/ContextDSResources/ContextDSResourceType')" +
|
return String.format("update replace collection('/db/DRIVER/ContextDSResources/ContextDSResourceType')" +
|
||||||
"/RESOURCE_PROFILE/BODY/CONFIGURATION/context[./@id = '%s']/param[./@name = '%s'] with <param name='%s'/>", id, name, name);
|
"/RESOURCE_PROFILE/BODY/CONFIGURATION/context[./@id = '%s']/param[./@name = '%s'] with <param name='%s'/>", id, name, name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getXQueryNoEscape(final String id, final String name, final String value) {
|
// private String getXQueryNoEscape(final String id, final String name, final String value) {
|
||||||
if (StringUtils.isNotBlank(value)) {
|
// if (StringUtils.isNotBlank(value)) {
|
||||||
return String.format("update replace collection('/db/DRIVER/ContextDSResources/ContextDSResourceType')" +
|
// return String.format("update replace collection('/db/DRIVER/ContextDSResources/ContextDSResourceType')" +
|
||||||
"/RESOURCE_PROFILE/BODY/CONFIGURATION/context[./@id = '%s']/param[./@name = '%s'] with <param name='%s'>%s</param>", id, name, name, value);
|
// "/RESOURCE_PROFILE/BODY/CONFIGURATION/context[./@id = '%s']/param[./@name = '%s'] with <param name='%s'>%s</param>", id, name, name, value);
|
||||||
} else {
|
// } else {
|
||||||
return String.format("update replace collection('/db/DRIVER/ContextDSResources/ContextDSResourceType')" +
|
// return String.format("update replace collection('/db/DRIVER/ContextDSResources/ContextDSResourceType')" +
|
||||||
"/RESOURCE_PROFILE/BODY/CONFIGURATION/context[./@id = '%s']/param[./@name = '%s'] with <param name='%s'/>", id, name, name);
|
// "/RESOURCE_PROFILE/BODY/CONFIGURATION/context[./@id = '%s']/param[./@name = '%s'] with <param name='%s'/>", id, name, name);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
private String getConceptXQuery(final String id, final String name, final String value) {
|
private String getConceptXQuery(final String id, final String name, final String value) {
|
||||||
final Escaper esc = XmlEscapers.xmlContentEscaper();
|
final Escaper esc = XmlEscapers.xmlContentEscaper();
|
||||||
|
|
|
@ -223,6 +223,44 @@ public class CommunityApiController {
|
||||||
communityApiCore.removeCommunityContentProvider(id, contentproviderId);
|
communityApiCore.removeCommunityContentProvider(id, contentproviderId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RequestMapping(value = "/community/{id}/contentprovidersList", produces = {
|
||||||
|
"application/json"
|
||||||
|
}, method = RequestMethod.POST)
|
||||||
|
@Operation(summary = "associate a list of content providers to the community",
|
||||||
|
description = "associate a list of content providers to the community", tags = {
|
||||||
|
C_PJ, W
|
||||||
|
})
|
||||||
|
@ApiResponses(value = {
|
||||||
|
@ApiResponse(responseCode = "200", description = "OK"),
|
||||||
|
@ApiResponse(responseCode = "404", description = "not found"),
|
||||||
|
@ApiResponse(responseCode = "500", description = "unexpected error")
|
||||||
|
})
|
||||||
|
public List<CommunityContentprovider> addCommunityContentProvidersList(
|
||||||
|
@PathVariable final String id,
|
||||||
|
@RequestBody final List<CommunityContentprovider> contentprovidersList) throws CommunityException, CommunityNotFoundException {
|
||||||
|
|
||||||
|
return communityApiCore.addCommunityContentProvidersList(id, contentprovidersList);
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping(value = "/community/{id}/projectList", produces = {
|
||||||
|
"application/json"
|
||||||
|
}, method = RequestMethod.DELETE)
|
||||||
|
@Operation(summary = "remove a list of content providers from the community",
|
||||||
|
description = "remove a list of content providers from the community", tags = {
|
||||||
|
C_PJ, W
|
||||||
|
})
|
||||||
|
@ApiResponses(value = {
|
||||||
|
@ApiResponse(responseCode = "200", description = "OK"),
|
||||||
|
@ApiResponse(responseCode = "404", description = "not found"),
|
||||||
|
@ApiResponse(responseCode = "500", description = "unexpected error")
|
||||||
|
})
|
||||||
|
public void deleteCommunityContentProvidersList(
|
||||||
|
@PathVariable final String id,
|
||||||
|
@RequestBody final List<Integer> contentProviderIdList) throws CommunityException, CommunityNotFoundException {
|
||||||
|
|
||||||
|
communityApiCore.removeCommunityContentProviderList(id, contentProviderIdList);
|
||||||
|
}
|
||||||
|
|
||||||
// ADDING CODE FOR COMMUNITY ORGANIZATIONS
|
// ADDING CODE FOR COMMUNITY ORGANIZATIONS
|
||||||
|
|
||||||
@RequestMapping(value = "/community/{id}/organizations", produces = {
|
@RequestMapping(value = "/community/{id}/organizations", produces = {
|
||||||
|
|
|
@ -47,6 +47,13 @@ public class CommunityApiCore {// implements CommunityClient{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void removeAdvancedConstraint(String id) throws CommunityNotFoundException, CommunityException {
|
||||||
|
cc.getCommunity(id);
|
||||||
|
isClient.updateContextParam(id, CPROFILE_ADVANCED_CONSTRAINT, "", false);
|
||||||
|
cc.removeAdvancedConstraint(id);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public void setCommunity(final String id, final CommunityWritableProperties details) throws CommunityException, CommunityNotFoundException {
|
public void setCommunity(final String id, final CommunityWritableProperties details) throws CommunityException, CommunityNotFoundException {
|
||||||
|
|
||||||
cc.getCommunity(id); // ensure the community exists.
|
cc.getCommunity(id); // ensure the community exists.
|
||||||
|
@ -56,39 +63,39 @@ public class CommunityApiCore {// implements CommunityClient{
|
||||||
|
|
||||||
}
|
}
|
||||||
if (details.getName() != null) {
|
if (details.getName() != null) {
|
||||||
isClient.updateContextParam(id, CSUMMARY_NAME, details.getName());
|
isClient.updateContextParam(id, CSUMMARY_NAME, details.getName(), true);
|
||||||
|
|
||||||
}
|
}
|
||||||
if (details.getDescription() != null) {
|
if (details.getDescription() != null) {
|
||||||
isClient.updateContextParam(id, CSUMMARY_DESCRIPTION, details.getDescription());
|
isClient.updateContextParam(id, CSUMMARY_DESCRIPTION, details.getDescription(), true);
|
||||||
|
|
||||||
}
|
}
|
||||||
if (details.getLogoUrl() != null) {
|
if (details.getLogoUrl() != null) {
|
||||||
isClient.updateContextParam(id, CSUMMARY_LOGOURL, details.getLogoUrl());
|
isClient.updateContextParam(id, CSUMMARY_LOGOURL, details.getLogoUrl(), true);
|
||||||
|
|
||||||
}
|
}
|
||||||
if (details.getStatus() != null) {
|
if (details.getStatus() != null) {
|
||||||
isClient.updateContextParam(id, CSUMMARY_STATUS, details.getStatus().name());
|
isClient.updateContextParam(id, CSUMMARY_STATUS, details.getStatus().name(), true);
|
||||||
|
|
||||||
}
|
}
|
||||||
if (details.getSubjects() != null) {
|
if (details.getSubjects() != null) {
|
||||||
isClient.updateContextParam(id, CPROFILE_SUBJECT, Joiner.on(CSV_DELIMITER).join(details.getSubjects()));
|
isClient.updateContextParam(id, CPROFILE_SUBJECT, Joiner.on(CSV_DELIMITER).join(details.getSubjects()), true);
|
||||||
|
|
||||||
}
|
}
|
||||||
if (details.getFos() != null) {
|
if (details.getFos() != null) {
|
||||||
isClient.updateContextParam(id, CPROFILE_FOS, Joiner.on(CSV_DELIMITER).join(details.getFos()));
|
isClient.updateContextParam(id, CPROFILE_FOS, Joiner.on(CSV_DELIMITER).join(details.getFos()), true);
|
||||||
|
|
||||||
}
|
}
|
||||||
if (details.getSdg() != null) {
|
if (details.getSdg() != null) {
|
||||||
isClient.updateContextParam(id, CPROFILE_SDG, Joiner.on(CSV_DELIMITER).join(details.getSdg()));
|
isClient.updateContextParam(id, CPROFILE_SDG, Joiner.on(CSV_DELIMITER).join(details.getSdg()), true);
|
||||||
|
|
||||||
}
|
}
|
||||||
if (details.getAdvancedConstraint() != null) {
|
if (details.getAdvancedConstraint() != null) {
|
||||||
isClient.updateContextParamNoEscape(id, CPROFILE_ADVANCED_CONSTRAINT, "<![CDATA[" + new Gson().toJson(details.getAdvancedConstraint()) + "]]>");
|
isClient.updateContextParam(id, CPROFILE_ADVANCED_CONSTRAINT, "<![CDATA[" + new Gson().toJson(details.getAdvancedConstraint()) + "]]>", false);
|
||||||
|
|
||||||
}
|
}
|
||||||
if (details.getMainZenodoCommunity() != null) {
|
if (details.getMainZenodoCommunity() != null) {
|
||||||
isClient.updateContextParam(id, CSUMMARY_ZENODOC, details.getMainZenodoCommunity());
|
isClient.updateContextParam(id, CSUMMARY_ZENODOC, details.getMainZenodoCommunity(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
cc.updateCommunity(id, details);
|
cc.updateCommunity(id, details);
|
||||||
|
@ -190,6 +197,10 @@ public class CommunityApiCore {// implements CommunityClient{
|
||||||
log.info("content provider to add " + cp.toString());
|
log.info("content provider to add " + cp.toString());
|
||||||
if (!StringUtils.equalsIgnoreCase(id, cp.getCommunityId())) { throw new CommunityException("parameters 'id' and cp.communityId must be coherent"); }
|
if (!StringUtils.equalsIgnoreCase(id, cp.getCommunityId())) { throw new CommunityException("parameters 'id' and cp.communityId must be coherent"); }
|
||||||
|
|
||||||
|
return updateContentprovider(id, cp);
|
||||||
|
}
|
||||||
|
|
||||||
|
private CommunityContentprovider updateContentprovider(String id, CommunityContentprovider cp) throws CommunityException, CommunityNotFoundException {
|
||||||
final TreeMap<Integer, CommunityContentprovider> cps = getCommunityContentproviderMap(id);
|
final TreeMap<Integer, CommunityContentprovider> cps = getCommunityContentproviderMap(id);
|
||||||
final String concept_id = cp.getId();
|
final String concept_id = cp.getId();
|
||||||
if (concept_id != null && cps.keySet().contains(Integer.valueOf(concept_id))) {
|
if (concept_id != null && cps.keySet().contains(Integer.valueOf(concept_id))) {
|
||||||
|
@ -225,6 +236,30 @@ public class CommunityApiCore {// implements CommunityClient{
|
||||||
cc.removeFromCategory(id, CONTENTPROVIDERS_ID_SUFFIX, String.valueOf(contentproviderId));
|
cc.removeFromCategory(id, CONTENTPROVIDERS_ID_SUFFIX, String.valueOf(contentproviderId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<CommunityContentprovider> addCommunityContentProvidersList(String id, List<CommunityContentprovider> contentprovidersList) throws CommunityException, CommunityNotFoundException {
|
||||||
|
if(contentprovidersList == null || contentprovidersList.size() == 0){
|
||||||
|
throw new CommunityException("parameter 'contentprovidersList' must be present and should contain at least one content provider");
|
||||||
|
}
|
||||||
|
if (!StringUtils.equalsIgnoreCase(id, contentprovidersList.get(0).getCommunityId())) {
|
||||||
|
throw new CommunityException("parameters 'id' and contentprovider.communityId must be coherent");
|
||||||
|
}
|
||||||
|
|
||||||
|
List<CommunityContentprovider> contentproviders = new ArrayList();
|
||||||
|
|
||||||
|
for(CommunityContentprovider contentProvider : contentprovidersList){
|
||||||
|
contentproviders.add(updateContentprovider(id, contentProvider));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return contentproviders;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeCommunityContentProviderList(final String id, final List<Integer> contentProviderIdList) throws CommunityException, CommunityNotFoundException {
|
||||||
|
for(Integer contentProviderId: contentProviderIdList){
|
||||||
|
removeCommunityContentProvider(id, contentProviderId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void removeCommunityOrganization(final String id, final Integer organizationId) throws CommunityException, CommunityNotFoundException {
|
public void removeCommunityOrganization(final String id, final Integer organizationId) throws CommunityException, CommunityNotFoundException {
|
||||||
final Map<Integer, CommunityOrganization> organizations = getCommunityOrganizationMap(id);
|
final Map<Integer, CommunityOrganization> organizations = getCommunityOrganizationMap(id);
|
||||||
if (!organizations.containsKey(organizationId)) {
|
if (!organizations.containsKey(organizationId)) {
|
||||||
|
@ -278,7 +313,10 @@ public class CommunityApiCore {// implements CommunityClient{
|
||||||
|
|
||||||
final CommunityDetails cd = new CommunityDetails();
|
final CommunityDetails cd = new CommunityDetails();
|
||||||
|
|
||||||
final Set<String> current = Sets.newHashSet(cc.getCommunity(id).getFos());
|
final Set<String> current = Sets.newHashSet();
|
||||||
|
if(Optional.ofNullable(cc.getCommunity(id).getFos()).isPresent()){
|
||||||
|
current.addAll(cc.getCommunity(id).getFos());
|
||||||
|
}
|
||||||
|
|
||||||
current.addAll(foss);
|
current.addAll(foss);
|
||||||
|
|
||||||
|
@ -307,8 +345,10 @@ public class CommunityApiCore {// implements CommunityClient{
|
||||||
public CommunityDetails addCommunitySDG(final String id, final List<String> sdgs) throws CommunityException, CommunityNotFoundException {
|
public CommunityDetails addCommunitySDG(final String id, final List<String> sdgs) throws CommunityException, CommunityNotFoundException {
|
||||||
|
|
||||||
final CommunityDetails cd = new CommunityDetails();
|
final CommunityDetails cd = new CommunityDetails();
|
||||||
|
final Set<String> current = Sets.newHashSet();
|
||||||
final Set<String> current = Sets.newHashSet(cc.getCommunity(id).getSdg());
|
if(Optional.ofNullable(cc.getCommunity(id).getSdg()).isPresent()){
|
||||||
|
current.addAll(cc.getCommunity(id).getSdg());
|
||||||
|
}
|
||||||
|
|
||||||
current.addAll(sdgs);
|
current.addAll(sdgs);
|
||||||
|
|
||||||
|
@ -345,17 +385,15 @@ public class CommunityApiCore {// implements CommunityClient{
|
||||||
return cd;
|
return cd;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CommunityDetails removeCommunityAdvancedConstraint(final String id) throws CommunityException, CommunityNotFoundException {
|
public CommunityDetails removeCommunityAdvancedConstraint(final String id) throws CommunityNotFoundException, CommunityException {
|
||||||
|
|
||||||
final CommunityDetails cd = new CommunityDetails();
|
removeAdvancedConstraint(id);
|
||||||
SelectionCriteria sl = new SelectionCriteria();
|
|
||||||
cd.setAdvancedConstraint(sl);
|
|
||||||
|
|
||||||
setCommunity(id, CommunityWritableProperties.fromDetails(cd));
|
return new CommunityDetails();
|
||||||
|
|
||||||
return cd;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@CacheEvict(value = "community-cache", allEntries = true)
|
@CacheEvict(value = "community-cache", allEntries = true)
|
||||||
public void removeCommunityZenodoCommunity(final String id, final Integer zenodoCommId) throws CommunityException, CommunityNotFoundException {
|
public void removeCommunityZenodoCommunity(final String id, final Integer zenodoCommId) throws CommunityException, CommunityNotFoundException {
|
||||||
|
|
||||||
|
@ -463,4 +501,5 @@ public class CommunityApiCore {// implements CommunityClient{
|
||||||
return organization;
|
return organization;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -168,6 +168,13 @@ public class CommunityCommon {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void removeAdvancedConstraint(String id) throws CommunityException {
|
||||||
|
final Context context = getContextMap().get(id);
|
||||||
|
context.getParams()
|
||||||
|
.replace(CPROFILE_ADVANCED_CONSTRAINT, Arrays.asList(new Param()
|
||||||
|
.setName(CPROFILE_ADVANCED_CONSTRAINT).setValue(null)));
|
||||||
|
}
|
||||||
|
|
||||||
public void updateCommunity(String id, CommunityWritableProperties community) throws CommunityException {
|
public void updateCommunity(String id, CommunityWritableProperties community) throws CommunityException {
|
||||||
final Context context = getContextMap().get(id);
|
final Context context = getContextMap().get(id);
|
||||||
|
|
||||||
|
@ -202,21 +209,35 @@ public class CommunityCommon {
|
||||||
.join(community.getSubjects()))));
|
.join(community.getSubjects()))));
|
||||||
}
|
}
|
||||||
if(community.getFos() != null){
|
if(community.getFos() != null){
|
||||||
|
if (context.getParams().containsKey(CPROFILE_FOS))
|
||||||
context.getParams()
|
context.getParams()
|
||||||
.replace(CPROFILE_FOS, Arrays.asList(new Param().setName(CPROFILE_FOS)
|
.replace(CPROFILE_FOS, Arrays.asList(new Param().setName(CPROFILE_FOS)
|
||||||
.setValue(Joiner.on(CSV_DELIMITER)
|
.setValue(Joiner.on(CSV_DELIMITER)
|
||||||
.join(community.getFos()))));
|
.join(community.getFos()))));
|
||||||
|
else
|
||||||
|
context.getParams().put(CPROFILE_FOS, Arrays.asList(new Param().setName(CPROFILE_FOS)
|
||||||
|
.setValue(Joiner.on(CSV_DELIMITER)
|
||||||
|
.join(community.getFos()))));
|
||||||
}
|
}
|
||||||
if(community.getSdg() != null){
|
if(community.getSdg() != null){
|
||||||
|
if(context.getParams().containsKey(CPROFILE_SDG))
|
||||||
context.getParams()
|
context.getParams()
|
||||||
.replace(CPROFILE_SDG, Arrays.asList(new Param().setName(CPROFILE_SDG)
|
.replace(CPROFILE_SDG, Arrays.asList(new Param().setName(CPROFILE_SDG)
|
||||||
.setValue(Joiner.on(CSV_DELIMITER)
|
.setValue(Joiner.on(CSV_DELIMITER)
|
||||||
.join(community.getSdg()))));
|
.join(community.getSdg()))));
|
||||||
|
else
|
||||||
|
context.getParams().put(CPROFILE_SDG, Arrays.asList(new Param().setName(CPROFILE_SDG)
|
||||||
|
.setValue(Joiner.on(CSV_DELIMITER)
|
||||||
|
.join(community.getSdg()))));
|
||||||
}
|
}
|
||||||
if (community.getAdvancedConstraint() != null) {
|
if (community.getAdvancedConstraint() != null) {
|
||||||
|
if(context.getParams().containsKey(CPROFILE_ADVANCED_CONSTRAINT))
|
||||||
context.getParams()
|
context.getParams()
|
||||||
.replace(CPROFILE_ADVANCED_CONSTRAINT, Arrays.asList(new Param()
|
.replace(CPROFILE_ADVANCED_CONSTRAINT, Arrays.asList(new Param()
|
||||||
.setName(CPROFILE_ADVANCED_CONSTRAINT).setValue(new Gson().toJson(community.getAdvancedConstraint()))));
|
.setName(CPROFILE_ADVANCED_CONSTRAINT).setValue(new Gson().toJson(community.getAdvancedConstraint()))));
|
||||||
|
else
|
||||||
|
context.getParams().put(CPROFILE_ADVANCED_CONSTRAINT, Arrays.asList(new Param()
|
||||||
|
.setName(CPROFILE_ADVANCED_CONSTRAINT).setValue(new Gson().toJson(community.getAdvancedConstraint()))));
|
||||||
}
|
}
|
||||||
if(community.getMainZenodoCommunity() != null){
|
if(community.getMainZenodoCommunity() != null){
|
||||||
context.getParams()
|
context.getParams()
|
||||||
|
|
Loading…
Reference in New Issue