Wrapped beans form ckan2zenodo lib

This commit is contained in:
Francesco Mangiacrapa 2019-12-10 16:31:06 +01:00
parent 628f25047a
commit 02e264df8d
15 changed files with 732 additions and 299 deletions

View File

@ -10,6 +10,7 @@ import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Widget;
@ -109,6 +110,9 @@ public abstract class FormToPublishOnZenodoView extends Composite {
field_title.setValue(zenodoItem.getTitle());
field_record_url.setValue(zenodoItem.getRecord_url().toString());
Window.alert(zenodoItem.getMetadata().getRelated_identifiers().toString());
}

View File

@ -1,10 +1,20 @@
package org.gcube.portlets.widgets.ckan2zenodopublisher.server;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.gcube.data.publishing.ckan2zenodo.Ckan2ZenodoImpl;
import org.gcube.data.publishing.ckan2zenodo.model.zenodo.Creator;
import org.gcube.data.publishing.ckan2zenodo.model.zenodo.DepositionMetadata;
import org.gcube.data.publishing.ckan2zenodo.model.zenodo.DepositionMetadata.AccessRights;
import org.gcube.data.publishing.ckan2zenodo.model.zenodo.DepositionMetadata.UploadType;
import org.gcube.data.publishing.ckan2zenodo.model.zenodo.RelatedIdentifier;
import org.gcube.data.publishing.ckan2zenodo.model.zenodo.RelatedIdentifier.Relation;
import org.gcube.data.publishing.ckan2zenodo.model.zenodo.ZenodoDeposition;
import org.gcube.portlets.widgets.ckan2zenodopublisher.client.CkanToZendoPublisherWidgetConstant;
import org.gcube.portlets.widgets.ckan2zenodopublisher.client.CkanToZenodoPublisherService;
import org.gcube.portlets.widgets.ckan2zenodopublisher.server.converter.ItemConverter;
import org.gcube.portlets.widgets.ckan2zenodopublisher.server.converter.ItemToZenodoConverter;
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.CatalogueItem;
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.ZenodoItem;
import org.slf4j.Logger;
@ -43,8 +53,15 @@ public class CkanToZenodoPublisherServiceImpl extends RemoteServiceServlet imple
try {
//TO TEST
ZenodoDeposition zd = new ZenodoDeposition();
return ItemConverter.toZenodoItem(zd);
DepositionMetadata metadata = new DepositionMetadata(UploadType.dataset, new Date(), "My title", new ArrayList<Creator>(), "My desr", AccessRights.open);
List<RelatedIdentifier> related_identifiers = new ArrayList<RelatedIdentifier>(1);
related_identifiers.add(new RelatedIdentifier("12345", Relation.cites));
metadata.setRelated_identifiers(related_identifiers);
zd.setMetadata(metadata);
return ItemToZenodoConverter.toZenodoItem(zd);
} catch (Exception e) {
String error = "Error on converting the catalogue item: "+item.getItemName();
LOG.error(error, e);

View File

@ -3,8 +3,18 @@ package org.gcube.portlets.widgets.ckan2zenodopublisher.server;
import java.util.ArrayList;
import java.util.List;
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.SerializableEnum;
/**
* The Class CkanToZenodoUtil.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Dec 10, 2019
*/
public class CkanToZenodoUtil {
/**
* Gets the names.
*
@ -12,16 +22,29 @@ public class CkanToZenodoUtil {
* @return the names
*/
public static List<String> getNames(Enum<?>[] arrayEnum) {
//return Arrays.toString(e.getEnumConstants()).replaceAll("^.|.$", "").split(", ");
List<String> list = new ArrayList<String>();
for (Enum<?> s : arrayEnum) {
list.add(s.name());
}
return list;
List<String> list = new ArrayList<String>();
for (Enum<?> s : arrayEnum) {
list.add(s.name());
}
return list;
}
/**
* To serializable enum.
*
* @param <T> the generic type
* @param enumSelected the enum selected
* @param enumValues the enum values
* @return list of Values and list of selected values read from input Enum
*/
public static <T extends Enum<T>> SerializableEnum<String> toSerializableEnum(T[] enumSelected, T[] enumValues) {
List<String> selectedValues = CkanToZenodoUtil.getNames(enumSelected);
List<String> values = CkanToZenodoUtil.getNames(enumValues);
return new SerializableEnum<String>(selectedValues, values);
}
}

View File

@ -1,72 +0,0 @@
package org.gcube.portlets.widgets.ckan2zenodopublisher.server.converter;
import java.util.ArrayList;
import java.util.List;
import org.gcube.data.publishing.ckan2zenodo.model.zenodo.DepositionMetadata;
import org.gcube.data.publishing.ckan2zenodo.model.zenodo.FileDeposition;
import org.gcube.data.publishing.ckan2zenodo.model.zenodo.ZenodoDeposition;
import org.gcube.portlets.widgets.ckan2zenodopublisher.server.CkanToZenodoUtil;
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.ZenodoFile;
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.ZenodoItem;
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.ZenodoMetadata;
/**
* The Class Ckan2ZenodoItemConverter.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Dec 9, 2019
*/
public class ItemConverter {
public static ZenodoItem toZenodoItem(ZenodoDeposition zenodoDeposition) {
if(zenodoDeposition==null)
return null;
ZenodoItem zi = new ZenodoItem();
zi.setId(zenodoDeposition.getId());
zi.setDoi(zenodoDeposition.getDoi());
zi.setCreated(zenodoDeposition.getCreated());
if(zenodoDeposition.getFiles()!=null) {
List<ZenodoFile> listOfFiles = new ArrayList<ZenodoFile>(zenodoDeposition.getFiles().size());
for (FileDeposition fileDeposition : zenodoDeposition.getFiles()) {
listOfFiles.add(toZenodoFile(fileDeposition));
}
}
zi.setModified(zenodoDeposition.getModified());
zi.setOwner(zenodoDeposition.getOwner());
zi.setRecord_id(zenodoDeposition.getRecord_id());
zi.setRecord_url(zenodoDeposition.getRecord_url()!=null?zenodoDeposition.getRecord_url().toString():null);
zi.setState(zenodoDeposition.getState());
zi.setSubmitted(zenodoDeposition.getSubmitted());
zi.setTitle(zenodoDeposition.getTitle());
return zi;
}
public static ZenodoFile toZenodoFile(FileDeposition fileDeposition) {
if(fileDeposition==null)
return null;
ZenodoFile zf = new ZenodoFile();
zf.setId(fileDeposition.getId());
zf.setFilename(fileDeposition.getFilename());
zf.setFilesize(fileDeposition.getFilesize());
zf.setChecksum(fileDeposition.getChecksum());
return zf;
}
public static ZenodoMetadata toZenodoMetadata(DepositionMetadata depositionMetadata){
List<String> listUploadType = new ArrayList<String>(DepositionMetadata.UploadType.values().length);
CkanToZenodoUtil.getNames(DepositionMetadata.UploadType.values());
return null;
}
}

View File

@ -0,0 +1,251 @@
package org.gcube.portlets.widgets.ckan2zenodopublisher.server.converter;
import java.util.ArrayList;
import java.util.List;
import org.gcube.data.publishing.ckan2zenodo.model.zenodo.Community;
import org.gcube.data.publishing.ckan2zenodo.model.zenodo.Contributor;
import org.gcube.data.publishing.ckan2zenodo.model.zenodo.Creator;
import org.gcube.data.publishing.ckan2zenodo.model.zenodo.DateInterval;
import org.gcube.data.publishing.ckan2zenodo.model.zenodo.DepositionMetadata;
import org.gcube.data.publishing.ckan2zenodo.model.zenodo.DepositionMetadata.AccessRights;
import org.gcube.data.publishing.ckan2zenodo.model.zenodo.FileDeposition;
import org.gcube.data.publishing.ckan2zenodo.model.zenodo.RelatedIdentifier;
import org.gcube.data.publishing.ckan2zenodo.model.zenodo.RelatedIdentifier.Relation;
import org.gcube.data.publishing.ckan2zenodo.model.zenodo.ZenodoDeposition;
import org.gcube.portlets.widgets.ckan2zenodopublisher.server.CkanToZenodoUtil;
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.SerializableEnum;
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.ZenodoCreator;
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.ZenodoDateInterval;
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.ZenodoFile;
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.ZenodoItem;
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.ZenodoMetadata;
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.ZenodoRelatedIdentifier;
/**
* The Class ItemToZenodoConverter.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Dec 10, 2019
*/
public class ItemToZenodoConverter {
/**
* To zenodo item.
*
* @param zenodoDeposition the zenodo deposition
* @return the zenodo item
*/
public static ZenodoItem toZenodoItem(ZenodoDeposition zenodoDeposition) {
if(zenodoDeposition==null)
return null;
ZenodoItem zi = new ZenodoItem();
zi.setId(zenodoDeposition.getId());
zi.setDoi(zenodoDeposition.getDoi());
zi.setCreated(zenodoDeposition.getCreated());
if(zenodoDeposition.getFiles()!=null) {
List<ZenodoFile> listOfFiles = new ArrayList<ZenodoFile>(zenodoDeposition.getFiles().size());
for (FileDeposition fileDeposition : zenodoDeposition.getFiles()) {
listOfFiles.add(toZenodoFile(fileDeposition));
}
}
zi.setModified(zenodoDeposition.getModified());
zi.setOwner(zenodoDeposition.getOwner());
zi.setRecord_id(zenodoDeposition.getRecord_id());
zi.setRecord_url(zenodoDeposition.getRecord_url()!=null?zenodoDeposition.getRecord_url().toString():null);
zi.setState(zenodoDeposition.getState());
zi.setSubmitted(zenodoDeposition.getSubmitted());
zi.setTitle(zenodoDeposition.getTitle());
zi.setMetadata(toZenodoMetadata(zenodoDeposition.getMetadata()));
return zi;
}
/**
* To zenodo file.
*
* @param fileDeposition the file deposition
* @return the zenodo file
*/
public static ZenodoFile toZenodoFile(FileDeposition fileDeposition) {
if(fileDeposition==null)
return null;
ZenodoFile zf = new ZenodoFile();
zf.setId(fileDeposition.getId());
zf.setFilename(fileDeposition.getFilename());
zf.setFilesize(fileDeposition.getFilesize());
zf.setChecksum(fileDeposition.getChecksum());
return zf;
}
/**
* To zenodo metadata.
*
* @param depositionMetadata the deposition metadata
* @return the zenodo metadata
*/
public static ZenodoMetadata toZenodoMetadata(DepositionMetadata depositionMetadata){
if(depositionMetadata==null)
return null;
ZenodoMetadata zm = new ZenodoMetadata();
zm.setAccess_conditions(depositionMetadata.getAccess_conditions());
if(depositionMetadata.getAccess_right()!=null) {
AccessRights[] ar = { depositionMetadata.getAccess_right() };
SerializableEnum<String> sEnum = CkanToZenodoUtil.toSerializableEnum(ar, AccessRights.values());
zm.setAccess_right(sEnum);
}
zm.setCommunities(toZenodoCommunities(depositionMetadata.getCommunities()));
zm.setConference_acronym(depositionMetadata.getConference_acronym());
zm.setConference_dates(depositionMetadata.getConference_dates());
zm.setConference_place(depositionMetadata.getConference_place());
zm.setConference_session(depositionMetadata.getConference_session());
zm.setConference_session_part(depositionMetadata.getConference_session_part());
zm.setConference_title(depositionMetadata.getConference_title());
zm.setConference_url(depositionMetadata.getConference_url());
zm.setContributors(toZenodoContributors(depositionMetadata.getContributors()));
zm.setCreators(toZenodoCreators(depositionMetadata.getCreators()));
zm.setDates(toZenodDateIntervals(depositionMetadata.getDates()));
zm.setRelated_identifiers(toRelatedIdentifiers(depositionMetadata.getRelated_identifiers()));
return zm;
}
/**
* To related identifiers.
*
* @param related_identifiers the related identifiers
* @return the list
*/
private static List<ZenodoRelatedIdentifier> toRelatedIdentifiers(List<RelatedIdentifier> related_identifiers) {
if(related_identifiers==null)
return null;
List<ZenodoRelatedIdentifier> list = new ArrayList<ZenodoRelatedIdentifier>(related_identifiers.size());
for (RelatedIdentifier relatedIdentifier : related_identifiers) {
Relation[] rel = { relatedIdentifier.getRelation() };
SerializableEnum<String> sEnum = CkanToZenodoUtil.toSerializableEnum(rel, Relation.values());
ZenodoRelatedIdentifier zdi = new ZenodoRelatedIdentifier(relatedIdentifier.getIdentifier(), sEnum);
list.add(zdi);
}
return list;
}
/**
* To zenod date intervals.
*
* @param dateIntervals the date intervals
* @return the list
*/
private static List<ZenodoDateInterval> toZenodDateIntervals(List<DateInterval> dateIntervals) {
if(dateIntervals==null)
return null;
List<ZenodoDateInterval> list = new ArrayList<ZenodoDateInterval>(dateIntervals.size());
for (DateInterval dateInterval : dateIntervals) {
SerializableEnum<String> types = null;
if(dateInterval.getType()!=null) {
DateInterval.Type[] rel = { dateInterval.getType() };
types = CkanToZenodoUtil.toSerializableEnum(rel, DateInterval.Type.values());
}
ZenodoDateInterval zdi = new ZenodoDateInterval(dateInterval.getStart(), dateInterval.getEnd(), types, dateInterval.getDescription());
//TODO MUST BE COMPLETED
//list.add(new ZenodoCommunity(community.getIdentifier()));
}
return list;
}
/**
* To zenodo communities.
*
* @param communities the communities
* @return the list
*/
public static List<ZenodoCommunity> toZenodoCommunities(List<Community> communities) {
if(communities==null)
return null;
List<ZenodoCommunity> list = new ArrayList<ZenodoCommunity>(communities.size());
for (Community community : communities) {
list.add(new ZenodoCommunity(community.getIdentifier()));
}
return list;
}
/**
* To zenodo contributors.
*
* @param contributors the contributors
* @return the list
*/
public static List<ZenodoContributor> toZenodoContributors(List<Contributor> contributors) {
if(contributors==null)
return null;
List<ZenodoContributor> list = new ArrayList<ZenodoContributor>(contributors.size());
for (Contributor contr : contributors) {
ZenodoContributor zc = new ZenodoContributor();
zc.setAffiliation(contr.getAffiliation());
zc.setGnd(contr.getGnd());
zc.setName(contr.getName());
zc.setOrcid(contr.getOrcid());
SerializableEnum<String> types = null;
if(contr.getType()!=null) {
Contributor.Type[] rel = { contr.getType() };
types = CkanToZenodoUtil.toSerializableEnum(rel, Contributor.Type.values());
}
zc.setType(types);
list.add(zc);
}
return list;
}
/**
* To zenodo creators.
*
* @param creators the creators
* @return the list
*/
public static List<ZenodoCreator> toZenodoCreators(List<Creator> creators) {
if(creators==null)
return null;
List<ZenodoCreator> list = new ArrayList<ZenodoCreator>(creators.size());
for (Creator contr : creators) {
ZenodoContributor zc = new ZenodoContributor();
zc.setAffiliation(contr.getAffiliation());
zc.setGnd(contr.getGnd());
zc.setName(contr.getName());
zc.setOrcid(contr.getOrcid());
list.add(zc);
}
return list;
}
}

View File

@ -0,0 +1,57 @@
package org.gcube.portlets.widgets.ckan2zenodopublisher.shared;
import java.io.Serializable;
import java.util.List;
/**
* The Class SerializableEnum.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Dec 10, 2019
* @param <T> the generic type
*/
public class SerializableEnum<E> implements Serializable{
/**
*
*/
private static final long serialVersionUID = 1L;
private List<E> selectedValues;
private List<E> selectableValues;
public SerializableEnum() {
}
/**
* Instantiates a new serializable enum.
*
* @param enumerator the enumerator
*/
public SerializableEnum(List<E> selectedValues, List<E> selectableValues) {
this.selectedValues = selectedValues;
this.selectableValues = selectableValues;
}
public List<E> getSelectedValues() {
return selectedValues;
}
public List<E> getSelectableValues() {
return selectableValues;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("SerializableEnum [selectedValues=");
builder.append(selectedValues);
builder.append(", selectableValues=");
builder.append(selectableValues);
builder.append("]");
return builder.toString();
}
}

View File

@ -21,7 +21,7 @@ public class ZenodoCommunity implements Serializable{
/**
* Instantiates a new zenodo community.
*/
ZenodoCommunity(){}
public ZenodoCommunity(){}
/**
* Instantiates a new zenodo community.

View File

@ -1,9 +1,6 @@
package org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped;
import java.util.List;
import org.gcube.data.publishing.ckan2zenodo.model.zenodo.Contributor;
import org.gcube.portlets.widgets.ckan2zenodopublisher.server.CkanToZenodoUtil;
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.SerializableEnum;
/**
@ -19,33 +16,39 @@ public class ZenodoContributor extends ZenodoCreator{
*
*/
private static final long serialVersionUID = -3422470577729844766L;
public static final List<String> SELECTABLE_TYPE = CkanToZenodoUtil.getNames(Contributor.Type.values());
private String type;
private SerializableEnum<String> type;
/**
* Instantiates a new zenodo contributor.
*/
ZenodoContributor(){}
public ZenodoContributor(){}
/**
* Gets the type.
* Instantiates a new zenodo contributor.
*
* @return the type
* @param name the name
* @param affiliation the affiliation
* @param orcid the orcid
* @param gnd the gnd
*/
public String getType() {
public ZenodoContributor(String name, String affiliation, String orcid, String gnd) {
super(name, affiliation, orcid, gnd);
}
public SerializableEnum<String> getType() {
return type;
}
/**
* Sets the type.
*
* @param type the new type
*/
public void setType(String type) {
public void setType(SerializableEnum<String> type) {
this.type = type;
}
/* (non-Javadoc)
* @see org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.ZenodoCreator#toString()
*/

View File

@ -21,7 +21,7 @@ public class ZenodoCreator implements Serializable{
private String orcid;
private String gnd;
ZenodoCreator(){}
public ZenodoCreator(){}
public ZenodoCreator(String name, String affiliation, String orcid, String gnd) {

View File

@ -2,32 +2,44 @@ package org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import org.gcube.data.publishing.ckan2zenodo.model.zenodo.DateInterval;
import org.gcube.data.publishing.ckan2zenodo.model.zenodo.DateInterval.Type;
import org.gcube.portlets.widgets.ckan2zenodopublisher.server.CkanToZenodoUtil;
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.SerializableEnum;
public class ZenodoDateInterval implements Serializable{
/**
* The Class ZenodoDateInterval.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Dec 10, 2019
*/
public class ZenodoDateInterval implements Serializable {
/**
*
*/
private static final long serialVersionUID = 6553194706340699412L;
public static final List<String> SELECTABLE_TYPE = CkanToZenodoUtil.getNames(DateInterval.Type.values());
private Date start;
private Date end;
private Type type;
private SerializableEnum<String> type;
private String description;
ZenodoDateInterval(){}
/**
* Instantiates a new zenodo date interval.
*/
ZenodoDateInterval() {
}
public ZenodoDateInterval(Date start, Date end, Type type, String description) {
/**
* Instantiates a new zenodo date interval.
*
* @param start the start
* @param end the end
* @param type the type
* @param description the description
*/
public ZenodoDateInterval(Date start, Date end, SerializableEnum<String> type, String description) {
super();
this.start = start;
this.end = end;
@ -35,47 +47,81 @@ public class ZenodoDateInterval implements Serializable{
this.description = description;
}
/**
* Gets the start.
*
* @return the start
*/
public Date getStart() {
return start;
}
/**
* Sets the start.
*
* @param start the new start
*/
public void setStart(Date start) {
this.start = start;
}
/**
* Gets the end.
*
* @return the end
*/
public Date getEnd() {
return end;
}
/**
* Sets the end.
*
* @param end the new end
*/
public void setEnd(Date end) {
this.end = end;
}
public Type getType() {
/**
* Gets the type.
*
* @return the type
*/
public SerializableEnum<String> getType() {
return type;
}
public void setType(Type type) {
/**
* Sets the type.
*
* @param type the new type
*/
public void setType(SerializableEnum<String> type) {
this.type = type;
}
/**
* Gets the description.
*
* @return the description
*/
public String getDescription() {
return description;
}
/**
* Sets the description.
*
* @param description the new description
*/
public void setDescription(String description) {
this.description = description;
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
@ -90,7 +136,5 @@ public class ZenodoDateInterval implements Serializable{
builder.append("]");
return builder.toString();
}
}

View File

@ -3,27 +3,27 @@ package org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* The Class ZenodoItem.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Dec 9, 2019
* Dec 9, 2019
*/
public class ZenodoItem implements Serializable{
public class ZenodoItem implements Serializable {
/**
*
*/
private static final long serialVersionUID = -3623554371253293861L;
private Date created;
private Date created;
private String doi;
private ArrayList<ZenodoFile> files;
private List<ZenodoFile> files;
private Integer id;
//private DepositionMetadata metadata; TODO
private ZenodoMetadata metadata;
private Date modified;
private Integer owner;
private Integer record_id;
@ -31,36 +31,38 @@ public class ZenodoItem implements Serializable{
private String state;
private Boolean submitted;
private String title;
/**
* Instantiates a new zenodo item.
*/
public ZenodoItem() {}
public ZenodoItem() {
}
/**
* Instantiates a new zenodo item.
* Gets the metadata.
*
* @param doi the doi
* @param id the id
* @param owner the owner
* @param record_id the record id
* @param record_url the record url
* @param state the state
* @param submitted the submitted
* @param title the title
* @return the metadata
*/
public ZenodoItem(String doi, Integer id, Integer owner, Integer record_id, String record_url, String state,
Boolean submitted, String title) {
super();
this.doi = doi;
this.id = id;
this.owner = owner;
this.record_id = record_id;
this.record_url = record_url;
this.state = state;
this.submitted = submitted;
this.title = title;
public ZenodoMetadata getMetadata() {
return metadata;
}
/**
* Sets the metadata.
*
* @param metadata the new metadata
*/
public void setMetadata(ZenodoMetadata metadata) {
this.metadata = metadata;
}
/**
* Sets the files.
*
* @param files the new files
*/
public void setFiles(List<ZenodoFile> files) {
this.files = files;
}
/**
@ -104,7 +106,7 @@ public class ZenodoItem implements Serializable{
*
* @return the files
*/
public ArrayList<ZenodoFile> getFiles() {
public List<ZenodoFile> getFiles() {
return files;
}
@ -260,7 +262,5 @@ public class ZenodoItem implements Serializable{
public void setTitle(String title) {
this.title = title;
}
}

View File

@ -24,7 +24,7 @@ public class ZenodoLocation implements Serializable{
/**
* Instantiates a new zenodo location.
*/
ZenodoLocation(){}
public ZenodoLocation(){}

View File

@ -4,28 +4,27 @@ import java.io.Serializable;
import java.util.Date;
import java.util.List;
import org.gcube.data.publishing.ckan2zenodo.model.zenodo.DepositionMetadata;
import org.gcube.portlets.widgets.ckan2zenodopublisher.server.CkanToZenodoUtil;
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.SerializableEnum;
public class ZenodoMetadata implements Serializable{
/**
*
*/
private static final long serialVersionUID = -1885238190029199362L;
public static final List<String> SELECTABLE_UPLOAD_TYPE = CkanToZenodoUtil.getNames(DepositionMetadata.UploadType.values());
private String upload_type;
private SerializableEnum<String> upload_type;
public static final List<String> SELECTABLE_PUBLICATION_TYPE = CkanToZenodoUtil.getNames(DepositionMetadata.PublicationType.values());
private String publication_type;
private SerializableEnum<String> publication_type;
public static final List<String> SELECTABLE_IMAGE_TYPE = CkanToZenodoUtil.getNames(DepositionMetadata.ImageType.values());
private String image_type;
private SerializableEnum<String> image_type;
private Date publication_date;
private String title;
private List<ZenodoCreator> creators;
private String description; // TODO HTML
public static final List<String> SELECTABLE_ACCESS_RIGHTS = CkanToZenodoUtil.getNames(DepositionMetadata.AccessRights.values());
private String access_right;
private SerializableEnum<String> access_right;
private Date embargo_date;
private String access_conditions; // TODO HTML
@ -67,357 +66,436 @@ public class ZenodoMetadata implements Serializable{
public ZenodoMetadata(){}
public String getUpload_type() {
public SerializableEnum<String> getUpload_type() {
return upload_type;
}
public void setUpload_type(String upload_type) {
public void setUpload_type(SerializableEnum<String> upload_type) {
this.upload_type = upload_type;
}
public String getPublication_type() {
public SerializableEnum<String> getPublication_type() {
return publication_type;
}
public void setPublication_type(String publication_type) {
public void setPublication_type(SerializableEnum<String> publication_type) {
this.publication_type = publication_type;
}
public String getImage_type() {
public SerializableEnum<String> getImage_type() {
return image_type;
}
public void setImage_type(String image_type) {
public void setImage_type(SerializableEnum<String> image_type) {
this.image_type = image_type;
}
public Date getPublication_date() {
return publication_date;
}
public void setPublication_date(Date publication_date) {
this.publication_date = publication_date;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public List<ZenodoCreator> getCreators() {
return creators;
}
public void setCreators(List<ZenodoCreator> creators) {
this.creators = creators;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getAccess_right() {
public SerializableEnum<String> getAccess_right() {
return access_right;
}
public void setAccess_right(String access_right) {
public void setAccess_right(SerializableEnum<String> access_right) {
this.access_right = access_right;
}
public Date getEmbargo_date() {
return embargo_date;
}
public void setEmbargo_date(Date embargo_date) {
this.embargo_date = embargo_date;
}
public String getAccess_conditions() {
return access_conditions;
}
public void setAccess_conditions(String access_conditions) {
this.access_conditions = access_conditions;
}
public String getDoi() {
return doi;
}
public void setDoi(String doi) {
this.doi = doi;
}
public Boolean getPreserve_doi() {
return preserve_doi;
}
public void setPreserve_doi(Boolean preserve_doi) {
this.preserve_doi = preserve_doi;
}
public List<String> getKeywords() {
return keywords;
}
public void setKeywords(List<String> keywords) {
this.keywords = keywords;
}
public String getNotes() {
return notes;
}
public void setNotes(String notes) {
this.notes = notes;
}
public List<ZenodoRelatedIdentifier> getRelated_identifiers() {
return related_identifiers;
}
public void setRelated_identifiers(List<ZenodoRelatedIdentifier> related_identifiers) {
this.related_identifiers = related_identifiers;
}
public List<ZenodoContributor> getContributors() {
return contributors;
}
public void setContributors(List<ZenodoContributor> contributors) {
this.contributors = contributors;
}
public List<String> getReferences() {
return references;
}
public void setReferences(List<String> references) {
this.references = references;
}
public List<ZenodoCommunity> getCommunities() {
return communities;
}
public void setCommunities(List<ZenodoCommunity> communities) {
this.communities = communities;
}
public List<ZenodoGrant> getGrants() {
return grants;
}
public void setGrants(List<ZenodoGrant> grants) {
this.grants = grants;
}
public String getJournal_title() {
return journal_title;
}
public void setJournal_title(String journal_title) {
this.journal_title = journal_title;
}
public String getJournal_volume() {
return journal_volume;
}
public void setJournal_volume(String journal_volume) {
this.journal_volume = journal_volume;
}
public String getJournal_issue() {
return journal_issue;
}
public void setJournal_issue(String journal_issue) {
this.journal_issue = journal_issue;
}
public String getJournal_pages() {
return journal_pages;
}
public void setJournal_pages(String journal_pages) {
this.journal_pages = journal_pages;
}
public String getConference_title() {
return conference_title;
}
public void setConference_title(String conference_title) {
this.conference_title = conference_title;
}
public String getConference_acronym() {
return conference_acronym;
}
public void setConference_acronym(String conference_acronym) {
this.conference_acronym = conference_acronym;
}
public String getConference_dates() {
return conference_dates;
}
public void setConference_dates(String conference_dates) {
this.conference_dates = conference_dates;
}
public String getConference_place() {
return conference_place;
}
public void setConference_place(String conference_place) {
this.conference_place = conference_place;
}
public String getConference_url() {
return conference_url;
}
public void setConference_url(String conference_url) {
this.conference_url = conference_url;
}
public String getConference_session() {
return conference_session;
}
public void setConference_session(String conference_session) {
this.conference_session = conference_session;
}
public String getConference_session_part() {
return conference_session_part;
}
public void setConference_session_part(String conference_session_part) {
this.conference_session_part = conference_session_part;
}
public String getImprint_publisher() {
return imprint_publisher;
}
public void setImprint_publisher(String imprint_publisher) {
this.imprint_publisher = imprint_publisher;
}
public String getImprint_isbn() {
return imprint_isbn;
}
public void setImprint_isbn(String imprint_isbn) {
this.imprint_isbn = imprint_isbn;
}
public String getImprint_place() {
return imprint_place;
}
public void setImprint_place(String imprint_place) {
this.imprint_place = imprint_place;
}
public String getPartof_title() {
return partof_title;
}
public void setPartof_title(String partof_title) {
this.partof_title = partof_title;
}
public String getPartof_pages() {
return partof_pages;
}
public void setPartof_pages(String partof_pages) {
this.partof_pages = partof_pages;
}
public List<ZenodoCreator> getThesis_supervisors() {
return thesis_supervisors;
}
public void setThesis_supervisors(List<ZenodoCreator> thesis_supervisors) {
this.thesis_supervisors = thesis_supervisors;
}
public String getThesis_university() {
return thesis_university;
}
public void setThesis_university(String thesis_university) {
this.thesis_university = thesis_university;
}
public List<ZenodoSubject> getSubjects() {
return subjects;
}
public void setSubjects(List<ZenodoSubject> subjects) {
this.subjects = subjects;
}
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
public String getLanguage() {
return language;
}
public void setLanguage(String language) {
this.language = language;
}
public List<ZenodoLocation> getLocations() {
return locations;
}
public void setLocations(List<ZenodoLocation> locations) {
this.locations = locations;
}
public List<ZenodoDateInterval> getDates() {
return dates;
}
public void setDates(List<ZenodoDateInterval> dates) {
this.dates = dates;
}
public String getMethod() {
return method;
}
public void setMethod(String method) {
this.method = method;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("ZenodoMetadata [upload_type=");
builder.append(upload_type);
builder.append(", publication_type=");
builder.append(publication_type);
builder.append(", image_type=");
builder.append(image_type);
builder.append(", publication_date=");
builder.append(publication_date);
builder.append(", title=");
builder.append(title);
builder.append(", creators=");
builder.append(creators);
builder.append(", description=");
builder.append(description);
builder.append(", access_right=");
builder.append(access_right);
builder.append(", embargo_date=");
builder.append(embargo_date);
builder.append(", access_conditions=");
builder.append(access_conditions);
builder.append(", doi=");
builder.append(doi);
builder.append(", preserve_doi=");
builder.append(preserve_doi);
builder.append(", keywords=");
builder.append(keywords);
builder.append(", notes=");
builder.append(notes);
builder.append(", related_identifiers=");
builder.append(related_identifiers);
builder.append(", contributors=");
builder.append(contributors);
builder.append(", references=");
builder.append(references);
builder.append(", communities=");
builder.append(communities);
builder.append(", grants=");
builder.append(grants);
builder.append(", journal_title=");
builder.append(journal_title);
builder.append(", journal_volume=");
builder.append(journal_volume);
builder.append(", journal_issue=");
builder.append(journal_issue);
builder.append(", journal_pages=");
builder.append(journal_pages);
builder.append(", conference_title=");
builder.append(conference_title);
builder.append(", conference_acronym=");
builder.append(conference_acronym);
builder.append(", conference_dates=");
builder.append(conference_dates);
builder.append(", conference_place=");
builder.append(conference_place);
builder.append(", conference_url=");
builder.append(conference_url);
builder.append(", conference_session=");
builder.append(conference_session);
builder.append(", conference_session_part=");
builder.append(conference_session_part);
builder.append(", imprint_publisher=");
builder.append(imprint_publisher);
builder.append(", imprint_isbn=");
builder.append(imprint_isbn);
builder.append(", imprint_place=");
builder.append(imprint_place);
builder.append(", partof_title=");
builder.append(partof_title);
builder.append(", partof_pages=");
builder.append(partof_pages);
builder.append(", thesis_supervisors=");
builder.append(thesis_supervisors);
builder.append(", thesis_university=");
builder.append(thesis_university);
builder.append(", subjects=");
builder.append(subjects);
builder.append(", version=");
builder.append(version);
builder.append(", language=");
builder.append(language);
builder.append(", locations=");
builder.append(locations);
builder.append(", dates=");
builder.append(dates);
builder.append(", method=");
builder.append(method);
builder.append("]");
return builder.toString();
}
}

View File

@ -4,55 +4,85 @@
package org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped;
import java.io.Serializable;
import java.util.List;
import org.gcube.data.publishing.ckan2zenodo.model.zenodo.RelatedIdentifier.Relation;
import org.gcube.portlets.widgets.ckan2zenodopublisher.server.CkanToZenodoUtil;
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.SerializableEnum;
/**
* The Class ZenodoRelatedIdentifier.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Dec 10, 2019
* Dec 10, 2019
*/
public class ZenodoRelatedIdentifier implements Serializable{
public class ZenodoRelatedIdentifier implements Serializable {
/**
*
*/
private static final long serialVersionUID = 884279610505770594L;
private String identifier;
private String relation;
public static final List<String> SELECTABLE_RELATED_IDENTIFIERS = CkanToZenodoUtil.getNames(Relation.values());
ZenodoRelatedIdentifier(){}
public ZenodoRelatedIdentifier(String identifier, String relation) {
private SerializableEnum<String> relation;
/**
* Instantiates a new zenodo related identifier.
*/
public ZenodoRelatedIdentifier() {
}
/**
* Instantiates a new zenodo related identifier.
*
* @param identifier the identifier
* @param relation the relation
*/
public ZenodoRelatedIdentifier(String identifier, SerializableEnum<String> relation) {
super();
this.identifier = identifier;
this.relation = relation;
}
/**
* Gets the relation.
*
* @return the relation
*/
public SerializableEnum<String> getRelation() {
return relation;
}
/**
* Sets the relation.
*
* @param relation the new relation
*/
public void setRelation(SerializableEnum<String> relation) {
this.relation = relation;
}
/**
* Gets the identifier.
*
* @return the identifier
*/
public String getIdentifier() {
return identifier;
}
/**
* Sets the identifier.
*
* @param identifier the new identifier
*/
public void setIdentifier(String identifier) {
this.identifier = identifier;
}
public String getRelation() {
return relation;
}
public void setRelation(String relation) {
this.relation = relation;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
@ -63,7 +93,5 @@ public class ZenodoRelatedIdentifier implements Serializable{
builder.append("]");
return builder.toString();
}
}

View File

@ -23,7 +23,7 @@ public class ZenodoSubject implements Serializable{
/**
* Instantiates a new zenodo subject.
*/
ZenodoSubject(){}
public ZenodoSubject(){}