Search in sources :

Example 1 with SharedProjectDTO

use of io.hops.hopsworks.common.dao.kafka.SharedProjectDTO in project hopsworks by logicalclocks.

the class TopicsBuilder method buildSharedProject.

public SharedProjectDTO buildSharedProject(UriInfo uriInfo, Project project, String topicName) {
    SharedProjectDTO dto = new SharedProjectDTO();
    dto.setHref(sharedProjectUri(uriInfo, project, topicName).build());
    List<SharedProjectDTO> list = kafkaController.getTopicSharedProjects(topicName, project.getId());
    dto.setCount(Integer.toUnsignedLong(list.size()));
    list.forEach(dto::addItem);
    return dto;
}
Also used : SharedProjectDTO(io.hops.hopsworks.common.dao.kafka.SharedProjectDTO)

Example 2 with SharedProjectDTO

use of io.hops.hopsworks.common.dao.kafka.SharedProjectDTO in project hopsworks by logicalclocks.

the class KafkaController method getTopicSharedProjects.

public List<SharedProjectDTO> getTopicSharedProjects(String topicName, Integer ownerProjectId) {
    List<SharedTopics> projectIds = sharedTopicsFacade.findSharedTopicsByTopicAndOwnerProject(topicName, ownerProjectId);
    List<SharedProjectDTO> shareProjectDtos = new ArrayList<>();
    for (SharedTopics st : projectIds) {
        Project project = projectFacade.find(st.getSharedTopicsPK().getProjectId());
        if (project != null) {
            shareProjectDtos.add(new SharedProjectDTO(project.getName(), project.getId()));
        }
    }
    return shareProjectDtos;
}
Also used : Project(io.hops.hopsworks.persistence.entity.project.Project) SharedTopics(io.hops.hopsworks.persistence.entity.kafka.SharedTopics) ArrayList(java.util.ArrayList) SharedProjectDTO(io.hops.hopsworks.common.dao.kafka.SharedProjectDTO)

Aggregations

SharedProjectDTO (io.hops.hopsworks.common.dao.kafka.SharedProjectDTO)2 SharedTopics (io.hops.hopsworks.persistence.entity.kafka.SharedTopics)1 Project (io.hops.hopsworks.persistence.entity.project.Project)1 ArrayList (java.util.ArrayList)1