Search in sources :

Example 1 with ProjectFileType

use of eu.esdihumboldt.hale.common.core.io.project.model.internal.generated.ProjectFileType in project hale by halestudio.

the class JaxbToProject method convert.

/**
 * Convert the given project.
 *
 * @param project the project to convert
 * @return the project model object
 */
public static Project convert(ProjectType project) {
    Project result = new Project();
    result.setAuthor(project.getAuthor());
    result.setCreated(toDate(project.getCreated()));
    result.setDescription(project.getDescription());
    result.setHaleVersion(toVersion(project.getVersion()));
    result.setModified(toDate(project.getModified()));
    result.setName(project.getName());
    result.setSaveConfiguration(toIOConfiguration(project.getSaveConfig()));
    for (IOConfigurationType resource : project.getResource()) {
        result.getResources().add(toIOConfiguration(resource));
    }
    for (ExportConfigurationType exportConfig : project.getExportConfig()) {
        String name = exportConfig.getName();
        if (name != null && !name.isEmpty()) {
            result.getExportConfigurations().put(name, toIOConfiguration(exportConfig.getConfiguration()));
        }
    }
    for (ProjectFileType file : project.getFile()) {
        result.getProjectFiles().add(new ProjectFileInfo(file.getName(), URI.create(file.getLocation())));
    }
    for (JAXBElement<?> property : project.getAbstractProperty()) {
        Object value = property.getValue();
        if (value instanceof PropertyType) {
            addProperty(result.getProperties(), (PropertyType) value);
        } else if (value instanceof ComplexPropertyType) {
            addProperty(result.getProperties(), (ComplexPropertyType) value);
        }
    }
    return result;
}
Also used : IOConfigurationType(eu.esdihumboldt.hale.common.core.io.project.model.internal.generated.IOConfigurationType) Project(eu.esdihumboldt.hale.common.core.io.project.model.Project) ComplexPropertyType(eu.esdihumboldt.hale.common.core.io.project.model.internal.generated.ComplexPropertyType) ExportConfigurationType(eu.esdihumboldt.hale.common.core.io.project.model.internal.generated.ExportConfigurationType) ProjectFileType(eu.esdihumboldt.hale.common.core.io.project.model.internal.generated.ProjectFileType) ProjectFileInfo(eu.esdihumboldt.hale.common.core.io.project.model.ProjectFileInfo) PropertyType(eu.esdihumboldt.hale.common.core.io.project.model.internal.generated.PropertyType) ComplexPropertyType(eu.esdihumboldt.hale.common.core.io.project.model.internal.generated.ComplexPropertyType)

Example 2 with ProjectFileType

use of eu.esdihumboldt.hale.common.core.io.project.model.internal.generated.ProjectFileType in project hale by halestudio.

the class ProjectToJaxb method toProjectFileType.

private static ProjectFileType toProjectFileType(ProjectFileInfo file) {
    ProjectFileType result = new ProjectFileType();
    result.setName(file.getName());
    result.setLocation(file.getLocation().toString());
    return result;
}
Also used : ProjectFileType(eu.esdihumboldt.hale.common.core.io.project.model.internal.generated.ProjectFileType)

Aggregations

ProjectFileType (eu.esdihumboldt.hale.common.core.io.project.model.internal.generated.ProjectFileType)2 Project (eu.esdihumboldt.hale.common.core.io.project.model.Project)1 ProjectFileInfo (eu.esdihumboldt.hale.common.core.io.project.model.ProjectFileInfo)1 ComplexPropertyType (eu.esdihumboldt.hale.common.core.io.project.model.internal.generated.ComplexPropertyType)1 ExportConfigurationType (eu.esdihumboldt.hale.common.core.io.project.model.internal.generated.ExportConfigurationType)1 IOConfigurationType (eu.esdihumboldt.hale.common.core.io.project.model.internal.generated.IOConfigurationType)1 PropertyType (eu.esdihumboldt.hale.common.core.io.project.model.internal.generated.PropertyType)1