in progress on update
This commit is contained in:
parent
731cac1e95
commit
f83312dbf3
|
@ -5,4 +5,5 @@
|
|||
<installed facet="jst.web" version="2.3"/>
|
||||
<installed facet="com.gwtplugins.gwt.facet" version="1.0"/>
|
||||
<installed facet="wst.jsdt.web" version="1.0"/>
|
||||
<installed facet="jst.jaxrs" version="2.0"/>
|
||||
</faceted-project>
|
||||
|
|
|
@ -4,11 +4,12 @@
|
|||
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).
|
||||
|
||||
## [v1.1.0-SNAPSHOT] - 2022-03-01
|
||||
## [v2.0.0-SNAPSHOT] - 2022-03-01
|
||||
|
||||
#### Enhancement
|
||||
|
||||
- [#22890] Overloaded the method getProfilesInTheScope
|
||||
- [#22890] Overloaded the method getProfilesInTheScope(forName)
|
||||
- [#22890] Including the set/get currentValue for Update facility
|
||||
|
||||
## [v1.0.1-SNAPSHOT] - 2020-10-08
|
||||
|
||||
|
|
2
pom.xml
2
pom.xml
|
@ -14,7 +14,7 @@
|
|||
<groupId>org.gcube.portlets.widgets</groupId>
|
||||
<artifactId>metadata-profile-form-builder-widget</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
<version>2.0.0-SNAPSHOT</version>
|
||||
<name>Metadata Profile Form Builder</name>
|
||||
<description>
|
||||
The Metadata Profile Form Builder is a widget able to build dynamically a web form by reading "gCube Metadata Profile/s"
|
||||
|
|
|
@ -3,6 +3,7 @@ package org.gcube.portlets.widgets.mpformbuilder.client.form;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.portlets.widgets.mpformbuilder.client.form.generic.CreateMetadataForm.OPERATION;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.client.ui.metadata.MetaDataFieldSkeleton;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.shared.metadata.MetadataFieldWrapper;
|
||||
|
||||
|
@ -35,8 +36,6 @@ public class MetaDataField extends Composite {
|
|||
|
||||
@UiField Label repeatabilityLabel;
|
||||
|
||||
//@UiField ControlGroup cgMetaDataFieldSkeletonFields;
|
||||
|
||||
@UiField Button addFieldButton;
|
||||
|
||||
@UiField Button removeFieldButton;
|
||||
|
@ -47,6 +46,8 @@ public class MetaDataField extends Composite {
|
|||
|
||||
private HandlerManager eventBus;
|
||||
|
||||
private OPERATION operation;
|
||||
|
||||
/**
|
||||
* The Interface MetaDataFieldUiBinder.
|
||||
*
|
||||
|
@ -65,10 +66,11 @@ public class MetaDataField extends Composite {
|
|||
* @param eventBus the event bus
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
public MetaDataField(final MetadataFieldWrapper field, HandlerManager eventBus) throws Exception {
|
||||
public MetaDataField(final MetadataFieldWrapper field, HandlerManager eventBus, OPERATION operation) throws Exception {
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
this.fieldWrapper = field;
|
||||
this.eventBus = eventBus;
|
||||
this.operation = operation;
|
||||
addNewOccurrenceOfField();
|
||||
checkAllowedAddField();
|
||||
checkAllowedRemoveField();
|
||||
|
@ -143,7 +145,7 @@ public class MetaDataField extends Composite {
|
|||
*/
|
||||
private void addNewOccurrenceOfField() {
|
||||
try {
|
||||
MetaDataFieldSkeleton fieldWidget = new MetaDataFieldSkeleton(fieldWrapper, eventBus);
|
||||
MetaDataFieldSkeleton fieldWidget = new MetaDataFieldSkeleton(fieldWrapper, eventBus, operation);
|
||||
listOfMetadataFields.add(fieldWidget);
|
||||
panelMetaDataFieldsSkeleton.add(fieldWidget);
|
||||
} catch (Exception e) {
|
||||
|
|
|
@ -61,7 +61,7 @@ import com.google.gwt.user.client.ui.HTMLPanel;
|
|||
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
|
||||
/**
|
||||
* Create metadata form for ckan product.
|
||||
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
||||
|
@ -238,6 +238,10 @@ public class CreateMetadataForm extends Composite implements HasGenericFormListe
|
|||
/** The form data bean. */
|
||||
private GenericDatasetBean formDataBean;
|
||||
|
||||
private OPERATION operationPerfom;
|
||||
|
||||
public enum OPERATION {NEW, UPDATE}
|
||||
|
||||
/**
|
||||
* Invoked in the most general case.
|
||||
*
|
||||
|
@ -271,8 +275,9 @@ public class CreateMetadataForm extends Composite implements HasGenericFormListe
|
|||
*
|
||||
* @param profiles the profiles
|
||||
*/
|
||||
public CreateMetadataForm(List<MetaDataProfileBean> profiles, HandlerManager eventBus) {
|
||||
public CreateMetadataForm(List<MetaDataProfileBean> profiles, HandlerManager eventBus, OPERATION operation) {
|
||||
this(eventBus);
|
||||
this.operationPerfom = operation;
|
||||
showLoadingProfiles(true);
|
||||
createDatasetFormBody(profiles);
|
||||
showLoadingProfiles(false);
|
||||
|
@ -303,6 +308,7 @@ public class CreateMetadataForm extends Composite implements HasGenericFormListe
|
|||
showCustomFieldsEntries(false);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Show loading profiles.
|
||||
*
|
||||
|
@ -464,7 +470,7 @@ public class CreateMetadataForm extends Composite implements HasGenericFormListe
|
|||
|
||||
MetaDataField fieldWidget;
|
||||
try {
|
||||
fieldWidget = new MetaDataField(field, uiBus);
|
||||
fieldWidget = new MetaDataField(field, uiBus, operationPerfom);
|
||||
metadataFieldsPanel.add(fieldWidget);
|
||||
listOfMetadataFields.add(fieldWidget);
|
||||
} catch (Exception e) {
|
||||
|
@ -493,7 +499,7 @@ public class CreateMetadataForm extends Composite implements HasGenericFormListe
|
|||
|
||||
MetaDataField fieldWidget;
|
||||
try {
|
||||
fieldWidget = new MetaDataField(metadataFieldWrapper, uiBus);
|
||||
fieldWidget = new MetaDataField(metadataFieldWrapper, uiBus,operationPerfom);
|
||||
cp.addField(fieldWidget);
|
||||
listOfMetadataFields.add(fieldWidget);
|
||||
} catch (Exception e) {
|
||||
|
@ -519,7 +525,7 @@ public class CreateMetadataForm extends Composite implements HasGenericFormListe
|
|||
|
||||
MetaDataField fieldWidget;
|
||||
try {
|
||||
fieldWidget = new MetaDataField(field, uiBus);
|
||||
fieldWidget = new MetaDataField(field, uiBus, operationPerfom);
|
||||
extrasCategory.addField(fieldWidget);
|
||||
listOfMetadataFields.add(fieldWidget);
|
||||
} catch (Exception e) {
|
||||
|
|
|
@ -5,6 +5,7 @@ import java.util.List;
|
|||
|
||||
import org.gcube.portlets.widgets.mpformbuilder.client.events.CloseCreationFormEvent;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.client.events.CloseCreationFormEventHandler;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.client.form.generic.CreateMetadataForm.OPERATION;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.client.openlayerwidget.GeoJsonAreaSelectionDialog;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.client.ui.timeandranges.DataTimeBox;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.client.ui.upload.DialogUpload;
|
||||
|
@ -121,7 +122,8 @@ public class MetaDataFieldSkeleton extends Composite {
|
|||
|
||||
private static final String UPLOAD_MISSING_FILE = "You must upload a file";
|
||||
|
||||
public MetaDataFieldSkeleton(final MetadataFieldWrapper field, HandlerManager eventBus) throws Exception {
|
||||
public MetaDataFieldSkeleton(final MetadataFieldWrapper field, HandlerManager eventBus, OPERATION operation)
|
||||
throws Exception {
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
|
||||
// prepare information
|
||||
|
@ -133,6 +135,9 @@ public class MetaDataFieldSkeleton extends Composite {
|
|||
// bind
|
||||
bind();
|
||||
|
||||
if (operation == null)
|
||||
operation = OPERATION.NEW;
|
||||
|
||||
switch (field.getType()) {
|
||||
|
||||
case Boolean:
|
||||
|
@ -141,6 +146,16 @@ public class MetaDataFieldSkeleton extends Composite {
|
|||
holder = new CheckBox();
|
||||
if (field.getDefaultValue() != null)
|
||||
((CheckBox) holder).setValue(Boolean.valueOf(field.getDefaultValue()));
|
||||
|
||||
if (operation.equals(OPERATION.UPDATE)) {
|
||||
try {
|
||||
if (field.getCurrentValue() != null)
|
||||
((CheckBox) holder).setValue(Boolean.valueOf(field.getDefaultValue()));
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case GeoJSON:
|
||||
|
@ -154,6 +169,15 @@ public class MetaDataFieldSkeleton extends Composite {
|
|||
if (field.getDefaultValue() != null)
|
||||
textArea.setText(field.getDefaultValue());
|
||||
|
||||
if (operation.equals(OPERATION.UPDATE)) {
|
||||
try {
|
||||
if (field.getCurrentValue() != null)
|
||||
textArea.setText((String) field.getCurrentValue());
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
}
|
||||
}
|
||||
|
||||
containerGeoJSON.add(textArea);
|
||||
|
||||
HorizontalPanel hp = new HorizontalPanel();
|
||||
|
@ -216,6 +240,16 @@ public class MetaDataFieldSkeleton extends Composite {
|
|||
|
||||
if (field.getDefaultValue() != null)
|
||||
((TextArea) holder).setText(field.getDefaultValue());
|
||||
|
||||
if (operation.equals(OPERATION.UPDATE)) {
|
||||
try {
|
||||
if (field.getCurrentValue() != null)
|
||||
((TextArea) holder).setText((String) field.getCurrentValue());
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case Time:
|
||||
|
@ -230,6 +264,22 @@ public class MetaDataFieldSkeleton extends Composite {
|
|||
ref.setStartDate(dateAndTime[0], dateAndTime.length > 1 ? dateAndTime[1] : null);
|
||||
}
|
||||
}
|
||||
|
||||
if (operation.equals(OPERATION.UPDATE)) {
|
||||
// set time, if present
|
||||
try {
|
||||
if (field.getCurrentValue() != null) {
|
||||
String currentValue = (String) field.getCurrentValue();
|
||||
String[] dateAndTime = currentValue.split(" ");
|
||||
if (dateAndTime.length > 0) {
|
||||
ref.setStartDate(dateAndTime[0], dateAndTime.length > 1 ? dateAndTime[1] : null);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case Time_Interval:
|
||||
|
@ -237,6 +287,15 @@ public class MetaDataFieldSkeleton extends Composite {
|
|||
DataTimeBox rangeBox;
|
||||
holder = rangeBox = new DataTimeBox(true);
|
||||
setRangeTimeInTimeBox(field.getDefaultValue(), rangeBox);
|
||||
if (operation.equals(OPERATION.UPDATE)) {
|
||||
// set time, if present
|
||||
try {
|
||||
setRangeTimeInTimeBox((String) field.getCurrentValue(), rangeBox);
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
}
|
||||
}
|
||||
|
||||
rangesList.add(rangeBox);
|
||||
break;
|
||||
|
||||
|
@ -251,6 +310,15 @@ public class MetaDataFieldSkeleton extends Composite {
|
|||
SimplePanel panelFirstRange = new SimplePanel();
|
||||
DataTimeBox rangeBoxFirst = new DataTimeBox(true);
|
||||
setRangeTimeInTimeBox(field.getDefaultValue(), rangeBoxFirst);
|
||||
|
||||
if (operation.equals(OPERATION.UPDATE)) {
|
||||
try {
|
||||
setRangeTimeInTimeBox((String) field.getCurrentValue(), rangeBoxFirst);
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
}
|
||||
}
|
||||
|
||||
panelFirstRange.add(rangeBoxFirst);
|
||||
rangesList.add(rangeBoxFirst);
|
||||
|
||||
|
@ -303,6 +371,15 @@ public class MetaDataFieldSkeleton extends Composite {
|
|||
if (field.getDefaultValue() != null)
|
||||
((TextBox) holder).setText(field.getDefaultValue());
|
||||
|
||||
if (operation.equals(OPERATION.UPDATE)) {
|
||||
try {
|
||||
if (field.getCurrentValue() != null)
|
||||
((TextBox) holder).setText((String) field.getCurrentValue());
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case File:
|
||||
|
@ -322,6 +399,15 @@ public class MetaDataFieldSkeleton extends Composite {
|
|||
if (field.getDefaultValue() != null)
|
||||
((TextBox) holder).setText(field.getDefaultValue());
|
||||
|
||||
if (operation.equals(OPERATION.UPDATE)) {
|
||||
try {
|
||||
if (field.getCurrentValue() != null)
|
||||
((TextBox) holder).setText((String) field.getCurrentValue());
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
// listbox
|
||||
|
@ -331,11 +417,13 @@ public class MetaDataFieldSkeleton extends Composite {
|
|||
if (field.isMultiSelection())
|
||||
tempListBox.setTitle(TOOLTIP_MULTISELECTION);
|
||||
|
||||
// if it is not mandatory and not multi-selection, add a disabled option (placeholder)
|
||||
if(!field.getMandatory() && !field.isMultiSelection()){
|
||||
// if it is not mandatory and not multi-selection, add a disabled option
|
||||
// (placeholder)
|
||||
if (!field.getMandatory() && !field.isMultiSelection()) {
|
||||
tempListBox.addItem("Select " + field.getFieldName());
|
||||
tempListBox.setValue(0, "");
|
||||
tempListBox.getElement().getElementsByTagName("option").getItem(0).setAttribute("disabled", "disabled");
|
||||
tempListBox.getElement().getElementsByTagName("option").getItem(0).setAttribute("disabled",
|
||||
"disabled");
|
||||
tempListBox.setSelectedValue("Select " + field.getFieldName());
|
||||
}
|
||||
|
||||
|
@ -350,6 +438,15 @@ public class MetaDataFieldSkeleton extends Composite {
|
|||
if (field.getDefaultValue() != null)
|
||||
tempListBox.setSelectedValue(field.getDefaultValue());
|
||||
|
||||
if (operation.equals(OPERATION.UPDATE)) {
|
||||
try {
|
||||
if (field.getCurrentValue() != null)
|
||||
tempListBox.setSelectedValue((String) field.getCurrentValue());
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -371,12 +468,10 @@ public class MetaDataFieldSkeleton extends Composite {
|
|||
}
|
||||
};
|
||||
holder.addDomHandler(handler, ChangeEvent.getType());
|
||||
}catch (Exception e) {
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
}
|
||||
|
||||
|
||||
|
||||
// add custom css properties
|
||||
controls.addStyleName("form-controls-custom");
|
||||
controlLabel.addStyleName("form-control-label-custom");
|
||||
|
@ -422,7 +517,6 @@ public class MetaDataFieldSkeleton extends Composite {
|
|||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the holder.
|
||||
*
|
||||
|
@ -636,10 +730,12 @@ public class MetaDataFieldSkeleton extends Composite {
|
|||
|
||||
GWT.log("Checking is valid File");
|
||||
if (field.getMandatory()) {
|
||||
if (holder.getClass().equals(DialogUpload.class) || holder.getClass().equals(MultipleDilaogUpload.class)) {
|
||||
if (holder.getClass().equals(DialogUpload.class)
|
||||
|| holder.getClass().equals(MultipleDilaogUpload.class)) {
|
||||
DialogUpload dUpload = (DialogUpload) holder;
|
||||
if(dUpload.getFileUploadingState()!=null && dUpload.getFileUploadingState().getFile()!=null) {
|
||||
return dUpload.getFileUploadingState().getFile().getTempSystemPath()!=null?null:UPLOAD_MISSING_FILE;
|
||||
if (dUpload.getFileUploadingState() != null && dUpload.getFileUploadingState().getFile() != null) {
|
||||
return dUpload.getFileUploadingState().getFile().getTempSystemPath() != null ? null
|
||||
: UPLOAD_MISSING_FILE;
|
||||
}
|
||||
}
|
||||
return UPLOAD_MISSING_FILE;
|
||||
|
@ -772,14 +868,14 @@ public class MetaDataFieldSkeleton extends Composite {
|
|||
}
|
||||
|
||||
// if it was not mandatory but there was no choice, returning empty string
|
||||
if(!field.getMandatory()) {
|
||||
//Task #20446 - bug fix. Ignoring the placeholder
|
||||
if(toReturn.size()==1) {
|
||||
if (!field.getMandatory()) {
|
||||
// Task #20446 - bug fix. Ignoring the placeholder
|
||||
if (toReturn.size() == 1) {
|
||||
String placeholder = "Select " + field.getFieldName();
|
||||
if(toReturn.get(0).equals(placeholder)){
|
||||
GWT.log("Skipping placeholder: "+placeholder);
|
||||
if (toReturn.get(0).equals(placeholder)) {
|
||||
GWT.log("Skipping placeholder: " + placeholder);
|
||||
toReturn.clear();
|
||||
//toReturn.add("");
|
||||
// toReturn.add("");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -790,10 +886,10 @@ public class MetaDataFieldSkeleton extends Composite {
|
|||
|
||||
if (holder.getClass().equals(MultipleDilaogUpload.class) || holder.getClass().equals(DialogUpload.class)) {
|
||||
DialogUpload dUpload = (DialogUpload) holder;
|
||||
if(dUpload.getFileUploadingState()!=null) {
|
||||
if (dUpload.getFileUploadingState() != null) {
|
||||
String filePath = dUpload.getFileUploadingState().getFile().getTempSystemPath();
|
||||
toReturn.add(filePath);
|
||||
}else
|
||||
} else
|
||||
toReturn.add(null);
|
||||
}
|
||||
|
||||
|
|
|
@ -6,6 +6,8 @@ import java.util.HashMap;
|
|||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.xml.bind.JAXBException;
|
||||
|
||||
|
@ -19,6 +21,7 @@ import org.gcube.common.metadataprofilediscovery.jaxb.MetadataValidator;
|
|||
import org.gcube.common.metadataprofilediscovery.jaxb.MetadataVocabulary;
|
||||
import org.gcube.common.metadataprofilediscovery.jaxb.NamespaceCategory;
|
||||
import org.gcube.common.scope.api.ScopeProvider;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.server.util.WsUtil;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.shared.metadata.CategoryWrapper;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.shared.metadata.DataTypeWrapper;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.shared.metadata.FieldAsGroup;
|
||||
|
@ -115,6 +118,11 @@ public class MetadataDiscovery {
|
|||
MetadataFormat metadata = reader.getMetadataFormatForMetadataProfile(profile);
|
||||
MetaDataProfileBean bean = toMetaDataProfileBean(metadata, categories, profile.getName());
|
||||
beans.add(bean);
|
||||
|
||||
if(!WsUtil.isWithinPortal()) {
|
||||
LOG.info("DEV MODE ENABLED - Out of portal!");
|
||||
randomizeCurrentValues(bean.getMetadataFields());
|
||||
}
|
||||
}
|
||||
|
||||
prettyPrintList(beans);
|
||||
|
@ -130,6 +138,28 @@ public class MetadataDiscovery {
|
|||
return beans;
|
||||
}
|
||||
|
||||
private static void randomizeCurrentValues(List<MetadataFieldWrapper> listFields) {
|
||||
LOG.info("DEV MODE ENABLED - Generationg random current value");
|
||||
for (MetadataFieldWrapper metadataFieldWrapper : listFields) {
|
||||
DataTypeWrapper dtw = metadataFieldWrapper.getType();
|
||||
|
||||
switch (dtw) {
|
||||
case Boolean:
|
||||
metadataFieldWrapper.setCurrentValue(Boolean.FALSE.toString());
|
||||
break;
|
||||
case Number:
|
||||
metadataFieldWrapper.setCurrentValue(new Random().nextInt()+"");
|
||||
break;
|
||||
case String:
|
||||
case Text:
|
||||
metadataFieldWrapper.setCurrentValue("Text "+UUID.randomUUID());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -3,22 +3,40 @@ package org.gcube.portlets.widgets.mpformbuilder.shared.metadata;
|
|||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* A MetaDataProfileBean with its children (MetaDataType, MetaDataFields, Categories)
|
||||
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
||||
* The Class MetaDataProfileBean.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
* Mar 3, 2022
|
||||
*/
|
||||
public class MetaDataProfileBean implements Serializable{
|
||||
|
||||
private static final long serialVersionUID = -7377022025375553568L;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -8307518917648131477L;
|
||||
private String type;
|
||||
private String title;
|
||||
private List<CategoryWrapper> categories;
|
||||
private List<MetadataFieldWrapper> metadataFields;
|
||||
|
||||
/**
|
||||
* Instantiates a new meta data profile bean.
|
||||
*/
|
||||
public MetaDataProfileBean(){
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new meta data profile bean.
|
||||
*
|
||||
* @param type the type
|
||||
* @param title the title
|
||||
* @param metadataFields the metadata fields
|
||||
* @param categories the categories
|
||||
*/
|
||||
public MetaDataProfileBean(String type,
|
||||
String title,
|
||||
List<MetadataFieldWrapper> metadataFields,
|
||||
|
@ -31,43 +49,82 @@ public class MetaDataProfileBean implements Serializable{
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets the type.
|
||||
*
|
||||
* @return the type
|
||||
*/
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the type.
|
||||
*
|
||||
* @param type the type to set
|
||||
*/
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the metadata fields.
|
||||
*
|
||||
* @return the metadataFields
|
||||
*/
|
||||
public List<MetadataFieldWrapper> getMetadataFields() {
|
||||
return metadataFields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the metadata fields.
|
||||
*
|
||||
* @param metadataFields the metadataFields to set
|
||||
*/
|
||||
public void setMetadataFields(List<MetadataFieldWrapper> metadataFields) {
|
||||
this.metadataFields = metadataFields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the categories.
|
||||
*
|
||||
* @return the categories
|
||||
*/
|
||||
public List<CategoryWrapper> getCategories() {
|
||||
return categories;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the categories.
|
||||
*
|
||||
* @param categories the new categories
|
||||
*/
|
||||
public void setCategories(List<CategoryWrapper> categories) {
|
||||
this.categories = categories;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the title.
|
||||
*
|
||||
* @return the title
|
||||
*/
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the title.
|
||||
*
|
||||
* @param title the new title
|
||||
*/
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
/**
|
||||
* To string.
|
||||
*
|
||||
* @return the string
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
final int maxLen = 10;
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
package org.gcube.portlets.widgets.mpformbuilder.shared.metadata;
|
||||
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* The Class MetadataFieldWrapper.
|
||||
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
||||
*
|
||||
* @author francesco-mangiacrapa at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
* Mar 3, 2022
|
||||
*/
|
||||
public class MetadataFieldWrapper implements Serializable{
|
||||
public class MetadataFieldWrapper implements UpdatableField, Serializable {
|
||||
|
||||
private static final long serialVersionUID = -8476731365884466698L;
|
||||
private String fieldName;
|
||||
|
@ -28,6 +28,8 @@ public class MetadataFieldWrapper implements Serializable{
|
|||
|
||||
private Integer maxOccurs = 1;
|
||||
|
||||
private String currentValue;
|
||||
|
||||
/**
|
||||
* Instantiates a new metadata field.
|
||||
*/
|
||||
|
@ -38,19 +40,17 @@ public class MetadataFieldWrapper implements Serializable{
|
|||
/**
|
||||
* Instantiates a new metadata field.
|
||||
*
|
||||
* @param fieldName the field name
|
||||
* @param mandatory the mandatory
|
||||
* @param type the type
|
||||
* @param fieldName the field name
|
||||
* @param mandatory the mandatory
|
||||
* @param type the type
|
||||
* @param defaultValue the default value
|
||||
* @param note the note
|
||||
* @param vocabulary the vocabulary
|
||||
* @param validator the validator
|
||||
* @param category the category
|
||||
* @param note the note
|
||||
* @param vocabulary the vocabulary
|
||||
* @param validator the validator
|
||||
* @param category the category
|
||||
*/
|
||||
public MetadataFieldWrapper(
|
||||
String fieldName, Boolean mandatory, DataTypeWrapper type,
|
||||
String defaultValue, String note, List<String> vocabulary,
|
||||
String validator, CategoryWrapper category) {
|
||||
public MetadataFieldWrapper(String fieldName, Boolean mandatory, DataTypeWrapper type, String defaultValue,
|
||||
String note, List<String> vocabulary, String validator, CategoryWrapper category) {
|
||||
super();
|
||||
this.fieldName = fieldName;
|
||||
this.mandatory = mandatory;
|
||||
|
@ -62,8 +62,6 @@ public class MetadataFieldWrapper implements Serializable{
|
|||
this.ownerCategory = category;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets the max occurs.
|
||||
*
|
||||
|
@ -310,30 +308,48 @@ public class MetadataFieldWrapper implements Serializable{
|
|||
this.asTag = asTag;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
/**
|
||||
* Sets the current value.
|
||||
*
|
||||
* @param value the new current value
|
||||
*/
|
||||
public void setCurrentValue(String value) {
|
||||
this.currentValue = value;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the current value.
|
||||
*
|
||||
* @return the current value
|
||||
*/
|
||||
public String getCurrentValue() {
|
||||
return currentValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* To string.
|
||||
*
|
||||
* @return the string
|
||||
*/
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see java.lang.Object#toString()
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MetadataFieldWrapper ["
|
||||
+ (fieldName != null ? "fieldName=" + fieldName + ", " : "")
|
||||
+ (fieldNameFromCategory != null ? "fieldNameFromCategory="
|
||||
+ fieldNameFromCategory + ", " : "")
|
||||
return "MetadataFieldWrapper [" + (fieldName != null ? "fieldName=" + fieldName + ", " : "")
|
||||
+ (fieldNameFromCategory != null ? "fieldNameFromCategory=" + fieldNameFromCategory + ", " : "")
|
||||
+ (mandatory != null ? "mandatory=" + mandatory + ", " : "")
|
||||
+ (maxOccurs != null ? "maxOccurs=" + maxOccurs + ", " : "")
|
||||
+ (type != null ? "type=" + type + ", " : "")
|
||||
+ (defaultValue != null ? "defaultValue=" + defaultValue + ", "
|
||||
: "")
|
||||
+ (defaultValue != null ? "defaultValue=" + defaultValue + ", " : "")
|
||||
+ (note != null ? "note=" + note + ", " : "")
|
||||
+ (vocabulary != null ? "vocabulary=" + vocabulary + ", " : "")
|
||||
+ "multiSelection="
|
||||
+ multiSelection
|
||||
+ ", "
|
||||
+ (validator != null ? "validator=" + validator + ", " : "")
|
||||
+ (ownerCategory != null ? "ownerCategory=" + ownerCategory.getId()
|
||||
+ ", " : "")
|
||||
+ (asGroup != null ? "asGroup=" + asGroup + ", " : "")
|
||||
+ (asTag != null ? "asTag=" + asTag : "") + "]";
|
||||
+ (vocabulary != null ? "vocabulary=" + vocabulary + ", " : "") + "multiSelection=" + multiSelection
|
||||
+ ", " + (validator != null ? "validator=" + validator + ", " : "")
|
||||
+ (ownerCategory != null ? "ownerCategory=" + ownerCategory.getId() + ", " : "")
|
||||
+ (asGroup != null ? "asGroup=" + asGroup + ", " : "") + (asTag != null ? "asTag=" + asTag : "") + "]";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
package org.gcube.portlets.widgets.mpformbuilder.shared.metadata;
|
||||
|
||||
public interface UpdatableField {
|
||||
|
||||
void setCurrentValue(String value);
|
||||
|
||||
String getCurrentValue();
|
||||
}
|
Loading…
Reference in New Issue