renamed license bean
This commit is contained in:
parent
cb29e33652
commit
b668e7c5b2
|
@ -8,7 +8,7 @@ import java.util.List;
|
||||||
import org.gcube.portlets.widgets.ckan2zenodopublisher.client.ui.BasicTabPanel;
|
import org.gcube.portlets.widgets.ckan2zenodopublisher.client.ui.BasicTabPanel;
|
||||||
import org.gcube.portlets.widgets.ckan2zenodopublisher.client.ui.basicinformation.BasicInformationView;
|
import org.gcube.portlets.widgets.ckan2zenodopublisher.client.ui.basicinformation.BasicInformationView;
|
||||||
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.SerializableEnum;
|
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.SerializableEnum;
|
||||||
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.LicenseBean;
|
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.LicenseDTO;
|
||||||
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.ZenodoContributor;
|
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.ZenodoContributor;
|
||||||
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.ZenodoCreator;
|
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.ZenodoCreator;
|
||||||
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.ZenodoFile;
|
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.ZenodoFile;
|
||||||
|
@ -162,8 +162,8 @@ public class Ckan2ZenodoViewManager {
|
||||||
//license
|
//license
|
||||||
String licenseId = basicForm.getField_license().getSelectedValue();
|
String licenseId = basicForm.getField_license().getSelectedValue();
|
||||||
if(licenseId!=null) {
|
if(licenseId!=null) {
|
||||||
LicenseBean licenseBean = new LicenseBean(licenseId, null, null);
|
LicenseDTO licenseBean = new LicenseDTO(licenseId, null, null);
|
||||||
meta.setLicenses(new SerializableEnum<LicenseBean>(Arrays.asList(licenseBean),null));
|
meta.setLicenses(new SerializableEnum<LicenseDTO>(Arrays.asList(licenseBean),null));
|
||||||
//meta.setLicenses(Arrays.asList(licenseBean));
|
//meta.setLicenses(Arrays.asList(licenseBean));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ package org.gcube.portlets.widgets.ckan2zenodopublisher.client.view;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.LicenseBean;
|
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.LicenseDTO;
|
||||||
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.ZenodoLicense;
|
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.ZenodoLicense;
|
||||||
|
|
||||||
import com.github.gwtbootstrap.client.ui.ControlGroup;
|
import com.github.gwtbootstrap.client.ui.ControlGroup;
|
||||||
|
@ -102,12 +102,12 @@ public class FieldUtil {
|
||||||
* @param listLicenses the list licenses
|
* @param listLicenses the list licenses
|
||||||
* @return the list
|
* @return the list
|
||||||
*/
|
*/
|
||||||
public static List<String> toZenodoIds(List<LicenseBean> listLicenses){
|
public static List<String> toZenodoIds(List<LicenseDTO> listLicenses){
|
||||||
if(listLicenses==null)
|
if(listLicenses==null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
List<String> licenses = new ArrayList<String>(listLicenses.size());
|
List<String> licenses = new ArrayList<String>(listLicenses.size());
|
||||||
for (ZenodoLicense zenodoLicense : listLicenses) {
|
for (LicenseDTO zenodoLicense : listLicenses) {
|
||||||
licenses.add(zenodoLicense.getId());
|
licenses.add(zenodoLicense.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -187,18 +187,8 @@ public class CkanToZenodoPublisherServiceImpl extends RemoteServiceServlet imple
|
||||||
zdDeposition = client.forceTranslation(itemDescr);
|
zdDeposition = client.forceTranslation(itemDescr);
|
||||||
}
|
}
|
||||||
|
|
||||||
//fixing issue #25275
|
List<CkanResource> filteredResources = loadFilterResources(item.getItemId());
|
||||||
List<CkanResource> filteredResources = null;
|
LOG.debug("Loaded filtered resources: " + filteredResources);
|
||||||
try {
|
|
||||||
// Loading Filtered resources according to VRE policies
|
|
||||||
filteredResources = loadFilterResources(item.getItemId());
|
|
||||||
LOG.debug("Loaded filtered resources: " + filteredResources);
|
|
||||||
} catch (ConfigurationException | TransformationException e) {
|
|
||||||
LOG.info(ConfigurationException.class.getSimpleName() + " thrown, registering loadFilterResources error: "
|
|
||||||
+ itemDescr.getName());
|
|
||||||
itemTrError = new ItemTranslateError(e.getMessage(), ERROR_TYPE.INFO);
|
|
||||||
//zdDeposition = client.forceTranslation(itemDescr);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Converting ZenodoDeposition to ZenodoItem
|
// Converting ZenodoDeposition to ZenodoItem
|
||||||
ZenodoItem zenodoItem = ItemToZenodoConverter.toZenodoItem(zdDeposition);
|
ZenodoItem zenodoItem = ItemToZenodoConverter.toZenodoItem(zdDeposition);
|
||||||
|
|
|
@ -4,7 +4,7 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.SerializableEnum;
|
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.SerializableEnum;
|
||||||
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.LicenseBean;
|
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.LicenseDTO;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -56,12 +56,9 @@ public class CkanToZenodoUtil {
|
||||||
* @param allLicenses the all licenses
|
* @param allLicenses the all licenses
|
||||||
* @return the serializable enum
|
* @return the serializable enum
|
||||||
*/
|
*/
|
||||||
public static SerializableEnum<LicenseBean> licenseToSerializableEnum(List<LicenseBean> selectedLicense, List<LicenseBean> allLicenses) {
|
public static SerializableEnum<LicenseDTO> licenseToSerializableEnum(List<LicenseDTO> selectedLicense, List<LicenseDTO> allLicenses) {
|
||||||
|
|
||||||
// if(allLicenses==null)
|
|
||||||
// allLicenses = new ArrayList<LicenseBean>();
|
|
||||||
|
|
||||||
return new SerializableEnum<LicenseBean>(selectedLicense, allLicenses);
|
return new SerializableEnum<LicenseDTO>(selectedLicense, allLicenses);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -23,7 +23,7 @@ import org.gcube.data.publishing.ckan2zenodo.model.zenodo.Subject;
|
||||||
import org.gcube.data.publishing.ckan2zenodo.model.zenodo.ZenodoDeposition;
|
import org.gcube.data.publishing.ckan2zenodo.model.zenodo.ZenodoDeposition;
|
||||||
import org.gcube.portlets.widgets.ckan2zenodopublisher.server.CkanToZenodoUtil;
|
import org.gcube.portlets.widgets.ckan2zenodopublisher.server.CkanToZenodoUtil;
|
||||||
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.SerializableEnum;
|
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.SerializableEnum;
|
||||||
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.LicenseBean;
|
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.LicenseDTO;
|
||||||
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.ZenodoAuthor;
|
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.ZenodoAuthor;
|
||||||
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.ZenodoCommunity;
|
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.ZenodoCommunity;
|
||||||
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.ZenodoContributor;
|
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.ZenodoContributor;
|
||||||
|
@ -235,9 +235,9 @@ public class ItemToZenodoConverter {
|
||||||
zm.setImage_type(CkanToZenodoUtil.toSerializableEnum(imageType, ImageType.values()));
|
zm.setImage_type(CkanToZenodoUtil.toSerializableEnum(imageType, ImageType.values()));
|
||||||
|
|
||||||
//Licenses
|
//Licenses
|
||||||
List<LicenseBean> selectedLicenses = null;
|
List<LicenseDTO> selectedLicenses = null;
|
||||||
if(depositionMetadata.getLicense()!=null) {
|
if(depositionMetadata.getLicense()!=null) {
|
||||||
selectedLicenses = Arrays.asList(new LicenseBean(depositionMetadata.getLicense(),depositionMetadata.getLicense(), null));
|
selectedLicenses = Arrays.asList(new LicenseDTO(depositionMetadata.getLicense(),depositionMetadata.getLicense(), null));
|
||||||
}
|
}
|
||||||
if(selectedLicenses!=null) {
|
if(selectedLicenses!=null) {
|
||||||
zm.setLicenses(CkanToZenodoUtil.licenseToSerializableEnum(selectedLicenses, null)); //NEED TO ADD ALL LICENSES
|
zm.setLicenses(CkanToZenodoUtil.licenseToSerializableEnum(selectedLicenses, null)); //NEED TO ADD ALL LICENSES
|
||||||
|
@ -528,11 +528,11 @@ public class ItemToZenodoConverter {
|
||||||
}
|
}
|
||||||
|
|
||||||
//license
|
//license
|
||||||
SerializableEnum<LicenseBean> licenses = metadata.getLicenses();
|
SerializableEnum<LicenseDTO> licenses = metadata.getLicenses();
|
||||||
LOG.debug("Read licenses: "+licenses);
|
LOG.debug("Read licenses: "+licenses);
|
||||||
if(licenses!=null) {
|
if(licenses!=null) {
|
||||||
try {
|
try {
|
||||||
LicenseBean lB = licenses.getSelectedValues().get(0);
|
LicenseDTO lB = licenses.getSelectedValues().get(0);
|
||||||
LOG.debug("Set license: "+lB);
|
LOG.debug("Set license: "+lB);
|
||||||
depositionMetadata.setLicense(lB.getId());
|
depositionMetadata.setLicense(lB.getId());
|
||||||
}catch (Exception e) {
|
}catch (Exception e) {
|
||||||
|
|
|
@ -7,74 +7,58 @@ import java.io.Serializable;
|
||||||
*
|
*
|
||||||
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||||
*
|
*
|
||||||
* Jan 13, 2020
|
* Jan 13, 2020
|
||||||
*/
|
*/
|
||||||
public class LicenseBean implements ZenodoLicense, Serializable {
|
public class LicenseDTO implements Serializable {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = -7484830974654963132L;
|
private static final long serialVersionUID = 8796338619448833841L;
|
||||||
private String id;
|
private String id;
|
||||||
private String title;
|
private String title;
|
||||||
private String url;
|
private String url;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new license bean.
|
* Instantiates a new license bean.
|
||||||
*/
|
*/
|
||||||
public LicenseBean() {
|
public LicenseDTO() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public LicenseDTO(String id, String title, String url) {
|
||||||
/**
|
|
||||||
* Instantiates a new license bean.
|
|
||||||
*
|
|
||||||
* @param id the id
|
|
||||||
* @param title the title
|
|
||||||
* @param url the url
|
|
||||||
*/
|
|
||||||
public LicenseBean(String id, String title, String url) {
|
|
||||||
super();
|
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.title = title;
|
this.title = title;
|
||||||
this.url = url;
|
this.url = url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public String getTitle() {
|
|
||||||
return title;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void setTitle(String title) {
|
|
||||||
this.title = title;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public String getUrl() {
|
|
||||||
return url;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void setUrl(String url) {
|
|
||||||
this.url = url;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getTitle() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUrl() {
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
public void setId(String id) {
|
public void setId(String id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setTitle(String title) {
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUrl(String url) {
|
||||||
|
this.url = url;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
builder.append("LicenseBean [id=");
|
builder.append("LicenseDTO [id=");
|
||||||
builder.append(id);
|
builder.append(id);
|
||||||
builder.append(", title=");
|
builder.append(", title=");
|
||||||
builder.append(title);
|
builder.append(title);
|
||||||
|
@ -84,15 +68,4 @@ public class LicenseBean implements ZenodoLicense, Serializable {
|
||||||
return builder.toString();
|
return builder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see java.lang.Object#equals(java.lang.Object)
|
|
||||||
*/
|
|
||||||
// @Override
|
|
||||||
// public boolean equals(Object obj) {
|
|
||||||
// return obj.getClass().equals(this.getClass()) && ((LicenseBean)obj).getTitle().equals(this.title);
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -35,6 +35,8 @@ public class ZenodoItem implements Serializable {
|
||||||
private String name; // this is the dataset name
|
private String name; // this is the dataset name
|
||||||
|
|
||||||
private ItemTranslateError translateError;
|
private ItemTranslateError translateError;
|
||||||
|
|
||||||
|
private LicenseDTO licenseDTO; //not used, here only for GWT serialization
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new zenodo item.
|
* Instantiates a new zenodo item.
|
||||||
|
|
|
@ -77,7 +77,7 @@ public class ZenodoMetadata implements Serializable {
|
||||||
private List<ZenodoDateInterval> dates;
|
private List<ZenodoDateInterval> dates;
|
||||||
private String method; // TODO html
|
private String method; // TODO html
|
||||||
|
|
||||||
private SerializableEnum<LicenseBean> licenses;
|
private SerializableEnum<LicenseDTO> licenses;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new zenodo metadata.
|
* Instantiates a new zenodo metadata.
|
||||||
|
@ -882,7 +882,7 @@ public class ZenodoMetadata implements Serializable {
|
||||||
*
|
*
|
||||||
* @param licenses the new licenses
|
* @param licenses the new licenses
|
||||||
*/
|
*/
|
||||||
public void setLicenses(SerializableEnum<LicenseBean> licenses) {
|
public void setLicenses(SerializableEnum<LicenseDTO> licenses) {
|
||||||
this.licenses = licenses;
|
this.licenses = licenses;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -891,7 +891,7 @@ public class ZenodoMetadata implements Serializable {
|
||||||
*
|
*
|
||||||
* @return the licenses
|
* @return the licenses
|
||||||
*/
|
*/
|
||||||
public SerializableEnum<LicenseBean> getLicenses() {
|
public SerializableEnum<LicenseDTO> getLicenses() {
|
||||||
return licenses;
|
return licenses;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue