Search in sources :

Example 1 with ValueDto

use of org.eclipse.che.api.project.shared.dto.ValueDto in project che by eclipse.

the class DtoConverter method asDto.

/** Converts {@link ProjectTypeDef} to {@link ProjectTypeDto}. */
public static ProjectTypeDto asDto(ProjectTypeDef projectType) {
    final List<AttributeDto> typeAttributes = new ArrayList<>();
    for (Attribute attr : projectType.getAttributes()) {
        ValueDto valueDto = newDto(ValueDto.class);
        if (attr.getValue() != null) {
            valueDto.withList(attr.getValue().getList());
        }
        typeAttributes.add(newDto(AttributeDto.class).withName(attr.getName()).withDescription(attr.getDescription()).withRequired(attr.isRequired()).withVariable(attr.isVariable()).withValue(valueDto));
    }
    return newDto(ProjectTypeDto.class).withId(projectType.getId()).withDisplayName(projectType.getDisplayName()).withPrimaryable(projectType.isPrimaryable()).withMixable(projectType.isMixable()).withParents(projectType.getParents()).withAncestors(projectType.getAncestors()).withAttributes(typeAttributes);
}
Also used : AttributeDto(org.eclipse.che.api.project.shared.dto.AttributeDto) ValueDto(org.eclipse.che.api.project.shared.dto.ValueDto) ProjectTypeDto(org.eclipse.che.api.project.shared.dto.ProjectTypeDto) Attribute(org.eclipse.che.api.core.model.project.type.Attribute) ArrayList(java.util.ArrayList)

Aggregations

ArrayList (java.util.ArrayList)1 Attribute (org.eclipse.che.api.core.model.project.type.Attribute)1 AttributeDto (org.eclipse.che.api.project.shared.dto.AttributeDto)1 ProjectTypeDto (org.eclipse.che.api.project.shared.dto.ProjectTypeDto)1 ValueDto (org.eclipse.che.api.project.shared.dto.ValueDto)1