Skip to content

Commit

Permalink
Code Specification
Browse files Browse the repository at this point in the history
  • Loading branch information
周倬贤 committed Jun 15, 2024
1 parent 9b80552 commit 423da4b
Show file tree
Hide file tree
Showing 12 changed files with 337 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@

package org.apache.eventmesh.dashboard.console.controller;


import org.apache.eventmesh.dashboard.console.entity.connection.AddConnectionEntity;
import org.apache.eventmesh.dashboard.console.entity.connector.ConnectorEntity;
import org.apache.eventmesh.dashboard.console.entity.function.ConfigEntity;
import org.apache.eventmesh.dashboard.console.modle.dto.connection.AddConnectionDTO;
import org.apache.eventmesh.dashboard.console.mapstruct.connection.ConnectionControllerMapper;
import org.apache.eventmesh.dashboard.console.modle.dto.connection.CreateConnectionDTO;
import org.apache.eventmesh.dashboard.console.modle.dto.connection.GetConnectionListDTO;
import org.apache.eventmesh.dashboard.console.modle.vo.connection.ConnectionListVO;
Expand Down Expand Up @@ -60,15 +62,15 @@ public List<ConfigEntity> getConnectorConfigsByClassAndVersion(String version, S


@GetMapping("/showCreateConnectionMessage")
public AddConnectionDTO showCreateConnectionMessage() {
return new AddConnectionDTO();
public AddConnectionEntity showCreateConnectionMessage() {
return new AddConnectionEntity();
}


@PostMapping("/createConnection")
public String createConnection(@Validated @RequestBody CreateConnectionDTO createConnectionDTO) {
try {
connectionDataService.createConnection(createConnectionDTO);
connectionDataService.createConnection(ConnectionControllerMapper.INSTANCE.queryCreateEntityByConnection(createConnectionDTO));
} catch (Exception e) {
return e.getMessage();
}
Expand All @@ -78,7 +80,7 @@ public String createConnection(@Validated @RequestBody CreateConnectionDTO creat

@PostMapping("/getConnectionList")
public List<ConnectionListVO> getConnectionList(@Validated @RequestBody GetConnectionListDTO getConnectionListDTO) {
return connectionDataService.getConnectionToFrontByCluster(getConnectionListDTO.getClusterId(), getConnectionListDTO);
return connectionDataService.getConnectionToFrontByCluster(ConnectionControllerMapper.INSTANCE.queryEntityByConnection(getConnectionListDTO));
}

@GetMapping("/getConnectorDetail")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.apache.eventmesh.dashboard.console.entity;

import org.apache.eventmesh.dashboard.console.entity.connection.AddConnectionEntity;
import org.apache.eventmesh.dashboard.console.entity.connection.AddConnectorConfigEntity;

import lombok.Data;

@Data
public class CreateConnectionEntity {

private Long clusterId;

private AddConnectionEntity addConnectionEntity;

private AddConnectorConfigEntity addConnectorConfigEntity;
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
* limitations under the License.
*/

package org.apache.eventmesh.dashboard.console.modle.dto.connection;
package org.apache.eventmesh.dashboard.console.entity.connection;

import lombok.Data;

@Data
public class AddConnectionDTO {
public class AddConnectionEntity {

private String sinkName;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,16 @@
* limitations under the License.
*/

package org.apache.eventmesh.dashboard.console.modle.dto.connection;
package org.apache.eventmesh.dashboard.console.entity.connection;

import org.apache.eventmesh.dashboard.console.entity.function.ConfigEntity;

import java.util.List;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
public class AddConnectorConfigDTO {
public class AddConnectorConfigEntity {

private List<ConfigEntity> sinkConnectorConfigs;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@


import org.apache.eventmesh.dashboard.console.entity.function.ConfigEntity;
import org.apache.eventmesh.dashboard.console.entity.function.LogEntity;
import org.apache.eventmesh.dashboard.console.modle.dto.config.GetConfigsListDTO;
import org.apache.eventmesh.dashboard.console.modle.dto.log.GetLogListDTO;

import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.apache.eventmesh.dashboard.console.mapstruct.connection;

import org.apache.eventmesh.dashboard.console.entity.CreateConnectionEntity;
import org.apache.eventmesh.dashboard.console.entity.cluster.ConnectionEntity;
import org.apache.eventmesh.dashboard.console.modle.dto.connection.CreateConnectionDTO;
import org.apache.eventmesh.dashboard.console.modle.dto.connection.GetConnectionListDTO;

import org.mapstruct.factory.Mappers;

/**
*
*/
public interface ConnectionControllerMapper {

ConnectionControllerMapper INSTANCE = Mappers.getMapper(ConnectionControllerMapper.class);

ConnectionEntity queryEntityByConnection(GetConnectionListDTO getConnectionListDTO);

CreateConnectionEntity queryCreateEntityByConnection(CreateConnectionDTO createConnectionDTO);
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,17 @@

package org.apache.eventmesh.dashboard.console.modle.dto.connection;

import org.apache.eventmesh.dashboard.console.entity.connection.AddConnectionEntity;
import org.apache.eventmesh.dashboard.console.entity.connection.AddConnectorConfigEntity;

import lombok.Data;

@Data
public class CreateConnectionDTO {

private Long clusterId;

private AddConnectionDTO addConnectionDTO;
private AddConnectionEntity addConnectionEntity;

private AddConnectorConfigDTO addConnectorConfigDTO;
private AddConnectorConfigEntity addConnectorConfigEntity;
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@

package org.apache.eventmesh.dashboard.console.service.cluster;

import org.apache.eventmesh.dashboard.console.entity.CreateConnectionEntity;
import org.apache.eventmesh.dashboard.console.entity.cluster.ConnectionEntity;
import org.apache.eventmesh.dashboard.console.entity.connector.ConnectorEntity;
import org.apache.eventmesh.dashboard.console.entity.function.ConfigEntity;
import org.apache.eventmesh.dashboard.console.modle.dto.connection.CreateConnectionDTO;
import org.apache.eventmesh.dashboard.console.modle.dto.connection.GetConnectionListDTO;
import org.apache.eventmesh.dashboard.console.modle.vo.connection.ConnectionListVO;

import java.util.List;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
* Service providing ConnectionEntity data.
Expand All @@ -40,13 +40,16 @@ public interface ConnectionDataService {

List<ConnectionEntity> getAllConnectionsByClusterId(Long clusterId);

boolean createConnection(CreateConnectionDTO createConnectionDTO);
boolean createConnection(CreateConnectionEntity connectionEntity);

List<ConnectionEntity> getAllConnections();

List<ConnectionListVO> getConnectionToFrontByCluster(Long clusterId, GetConnectionListDTO getConnectionListDTO);
List<ConnectionListVO> getConnectionToFrontByCluster(ConnectionEntity connectionEntity);

@Transactional
void replaceAllConnections(List<ConnectionEntity> connectionEntityList);

List<ConfigEntity> getConnectorConfigsByClassAndVersion(String classType, String version);

Long insert(ConnectionEntity connectionEntity);
void insert(ConnectionEntity connectionEntity);
}
Loading

0 comments on commit 423da4b

Please sign in to comment.