Search in sources :

Example 1 with StackSource

use of org.eclipse.che.api.workspace.shared.stack.StackSource in project che by eclipse.

the class DtoConverter method asDto.

/** Convert {@link StackImpl} to {@link StackDto}. */
public static StackDto asDto(Stack stack) {
    WorkspaceConfigDto workspaceConfigDto = null;
    if (stack.getWorkspaceConfig() != null) {
        workspaceConfigDto = asDto(stack.getWorkspaceConfig());
    }
    StackSourceDto stackSourceDto = null;
    StackSource source = stack.getSource();
    if (source != null) {
        stackSourceDto = newDto(StackSourceDto.class).withType(source.getType()).withOrigin(source.getOrigin());
    }
    List<StackComponentDto> componentsDto = null;
    if (stack.getComponents() != null) {
        componentsDto = stack.getComponents().stream().map(component -> newDto(StackComponentDto.class).withName(component.getName()).withVersion(component.getVersion())).collect(toList());
    }
    return newDto(StackDto.class).withId(stack.getId()).withName(stack.getName()).withDescription(stack.getDescription()).withCreator(stack.getCreator()).withScope(stack.getScope()).withTags(stack.getTags()).withComponents(componentsDto).withWorkspaceConfig(workspaceConfigDto).withSource(stackSourceDto);
}
Also used : StackComponentDto(org.eclipse.che.api.workspace.shared.dto.stack.StackComponentDto) StackDto(org.eclipse.che.api.workspace.shared.dto.stack.StackDto) WorkspaceConfigDto(org.eclipse.che.api.workspace.shared.dto.WorkspaceConfigDto) StackSourceDto(org.eclipse.che.api.workspace.shared.dto.stack.StackSourceDto) StackSource(org.eclipse.che.api.workspace.shared.stack.StackSource)

Aggregations

WorkspaceConfigDto (org.eclipse.che.api.workspace.shared.dto.WorkspaceConfigDto)1 StackComponentDto (org.eclipse.che.api.workspace.shared.dto.stack.StackComponentDto)1 StackDto (org.eclipse.che.api.workspace.shared.dto.stack.StackDto)1 StackSourceDto (org.eclipse.che.api.workspace.shared.dto.stack.StackSourceDto)1 StackSource (org.eclipse.che.api.workspace.shared.stack.StackSource)1