vran
3 years ago
committed by
GitHub
9 changed files with 48 additions and 2 deletions
@ -0,0 +1,33 @@ |
|||
package com.databasir.api.validator; |
|||
|
|||
import com.databasir.core.domain.DomainErrors; |
|||
import com.databasir.core.domain.project.data.ProjectCreateRequest; |
|||
import com.databasir.core.domain.project.data.ProjectUpdateRequest; |
|||
import org.quartz.CronExpression; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
import java.text.ParseException; |
|||
|
|||
@Component |
|||
public class CronExpressionValidator { |
|||
|
|||
public void isValidCron(ProjectUpdateRequest request) { |
|||
if (request.getProjectSyncRule().getIsAutoSync()) { |
|||
isValidCron(request.getProjectSyncRule().getAutoSyncCron()); |
|||
} |
|||
} |
|||
|
|||
public void isValidCron(ProjectCreateRequest request) { |
|||
if (request.getProjectSyncRule().getIsAutoSync()) { |
|||
isValidCron(request.getProjectSyncRule().getAutoSyncCron()); |
|||
} |
|||
} |
|||
|
|||
public void isValidCron(String cron) { |
|||
try { |
|||
new CronExpression(cron); |
|||
} catch (ParseException pe) { |
|||
throw DomainErrors.INVALID_CRON_EXPRESSION.exception("错误的 CRON 表达式:" + pe.getMessage(), pe); |
|||
} |
|||
} |
|||
} |
@ -1 +1 @@ |
|||
<!DOCTYPE html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="/favicon.ico"><title>databasir-frontend</title><link href="/css/chunk-0e34b2c6.06814884.css" rel="prefetch"><link href="/css/chunk-588dbed6.e51aa148.css" rel="prefetch"><link href="/css/chunk-7efe8be4.00ac37b1.css" rel="prefetch"><link href="/js/chunk-0e34b2c6.7af33675.js" rel="prefetch"><link href="/js/chunk-2d0a47bb.baec3bc7.js" rel="prefetch"><link href="/js/chunk-2d0cc811.c5d1ef9e.js" rel="prefetch"><link href="/js/chunk-48cebeac.162363c9.js" rel="prefetch"><link href="/js/chunk-588dbed6.ba7725b2.js" rel="prefetch"><link href="/js/chunk-7efe8be4.815f1aa1.js" rel="prefetch"><link href="/js/chunk-9622a6d8.d116da54.js" rel="prefetch"><link href="/js/chunk-abb10c56.c12963e3.js" rel="prefetch"><link href="/js/chunk-fffb1b64.1ffb9f27.js" rel="prefetch"><link href="/css/app.fc57c576.css" rel="preload" as="style"><link href="/css/chunk-vendors.d4aa889d.css" rel="preload" as="style"><link href="/js/app.d3ac1eb1.js" rel="preload" as="script"><link href="/js/chunk-vendors.42fcab1c.js" rel="preload" as="script"><link href="/css/chunk-vendors.d4aa889d.css" rel="stylesheet"><link href="/css/app.fc57c576.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but databasir-frontend doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="/js/chunk-vendors.42fcab1c.js"></script><script src="/js/app.d3ac1eb1.js"></script></body></html> |
|||
<!DOCTYPE html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="/favicon.ico"><title>databasir-frontend</title><link href="/css/chunk-0e34b2c6.06814884.css" rel="prefetch"><link href="/css/chunk-588dbed6.e51aa148.css" rel="prefetch"><link href="/css/chunk-7efe8be4.00ac37b1.css" rel="prefetch"><link href="/js/chunk-0e34b2c6.7af33675.js" rel="prefetch"><link href="/js/chunk-2d0a47bb.baec3bc7.js" rel="prefetch"><link href="/js/chunk-2d0cc811.c5d1ef9e.js" rel="prefetch"><link href="/js/chunk-48cebeac.162363c9.js" rel="prefetch"><link href="/js/chunk-588dbed6.ba7725b2.js" rel="prefetch"><link href="/js/chunk-7efe8be4.815f1aa1.js" rel="prefetch"><link href="/js/chunk-9622a6d8.d116da54.js" rel="prefetch"><link href="/js/chunk-abb10c56.2eac1d1a.js" rel="prefetch"><link href="/js/chunk-fffb1b64.1ffb9f27.js" rel="prefetch"><link href="/css/app.fc57c576.css" rel="preload" as="style"><link href="/css/chunk-vendors.d4aa889d.css" rel="preload" as="style"><link href="/js/app.5749a94b.js" rel="preload" as="script"><link href="/js/chunk-vendors.42fcab1c.js" rel="preload" as="script"><link href="/css/chunk-vendors.d4aa889d.css" rel="stylesheet"><link href="/css/app.fc57c576.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but databasir-frontend doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="/js/chunk-vendors.42fcab1c.js"></script><script src="/js/app.5749a94b.js"></script></body></html> |
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in new issue