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);
}
Aggregations