Search in sources :

Example 11 with DataGridTemplateField

use of com.emc.metalnx.core.domain.entity.DataGridTemplateField in project metalnx-web by irods-contrib.

the class TemplateController method removeFieldFromDB.

@RequestMapping(value = "/removeFieldFromDB")
@ResponseStatus(value = HttpStatus.OK)
public void removeFieldFromDB(@RequestParam("templateFieldsIDList") final long[] templateFieldsIDList) {
    for (long templateFieldID : templateFieldsIDList) {
        DataGridTemplateField dataGridField = templateFieldService.findById(templateFieldID);
        TemplateFieldForm field = this.mapDataGridTempToFieldForm(dataGridField);
        if (addTemplateFields.contains(field)) {
            addTemplateFields.remove(field);
        }
        // adding the field to the list that is needed to be removed from a template
        if (!removeTemplateFields.contains(field)) {
            removeTemplateFields.add(field);
        }
    }
}
Also used : TemplateFieldForm(com.emc.metalnx.modelattribute.template.field.TemplateFieldForm) DataGridTemplateField(com.emc.metalnx.core.domain.entity.DataGridTemplateField) ResponseStatus(org.springframework.web.bind.annotation.ResponseStatus) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 12 with DataGridTemplateField

use of com.emc.metalnx.core.domain.entity.DataGridTemplateField in project metalnx-web by irods-contrib.

the class TemplateServiceImpl method mapDataGridTemplateToXml.

@Override
public MlxMetadataTemplate mapDataGridTemplateToXml(DataGridTemplate template) {
    // Mapping DB entity to XML entity
    MlxMetadataTemplate t = new MlxMetadataTemplate();
    t.setName(template.getTemplateName());
    t.setDescription(template.getDescription());
    t.setUsageInfo(template.getUsageInformation());
    t.setAccessType(template.getAccessType());
    for (DataGridTemplateField field : template.getFields()) {
        MlxMetadataAVU avu = new MlxMetadataAVU();
        avu.setAttribute(field.getAttribute());
        avu.setValue(field.getValue());
        avu.setUnit(field.getUnit());
        t.getMetadatas().add(avu);
    }
    return t;
}
Also used : MlxMetadataTemplate(com.emc.com.emc.metalnx.core.xml.MlxMetadataTemplate) MlxMetadataAVU(com.emc.com.emc.metalnx.core.xml.MlxMetadataAVU) DataGridTemplateField(com.emc.metalnx.core.domain.entity.DataGridTemplateField)

Aggregations

DataGridTemplateField (com.emc.metalnx.core.domain.entity.DataGridTemplateField)12 TemplateFieldForm (com.emc.metalnx.modelattribute.template.field.TemplateFieldForm)7 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)6 DataGridTemplate (com.emc.metalnx.core.domain.entity.DataGridTemplate)4 DataGridTemplateAttrException (com.emc.metalnx.core.domain.exceptions.DataGridTemplateAttrException)3 DataGridTemplateUnitException (com.emc.metalnx.core.domain.exceptions.DataGridTemplateUnitException)3 DataGridTemplateValueException (com.emc.metalnx.core.domain.exceptions.DataGridTemplateValueException)3 ArrayList (java.util.ArrayList)3 MlxMetadataAVU (com.emc.com.emc.metalnx.core.xml.MlxMetadataAVU)2 MlxMetadataTemplate (com.emc.com.emc.metalnx.core.xml.MlxMetadataTemplate)2 DataGridConnectionRefusedException (com.emc.metalnx.core.domain.exceptions.DataGridConnectionRefusedException)2 DataGridException (com.emc.metalnx.core.domain.exceptions.DataGridException)2 DataGridTooLongTemplateNameException (com.emc.metalnx.core.domain.exceptions.DataGridTooLongTemplateNameException)2 IOException (java.io.IOException)2 JAXBException (javax.xml.bind.JAXBException)2 MlxMetadataTemplates (com.emc.com.emc.metalnx.core.xml.MlxMetadataTemplates)1 DataGridUser (com.emc.metalnx.core.domain.entity.DataGridUser)1 MetadataTemplateForm (com.emc.metalnx.modelattribute.metadatatemplate.MetadataTemplateForm)1 JAXBContext (javax.xml.bind.JAXBContext)1 Unmarshaller (javax.xml.bind.Unmarshaller)1