Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[chore] optimize manager code style #1993

Merged
merged 1 commit into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 43,7 @@
import org.springframework.web.client.RestTemplate;

/**
* Abstract alert notify handler implementation.
*/
@Slf4j
abstract class AbstractAlertNotifyHandlerImpl implements AlertNotifyHandler {
Expand Down Expand Up @@ -128,5 129,3 @@ public void onEvent(SystemConfigChangeEvent event) {
this.bundle = ResourceBundleUtil.getBundle("alerter");
}
}


Original file line number Diff line number Diff line change
Expand Up @@ -92,7 92,6 @@ private static class GotifyWebHookDto {
private String message;
private Extras extras;


@Data
public static class Extras {
@JsonProperty("client::display")
Expand All @@ -104,6 103,5 @@ public static class ClientDisplay {
private String contentType;
}


}
}
Original file line number Diff line number Diff line change
Expand Up @@ -94,5 94,4 @@ private static class ServerChanWebHookDto {

}


}
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 32,7 @@
import org.springframework.web.bind.annotation.RestController;

/**
* Internationalization I 18 N
* 国际化I18N
* Internationalization I18N
*/
@Tag(name = "I18N International Resource API")
@RestController
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 50,6 @@

/**
* Monitor and manage batch API
* 监控管理批量API
*/
@Tag(name = "Monitor Manage Batch API")
@RestController
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 44,6 @@
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;


