added field 'enabled' to community_datasources, fixed a migrated field
This commit is contained in:
parent
89af989d1a
commit
c5b23207b2
|
@ -11,6 +11,7 @@ import java.util.stream.Stream;
|
|||
|
||||
import javax.transaction.Transactional;
|
||||
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
@ -258,8 +259,7 @@ public class CommunityImporterService {
|
|||
details.setStatus(CommunityStatus.hidden);
|
||||
}
|
||||
|
||||
details.setName(asCsv(CSUMMARY_NAME, c.getParams()));
|
||||
details.setName(c.getLabel());
|
||||
details.setName(StringUtils.firstNonBlank(asCsv(CSUMMARY_NAME, c.getParams()), c.getLabel()));
|
||||
details.setZenodoCommunity(asCsv(CSUMMARY_ZENODOC, c.getParams()));
|
||||
details.setSubjects(splitValues(asValues(CPROFILE_SUBJECT, c.getParams()), CSV_DELIMITER));
|
||||
details.setFos(splitValues(asValues(CPROFILE_FOS, c.getParams()), CSV_DELIMITER));
|
||||
|
@ -298,6 +298,7 @@ public class CommunityImporterService {
|
|||
d.setOpenaireId(firstValue(OPENAIRE_ID, p));
|
||||
d.setName(firstValue(CCONTENTPROVIDER_NAME, p));
|
||||
d.setOfficialname(firstValue(CCONTENTPROVIDER_OFFICIALNAME, p));
|
||||
d.setEnabled(BooleanUtils.toBoolean(firstValue(CCONTENTPROVIDER_ENABLED, p)));
|
||||
d.setSelectioncriteria(SelectionCriteria.fromJson(firstValue(CCONTENTPROVIDER_SELCRITERIA, p)));
|
||||
return d;
|
||||
}
|
||||
|
|
|
@ -33,6 +33,9 @@ public class DbDatasource implements Serializable {
|
|||
@Column(name = "ds_officialname")
|
||||
private String dsOfficialName;
|
||||
|
||||
@Column(name = "enabled")
|
||||
private Boolean enabled;
|
||||
|
||||
@Type(type = "jsonb")
|
||||
@Column(name = "constraints")
|
||||
private SelectionCriteria constraints;
|
||||
|
@ -79,6 +82,14 @@ public class DbDatasource implements Serializable {
|
|||
this.dsOfficialName = dsOfficialName;
|
||||
}
|
||||
|
||||
public Boolean getEnabled() {
|
||||
return enabled;
|
||||
}
|
||||
|
||||
public void setEnabled(final Boolean enabled) {
|
||||
this.enabled = enabled;
|
||||
}
|
||||
|
||||
public SelectionCriteria getConstraints() {
|
||||
return constraints;
|
||||
}
|
||||
|
|
|
@ -176,6 +176,7 @@ public class CommunityMappingUtils {
|
|||
ccp.setName(dbEntry.getDsName());
|
||||
ccp.setOfficialname(dbEntry.getDsOfficialName());
|
||||
ccp.setSelectioncriteria(dbEntry.getConstraints());
|
||||
ccp.setEnabled(dbEntry.getEnabled() != null ? dbEntry.getEnabled() : true);
|
||||
return ccp;
|
||||
}
|
||||
|
||||
|
@ -186,6 +187,7 @@ public class CommunityMappingUtils {
|
|||
ds.setDsName(provider.getName());
|
||||
ds.setDsOfficialName(provider.getOfficialname());
|
||||
ds.setConstraints(provider.getSelectioncriteria());
|
||||
ds.setEnabled(provider.isEnabled());
|
||||
return ds;
|
||||
}
|
||||
|
||||
|
|
|
@ -42,6 +42,7 @@ CREATE TABLE community_datasources (
|
|||
ds_id text NOT NULL,
|
||||
ds_name text NOT NULL,
|
||||
ds_officialname text NOT NULL,
|
||||
enabled boolean NOT NULL DEFAULT true;
|
||||
constraints jsonb,
|
||||
PRIMARY KEY (community, ds_id)
|
||||
);
|
||||
|
|
|
@ -26,6 +26,10 @@ public class CommunityContentprovider {
|
|||
@Schema(description = "content provider official name", required = true)
|
||||
private String officialname;
|
||||
|
||||
// @NotNull
|
||||
@Schema(description = "content provider enabled for content inclusion", required = false)
|
||||
private boolean enabled;
|
||||
|
||||
// @NotNull
|
||||
@Schema(description = "content provider selection criteria", required = false)
|
||||
private SelectionCriteria selectioncriteria;
|
||||
|
@ -62,6 +66,14 @@ public class CommunityContentprovider {
|
|||
this.officialname = officialname;
|
||||
}
|
||||
|
||||
public boolean isEnabled() {
|
||||
return enabled;
|
||||
}
|
||||
|
||||
public void setEnabled(final boolean enabled) {
|
||||
this.enabled = enabled;
|
||||
}
|
||||
|
||||
public SelectionCriteria getSelectioncriteria() {
|
||||
return this.selectioncriteria;
|
||||
}
|
||||
|
@ -101,4 +113,5 @@ public class CommunityContentprovider {
|
|||
.append("\n]");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue