Bug fixing incident #27455
This commit is contained in:
parent
4f62afc5bc
commit
c295cdc794
|
@ -4,6 +4,12 @@
|
||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## [v2.2.2-SNAPSHOT] - 2024-05-14
|
||||||
|
|
||||||
|
**Bug fixes**
|
||||||
|
|
||||||
|
- Incident Catalogue edit is leading to duplicate fields [#27455]
|
||||||
|
|
||||||
## [v2.2.1] - 2024-03-19
|
## [v2.2.1] - 2024-03-19
|
||||||
|
|
||||||
**Enhancement**
|
**Enhancement**
|
||||||
|
|
2
pom.xml
2
pom.xml
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
<groupId>org.gcube.portlets.widgets</groupId>
|
<groupId>org.gcube.portlets.widgets</groupId>
|
||||||
<artifactId>ckan-metadata-publisher-widget</artifactId>
|
<artifactId>ckan-metadata-publisher-widget</artifactId>
|
||||||
<version>2.2.1</version>
|
<version>2.2.2-SNAPSHOT</version>
|
||||||
<name>gCube Ckan metadata publisher widget</name>
|
<name>gCube Ckan metadata publisher widget</name>
|
||||||
|
|
||||||
<description>
|
<description>
|
||||||
|
|
|
@ -9,6 +9,7 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.CKanMetadataPublisher;
|
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.CKanMetadataPublisher;
|
||||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.CKanPublisherServiceAsync;
|
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.CKanPublisherServiceAsync;
|
||||||
|
@ -566,6 +567,8 @@ public class UpdateDatasetForm extends Composite {
|
||||||
public void onSuccess(
|
public void onSuccess(
|
||||||
final MetadataProfileBeanForUpdate metadataProfileForUpdate) {
|
final MetadataProfileBeanForUpdate metadataProfileForUpdate) {
|
||||||
setAlertBlock("", null, AlertType.ERROR, false);
|
setAlertBlock("", null, AlertType.ERROR, false);
|
||||||
|
|
||||||
|
GWT.log("MetadataProfileBeanForUpdate: "+metadataProfileForUpdate);
|
||||||
|
|
||||||
List<MetaDataProfileBean> profiles = metadataProfileForUpdate
|
List<MetaDataProfileBean> profiles = metadataProfileForUpdate
|
||||||
.getListProfileBean();
|
.getListProfileBean();
|
||||||
|
@ -817,6 +820,7 @@ public class UpdateDatasetForm extends Composite {
|
||||||
|
|
||||||
GWT.log("There are " + categories.size() + " categories for profile " + bean.getTitle());
|
GWT.log("There are " + categories.size() + " categories for profile " + bean.getTitle());
|
||||||
|
|
||||||
|
//Adding fields without categories
|
||||||
if (categories == null || categories.isEmpty()) {
|
if (categories == null || categories.isEmpty()) {
|
||||||
for (MetadataFieldWrapper field : fields) {
|
for (MetadataFieldWrapper field : fields) {
|
||||||
|
|
||||||
|
@ -830,12 +834,41 @@ public class UpdateDatasetForm extends Composite {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
// create the categories, then parse the fields. Fields do not belonging to a
|
||||||
|
// category are put at the end
|
||||||
|
|
||||||
|
//Collecting and showing the fields for categories
|
||||||
|
for (CategoryWrapper categoryWrapper : categories) {
|
||||||
|
|
||||||
|
List<MetadataFieldWrapper> fieldsForThisCategory = fields.stream().filter(f -> f.getOwnerCategory().getId()==categoryWrapper.getId()).collect(Collectors.toList());
|
||||||
|
|
||||||
|
CategoryPanel cp = new CategoryPanel(categoryWrapper.getTitle(),
|
||||||
|
categoryWrapper.getDescription());
|
||||||
|
fields.removeAll(fieldsForThisCategory);
|
||||||
|
|
||||||
|
for (MetadataFieldWrapper metadataFieldWrapper : fieldsForThisCategory) {
|
||||||
|
|
||||||
|
MetaDataField fieldWidget;
|
||||||
|
try {
|
||||||
|
fieldWidget = new MetaDataField(metadataFieldWrapper, eventBusPublisherWidget,
|
||||||
|
operation);
|
||||||
|
cp.addField(fieldWidget);
|
||||||
|
listOfMetadataFields.add(fieldWidget);
|
||||||
|
} catch (Exception e) {
|
||||||
|
GWT.log("Unable to build such widget", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
metadataFieldsPanel.add(cp);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// create the categories, then parse the fields. Fields do not belonging to a
|
// create the categories, then parse the fields. Fields do not belonging to a
|
||||||
// category are put at the end
|
// category are put at the end
|
||||||
for (CategoryWrapper categoryWrapper : categories) {
|
/*for (CategoryWrapper categoryWrapper : categories) {
|
||||||
if (categoryWrapper.getFieldsForThisCategory() != null
|
if (categoryWrapper.getFieldsForThisCategory() != null
|
||||||
&& categoryWrapper.getFieldsForThisCategory().size() > 0) {
|
&& categoryWrapper.getFieldsForThisCategory().size() > 0) {
|
||||||
|
|
||||||
CategoryPanel cp = new CategoryPanel(categoryWrapper.getTitle(),
|
CategoryPanel cp = new CategoryPanel(categoryWrapper.getTitle(),
|
||||||
categoryWrapper.getDescription());
|
categoryWrapper.getDescription());
|
||||||
List<MetadataFieldWrapper> fieldsForThisCategory = categoryWrapper
|
List<MetadataFieldWrapper> fieldsForThisCategory = categoryWrapper
|
||||||
|
@ -856,7 +889,7 @@ public class UpdateDatasetForm extends Composite {
|
||||||
}
|
}
|
||||||
metadataFieldsPanel.add(cp);
|
metadataFieldsPanel.add(cp);
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
// add the remaining one at the end of the categories
|
// add the remaining one at the end of the categories
|
||||||
CategoryPanel extrasCategory = new CategoryPanel("Other", null);
|
CategoryPanel extrasCategory = new CategoryPanel("Other", null);
|
||||||
|
|
|
@ -29,6 +29,7 @@ import org.gcube.datacatalogue.utillibrary.shared.jackan.model.CkanDataset;
|
||||||
import org.gcube.datacatalogue.utillibrary.shared.jackan.model.CkanGroup;
|
import org.gcube.datacatalogue.utillibrary.shared.jackan.model.CkanGroup;
|
||||||
import org.gcube.datacatalogue.utillibrary.shared.jackan.model.CkanLicense;
|
import org.gcube.datacatalogue.utillibrary.shared.jackan.model.CkanLicense;
|
||||||
import org.gcube.datacatalogue.utillibrary.shared.jackan.model.CkanOrganization;
|
import org.gcube.datacatalogue.utillibrary.shared.jackan.model.CkanOrganization;
|
||||||
|
import org.gcube.datacatalogue.utillibrary.shared.jackan.model.CkanPair;
|
||||||
import org.gcube.datacatalogue.utillibrary.shared.jackan.model.CkanResource;
|
import org.gcube.datacatalogue.utillibrary.shared.jackan.model.CkanResource;
|
||||||
import org.gcube.datacatalogue.utillibrary.shared.jackan.model.CkanTag;
|
import org.gcube.datacatalogue.utillibrary.shared.jackan.model.CkanTag;
|
||||||
import org.gcube.portlets.user.uriresolvermanager.UriResolverManager;
|
import org.gcube.portlets.user.uriresolvermanager.UriResolverManager;
|
||||||
|
@ -485,9 +486,12 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C
|
||||||
}
|
}
|
||||||
bean.setResources(list);
|
bean.setResources(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logger.debug("extras are #: "+dataset.getExtras().size());
|
||||||
// Settings the dataset type
|
// Settings the dataset type
|
||||||
Map<String, List<String>> extras = dataset.getListExtrasAsHashMap();
|
Map<String, List<String>> extras = dataset.getListExtrasAsHashMap();
|
||||||
|
printExtras(dataset);
|
||||||
|
|
||||||
if (extras != null) {
|
if (extras != null) {
|
||||||
List<String> theDatasetType = extras.get(SYS_TYPE);
|
List<String> theDatasetType = extras.get(SYS_TYPE);
|
||||||
if (theDatasetType != null && theDatasetType.size() > 0) {
|
if (theDatasetType != null && theDatasetType.size() > 0) {
|
||||||
|
@ -499,6 +503,18 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C
|
||||||
logger.info("Returning the bean for dataset title {} and type {}" + bean.getTitle(), bean.getChosenType());
|
logger.info("Returning the bean for dataset title {} and type {}" + bean.getTitle(), bean.getChosenType());
|
||||||
return bean;
|
return bean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void printExtras(CkanDataset dataset) {
|
||||||
|
if(logger.isDebugEnabled()) {
|
||||||
|
logger.trace("extras are: "+dataset.getExtras());
|
||||||
|
if (dataset.getExtras() != null) {
|
||||||
|
int i = 0;
|
||||||
|
for (CkanPair cp : dataset.getExtras()) {
|
||||||
|
logger.debug(++i+") key:" + cp.getKey() + ", value: "+cp.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Discover from the IS the vocabulary of tags for this scope, if present.
|
* Discover from the IS the vocabulary of tags for this scope, if present.
|
||||||
|
@ -1277,7 +1293,7 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C
|
||||||
String scopePerCurrentUrl = GenericUtils.getScopeFromClientUrl(getThreadLocalRequest());
|
String scopePerCurrentUrl = GenericUtils.getScopeFromClientUrl(getThreadLocalRequest());
|
||||||
|
|
||||||
if (!isWithinPortal()) {
|
if (!isWithinPortal()) {
|
||||||
role = RolesCkanGroupOrOrg.EDITOR;
|
role = RolesCkanGroupOrOrg.ADMIN;
|
||||||
logger.warn("OUT FROM PORTAL SETTING HARD-CODED ROLE " + role);
|
logger.warn("OUT FROM PORTAL SETTING HARD-CODED ROLE " + role);
|
||||||
} else {
|
} else {
|
||||||
String keyPerScopeRole = CatalogueUtilMethods
|
String keyPerScopeRole = CatalogueUtilMethods
|
||||||
|
|
Loading…
Reference in New Issue