/**
* Message Notification Configuration API
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 47,6 @@
@RequestMapping(value = "/api/status/page", produces = {APPLICATION_JSON_VALUE})
public class StatusPageController {


@Autowired
private StatusPageService statusPageService;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 42,6 @@
@RequestMapping(value = "/api/status/page/public", produces = {APPLICATION_JSON_VALUE})
public class StatusPagePublicController {


@Autowired
private StatusPageService statusPageService;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 23,6 @@
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;


/**
* Collector repository
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 25,11 @@
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;


/**
* CollectorMonitorBind repository
*/
public interface CollectorMonitorBindDao extends JpaRepository<CollectorMonitorBind, Long>, JpaSpecificationExecutor<CollectorMonitorBind> {


/**
* find monitors by collector
* @param collector collector
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 33,6 @@
*/
public interface MonitorDao extends JpaRepository<Monitor, Long>, JpaSpecificationExecutor<Monitor> {


/**
* Delete monitor based on monitor ID list
* @param monitorIds Monitoring ID List
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 25,5 @@
* Query all enabled notification policies
*/
public interface NoticeTemplateDao extends JpaRepository<NoticeTemplate, Long>, JpaSpecificationExecutor<NoticeTemplate> {


}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 26,6 @@
import lombok.Data;
import lombok.NoArgsConstructor;


/**
* Email account configuration dto
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 22,7 @@
import org.springframework.context.ApplicationEvent;

/**
* Object store configuration change event.
*/
@Getter
public class ObjectStoreConfigChangeEvent extends ApplicationEvent {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 23,6 @@
import lombok.Data;
import lombok.NoArgsConstructor;


/**
* Refresh Token Response
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 39,6 @@ public class TemplateConfig {
*/
private Map<String, AppTemplate> apps;


/**
* app template
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 19,11 @@

/**
* <p>ConfigService interface provides CRUD operations for configurations.</p>
* @param <T> 配置类型
* @param <T> configuration type.
* @version 1.0
*/
public interface GeneralConfigService<T> {



/**
* config type: email, sms
* @return type string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 37,6 @@
*/
public interface MonitorService {


/**
* Monitoring Availability Probes
* @param monitor Monitoring entity information
Expand Down Expand Up @@ -180,7 179,6 @@ public interface MonitorService {
*/
void copyMonitors(List<Long> ids);


/**
* update app collect job by app
* @param job job content
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 140,6 @@ public interface NoticeConfigService {
*/
void deleteNoticeTemplate(Long templateId);


/**
* Query specific notification templates according to the template ID (primary key ID)
* @param templateId Template ID
Expand All @@ -162,5 161,4 @@ public interface NoticeConfigService {
*/
boolean sendTestMsg(NoticeReceiver noticeReceiver);


}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 24,6 @@
import org.apache.hertzbeat.manager.pojo.dto.EmailNoticeSender;
import org.springframework.stereotype.Service;


/**
* MailGeneralConfigServiceImpl class is the implementation of general email configuration service,
* which inherits the AbstractGeneralConfigServiceImpl class.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 29,7 @@
*/
@Service
public class SystemSecretServiceImpl extends AbstractGeneralConfigServiceImpl<SystemSecret> {



/**
*
* <p>Constructor, passing in GeneralConfigDao, ObjectMapper and type.</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 36,7 @@
import org.springframework.transaction.annotation.Transactional;

/**
* Tag service implementation.
*/
@Service
@Transactional(rollbackFor = Exception.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 34,7 @@ public class TemplateConfigServiceImpl extends AbstractGeneralConfigServiceImpl<

@Resource
private AppService appService;



/**
*
* <p>Constructor, passing in GeneralConfigDao, ObjectMapper and type.</p>
Expand All @@ -59,7 58,6 @@ public String type() {
return "template";
}


@Override
protected TypeReference<TemplateConfig> getTypeReference() {
return new TypeReference<>() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 36,6 @@ public class YamlImExportServiceImpl extends AbstractImExportServiceImpl{
public static final String TYPE = "YAML";
public static final String FILE_SUFFIX = ".yaml";


/**
* Export file type
* @return file type
Expand Down Expand Up @@ -72,7 71,6 @@ List<ExportMonitorDTO> parseImport(InputStream is) {
* Export Configuration to Output Stream
* @param monitorList configuration list
* @param os output stream
*
*/
@Override
void writeOs(List<ExportMonitorDTO> monitorList, OutputStream os) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 127,6 @@ ResponseEntity<Message<Void>> handleHttpMessageNotReadableException(HttpMessageN
}
}


/**
* handler the exception thrown for data input verify
* @param e data input verify exception
Expand Down Expand Up @@ -187,7 186,6 @@ ResponseEntity<Message<Void>> handleInputOtherValidException(ConstraintViolation
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(message);
}


/**
* handler the exception thrown for datastore error
* @param exception datastore exception
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 55,7 @@
import org.springframework.context.ApplicationContext;

/**
*
* Manager Test
* @version 2.1
*/
class ManagerTest extends AbstractSpringIntegrationTest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 36,4 @@ void send() {
@Test
void type() {
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 36,4 @@ void afterPropertiesSet() {
@Test
void sendNoticeMsg() {
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 32,4 @@ void setUp() {
@Test
void store() {
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 36,5 @@ void send() {
@Test
void type() {
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 27,7 @@
import org.springframework.util.StringUtils;

/**
*
* Test case for {@link HuaweiCloudSmnAlertNotifyHandlerImpl}
*/
@Slf4j
class HuaweiCloudSmnAlertNotifyHandlerImplTest extends AbstractSpringIntegrationTest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 30,6 @@

/**
* Test case for {@link SlackAlertNotifyHandlerImpl}
*
* @version 2.1
*/
@Slf4j
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 30,7 @@
import org.springframework.util.StringUtils;

/**
*
* Test case for {@link TelegramBotAlertNotifyHandlerImpl}
* @version 2.1
*/
@Slf4j
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 31,13 @@

/**
* unit test case for WeChatAppAlertNotifyHandlerImpl
*
*/
@Slf4j
public class WeChatAppAlertNotifyHandlerImplTest extends AbstractSpringIntegrationTest {


@Resource
private WeWorkAppAlertNotifyHandlerImpl weChatAppAlertNotifyHandler;


@Test
public void send() {
String corpId = System.getenv("CORP_ID");
Expand Down Expand Up @@ -75,5 72,4 @@ public void send() {
weChatAppAlertNotifyHandler.send(receiver, noticeTemplate, alert);
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 39,4 @@ void send() {
@Test
void type() {
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 125,5 @@ void queryAppsHierarchy() throws Exception {
.andExpect(jsonPath("$.code").value((int) CommonConstants.SUCCESS_CODE))
.andExpect(jsonPath("$.data[0].category").value("os"))
.andReturn();



}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 62,4 @@ void queryI18n() throws Exception {
.andExpect(jsonPath("$.code").value((int) CommonConstants.SUCCESS_CODE))
.andReturn();
}
}
}
Loading
Loading