status
stringclasses 1
value | repo_name
stringclasses 31
values | repo_url
stringclasses 31
values | issue_id
int64 1
104k
| title
stringlengths 4
233
| body
stringlengths 0
186k
⌀ | issue_url
stringlengths 38
56
| pull_url
stringlengths 37
54
| before_fix_sha
stringlengths 40
40
| after_fix_sha
stringlengths 40
40
| report_datetime
timestamp[us, tz=UTC] | language
stringclasses 5
values | commit_datetime
timestamp[us, tz=UTC] | updated_file
stringlengths 7
188
| chunk_content
stringlengths 1
1.03M
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 10,622 |
[Bug] [Api] The name of the workflow or task exceeds the length limit after the workflow is copied multiple times
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The name of the workflow or task exceeds the length limit after the workflow is copied multiple times
<img width="1134" alt="image" src="https://user-images.githubusercontent.com/13765310/175562154-e99c751e-cfd6-4351-879f-341cc5b71310.png">
### What you expected to happen
The name length of the workflow or task does not exceed the limit
### How to reproduce
Copy a workflow until an error of "batch copy process definition error" is reported
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/10622
|
https://github.com/apache/dolphinscheduler/pull/10621
|
acd3d3fab14d08b3b06015be3ac9cfb2f4bfc934
|
c34503e3f6cbfb20f1298a57d52af1990ddaf5aa
| 2022-06-26T14:13:27Z |
java
| 2022-08-04T07:04:14Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
|
long projectCode = 1L;
Mockito.when(projectMapper.queryByCode(projectCode)).thenReturn(getProject(projectCode));
Project project = getProject(projectCode);
User loginUser = new User();
loginUser.setId(-1);
loginUser.setUserType(UserType.GENERAL_USER);
Map<String, Object> result = new HashMap<>();
putMsg(result, Status.PROJECT_NOT_FOUND, projectCode);
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectCode,WORKFLOW_DEFINITION)).thenReturn(result);
Map<String, Object> map = processDefinitionService.queryProcessDefinitionByName(loginUser, projectCode, "test_def");
Assert.assertEquals(Status.PROJECT_NOT_FOUND, map.get(Constants.STATUS));
putMsg(result, Status.SUCCESS, projectCode);
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectCode,WORKFLOW_DEFINITION)).thenReturn(result);
Mockito.when(processDefineMapper.queryByDefineName(project.getCode(), "test_def")).thenReturn(null);
Map<String, Object> instanceNotExitRes = processDefinitionService.queryProcessDefinitionByName(loginUser, projectCode, "test_def");
Assert.assertEquals(Status.PROCESS_DEFINE_NOT_EXIST, instanceNotExitRes.get(Constants.STATUS));
Mockito.when(processDefineMapper.queryByDefineName(project.getCode(), "test")).thenReturn(getProcessDefinition());
putMsg(result, Status.SUCCESS, projectCode);
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectCode,WORKFLOW_DEFINITION)).thenReturn(result);
Map<String, Object> successRes = processDefinitionService.queryProcessDefinitionByName(loginUser, projectCode, "test");
Assert.assertEquals(Status.SUCCESS, successRes.get(Constants.STATUS));
}
@Test
public void testBatchCopyProcessDefinition() {
long projectCode = 1L;
Project project = getProject(projectCode);
User loginUser = new User();
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 10,622 |
[Bug] [Api] The name of the workflow or task exceeds the length limit after the workflow is copied multiple times
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The name of the workflow or task exceeds the length limit after the workflow is copied multiple times
<img width="1134" alt="image" src="https://user-images.githubusercontent.com/13765310/175562154-e99c751e-cfd6-4351-879f-341cc5b71310.png">
### What you expected to happen
The name length of the workflow or task does not exceed the limit
### How to reproduce
Copy a workflow until an error of "batch copy process definition error" is reported
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/10622
|
https://github.com/apache/dolphinscheduler/pull/10621
|
acd3d3fab14d08b3b06015be3ac9cfb2f4bfc934
|
c34503e3f6cbfb20f1298a57d52af1990ddaf5aa
| 2022-06-26T14:13:27Z |
java
| 2022-08-04T07:04:14Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
|
loginUser.setId(1);
loginUser.setUserType(UserType.GENERAL_USER);
Mockito.when(projectMapper.queryByCode(projectCode)).thenReturn(getProject(projectCode));
Map<String, Object> result = new HashMap<>();
putMsg(result, Status.SUCCESS, projectCode);
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectCode,WORKFLOW_BATCH_COPY)).thenReturn(result);
Map<String, Object> map = processDefinitionService.batchCopyProcessDefinition(loginUser, projectCode, StringUtils.EMPTY, 2L);
Assert.assertEquals(Status.PROCESS_DEFINITION_CODES_IS_EMPTY, map.get(Constants.STATUS));
putMsg(result, Status.PROJECT_NOT_FOUND, projectCode);
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectCode,WORKFLOW_BATCH_COPY)).thenReturn(result);
Map<String, Object> map1 = processDefinitionService.batchCopyProcessDefinition(
loginUser, projectCode, String.valueOf(project.getId()), 2L);
Assert.assertEquals(Status.PROJECT_NOT_FOUND, map1.get(Constants.STATUS));
projectCode = 2L;
Project project1 = getProject(projectCode);
Mockito.when(projectMapper.queryByCode(projectCode)).thenReturn(project1);
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectCode,WORKFLOW_BATCH_COPY)).thenReturn(result);
putMsg(result, Status.SUCCESS, projectCode);
ProcessDefinition definition = getProcessDefinition();
List<ProcessDefinition> processDefinitionList = new ArrayList<>();
processDefinitionList.add(definition);
Set<Long> definitionCodes = Arrays.stream("46".split(Constants.COMMA)).map(Long::parseLong).collect(Collectors.toSet());
Mockito.when(processDefineMapper.queryByCodes(definitionCodes)).thenReturn(processDefinitionList);
Mockito.when(processService.saveProcessDefine(loginUser, definition, Boolean.TRUE, Boolean.TRUE)).thenReturn(2);
Map<String, Object> map3 = processDefinitionService.batchCopyProcessDefinition(
loginUser, projectCode, "46", 1L);
Assert.assertEquals(Status.SUCCESS, map3.get(Constants.STATUS));
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 10,622 |
[Bug] [Api] The name of the workflow or task exceeds the length limit after the workflow is copied multiple times
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The name of the workflow or task exceeds the length limit after the workflow is copied multiple times
<img width="1134" alt="image" src="https://user-images.githubusercontent.com/13765310/175562154-e99c751e-cfd6-4351-879f-341cc5b71310.png">
### What you expected to happen
The name length of the workflow or task does not exceed the limit
### How to reproduce
Copy a workflow until an error of "batch copy process definition error" is reported
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/10622
|
https://github.com/apache/dolphinscheduler/pull/10621
|
acd3d3fab14d08b3b06015be3ac9cfb2f4bfc934
|
c34503e3f6cbfb20f1298a57d52af1990ddaf5aa
| 2022-06-26T14:13:27Z |
java
| 2022-08-04T07:04:14Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
|
}
@Test
public void testBatchMoveProcessDefinition() {
long projectCode = 1L;
Project project1 = getProject(projectCode);
Mockito.when(projectMapper.queryByCode(projectCode)).thenReturn(project1);
long projectCode2 = 2L;
Project project2 = getProject(projectCode2);
Mockito.when(projectMapper.queryByCode(projectCode2)).thenReturn(project2);
User loginUser = new User();
loginUser.setId(-1);
loginUser.setUserType(UserType.GENERAL_USER);
Map<String, Object> result = new HashMap<>();
putMsg(result, Status.SUCCESS, projectCode);
Mockito.when(projectService.checkProjectAndAuth(loginUser, project1, projectCode, TASK_DEFINITION_MOVE)).thenReturn(result);
Mockito.when(projectService.checkProjectAndAuth(loginUser, project2, projectCode2, TASK_DEFINITION_MOVE)).thenReturn(result);
ProcessDefinition definition = getProcessDefinition();
definition.setVersion(1);
List<ProcessDefinition> processDefinitionList = new ArrayList<>();
processDefinitionList.add(definition);
Set<Long> definitionCodes = Arrays.stream("46".split(Constants.COMMA)).map(Long::parseLong).collect(Collectors.toSet());
Mockito.when(processDefineMapper.queryByCodes(definitionCodes)).thenReturn(processDefinitionList);
Mockito.when(processService.saveProcessDefine(loginUser, definition, Boolean.TRUE, Boolean.TRUE)).thenReturn(2);
Mockito.when(processTaskRelationMapper.queryByProcessCode(projectCode, 46L)).thenReturn(getProcessTaskRelation(projectCode));
putMsg(result, Status.SUCCESS);
Map<String, Object> successRes = processDefinitionService.batchMoveProcessDefinition(
loginUser, projectCode, "46", projectCode2);
Assert.assertEquals(Status.SUCCESS, successRes.get(Constants.STATUS));
}
@Test
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 10,622 |
[Bug] [Api] The name of the workflow or task exceeds the length limit after the workflow is copied multiple times
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The name of the workflow or task exceeds the length limit after the workflow is copied multiple times
<img width="1134" alt="image" src="https://user-images.githubusercontent.com/13765310/175562154-e99c751e-cfd6-4351-879f-341cc5b71310.png">
### What you expected to happen
The name length of the workflow or task does not exceed the limit
### How to reproduce
Copy a workflow until an error of "batch copy process definition error" is reported
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/10622
|
https://github.com/apache/dolphinscheduler/pull/10621
|
acd3d3fab14d08b3b06015be3ac9cfb2f4bfc934
|
c34503e3f6cbfb20f1298a57d52af1990ddaf5aa
| 2022-06-26T14:13:27Z |
java
| 2022-08-04T07:04:14Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
|
public void deleteProcessDefinitionByCodeTest() {
long projectCode = 1L;
Mockito.when(projectMapper.queryByCode(projectCode)).thenReturn(getProject(projectCode));
Project project = getProject(projectCode);
User loginUser = new User();
loginUser.setId(-1);
loginUser.setUserType(UserType.GENERAL_USER);
Map<String, Object> result = new HashMap<>();
putMsg(result, Status.PROJECT_NOT_FOUND, projectCode);
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_DEFINITION_DELETE)).thenReturn(result);
Map<String, Object> map = processDefinitionService.deleteProcessDefinitionByCode(loginUser, projectCode, 6L);
Assert.assertEquals(Status.PROJECT_NOT_FOUND, map.get(Constants.STATUS));
putMsg(result, Status.SUCCESS, projectCode);
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_DEFINITION_DELETE)).thenReturn(result);
Mockito.when(processDefineMapper.queryByCode(1L)).thenReturn(null);
Map<String, Object> instanceNotExitRes = processDefinitionService.deleteProcessDefinitionByCode(loginUser, projectCode, 1L);
Assert.assertEquals(Status.PROCESS_DEFINE_NOT_EXIST, instanceNotExitRes.get(Constants.STATUS));
ProcessDefinition processDefinition = getProcessDefinition();
putMsg(result, Status.SUCCESS, projectCode);
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_DEFINITION_DELETE)).thenReturn(result);
loginUser.setUserType(UserType.GENERAL_USER);
Mockito.when(processDefineMapper.queryByCode(46L)).thenReturn(processDefinition);
Map<String, Object> userNoAuthRes = processDefinitionService.deleteProcessDefinitionByCode(loginUser, projectCode, 46L);
Assert.assertEquals(Status.USER_NO_OPERATION_PERM, userNoAuthRes.get(Constants.STATUS));
loginUser.setUserType(UserType.ADMIN_USER);
putMsg(result, Status.SUCCESS, projectCode);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 10,622 |
[Bug] [Api] The name of the workflow or task exceeds the length limit after the workflow is copied multiple times
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The name of the workflow or task exceeds the length limit after the workflow is copied multiple times
<img width="1134" alt="image" src="https://user-images.githubusercontent.com/13765310/175562154-e99c751e-cfd6-4351-879f-341cc5b71310.png">
### What you expected to happen
The name length of the workflow or task does not exceed the limit
### How to reproduce
Copy a workflow until an error of "batch copy process definition error" is reported
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/10622
|
https://github.com/apache/dolphinscheduler/pull/10621
|
acd3d3fab14d08b3b06015be3ac9cfb2f4bfc934
|
c34503e3f6cbfb20f1298a57d52af1990ddaf5aa
| 2022-06-26T14:13:27Z |
java
| 2022-08-04T07:04:14Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
|
processDefinition.setReleaseState(ReleaseState.ONLINE);
Mockito.when(processDefineMapper.queryByCode(46L)).thenReturn(processDefinition);
Throwable exception = Assertions.assertThrows(ServiceException.class, () -> processDefinitionService.deleteProcessDefinitionByCode(loginUser, projectCode, 46L));
String formatter = MessageFormat.format(Status.PROCESS_DEFINE_STATE_ONLINE.getMsg(), processDefinition.getName());
Assertions.assertEquals(formatter, exception.getMessage());
processDefinition.setReleaseState(ReleaseState.OFFLINE);
Mockito.when(processDefineMapper.queryByCode(46L)).thenReturn(processDefinition);
putMsg(result, Status.SUCCESS, projectCode);
Mockito.when(scheduleMapper.queryByProcessDefinitionCode(46L)).thenReturn(getSchedule());
Mockito.when(scheduleMapper.deleteById(46)).thenReturn(1);
Mockito.when(processDefineMapper.deleteById(processDefinition.getId())).thenReturn(1);
Mockito.when(processTaskRelationMapper.deleteByCode(project.getCode(), processDefinition.getCode())).thenReturn(1);
Mockito.when(workFlowLineageService.queryTaskDepOnProcess(project.getCode(), processDefinition.getCode())).thenReturn(Collections.emptySet());
Map<String, Object> schedulerGreaterThanOneRes = processDefinitionService.deleteProcessDefinitionByCode(loginUser, projectCode, 46L);
Assert.assertEquals(Status.SUCCESS, schedulerGreaterThanOneRes.get(Constants.STATUS));
Schedule schedule = getSchedule();
schedule.setReleaseState(ReleaseState.ONLINE);
putMsg(result, Status.SUCCESS, projectCode);
Mockito.when(scheduleMapper.queryByProcessDefinitionCode(46L)).thenReturn(schedule);
Mockito.when(workFlowLineageService.queryTaskDepOnProcess(project.getCode(), processDefinition.getCode())).thenReturn(Collections.emptySet());
Map<String, Object> schedulerOnlineRes = processDefinitionService.deleteProcessDefinitionByCode(loginUser, projectCode, 46L);
Assert.assertEquals(Status.SCHEDULE_CRON_STATE_ONLINE, schedulerOnlineRes.get(Constants.STATUS));
loginUser.setUserType(UserType.ADMIN_USER);
putMsg(result, Status.SUCCESS, projectCode);
TaskMainInfo taskMainInfo = getTaskMainInfo().get(0);
Mockito.when(workFlowLineageService.queryTaskDepOnProcess(project.getCode(), processDefinition.getCode())).thenReturn(ImmutableSet.copyOf(getTaskMainInfo()));
exception = Assertions.assertThrows(ServiceException.class, () -> processDefinitionService.deleteProcessDefinitionByCode(loginUser, projectCode, 46L));
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 10,622 |
[Bug] [Api] The name of the workflow or task exceeds the length limit after the workflow is copied multiple times
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The name of the workflow or task exceeds the length limit after the workflow is copied multiple times
<img width="1134" alt="image" src="https://user-images.githubusercontent.com/13765310/175562154-e99c751e-cfd6-4351-879f-341cc5b71310.png">
### What you expected to happen
The name length of the workflow or task does not exceed the limit
### How to reproduce
Copy a workflow until an error of "batch copy process definition error" is reported
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/10622
|
https://github.com/apache/dolphinscheduler/pull/10621
|
acd3d3fab14d08b3b06015be3ac9cfb2f4bfc934
|
c34503e3f6cbfb20f1298a57d52af1990ddaf5aa
| 2022-06-26T14:13:27Z |
java
| 2022-08-04T07:04:14Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
|
formatter = MessageFormat.format(Status.DELETE_PROCESS_DEFINITION_USE_BY_OTHER_FAIL.getMsg(), String.format("%s:%s", taskMainInfo.getProcessDefinitionName(), taskMainInfo.getTaskName()));
Assertions.assertEquals(formatter, exception.getMessage());
schedule.setReleaseState(ReleaseState.OFFLINE);
Mockito.when(processDefineMapper.deleteById(46)).thenReturn(1);
Mockito.when(scheduleMapper.deleteById(schedule.getId())).thenReturn(1);
Mockito.when(processTaskRelationMapper.deleteByCode(project.getCode(), processDefinition.getCode())).thenReturn(1);
Mockito.when(scheduleMapper.queryByProcessDefinitionCode(46L)).thenReturn(getSchedule());
Mockito.when(workFlowLineageService.queryTaskDepOnProcess(project.getCode(), processDefinition.getCode())).thenReturn(Collections.emptySet());
putMsg(result, Status.SUCCESS, projectCode);
Map<String, Object> deleteSuccess = processDefinitionService.deleteProcessDefinitionByCode(loginUser, projectCode, 46L);
Assert.assertEquals(Status.SUCCESS, deleteSuccess.get(Constants.STATUS));
}
@Test
@Ignore
public void testReleaseProcessDefinition() {
long projectCode = 1L;
Mockito.when(projectMapper.queryByCode(projectCode)).thenReturn(getProject(projectCode));
Project project = getProject(projectCode);
User loginUser = new User();
loginUser.setId(1);
loginUser.setUserType(UserType.GENERAL_USER);
Map<String, Object> result = new HashMap<>();
putMsg(result, Status.PROJECT_NOT_FOUND, projectCode);
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectCode,null)).thenReturn(result);
Map<String, Object> map = processDefinitionService.releaseProcessDefinition(loginUser, projectCode,
6, ReleaseState.OFFLINE);
Assert.assertEquals(Status.PROJECT_NOT_FOUND, map.get(Constants.STATUS));
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 10,622 |
[Bug] [Api] The name of the workflow or task exceeds the length limit after the workflow is copied multiple times
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The name of the workflow or task exceeds the length limit after the workflow is copied multiple times
<img width="1134" alt="image" src="https://user-images.githubusercontent.com/13765310/175562154-e99c751e-cfd6-4351-879f-341cc5b71310.png">
### What you expected to happen
The name length of the workflow or task does not exceed the limit
### How to reproduce
Copy a workflow until an error of "batch copy process definition error" is reported
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/10622
|
https://github.com/apache/dolphinscheduler/pull/10621
|
acd3d3fab14d08b3b06015be3ac9cfb2f4bfc934
|
c34503e3f6cbfb20f1298a57d52af1990ddaf5aa
| 2022-06-26T14:13:27Z |
java
| 2022-08-04T07:04:14Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
|
putMsg(result, Status.SUCCESS, projectCode);
Mockito.when(processDefineMapper.queryByCode(46L)).thenReturn(getProcessDefinition());
List<ProcessTaskRelation> processTaskRelationList = new ArrayList<>();
ProcessTaskRelation processTaskRelation = new ProcessTaskRelation();
processTaskRelation.setProjectCode(projectCode);
processTaskRelation.setProcessDefinitionCode(46L);
processTaskRelation.setPostTaskCode(123L);
processTaskRelationList.add(processTaskRelation);
Mockito.when(processService.findRelationByCode(46L, 1)).thenReturn(processTaskRelationList);
Map<String, Object> onlineRes = processDefinitionService.releaseProcessDefinition(
loginUser, projectCode, 46, ReleaseState.ONLINE);
Assert.assertEquals(Status.SUCCESS, onlineRes.get(Constants.STATUS));
Map<String, Object> onlineWithResourceRes = processDefinitionService.releaseProcessDefinition(
loginUser, projectCode, 46, ReleaseState.ONLINE);
Assert.assertEquals(Status.SUCCESS, onlineWithResourceRes.get(Constants.STATUS));
Map<String, Object> failRes = processDefinitionService.releaseProcessDefinition(
loginUser, projectCode, 46, ReleaseState.getEnum(2));
Assert.assertEquals(Status.REQUEST_PARAMS_NOT_VALID_ERROR, failRes.get(Constants.STATUS));
}
@Test
public void testVerifyProcessDefinitionName() {
long projectCode = 1L;
Mockito.when(projectMapper.queryByCode(projectCode)).thenReturn(getProject(projectCode));
Project project = getProject(projectCode);
User loginUser = new User();
loginUser.setId(-1);
loginUser.setUserType(UserType.GENERAL_USER);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 10,622 |
[Bug] [Api] The name of the workflow or task exceeds the length limit after the workflow is copied multiple times
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The name of the workflow or task exceeds the length limit after the workflow is copied multiple times
<img width="1134" alt="image" src="https://user-images.githubusercontent.com/13765310/175562154-e99c751e-cfd6-4351-879f-341cc5b71310.png">
### What you expected to happen
The name length of the workflow or task does not exceed the limit
### How to reproduce
Copy a workflow until an error of "batch copy process definition error" is reported
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/10622
|
https://github.com/apache/dolphinscheduler/pull/10621
|
acd3d3fab14d08b3b06015be3ac9cfb2f4bfc934
|
c34503e3f6cbfb20f1298a57d52af1990ddaf5aa
| 2022-06-26T14:13:27Z |
java
| 2022-08-04T07:04:14Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
|
Map<String, Object> result = new HashMap<>();
putMsg(result, Status.PROJECT_NOT_FOUND, projectCode);
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_CREATE)).thenReturn(result);
Map<String, Object> map = processDefinitionService.verifyProcessDefinitionName(loginUser,
projectCode, "test_pdf");
Assert.assertEquals(Status.PROJECT_NOT_FOUND, map.get(Constants.STATUS));
putMsg(result, Status.SUCCESS, projectCode);
Mockito.when(processDefineMapper.verifyByDefineName(project.getCode(), "test_pdf")).thenReturn(null);
Map<String, Object> processNotExistRes = processDefinitionService.verifyProcessDefinitionName(loginUser,
projectCode, "test_pdf");
Assert.assertEquals(Status.SUCCESS, processNotExistRes.get(Constants.STATUS));
Mockito.when(processDefineMapper.verifyByDefineName(project.getCode(), "test_pdf")).thenReturn(getProcessDefinition());
Map<String, Object> processExistRes = processDefinitionService.verifyProcessDefinitionName(loginUser,
projectCode, "test_pdf");
Assert.assertEquals(Status.PROCESS_DEFINITION_NAME_EXIST, processExistRes.get(Constants.STATUS));
}
@Test
public void testCheckProcessNodeList() {
Map<String, Object> dataNotValidRes = processDefinitionService.checkProcessNodeList(null, null);
Assert.assertEquals(Status.DATA_IS_NOT_VALID, dataNotValidRes.get(Constants.STATUS));
List<TaskDefinitionLog> taskDefinitionLogs = JSONUtils.toList(taskDefinitionJson, TaskDefinitionLog.class);
Map<String, Object> taskEmptyRes = processDefinitionService.checkProcessNodeList(taskRelationJson, taskDefinitionLogs);
Assert.assertEquals(Status.PROCESS_DAG_IS_EMPTY, taskEmptyRes.get(Constants.STATUS));
}
@Test
public void testGetTaskNodeListByDefinitionCode() {
long projectCode = 1L;
Mockito.when(projectMapper.queryByCode(projectCode)).thenReturn(getProject(projectCode));
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 10,622 |
[Bug] [Api] The name of the workflow or task exceeds the length limit after the workflow is copied multiple times
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The name of the workflow or task exceeds the length limit after the workflow is copied multiple times
<img width="1134" alt="image" src="https://user-images.githubusercontent.com/13765310/175562154-e99c751e-cfd6-4351-879f-341cc5b71310.png">
### What you expected to happen
The name length of the workflow or task does not exceed the limit
### How to reproduce
Copy a workflow until an error of "batch copy process definition error" is reported
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/10622
|
https://github.com/apache/dolphinscheduler/pull/10621
|
acd3d3fab14d08b3b06015be3ac9cfb2f4bfc934
|
c34503e3f6cbfb20f1298a57d52af1990ddaf5aa
| 2022-06-26T14:13:27Z |
java
| 2022-08-04T07:04:14Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
|
Project project = getProject(projectCode);
User loginUser = new User();
loginUser.setId(-1);
loginUser.setUserType(UserType.GENERAL_USER);
Map<String, Object> result = new HashMap<>();
putMsg(result, Status.SUCCESS, projectCode);
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectCode,null)).thenReturn(result);
Mockito.when(processDefineMapper.queryByCode(46L)).thenReturn(null);
Map<String, Object> processDefinitionNullRes = processDefinitionService.getTaskNodeListByDefinitionCode(loginUser, projectCode, 46L);
Assert.assertEquals(Status.PROCESS_DEFINE_NOT_EXIST, processDefinitionNullRes.get(Constants.STATUS));
ProcessDefinition processDefinition = getProcessDefinition();
putMsg(result, Status.SUCCESS, projectCode);
Mockito.when(processService.genDagData(Mockito.any())).thenReturn(new DagData(processDefinition, null, null));
Mockito.when(processDefineMapper.queryByCode(46L)).thenReturn(processDefinition);
Map<String, Object> dataNotValidRes = processDefinitionService.getTaskNodeListByDefinitionCode(loginUser, projectCode, 46L);
Assert.assertEquals(Status.SUCCESS, dataNotValidRes.get(Constants.STATUS));
}
@Test
public void testGetTaskNodeListByDefinitionCodes() {
long projectCode = 1L;
Mockito.when(projectMapper.queryByCode(projectCode)).thenReturn(getProject(projectCode));
Project project = getProject(projectCode);
User loginUser = new User();
loginUser.setId(-1);
loginUser.setUserType(UserType.GENERAL_USER);
Map<String, Object> result = new HashMap<>();
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 10,622 |
[Bug] [Api] The name of the workflow or task exceeds the length limit after the workflow is copied multiple times
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The name of the workflow or task exceeds the length limit after the workflow is copied multiple times
<img width="1134" alt="image" src="https://user-images.githubusercontent.com/13765310/175562154-e99c751e-cfd6-4351-879f-341cc5b71310.png">
### What you expected to happen
The name length of the workflow or task does not exceed the limit
### How to reproduce
Copy a workflow until an error of "batch copy process definition error" is reported
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/10622
|
https://github.com/apache/dolphinscheduler/pull/10621
|
acd3d3fab14d08b3b06015be3ac9cfb2f4bfc934
|
c34503e3f6cbfb20f1298a57d52af1990ddaf5aa
| 2022-06-26T14:13:27Z |
java
| 2022-08-04T07:04:14Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
|
putMsg(result, Status.SUCCESS, projectCode);
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectCode,null)).thenReturn(result);
String defineCodes = "46";
Set<Long> defineCodeSet = Lists.newArrayList(defineCodes.split(Constants.COMMA)).stream().map(Long::parseLong).collect(Collectors.toSet());
Mockito.when(processDefineMapper.queryByCodes(defineCodeSet)).thenReturn(null);
Map<String, Object> processNotExistRes = processDefinitionService.getNodeListMapByDefinitionCodes(loginUser, projectCode, defineCodes);
Assert.assertEquals(Status.PROCESS_DEFINE_NOT_EXIST, processNotExistRes.get(Constants.STATUS));
putMsg(result, Status.SUCCESS, projectCode);
ProcessDefinition processDefinition = getProcessDefinition();
List<ProcessDefinition> processDefinitionList = new ArrayList<>();
processDefinitionList.add(processDefinition);
Mockito.when(processDefineMapper.queryByCodes(defineCodeSet)).thenReturn(processDefinitionList);
Mockito.when(processService.genDagData(Mockito.any())).thenReturn(new DagData(processDefinition, null, null));
Project project1 = getProject(projectCode);
List<Project> projects = new ArrayList<>();
projects.add(project1);
Mockito.when(projectMapper.queryProjectCreatedAndAuthorizedByUserId(loginUser.getId())).thenReturn(projects);
Map<String, Object> successRes = processDefinitionService.getNodeListMapByDefinitionCodes(loginUser, projectCode, defineCodes);
Assert.assertEquals(Status.SUCCESS, successRes.get(Constants.STATUS));
}
@Test
public void testQueryAllProcessDefinitionByProjectCode() {
User loginUser = new User();
loginUser.setId(1);
loginUser.setUserType(UserType.GENERAL_USER);
Map<String, Object> result = new HashMap<>();
long projectCode = 2L;
Project project = getProject(projectCode);
Mockito.when(projectMapper.queryByCode(projectCode)).thenReturn(project);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 10,622 |
[Bug] [Api] The name of the workflow or task exceeds the length limit after the workflow is copied multiple times
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The name of the workflow or task exceeds the length limit after the workflow is copied multiple times
<img width="1134" alt="image" src="https://user-images.githubusercontent.com/13765310/175562154-e99c751e-cfd6-4351-879f-341cc5b71310.png">
### What you expected to happen
The name length of the workflow or task does not exceed the limit
### How to reproduce
Copy a workflow until an error of "batch copy process definition error" is reported
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/10622
|
https://github.com/apache/dolphinscheduler/pull/10621
|
acd3d3fab14d08b3b06015be3ac9cfb2f4bfc934
|
c34503e3f6cbfb20f1298a57d52af1990ddaf5aa
| 2022-06-26T14:13:27Z |
java
| 2022-08-04T07:04:14Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
|
putMsg(result, Status.SUCCESS, projectCode);
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectCode,WORKFLOW_DEFINITION)).thenReturn(result);
ProcessDefinition processDefinition = getProcessDefinition();
List<ProcessDefinition> processDefinitionList = new ArrayList<>();
processDefinitionList.add(processDefinition);
Mockito.when(processDefineMapper.queryAllDefinitionList(projectCode)).thenReturn(processDefinitionList);
Map<String, Object> successRes = processDefinitionService.queryAllProcessDefinitionByProjectCode(loginUser, projectCode);
Assert.assertEquals(Status.SUCCESS, successRes.get(Constants.STATUS));
}
@Test
public void testViewTree() {
User loginUser = new User();
loginUser.setId(1);
loginUser.setTenantId(1);
loginUser.setUserType(UserType.ADMIN_USER);
long projectCode = 1;
Project project1 = getProject(projectCode);
Map<String, Object> result = new HashMap<>();
putMsg(result, Status.SUCCESS, projectCode);
Mockito.when(projectMapper.queryByCode(1)).thenReturn(project1);
Mockito.when(projectService.checkProjectAndAuth(loginUser, project1, projectCode, WORKFLOW_TREE_VIEW)).thenReturn(result);
ProcessDefinition processDefinition = getProcessDefinition();
Map<String, Object> processDefinitionNullRes = processDefinitionService.viewTree(loginUser,processDefinition.getProjectCode(),46, 10);
Assert.assertEquals(Status.PROCESS_DEFINE_NOT_EXIST, processDefinitionNullRes.get(Constants.STATUS));
putMsg(result, Status.SUCCESS, projectCode);
Mockito.when(projectMapper.queryByCode(1)).thenReturn(project1);
Mockito.when(projectService.checkProjectAndAuth(loginUser, project1, 1, WORKFLOW_TREE_VIEW)).thenReturn(result);
Mockito.when(processDefineMapper.queryByCode(46L)).thenReturn(processDefinition);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 10,622 |
[Bug] [Api] The name of the workflow or task exceeds the length limit after the workflow is copied multiple times
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The name of the workflow or task exceeds the length limit after the workflow is copied multiple times
<img width="1134" alt="image" src="https://user-images.githubusercontent.com/13765310/175562154-e99c751e-cfd6-4351-879f-341cc5b71310.png">
### What you expected to happen
The name length of the workflow or task does not exceed the limit
### How to reproduce
Copy a workflow until an error of "batch copy process definition error" is reported
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/10622
|
https://github.com/apache/dolphinscheduler/pull/10621
|
acd3d3fab14d08b3b06015be3ac9cfb2f4bfc934
|
c34503e3f6cbfb20f1298a57d52af1990ddaf5aa
| 2022-06-26T14:13:27Z |
java
| 2022-08-04T07:04:14Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
|
Mockito.when(processService.genDagGraph(processDefinition)).thenReturn(new DAG<>());
Map<String, Object> taskNullRes = processDefinitionService.viewTree(loginUser,processDefinition.getProjectCode(),46, 10);
Assert.assertEquals(Status.SUCCESS, taskNullRes.get(Constants.STATUS));
Map<String, Object> taskNotNuLLRes = processDefinitionService.viewTree(loginUser,processDefinition.getProjectCode(),46, 10);
Assert.assertEquals(Status.SUCCESS, taskNotNuLLRes.get(Constants.STATUS));
}
@Test
public void testSubProcessViewTree() {
User loginUser = new User();
loginUser.setId(1);
loginUser.setUserType(UserType.ADMIN_USER);
ProcessDefinition processDefinition = getProcessDefinition();
Mockito.when(processDefineMapper.queryByCode(46L)).thenReturn(processDefinition);
Project project1 = getProject(1);
Map<String, Object> result = new HashMap<>();
result.put(Constants.STATUS, Status.SUCCESS);
Mockito.when(projectMapper.queryByCode(1)).thenReturn(project1);
Mockito.when(projectService.checkProjectAndAuth(loginUser, project1, 1, WORKFLOW_TREE_VIEW)).thenReturn(result);
Mockito.when(processService.genDagGraph(processDefinition)).thenReturn(new DAG<>());
Map<String, Object> taskNotNuLLRes = processDefinitionService.viewTree(loginUser,processDefinition.getProjectCode(), 46, 10);
Assert.assertEquals(Status.SUCCESS, taskNotNuLLRes.get(Constants.STATUS));
}
@Test
public void testUpdateProcessDefinition() {
User loginUser = new User();
loginUser.setId(1);
loginUser.setUserType(UserType.ADMIN_USER);
Map<String, Object> result = new HashMap<>();
putMsg(result, Status.SUCCESS);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 10,622 |
[Bug] [Api] The name of the workflow or task exceeds the length limit after the workflow is copied multiple times
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The name of the workflow or task exceeds the length limit after the workflow is copied multiple times
<img width="1134" alt="image" src="https://user-images.githubusercontent.com/13765310/175562154-e99c751e-cfd6-4351-879f-341cc5b71310.png">
### What you expected to happen
The name length of the workflow or task does not exceed the limit
### How to reproduce
Copy a workflow until an error of "batch copy process definition error" is reported
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/10622
|
https://github.com/apache/dolphinscheduler/pull/10621
|
acd3d3fab14d08b3b06015be3ac9cfb2f4bfc934
|
c34503e3f6cbfb20f1298a57d52af1990ddaf5aa
| 2022-06-26T14:13:27Z |
java
| 2022-08-04T07:04:14Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
|
long projectCode = 1L;
Project project = getProject(projectCode);
Mockito.when(projectMapper.queryByCode(projectCode)).thenReturn(getProject(projectCode));
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_UPDATE)).thenReturn(result);
Map<String, Object> updateResult = processDefinitionService.updateProcessDefinition(loginUser, projectCode, "test", 1,
"", "", "", 0, "root", null,"",null, ProcessExecutionTypeEnum.PARALLEL);
Assert.assertEquals(Status.DATA_IS_NOT_VALID, updateResult.get(Constants.STATUS));
}
@Test
public void testBatchExportProcessDefinitionByCodes() {
processDefinitionService.batchExportProcessDefinitionByCodes(null, 1L, null, null);
User loginUser = new User();
loginUser.setId(1);
loginUser.setUserType(UserType.ADMIN_USER);
long projectCode = 1L;
Project project = getProject(projectCode);
Map<String, Object> result = new HashMap<>();
putMsg(result, Status.PROJECT_NOT_FOUND);
Mockito.when(projectMapper.queryByCode(projectCode)).thenReturn(getProject(projectCode));
processDefinitionService.batchExportProcessDefinitionByCodes(
loginUser, projectCode, "1", null);
ProcessDefinition processDefinition = new ProcessDefinition();
processDefinition.setId(1);
Map<String, Object> checkResult = new HashMap<>();
checkResult.put(Constants.STATUS, Status.SUCCESS);
Mockito.when(projectMapper.queryByCode(projectCode)).thenReturn(project);
HttpServletResponse response = mock(HttpServletResponse.class);
DagData dagData = new DagData(getProcessDefinition(), null, null);
Mockito.when(processService.genDagData(Mockito.any())).thenReturn(dagData);
processDefinitionService.batchExportProcessDefinitionByCodes(loginUser, projectCode, "1", response);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 10,622 |
[Bug] [Api] The name of the workflow or task exceeds the length limit after the workflow is copied multiple times
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The name of the workflow or task exceeds the length limit after the workflow is copied multiple times
<img width="1134" alt="image" src="https://user-images.githubusercontent.com/13765310/175562154-e99c751e-cfd6-4351-879f-341cc5b71310.png">
### What you expected to happen
The name length of the workflow or task does not exceed the limit
### How to reproduce
Copy a workflow until an error of "batch copy process definition error" is reported
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/10622
|
https://github.com/apache/dolphinscheduler/pull/10621
|
acd3d3fab14d08b3b06015be3ac9cfb2f4bfc934
|
c34503e3f6cbfb20f1298a57d52af1990ddaf5aa
| 2022-06-26T14:13:27Z |
java
| 2022-08-04T07:04:14Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
|
Assert.assertNotNull(processDefinitionService.exportProcessDagData(processDefinition));
}
@Test
public void testImportSqlProcessDefinition() throws Exception {
int userId = 10;
User loginUser = Mockito.mock(User.class);
Mockito.when(loginUser.getId()).thenReturn(userId);
Mockito.when(loginUser.getTenantId()).thenReturn(2);
Mockito.when(loginUser.getUserType()).thenReturn(UserType.GENERAL_USER);
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
ZipOutputStream outputStream = new ZipOutputStream(byteArrayOutputStream);
outputStream.putNextEntry(new ZipEntry("import_sql/"));
outputStream.putNextEntry(new ZipEntry("import_sql/a.sql"));
outputStream.write("-- upstream: start_auto_dag\n-- datasource: mysql_1\nselect 1;".getBytes(StandardCharsets.UTF_8));
outputStream.putNextEntry(new ZipEntry("import_sql/b.sql"));
outputStream.write("-- name: start_auto_dag\n-- datasource: mysql_1\nselect 1;".getBytes(StandardCharsets.UTF_8));
outputStream.close();
MockMultipartFile mockMultipartFile = new MockMultipartFile("import_sql.zip", byteArrayOutputStream.toByteArray());
DataSource dataSource = Mockito.mock(DataSource.class);
Mockito.when(dataSource.getId()).thenReturn(1);
Mockito.when(dataSource.getType()).thenReturn(DbType.MYSQL);
Mockito.when(dataSourceMapper.queryDataSourceByNameAndUserId(userId, "mysql_1")).thenReturn(dataSource);
long projectCode = 1001;
Project project1 = getProject(projectCode);
Map<String, Object> result = new HashMap<>();
result.put(Constants.STATUS, Status.SUCCESS);
Mockito.when(projectMapper.queryByCode(projectCode)).thenReturn(getProject(projectCode));
Mockito.when(projectService.checkProjectAndAuth(loginUser, project1, projectCode, WORKFLOW_IMPORT)).thenReturn(result);
Mockito.when(processService.saveTaskDefine(Mockito.same(loginUser), Mockito.eq(projectCode), Mockito.notNull(), Mockito.anyBoolean())).thenReturn(2);
Mockito.when(processService.saveProcessDefine(Mockito.same(loginUser), Mockito.notNull(), Mockito.notNull(), Mockito.anyBoolean())).thenReturn(1);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 10,622 |
[Bug] [Api] The name of the workflow or task exceeds the length limit after the workflow is copied multiple times
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The name of the workflow or task exceeds the length limit after the workflow is copied multiple times
<img width="1134" alt="image" src="https://user-images.githubusercontent.com/13765310/175562154-e99c751e-cfd6-4351-879f-341cc5b71310.png">
### What you expected to happen
The name length of the workflow or task does not exceed the limit
### How to reproduce
Copy a workflow until an error of "batch copy process definition error" is reported
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/10622
|
https://github.com/apache/dolphinscheduler/pull/10621
|
acd3d3fab14d08b3b06015be3ac9cfb2f4bfc934
|
c34503e3f6cbfb20f1298a57d52af1990ddaf5aa
| 2022-06-26T14:13:27Z |
java
| 2022-08-04T07:04:14Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
|
Mockito.when(processService.saveTaskRelation(Mockito.same(loginUser), Mockito.eq(projectCode), Mockito.anyLong(),
Mockito.eq(1), Mockito.notNull(), Mockito.notNull(), Mockito.anyBoolean())).thenReturn(0);
result = processDefinitionService.importSqlProcessDefinition(loginUser, projectCode, mockMultipartFile);
Assert.assertEquals(result.get(Constants.STATUS), Status.SUCCESS);
}
/**
* get mock processDefinition
*
* @return ProcessDefinition
*/
private ProcessDefinition getProcessDefinition() {
ProcessDefinition processDefinition = new ProcessDefinition();
processDefinition.setId(46);
processDefinition.setProjectCode(1L);
processDefinition.setName("test_pdf");
processDefinition.setTenantId(1);
processDefinition.setDescription("");
processDefinition.setCode(46L);
processDefinition.setVersion(1);
return processDefinition;
}
/**
* get mock Project
*
* @param projectCode projectCode
* @return Project
*/
private Project getProject(long projectCode) {
Project project = new Project();
project.setCode(projectCode);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 10,622 |
[Bug] [Api] The name of the workflow or task exceeds the length limit after the workflow is copied multiple times
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The name of the workflow or task exceeds the length limit after the workflow is copied multiple times
<img width="1134" alt="image" src="https://user-images.githubusercontent.com/13765310/175562154-e99c751e-cfd6-4351-879f-341cc5b71310.png">
### What you expected to happen
The name length of the workflow or task does not exceed the limit
### How to reproduce
Copy a workflow until an error of "batch copy process definition error" is reported
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/10622
|
https://github.com/apache/dolphinscheduler/pull/10621
|
acd3d3fab14d08b3b06015be3ac9cfb2f4bfc934
|
c34503e3f6cbfb20f1298a57d52af1990ddaf5aa
| 2022-06-26T14:13:27Z |
java
| 2022-08-04T07:04:14Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
|
project.setId(1);
project.setName("test");
project.setUserId(1);
return project;
}
private List<ProcessTaskRelation> getProcessTaskRelation(long projectCode) {
List<ProcessTaskRelation> processTaskRelations = new ArrayList<>();
ProcessTaskRelation processTaskRelation = new ProcessTaskRelation();
processTaskRelation.setProjectCode(projectCode);
processTaskRelation.setProcessDefinitionCode(46L);
processTaskRelation.setProcessDefinitionVersion(1);
processTaskRelations.add(processTaskRelation);
return processTaskRelations;
}
/**
* get mock schedule
*
* @return schedule
*/
private Schedule getSchedule() {
Date date = new Date();
Schedule schedule = new Schedule();
schedule.setId(46);
schedule.setProcessDefinitionCode(1);
schedule.setStartTime(date);
schedule.setEndTime(date);
schedule.setCrontab("0 0 5 * * ? *");
schedule.setFailureStrategy(FailureStrategy.END);
schedule.setUserId(1);
schedule.setReleaseState(ReleaseState.OFFLINE);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 10,622 |
[Bug] [Api] The name of the workflow or task exceeds the length limit after the workflow is copied multiple times
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The name of the workflow or task exceeds the length limit after the workflow is copied multiple times
<img width="1134" alt="image" src="https://user-images.githubusercontent.com/13765310/175562154-e99c751e-cfd6-4351-879f-341cc5b71310.png">
### What you expected to happen
The name length of the workflow or task does not exceed the limit
### How to reproduce
Copy a workflow until an error of "batch copy process definition error" is reported
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/10622
|
https://github.com/apache/dolphinscheduler/pull/10621
|
acd3d3fab14d08b3b06015be3ac9cfb2f4bfc934
|
c34503e3f6cbfb20f1298a57d52af1990ddaf5aa
| 2022-06-26T14:13:27Z |
java
| 2022-08-04T07:04:14Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
|
schedule.setProcessInstancePriority(Priority.MEDIUM);
schedule.setWarningType(WarningType.NONE);
schedule.setWarningGroupId(1);
schedule.setWorkerGroup(Constants.DEFAULT_WORKER_GROUP);
return schedule;
}
private void putMsg(Map<String, Object> result, Status status, Object... statusParams) {
result.put(Constants.STATUS, status);
if (statusParams != null && statusParams.length > 0) {
result.put(Constants.MSG, MessageFormat.format(status.getMsg(), statusParams));
} else {
result.put(Constants.MSG, status.getMsg());
}
}
/**
* get mock task main info
*
* @return schedule
*/
private List<TaskMainInfo> getTaskMainInfo() {
List<TaskMainInfo> taskMainInfos = new ArrayList<>();
TaskMainInfo taskMainInfo = new TaskMainInfo();
taskMainInfo.setId(1);
taskMainInfo.setProcessDefinitionName("process");
taskMainInfo.setTaskName("task");
taskMainInfos.add(taskMainInfo);
return taskMainInfos;
}
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 10,622 |
[Bug] [Api] The name of the workflow or task exceeds the length limit after the workflow is copied multiple times
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The name of the workflow or task exceeds the length limit after the workflow is copied multiple times
<img width="1134" alt="image" src="https://user-images.githubusercontent.com/13765310/175562154-e99c751e-cfd6-4351-879f-341cc5b71310.png">
### What you expected to happen
The name length of the workflow or task does not exceed the limit
### How to reproduce
Copy a workflow until an error of "batch copy process definition error" is reported
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/10622
|
https://github.com/apache/dolphinscheduler/pull/10621
|
acd3d3fab14d08b3b06015be3ac9cfb2f4bfc934
|
c34503e3f6cbfb20f1298a57d52af1990ddaf5aa
| 2022-06-26T14:13:27Z |
java
| 2022-08-04T07:04:14Z |
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
|
/*
* 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.dolphinscheduler.common;
import org.apache.dolphinscheduler.plugin.task.api.enums.ExecutionStatus;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.SystemUtils;
import java.time.Duration;
import java.util.regex.Pattern;
/**
* Constants
*/
public final class Constants {
private Constants() {
throw new UnsupportedOperationException("Construct Constants");
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 10,622 |
[Bug] [Api] The name of the workflow or task exceeds the length limit after the workflow is copied multiple times
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The name of the workflow or task exceeds the length limit after the workflow is copied multiple times
<img width="1134" alt="image" src="https://user-images.githubusercontent.com/13765310/175562154-e99c751e-cfd6-4351-879f-341cc5b71310.png">
### What you expected to happen
The name length of the workflow or task does not exceed the limit
### How to reproduce
Copy a workflow until an error of "batch copy process definition error" is reported
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/10622
|
https://github.com/apache/dolphinscheduler/pull/10621
|
acd3d3fab14d08b3b06015be3ac9cfb2f4bfc934
|
c34503e3f6cbfb20f1298a57d52af1990ddaf5aa
| 2022-06-26T14:13:27Z |
java
| 2022-08-04T07:04:14Z |
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
|
/**
* common properties path
*/
public static final String COMMON_PROPERTIES_PATH = "/common.properties";
/**
* registry properties
*/
public static final String REGISTRY_DOLPHINSCHEDULER_MASTERS = "/nodes/master";
public static final String REGISTRY_DOLPHINSCHEDULER_WORKERS = "/nodes/worker";
public static final String REGISTRY_DOLPHINSCHEDULER_DEAD_SERVERS = "/dead-servers";
public static final String REGISTRY_DOLPHINSCHEDULER_NODE = "/nodes";
public static final String REGISTRY_DOLPHINSCHEDULER_LOCK_MASTERS = "/lock/masters";
public static final String REGISTRY_DOLPHINSCHEDULER_LOCK_FAILOVER_MASTERS = "/lock/failover/masters";
public static final String REGISTRY_DOLPHINSCHEDULER_LOCK_FAILOVER_WORKERS = "/lock/failover/workers";
public static final String REGISTRY_DOLPHINSCHEDULER_LOCK_FAILOVER_STARTUP_MASTERS = "/lock/failover/startup-masters";
public static final String FORMAT_SS = "%s%s";
public static final String FORMAT_S_S = "%s/%s";
public static final String FORMAT_S_S_COLON = "%s:%s";
public static final String FOLDER_SEPARATOR = "/";
public static final String RESOURCE_TYPE_FILE = "resources";
public static final String RESOURCE_TYPE_UDF = "udfs";
public static final String STORAGE_S3 = "S3";
public static final String STORAGE_HDFS = "HDFS";
public static final String EMPTY_STRING = "";
/**
* resource.hdfs.fs.defaultFS
*/
public static final String FS_DEFAULT_FS = "resource.hdfs.fs.defaultFS";
/**
* hadoop configuration
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 10,622 |
[Bug] [Api] The name of the workflow or task exceeds the length limit after the workflow is copied multiple times
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The name of the workflow or task exceeds the length limit after the workflow is copied multiple times
<img width="1134" alt="image" src="https://user-images.githubusercontent.com/13765310/175562154-e99c751e-cfd6-4351-879f-341cc5b71310.png">
### What you expected to happen
The name length of the workflow or task does not exceed the limit
### How to reproduce
Copy a workflow until an error of "batch copy process definition error" is reported
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/10622
|
https://github.com/apache/dolphinscheduler/pull/10621
|
acd3d3fab14d08b3b06015be3ac9cfb2f4bfc934
|
c34503e3f6cbfb20f1298a57d52af1990ddaf5aa
| 2022-06-26T14:13:27Z |
java
| 2022-08-04T07:04:14Z |
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
|
*/
public static final String HADOOP_RM_STATE_ACTIVE = "ACTIVE";
public static final String HADOOP_RESOURCE_MANAGER_HTTPADDRESS_PORT = "resource.manager.httpaddress.port";
/**
* yarn.resourcemanager.ha.rm.ids
*/
public static final String YARN_RESOURCEMANAGER_HA_RM_IDS = "yarn.resourcemanager.ha.rm.ids";
/**
* yarn.application.status.address
*/
public static final String YARN_APPLICATION_STATUS_ADDRESS = "yarn.application.status.address";
/**
* yarn.job.history.status.address
*/
public static final String YARN_JOB_HISTORY_STATUS_ADDRESS = "yarn.job.history.status.address";
/**
* hdfs configuration
* resource.hdfs.root.user
*/
public static final String HDFS_ROOT_USER = "resource.hdfs.root.user";
/**
* hdfs/s3 configuration
* resource.storage.upload.base.path
*/
public static final String RESOURCE_UPLOAD_PATH = "resource.storage.upload.base.path";
/**
* data basedir path
*/
public static final String DATA_BASEDIR_PATH = "data.basedir.path";
/**
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 10,622 |
[Bug] [Api] The name of the workflow or task exceeds the length limit after the workflow is copied multiple times
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The name of the workflow or task exceeds the length limit after the workflow is copied multiple times
<img width="1134" alt="image" src="https://user-images.githubusercontent.com/13765310/175562154-e99c751e-cfd6-4351-879f-341cc5b71310.png">
### What you expected to happen
The name length of the workflow or task does not exceed the limit
### How to reproduce
Copy a workflow until an error of "batch copy process definition error" is reported
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/10622
|
https://github.com/apache/dolphinscheduler/pull/10621
|
acd3d3fab14d08b3b06015be3ac9cfb2f4bfc934
|
c34503e3f6cbfb20f1298a57d52af1990ddaf5aa
| 2022-06-26T14:13:27Z |
java
| 2022-08-04T07:04:14Z |
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
|
* dolphinscheduler.env.path
*/
public static final String DOLPHINSCHEDULER_ENV_PATH = "dolphinscheduler.env.path";
/**
* environment properties default path
*/
public static final String ENV_PATH = "dolphinscheduler_env.sh";
/**
* resource.view.suffixs
*/
public static final String RESOURCE_VIEW_SUFFIXES = "resource.view.suffixs";
public static final String RESOURCE_VIEW_SUFFIXES_DEFAULT_VALUE = "txt,log,sh,bat,conf,cfg,py,java,sql,xml,hql,properties,json,yml,yaml,ini,js";
/**
* development.state
*/
public static final String DEVELOPMENT_STATE = "development.state";
/**
* sudo enable
*/
public static final String SUDO_ENABLE = "sudo.enable";
/**
* string true
*/
public static final String STRING_TRUE = "true";
/**
* resource storage type
*/
public static final String RESOURCE_STORAGE_TYPE = "resource.storage.type";
public static final String AWS_S3_BUCKET_NAME = "resource.aws.s3.bucket.name";
public static final String AWS_END_POINT = "resource.aws.s3.endpoint";
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 10,622 |
[Bug] [Api] The name of the workflow or task exceeds the length limit after the workflow is copied multiple times
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The name of the workflow or task exceeds the length limit after the workflow is copied multiple times
<img width="1134" alt="image" src="https://user-images.githubusercontent.com/13765310/175562154-e99c751e-cfd6-4351-879f-341cc5b71310.png">
### What you expected to happen
The name length of the workflow or task does not exceed the limit
### How to reproduce
Copy a workflow until an error of "batch copy process definition error" is reported
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/10622
|
https://github.com/apache/dolphinscheduler/pull/10621
|
acd3d3fab14d08b3b06015be3ac9cfb2f4bfc934
|
c34503e3f6cbfb20f1298a57d52af1990ddaf5aa
| 2022-06-26T14:13:27Z |
java
| 2022-08-04T07:04:14Z |
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
|
/**
* comma ,
*/
public static final String COMMA = ",";
/**
* COLON :
*/
public static final String COLON = ":";
/**
* period .
*/
public static final String PERIOD = ".";
/**
* QUESTION ?
*/
public static final String QUESTION = "?";
/**
* SPACE " "
*/
public static final String SPACE = " ";
/**
* SINGLE_SLASH /
*/
public static final String SINGLE_SLASH = "/";
/**
* DOUBLE_SLASH //
*/
public static final String DOUBLE_SLASH = "//";
/**
* EQUAL SIGN
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 10,622 |
[Bug] [Api] The name of the workflow or task exceeds the length limit after the workflow is copied multiple times
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The name of the workflow or task exceeds the length limit after the workflow is copied multiple times
<img width="1134" alt="image" src="https://user-images.githubusercontent.com/13765310/175562154-e99c751e-cfd6-4351-879f-341cc5b71310.png">
### What you expected to happen
The name length of the workflow or task does not exceed the limit
### How to reproduce
Copy a workflow until an error of "batch copy process definition error" is reported
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/10622
|
https://github.com/apache/dolphinscheduler/pull/10621
|
acd3d3fab14d08b3b06015be3ac9cfb2f4bfc934
|
c34503e3f6cbfb20f1298a57d52af1990ddaf5aa
| 2022-06-26T14:13:27Z |
java
| 2022-08-04T07:04:14Z |
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
|
*/
public static final String EQUAL_SIGN = "=";
/**
* AT SIGN
*/
public static final String AT_SIGN = "@";
/**
* date format of yyyy-MM-dd HH:mm:ss
*/
public static final String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";
/**
* date format of yyyyMMdd
*/
public static final String YYYYMMDD = "yyyyMMdd";
/**
* date format of yyyyMMddHHmmss
*/
public static final String YYYYMMDDHHMMSS = "yyyyMMddHHmmss";
/**
* date format of yyyyMMddHHmmssSSS
*/
public static final String YYYYMMDDHHMMSSSSS = "yyyyMMddHHmmssSSS";
/**
* http connect time out
*/
public static final int HTTP_CONNECT_TIMEOUT = 60 * 1000;
/**
* http connect request time out
*/
public static final int HTTP_CONNECTION_REQUEST_TIMEOUT = 60 * 1000;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 10,622 |
[Bug] [Api] The name of the workflow or task exceeds the length limit after the workflow is copied multiple times
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The name of the workflow or task exceeds the length limit after the workflow is copied multiple times
<img width="1134" alt="image" src="https://user-images.githubusercontent.com/13765310/175562154-e99c751e-cfd6-4351-879f-341cc5b71310.png">
### What you expected to happen
The name length of the workflow or task does not exceed the limit
### How to reproduce
Copy a workflow until an error of "batch copy process definition error" is reported
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/10622
|
https://github.com/apache/dolphinscheduler/pull/10621
|
acd3d3fab14d08b3b06015be3ac9cfb2f4bfc934
|
c34503e3f6cbfb20f1298a57d52af1990ddaf5aa
| 2022-06-26T14:13:27Z |
java
| 2022-08-04T07:04:14Z |
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
|
/**
* httpclient soceket time out
*/
public static final int SOCKET_TIMEOUT = 60 * 1000;
/**
* registry session timeout
*/
public static final int REGISTRY_SESSION_TIMEOUT = 10 * 1000;
/**
* http header
*/
public static final String HTTP_HEADER_UNKNOWN = "unKnown";
/**
* http X-Forwarded-For
*/
public static final String HTTP_X_FORWARDED_FOR = "X-Forwarded-For";
/**
* http X-Real-IP
*/
public static final String HTTP_X_REAL_IP = "X-Real-IP";
/**
* UTF-8
*/
public static final String UTF_8 = "UTF-8";
/**
* user name regex
*/
public static final Pattern REGEX_USER_NAME = Pattern.compile("^[a-zA-Z0-9._-]{3,39}$");
/**
* read permission
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 10,622 |
[Bug] [Api] The name of the workflow or task exceeds the length limit after the workflow is copied multiple times
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The name of the workflow or task exceeds the length limit after the workflow is copied multiple times
<img width="1134" alt="image" src="https://user-images.githubusercontent.com/13765310/175562154-e99c751e-cfd6-4351-879f-341cc5b71310.png">
### What you expected to happen
The name length of the workflow or task does not exceed the limit
### How to reproduce
Copy a workflow until an error of "batch copy process definition error" is reported
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/10622
|
https://github.com/apache/dolphinscheduler/pull/10621
|
acd3d3fab14d08b3b06015be3ac9cfb2f4bfc934
|
c34503e3f6cbfb20f1298a57d52af1990ddaf5aa
| 2022-06-26T14:13:27Z |
java
| 2022-08-04T07:04:14Z |
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
|
*/
public static final int READ_PERMISSION = 2;
/**
* write permission
*/
public static final int WRITE_PERMISSION = 2 * 2;
/**
* execute permission
*/
public static final int EXECUTE_PERMISSION = 1;
/**
* default admin permission
*/
public static final int DEFAULT_ADMIN_PERMISSION = 7;
/**
* default hash map size
*/
public static final int DEFAULT_HASH_MAP_SIZE = 16;
/**
* all permissions
*/
public static final int ALL_PERMISSIONS = READ_PERMISSION | WRITE_PERMISSION | EXECUTE_PERMISSION;
/**
* max task timeout
*/
public static final int MAX_TASK_TIMEOUT = 24 * 3600;
/**
* worker host weight
*/
public static final int DEFAULT_WORKER_HOST_WEIGHT = 100;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 10,622 |
[Bug] [Api] The name of the workflow or task exceeds the length limit after the workflow is copied multiple times
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The name of the workflow or task exceeds the length limit after the workflow is copied multiple times
<img width="1134" alt="image" src="https://user-images.githubusercontent.com/13765310/175562154-e99c751e-cfd6-4351-879f-341cc5b71310.png">
### What you expected to happen
The name length of the workflow or task does not exceed the limit
### How to reproduce
Copy a workflow until an error of "batch copy process definition error" is reported
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/10622
|
https://github.com/apache/dolphinscheduler/pull/10621
|
acd3d3fab14d08b3b06015be3ac9cfb2f4bfc934
|
c34503e3f6cbfb20f1298a57d52af1990ddaf5aa
| 2022-06-26T14:13:27Z |
java
| 2022-08-04T07:04:14Z |
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
|
/**
* time unit secong to minutes
*/
public static final int SEC_2_MINUTES_TIME_UNIT = 60;
/***
*
* rpc port
*/
public static final String RPC_PORT = "rpc.port";
/**
* forbid running task
*/
public static final String FLOWNODE_RUN_FLAG_FORBIDDEN = "FORBIDDEN";
/**
* normal running task
*/
public static final String FLOWNODE_RUN_FLAG_NORMAL = "NORMAL";
public static final String COMMON_TASK_TYPE = "common";
public static final String DEFAULT = "default";
public static final String PASSWORD = "password";
public static final String XXXXXX = "******";
public static final String NULL = "NULL";
public static final String THREAD_NAME_MASTER_SERVER = "Master-Server";
public static final String THREAD_NAME_WORKER_SERVER = "Worker-Server";
public static final String THREAD_NAME_ALERT_SERVER = "Alert-Server";
/**
* command parameter keys
*/
public static final String CMD_PARAM_RECOVER_PROCESS_ID_STRING = "ProcessInstanceId";
public static final String CMD_PARAM_RECOVERY_START_NODE_STRING = "StartNodeIdList";
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 10,622 |
[Bug] [Api] The name of the workflow or task exceeds the length limit after the workflow is copied multiple times
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The name of the workflow or task exceeds the length limit after the workflow is copied multiple times
<img width="1134" alt="image" src="https://user-images.githubusercontent.com/13765310/175562154-e99c751e-cfd6-4351-879f-341cc5b71310.png">
### What you expected to happen
The name length of the workflow or task does not exceed the limit
### How to reproduce
Copy a workflow until an error of "batch copy process definition error" is reported
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/10622
|
https://github.com/apache/dolphinscheduler/pull/10621
|
acd3d3fab14d08b3b06015be3ac9cfb2f4bfc934
|
c34503e3f6cbfb20f1298a57d52af1990ddaf5aa
| 2022-06-26T14:13:27Z |
java
| 2022-08-04T07:04:14Z |
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
|
public static final String CMD_PARAM_RECOVERY_WAITING_THREAD = "WaitingThreadInstanceId";
public static final String CMD_PARAM_SUB_PROCESS = "processInstanceId";
public static final String CMD_PARAM_EMPTY_SUB_PROCESS = "0";
public static final String CMD_PARAM_SUB_PROCESS_PARENT_INSTANCE_ID = "parentProcessInstanceId";
public static final String CMD_PARAM_SUB_PROCESS_DEFINE_CODE = "processDefinitionCode";
public static final String CMD_PARAM_START_NODES = "StartNodeList";
public static final String CMD_PARAM_START_PARAMS = "StartParams";
public static final String CMD_PARAM_FATHER_PARAMS = "fatherParams";
/**
* complement data start date
*/
public static final String CMDPARAM_COMPLEMENT_DATA_START_DATE = "complementStartDate";
/**
* complement data end date
*/
public static final String CMDPARAM_COMPLEMENT_DATA_END_DATE = "complementEndDate";
/**
* complement data Schedule date
*/
public static final String CMDPARAM_COMPLEMENT_DATA_SCHEDULE_DATE_LIST = "complementScheduleDateList";
/**
* complement date default cron string
*/
public static final String DEFAULT_CRON_STRING = "0 0 0 * * ? *";
/**
* sleep 1000ms
*/
public static final long SLEEP_TIME_MILLIS = 1_000L;
/**
* short sleep 100ms
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 10,622 |
[Bug] [Api] The name of the workflow or task exceeds the length limit after the workflow is copied multiple times
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The name of the workflow or task exceeds the length limit after the workflow is copied multiple times
<img width="1134" alt="image" src="https://user-images.githubusercontent.com/13765310/175562154-e99c751e-cfd6-4351-879f-341cc5b71310.png">
### What you expected to happen
The name length of the workflow or task does not exceed the limit
### How to reproduce
Copy a workflow until an error of "batch copy process definition error" is reported
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/10622
|
https://github.com/apache/dolphinscheduler/pull/10621
|
acd3d3fab14d08b3b06015be3ac9cfb2f4bfc934
|
c34503e3f6cbfb20f1298a57d52af1990ddaf5aa
| 2022-06-26T14:13:27Z |
java
| 2022-08-04T07:04:14Z |
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
|
*/
public static final long SLEEP_TIME_MILLIS_SHORT = 100L;
public static final Duration SERVER_CLOSE_WAIT_TIME = Duration.ofSeconds(3);
/**
* one second mils
*/
public static final long SECOND_TIME_MILLIS = 1_000L;
/**
* master task instance cache-database refresh interval
*/
public static final long CACHE_REFRESH_TIME_MILLIS = 20 * 1_000L;
/**
* heartbeat for zk info length
*/
public static final int HEARTBEAT_FOR_ZOOKEEPER_INFO_LENGTH = 14;
/**
* jar
*/
public static final String JAR = "jar";
/**
* hadoop
*/
public static final String HADOOP = "hadoop";
/**
* -D <property>=<value>
*/
public static final String D = "-D";
/**
* exit code success
*/
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 10,622 |
[Bug] [Api] The name of the workflow or task exceeds the length limit after the workflow is copied multiple times
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The name of the workflow or task exceeds the length limit after the workflow is copied multiple times
<img width="1134" alt="image" src="https://user-images.githubusercontent.com/13765310/175562154-e99c751e-cfd6-4351-879f-341cc5b71310.png">
### What you expected to happen
The name length of the workflow or task does not exceed the limit
### How to reproduce
Copy a workflow until an error of "batch copy process definition error" is reported
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/10622
|
https://github.com/apache/dolphinscheduler/pull/10621
|
acd3d3fab14d08b3b06015be3ac9cfb2f4bfc934
|
c34503e3f6cbfb20f1298a57d52af1990ddaf5aa
| 2022-06-26T14:13:27Z |
java
| 2022-08-04T07:04:14Z |
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
|
public static final int EXIT_CODE_SUCCESS = 0;
/**
* exit code failure
*/
public static final int EXIT_CODE_FAILURE = -1;
/**
* process or task definition failure
*/
public static final int DEFINITION_FAILURE = -1;
public static final int OPPOSITE_VALUE = -1;
/**
* process or task definition first version
*/
public static final int VERSION_FIRST = 1;
/**
* date format of yyyyMMdd
*/
public static final String PARAMETER_FORMAT_DATE = "yyyyMMdd";
/**
* date format of yyyyMMddHHmmss
*/
public static final String PARAMETER_FORMAT_TIME = "yyyyMMddHHmmss";
/**
* system date(yyyyMMddHHmmss)
*/
public static final String PARAMETER_DATETIME = "system.datetime";
/**
* system date(yyyymmdd) today
*/
public static final String PARAMETER_CURRENT_DATE = "system.biz.curdate";
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 10,622 |
[Bug] [Api] The name of the workflow or task exceeds the length limit after the workflow is copied multiple times
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The name of the workflow or task exceeds the length limit after the workflow is copied multiple times
<img width="1134" alt="image" src="https://user-images.githubusercontent.com/13765310/175562154-e99c751e-cfd6-4351-879f-341cc5b71310.png">
### What you expected to happen
The name length of the workflow or task does not exceed the limit
### How to reproduce
Copy a workflow until an error of "batch copy process definition error" is reported
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/10622
|
https://github.com/apache/dolphinscheduler/pull/10621
|
acd3d3fab14d08b3b06015be3ac9cfb2f4bfc934
|
c34503e3f6cbfb20f1298a57d52af1990ddaf5aa
| 2022-06-26T14:13:27Z |
java
| 2022-08-04T07:04:14Z |
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
|
/**
* system date(yyyymmdd) yesterday
*/
public static final String PARAMETER_BUSINESS_DATE = "system.biz.date";
/**
* ACCEPTED
*/
public static final String ACCEPTED = "ACCEPTED";
/**
* SUCCEEDED
*/
public static final String SUCCEEDED = "SUCCEEDED";
/**
* ENDED
*/
public static final String ENDED = "ENDED";
/**
* NEW
*/
public static final String NEW = "NEW";
/**
* NEW_SAVING
*/
public static final String NEW_SAVING = "NEW_SAVING";
/**
* SUBMITTED
*/
public static final String SUBMITTED = "SUBMITTED";
/**
* FAILED
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 10,622 |
[Bug] [Api] The name of the workflow or task exceeds the length limit after the workflow is copied multiple times
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The name of the workflow or task exceeds the length limit after the workflow is copied multiple times
<img width="1134" alt="image" src="https://user-images.githubusercontent.com/13765310/175562154-e99c751e-cfd6-4351-879f-341cc5b71310.png">
### What you expected to happen
The name length of the workflow or task does not exceed the limit
### How to reproduce
Copy a workflow until an error of "batch copy process definition error" is reported
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/10622
|
https://github.com/apache/dolphinscheduler/pull/10621
|
acd3d3fab14d08b3b06015be3ac9cfb2f4bfc934
|
c34503e3f6cbfb20f1298a57d52af1990ddaf5aa
| 2022-06-26T14:13:27Z |
java
| 2022-08-04T07:04:14Z |
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
|
*/
public static final String FAILED = "FAILED";
/**
* KILLED
*/
public static final String KILLED = "KILLED";
/**
* RUNNING
*/
public static final String RUNNING = "RUNNING";
/**
* underline "_"
*/
public static final String UNDERLINE = "_";
/**
* application regex
*/
public static final String APPLICATION_REGEX = "application_\\d+_\\d+";
public static final String PID = SystemUtils.IS_OS_WINDOWS ? "handle" : "pid";
/**
* month_begin
*/
public static final String MONTH_BEGIN = "month_begin";
/**
* add_months
*/
public static final String ADD_MONTHS = "add_months";
/**
* month_end
*/
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 10,622 |
[Bug] [Api] The name of the workflow or task exceeds the length limit after the workflow is copied multiple times
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The name of the workflow or task exceeds the length limit after the workflow is copied multiple times
<img width="1134" alt="image" src="https://user-images.githubusercontent.com/13765310/175562154-e99c751e-cfd6-4351-879f-341cc5b71310.png">
### What you expected to happen
The name length of the workflow or task does not exceed the limit
### How to reproduce
Copy a workflow until an error of "batch copy process definition error" is reported
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/10622
|
https://github.com/apache/dolphinscheduler/pull/10621
|
acd3d3fab14d08b3b06015be3ac9cfb2f4bfc934
|
c34503e3f6cbfb20f1298a57d52af1990ddaf5aa
| 2022-06-26T14:13:27Z |
java
| 2022-08-04T07:04:14Z |
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
|
public static final String MONTH_END = "month_end";
/**
* week_begin
*/
public static final String WEEK_BEGIN = "week_begin";
/**
* week_end
*/
public static final String WEEK_END = "week_end";
/**
* timestamp
*/
public static final String TIMESTAMP = "timestamp";
public static final char SUBTRACT_CHAR = '-';
public static final char ADD_CHAR = '+';
public static final char MULTIPLY_CHAR = '*';
public static final char DIVISION_CHAR = '/';
public static final char LEFT_BRACE_CHAR = '(';
public static final char RIGHT_BRACE_CHAR = ')';
public static final String ADD_STRING = "+";
public static final String STAR = "*";
public static final String DIVISION_STRING = "/";
public static final String LEFT_BRACE_STRING = "(";
public static final char P = 'P';
public static final char N = 'N';
public static final String SUBTRACT_STRING = "-";
public static final String GLOBAL_PARAMS = "globalParams";
public static final String LOCAL_PARAMS = "localParams";
public static final String SUBPROCESS_INSTANCE_ID = "subProcessInstanceId";
public static final String PROCESS_INSTANCE_STATE = "processInstanceState";
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 10,622 |
[Bug] [Api] The name of the workflow or task exceeds the length limit after the workflow is copied multiple times
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The name of the workflow or task exceeds the length limit after the workflow is copied multiple times
<img width="1134" alt="image" src="https://user-images.githubusercontent.com/13765310/175562154-e99c751e-cfd6-4351-879f-341cc5b71310.png">
### What you expected to happen
The name length of the workflow or task does not exceed the limit
### How to reproduce
Copy a workflow until an error of "batch copy process definition error" is reported
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/10622
|
https://github.com/apache/dolphinscheduler/pull/10621
|
acd3d3fab14d08b3b06015be3ac9cfb2f4bfc934
|
c34503e3f6cbfb20f1298a57d52af1990ddaf5aa
| 2022-06-26T14:13:27Z |
java
| 2022-08-04T07:04:14Z |
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
|
public static final String PARENT_WORKFLOW_INSTANCE = "parentWorkflowInstance";
public static final String CONDITION_RESULT = "conditionResult";
public static final String SWITCH_RESULT = "switchResult";
public static final String WAIT_START_TIMEOUT = "waitStartTimeout";
public static final String DEPENDENCE = "dependence";
public static final String TASK_LIST = "taskList";
public static final String QUEUE = "queue";
public static final String QUEUE_NAME = "queueName";
public static final int LOG_QUERY_SKIP_LINE_NUMBER = 0;
public static final int LOG_QUERY_LIMIT = 4096;
public static final String BLOCKING_CONDITION = "blockingCondition";
public static final String ALERT_WHEN_BLOCKING = "alertWhenBlocking";
/**
* master/worker server use for zk
*/
public static final String MASTER_TYPE = "master";
public static final String WORKER_TYPE = "worker";
public static final String DELETE_OP = "delete";
public static final String ADD_OP = "add";
public static final String ALIAS = "alias";
public static final String CONTENT = "content";
public static final String DEPENDENT_SPLIT = ":||";
public static final long DEPENDENT_ALL_TASK_CODE = 0;
/**
* preview schedule execute count
*/
public static final int PREVIEW_SCHEDULE_EXECUTE_COUNT = 5;
/**
* kerberos
*/
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 10,622 |
[Bug] [Api] The name of the workflow or task exceeds the length limit after the workflow is copied multiple times
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The name of the workflow or task exceeds the length limit after the workflow is copied multiple times
<img width="1134" alt="image" src="https://user-images.githubusercontent.com/13765310/175562154-e99c751e-cfd6-4351-879f-341cc5b71310.png">
### What you expected to happen
The name length of the workflow or task does not exceed the limit
### How to reproduce
Copy a workflow until an error of "batch copy process definition error" is reported
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/10622
|
https://github.com/apache/dolphinscheduler/pull/10621
|
acd3d3fab14d08b3b06015be3ac9cfb2f4bfc934
|
c34503e3f6cbfb20f1298a57d52af1990ddaf5aa
| 2022-06-26T14:13:27Z |
java
| 2022-08-04T07:04:14Z |
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
|
public static final String KERBEROS = "kerberos";
/**
* kerberos expire time
*/
public static final String KERBEROS_EXPIRE_TIME = "kerberos.expire.time";
/**
* java.security.krb5.conf
*/
public static final String JAVA_SECURITY_KRB5_CONF = "java.security.krb5.conf";
/**
* java.security.krb5.conf.path
*/
public static final String JAVA_SECURITY_KRB5_CONF_PATH = "java.security.krb5.conf.path";
/**
* hadoop.security.authentication
*/
public static final String HADOOP_SECURITY_AUTHENTICATION = "hadoop.security.authentication";
/**
* hadoop.security.authentication
*/
public static final String HADOOP_SECURITY_AUTHENTICATION_STARTUP_STATE = "hadoop.security.authentication.startup.state";
/**
* com.amazonaws.services.s3.enableV4
*/
public static final String AWS_S3_V4 = "com.amazonaws.services.s3.enableV4";
/**
* loginUserFromKeytab user
*/
public static final String LOGIN_USER_KEY_TAB_USERNAME = "login.user.keytab.username";
/**
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 10,622 |
[Bug] [Api] The name of the workflow or task exceeds the length limit after the workflow is copied multiple times
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The name of the workflow or task exceeds the length limit after the workflow is copied multiple times
<img width="1134" alt="image" src="https://user-images.githubusercontent.com/13765310/175562154-e99c751e-cfd6-4351-879f-341cc5b71310.png">
### What you expected to happen
The name length of the workflow or task does not exceed the limit
### How to reproduce
Copy a workflow until an error of "batch copy process definition error" is reported
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/10622
|
https://github.com/apache/dolphinscheduler/pull/10621
|
acd3d3fab14d08b3b06015be3ac9cfb2f4bfc934
|
c34503e3f6cbfb20f1298a57d52af1990ddaf5aa
| 2022-06-26T14:13:27Z |
java
| 2022-08-04T07:04:14Z |
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
|
* loginUserFromKeytab path
*/
public static final String LOGIN_USER_KEY_TAB_PATH = "login.user.keytab.path";
public static final String WORKFLOW_INSTANCE_ID_MDC_KEY = "workflowInstanceId";
public static final String TASK_INSTANCE_ID_MDC_KEY = "taskInstanceId";
/**
* task log info format
*/
public static final String TASK_LOG_INFO_FORMAT = "TaskLogInfo-%s";
public static final int[] NOT_TERMINATED_STATES = new int[] {
ExecutionStatus.SUBMITTED_SUCCESS.ordinal(),
ExecutionStatus.DISPATCH.ordinal(),
ExecutionStatus.RUNNING_EXECUTION.ordinal(),
ExecutionStatus.DELAY_EXECUTION.ordinal(),
ExecutionStatus.READY_PAUSE.ordinal(),
ExecutionStatus.READY_STOP.ordinal(),
ExecutionStatus.NEED_FAULT_TOLERANCE.ordinal(),
ExecutionStatus.WAITING_THREAD.ordinal(),
ExecutionStatus.WAITING_DEPEND.ordinal()
};
public static final int[] RUNNING_PROCESS_STATE = new int[] {
ExecutionStatus.RUNNING_EXECUTION.ordinal(),
ExecutionStatus.SUBMITTED_SUCCESS.ordinal(),
ExecutionStatus.DISPATCH.ordinal(),
ExecutionStatus.SERIAL_WAIT.ordinal()
};
/**
* status
*/
public static final String STATUS = "status";
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 10,622 |
[Bug] [Api] The name of the workflow or task exceeds the length limit after the workflow is copied multiple times
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The name of the workflow or task exceeds the length limit after the workflow is copied multiple times
<img width="1134" alt="image" src="https://user-images.githubusercontent.com/13765310/175562154-e99c751e-cfd6-4351-879f-341cc5b71310.png">
### What you expected to happen
The name length of the workflow or task does not exceed the limit
### How to reproduce
Copy a workflow until an error of "batch copy process definition error" is reported
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/10622
|
https://github.com/apache/dolphinscheduler/pull/10621
|
acd3d3fab14d08b3b06015be3ac9cfb2f4bfc934
|
c34503e3f6cbfb20f1298a57d52af1990ddaf5aa
| 2022-06-26T14:13:27Z |
java
| 2022-08-04T07:04:14Z |
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
|
/**
* message
*/
public static final String MSG = "msg";
/**
* data total
*/
public static final String COUNT = "count";
/**
* page size
*/
public static final String PAGE_SIZE = "pageSize";
/**
* current page no
*/
public static final String PAGE_NUMBER = "pageNo";
/**
*
*/
public static final String DATA_LIST = "data";
public static final String TOTAL_LIST = "totalList";
public static final String CURRENT_PAGE = "currentPage";
public static final String TOTAL_PAGE = "totalPage";
public static final String TOTAL = "total";
/**
* workflow
*/
public static final String WORKFLOW_LIST = "workFlowList";
public static final String WORKFLOW_RELATION_LIST = "workFlowRelationList";
/**
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 10,622 |
[Bug] [Api] The name of the workflow or task exceeds the length limit after the workflow is copied multiple times
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The name of the workflow or task exceeds the length limit after the workflow is copied multiple times
<img width="1134" alt="image" src="https://user-images.githubusercontent.com/13765310/175562154-e99c751e-cfd6-4351-879f-341cc5b71310.png">
### What you expected to happen
The name length of the workflow or task does not exceed the limit
### How to reproduce
Copy a workflow until an error of "batch copy process definition error" is reported
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/10622
|
https://github.com/apache/dolphinscheduler/pull/10621
|
acd3d3fab14d08b3b06015be3ac9cfb2f4bfc934
|
c34503e3f6cbfb20f1298a57d52af1990ddaf5aa
| 2022-06-26T14:13:27Z |
java
| 2022-08-04T07:04:14Z |
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
|
* session user
*/
public static final String SESSION_USER = "session.user";
public static final String SESSION_ID = "sessionId";
/**
* locale
*/
public static final String LOCALE_LANGUAGE = "language";
/**
* database type
*/
public static final String MYSQL = "MYSQL";
public static final String HIVE = "HIVE";
public static final String ADDRESS = "address";
public static final String DATABASE = "database";
public static final String OTHER = "other";
public static final String USER = "user";
public static final String JDBC_URL = "jdbcUrl";
/**
* session timeout
*/
public static final int SESSION_TIME_OUT = 7200;
public static final int MAX_FILE_SIZE = 1024 * 1024 * 1024;
public static final String UDF = "UDF";
public static final String CLASS = "class";
/**
* dataSource sensitive param
*/
public static final String DATASOURCE_PASSWORD_REGEX = "(?<=((?i)password((\\\\\":\\\\\")|(=')))).*?(?=((\\\\\")|(')))";
/**
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 10,622 |
[Bug] [Api] The name of the workflow or task exceeds the length limit after the workflow is copied multiple times
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The name of the workflow or task exceeds the length limit after the workflow is copied multiple times
<img width="1134" alt="image" src="https://user-images.githubusercontent.com/13765310/175562154-e99c751e-cfd6-4351-879f-341cc5b71310.png">
### What you expected to happen
The name length of the workflow or task does not exceed the limit
### How to reproduce
Copy a workflow until an error of "batch copy process definition error" is reported
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/10622
|
https://github.com/apache/dolphinscheduler/pull/10621
|
acd3d3fab14d08b3b06015be3ac9cfb2f4bfc934
|
c34503e3f6cbfb20f1298a57d52af1990ddaf5aa
| 2022-06-26T14:13:27Z |
java
| 2022-08-04T07:04:14Z |
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
|
* default worker group
*/
public static final String DEFAULT_WORKER_GROUP = "default";
/**
* authorize writable perm
*/
public static final int AUTHORIZE_WRITABLE_PERM = 7;
/**
* authorize readable perm
*/
public static final int AUTHORIZE_READABLE_PERM = 4;
public static final int NORMAL_NODE_STATUS = 0;
public static final int ABNORMAL_NODE_STATUS = 1;
public static final int BUSY_NODE_STATUE = 2;
public static final String START_TIME = "start time";
public static final String END_TIME = "end time";
public static final String START_END_DATE = "startDate,endDate";
/**
* system line separator
*/
public static final String SYSTEM_LINE_SEPARATOR = System.getProperty("line.separator");
/**
* datasource encryption salt
*/
public static final String DATASOURCE_ENCRYPTION_SALT_DEFAULT = "!@#$%^&*";
public static final String DATASOURCE_ENCRYPTION_ENABLE = "datasource.encryption.enable";
public static final String DATASOURCE_ENCRYPTION_SALT = "datasource.encryption.salt";
/**
* network interface preferred
*/
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 10,622 |
[Bug] [Api] The name of the workflow or task exceeds the length limit after the workflow is copied multiple times
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The name of the workflow or task exceeds the length limit after the workflow is copied multiple times
<img width="1134" alt="image" src="https://user-images.githubusercontent.com/13765310/175562154-e99c751e-cfd6-4351-879f-341cc5b71310.png">
### What you expected to happen
The name length of the workflow or task does not exceed the limit
### How to reproduce
Copy a workflow until an error of "batch copy process definition error" is reported
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/10622
|
https://github.com/apache/dolphinscheduler/pull/10621
|
acd3d3fab14d08b3b06015be3ac9cfb2f4bfc934
|
c34503e3f6cbfb20f1298a57d52af1990ddaf5aa
| 2022-06-26T14:13:27Z |
java
| 2022-08-04T07:04:14Z |
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
|
public static final String DOLPHIN_SCHEDULER_NETWORK_INTERFACE_PREFERRED = "dolphin.scheduler.network.interface.preferred";
/**
* network IP gets priority, default inner outer
*/
public static final String DOLPHIN_SCHEDULER_NETWORK_PRIORITY_STRATEGY = "dolphin.scheduler.network.priority.strategy";
/**
* exec shell scripts
*/
public static final String SH = "sh";
/**
* pstree, get pud and sub pid
*/
public static final String PSTREE = "pstree";
public static final boolean KUBERNETES_MODE = !StringUtils.isEmpty(System.getenv("KUBERNETES_SERVICE_HOST")) && !StringUtils.isEmpty(System.getenv("KUBERNETES_SERVICE_PORT"));
/**
* dry run flag
*/
public static final int DRY_RUN_FLAG_NO = 0;
public static final int DRY_RUN_FLAG_YES = 1;
/**
* data.quality.error.output.path
*/
public static final String DATA_QUALITY_ERROR_OUTPUT_PATH = "data-quality.error.output.path";
public static final String CACHE_KEY_VALUE_ALL = "'all'";
/**
* use for k8s
*/
public static final String NAMESPACE = "namespace";
public static final String CLUSTER = "cluster";
public static final String LIMITS_CPU = "limitsCpu";
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 10,622 |
[Bug] [Api] The name of the workflow or task exceeds the length limit after the workflow is copied multiple times
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The name of the workflow or task exceeds the length limit after the workflow is copied multiple times
<img width="1134" alt="image" src="https://user-images.githubusercontent.com/13765310/175562154-e99c751e-cfd6-4351-879f-341cc5b71310.png">
### What you expected to happen
The name length of the workflow or task does not exceed the limit
### How to reproduce
Copy a workflow until an error of "batch copy process definition error" is reported
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/10622
|
https://github.com/apache/dolphinscheduler/pull/10621
|
acd3d3fab14d08b3b06015be3ac9cfb2f4bfc934
|
c34503e3f6cbfb20f1298a57d52af1990ddaf5aa
| 2022-06-26T14:13:27Z |
java
| 2022-08-04T07:04:14Z |
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
|
public static final String LIMITS_MEMORY = "limitsMemory";
public static final Long K8S_LOCAL_TEST_CLUSTER_CODE = 0L;
/**
* schedule timezone
*/
public static final String SCHEDULE_TIMEZONE = "schedule_timezone";
public static final int RESOURCE_FULL_NAME_MAX_LENGTH = 128;
/**
* tenant
*/
public static final int TENANT_FULL_NAME_MAX_LENGTH = 30;
/**
* schedule time the amount of date data is too large, affecting the memory, so set 100
*/
public static final int SCHEDULE_TIME_MAX_LENGTH = 100;
/**
* password max and min LENGTH
*/
public static final int USER_PASSWORD_MAX_LENGTH = 20;
public static final int USER_PASSWORD_MIN_LENGTH = 2;
public static final String FUNCTION_START_WITH = "$";
public static final Integer DEFAULT_QUEUE_ID = 1;
/**
* Security authentication types (supported types: PASSWORD,LDAP)
*/
public static final String SECURITY_CONFIG_TYPE = "securityConfigType";
public static final String SECURITY_CONFIG_TYPE_PASSWORD = "PASSWORD";
public static final String SECURITY_CONFIG_TYPE_LDAP = "LDAP";
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,293 |
[Improvement][dolphinscheduler] Some variables in subclasses of AbstractAuthenticator are redundant
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
<img width="888" alt="image" src="https://user-images.githubusercontent.com/33984497/182782451-48a9b9bb-5336-4696-910d-810b449cc859.png">
<img width="869" alt="image" src="https://user-images.githubusercontent.com/33984497/182782737-9d19791f-578e-4864-8bd9-574e9e2dfdaf.png">
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11293
|
https://github.com/apache/dolphinscheduler/pull/11305
|
c9cf8c77746d85d1c0ff3d2073986a19cc71eacc
|
8ded072f799376d9fadb669cb990edd2197d1062
| 2022-08-04T06:55:34Z |
java
| 2022-08-05T06:11:12Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/security/impl/AbstractAuthenticator.java
|
/*
* 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.
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,293 |
[Improvement][dolphinscheduler] Some variables in subclasses of AbstractAuthenticator are redundant
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
<img width="888" alt="image" src="https://user-images.githubusercontent.com/33984497/182782451-48a9b9bb-5336-4696-910d-810b449cc859.png">
<img width="869" alt="image" src="https://user-images.githubusercontent.com/33984497/182782737-9d19791f-578e-4864-8bd9-574e9e2dfdaf.png">
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11293
|
https://github.com/apache/dolphinscheduler/pull/11305
|
c9cf8c77746d85d1c0ff3d2073986a19cc71eacc
|
8ded072f799376d9fadb669cb990edd2197d1062
| 2022-08-04T06:55:34Z |
java
| 2022-08-05T06:11:12Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/security/impl/AbstractAuthenticator.java
|
* 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.dolphinscheduler.api.security.impl;
import org.apache.dolphinscheduler.api.enums.Status;
import org.apache.dolphinscheduler.api.security.Authenticator;
import org.apache.dolphinscheduler.api.security.SecurityConfig;
import org.apache.dolphinscheduler.api.service.SessionService;
import org.apache.dolphinscheduler.api.service.UsersService;
import org.apache.dolphinscheduler.api.utils.Result;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.enums.Flag;
import org.apache.dolphinscheduler.dao.entity.Session;
import org.apache.dolphinscheduler.dao.entity.User;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
public abstract class AbstractAuthenticator implements Authenticator {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,293 |
[Improvement][dolphinscheduler] Some variables in subclasses of AbstractAuthenticator are redundant
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
<img width="888" alt="image" src="https://user-images.githubusercontent.com/33984497/182782451-48a9b9bb-5336-4696-910d-810b449cc859.png">
<img width="869" alt="image" src="https://user-images.githubusercontent.com/33984497/182782737-9d19791f-578e-4864-8bd9-574e9e2dfdaf.png">
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11293
|
https://github.com/apache/dolphinscheduler/pull/11305
|
c9cf8c77746d85d1c0ff3d2073986a19cc71eacc
|
8ded072f799376d9fadb669cb990edd2197d1062
| 2022-08-04T06:55:34Z |
java
| 2022-08-05T06:11:12Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/security/impl/AbstractAuthenticator.java
|
private static final Logger logger = LoggerFactory.getLogger(AbstractAuthenticator.class);
@Autowired
private UsersService userService;
@Autowired
private SessionService sessionService;
@Autowired
private SecurityConfig securityConfig;
/**
* user login and return user in db
*
* @param userId user identity field
* @param password user login password
* @param extra extra user login field
* @return user object in databse
*/
public abstract User login(String userId, String password, String extra);
@Override
public Result<Map<String, String>> authenticate(String userId, String password, String extra) {
Result<Map<String, String>> result = new Result<>();
User user = login(userId, password, extra);
if (user == null) {
result.setCode(Status.USER_NAME_PASSWD_ERROR.getCode());
result.setMsg(Status.USER_NAME_PASSWD_ERROR.getMsg());
return result;
}
if (user.getState() == Flag.NO.ordinal()) {
result.setCode(Status.USER_DISABLED.getCode());
result.setMsg(Status.USER_DISABLED.getMsg());
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,293 |
[Improvement][dolphinscheduler] Some variables in subclasses of AbstractAuthenticator are redundant
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
<img width="888" alt="image" src="https://user-images.githubusercontent.com/33984497/182782451-48a9b9bb-5336-4696-910d-810b449cc859.png">
<img width="869" alt="image" src="https://user-images.githubusercontent.com/33984497/182782737-9d19791f-578e-4864-8bd9-574e9e2dfdaf.png">
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11293
|
https://github.com/apache/dolphinscheduler/pull/11305
|
c9cf8c77746d85d1c0ff3d2073986a19cc71eacc
|
8ded072f799376d9fadb669cb990edd2197d1062
| 2022-08-04T06:55:34Z |
java
| 2022-08-05T06:11:12Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/security/impl/AbstractAuthenticator.java
|
return result;
}
String sessionId = sessionService.createSession(user, extra);
if (sessionId == null) {
result.setCode(Status.LOGIN_SESSION_FAILED.getCode());
result.setMsg(Status.LOGIN_SESSION_FAILED.getMsg());
return result;
}
logger.info("sessionId : {}", sessionId);
Map<String, String> data = new HashMap<>();
data.put(Constants.SESSION_ID, sessionId);
data.put(Constants.SECURITY_CONFIG_TYPE, securityConfig.getType());
result.setData(data);
result.setCode(Status.SUCCESS.getCode());
result.setMsg(Status.LOGIN_SUCCESS.getMsg());
return result;
}
@Override
public User getAuthUser(HttpServletRequest request) {
Session session = sessionService.getSession(request);
if (session == null) {
logger.info("session info is null ");
return null;
}
return userService.queryUser(session.getUserId());
}
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,293 |
[Improvement][dolphinscheduler] Some variables in subclasses of AbstractAuthenticator are redundant
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
<img width="888" alt="image" src="https://user-images.githubusercontent.com/33984497/182782451-48a9b9bb-5336-4696-910d-810b449cc859.png">
<img width="869" alt="image" src="https://user-images.githubusercontent.com/33984497/182782737-9d19791f-578e-4864-8bd9-574e9e2dfdaf.png">
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11293
|
https://github.com/apache/dolphinscheduler/pull/11305
|
c9cf8c77746d85d1c0ff3d2073986a19cc71eacc
|
8ded072f799376d9fadb669cb990edd2197d1062
| 2022-08-04T06:55:34Z |
java
| 2022-08-05T06:11:12Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/security/impl/ldap/LdapAuthenticator.java
|
/*
* 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.dolphinscheduler.api.security.impl.ldap;
import org.apache.dolphinscheduler.api.security.impl.AbstractAuthenticator;
import org.apache.dolphinscheduler.api.service.UsersService;
import org.apache.dolphinscheduler.dao.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
public class LdapAuthenticator extends AbstractAuthenticator {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,293 |
[Improvement][dolphinscheduler] Some variables in subclasses of AbstractAuthenticator are redundant
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
<img width="888" alt="image" src="https://user-images.githubusercontent.com/33984497/182782451-48a9b9bb-5336-4696-910d-810b449cc859.png">
<img width="869" alt="image" src="https://user-images.githubusercontent.com/33984497/182782737-9d19791f-578e-4864-8bd9-574e9e2dfdaf.png">
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11293
|
https://github.com/apache/dolphinscheduler/pull/11305
|
c9cf8c77746d85d1c0ff3d2073986a19cc71eacc
|
8ded072f799376d9fadb669cb990edd2197d1062
| 2022-08-04T06:55:34Z |
java
| 2022-08-05T06:11:12Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/security/impl/ldap/LdapAuthenticator.java
|
@Autowired
private UsersService usersService;
@Autowired
LdapService ldapService;
@Override
public User login(String userId, String password, String extra) {
User user = null;
String ldapEmail = ldapService.ldapLogin(userId, password);
if (ldapEmail != null) {
user = usersService.getUserByUserName(userId);
if (user == null && ldapService.createIfUserNotExists()) {
user = usersService.createUser(ldapService.getUserType(userId), userId, ldapEmail);
}
}
return user;
}
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,293 |
[Improvement][dolphinscheduler] Some variables in subclasses of AbstractAuthenticator are redundant
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
<img width="888" alt="image" src="https://user-images.githubusercontent.com/33984497/182782451-48a9b9bb-5336-4696-910d-810b449cc859.png">
<img width="869" alt="image" src="https://user-images.githubusercontent.com/33984497/182782737-9d19791f-578e-4864-8bd9-574e9e2dfdaf.png">
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11293
|
https://github.com/apache/dolphinscheduler/pull/11305
|
c9cf8c77746d85d1c0ff3d2073986a19cc71eacc
|
8ded072f799376d9fadb669cb990edd2197d1062
| 2022-08-04T06:55:34Z |
java
| 2022-08-05T06:11:12Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/security/impl/pwd/PasswordAuthenticator.java
|
/*
* 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.dolphinscheduler.api.security.impl.pwd;
import org.apache.dolphinscheduler.api.security.impl.AbstractAuthenticator;
import org.apache.dolphinscheduler.api.service.UsersService;
import org.apache.dolphinscheduler.dao.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
public class PasswordAuthenticator extends AbstractAuthenticator {
@Autowired
private UsersService userService;
@Override
public User login(String userId, String password, String extra) {
return userService.queryUser(userId, password);
}
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,295 |
[Improvement][common,task-api] have duplicate classes
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
<img width="874" alt="image" src="https://user-images.githubusercontent.com/33984497/182791206-4e6e5132-9810-4a61-ad4d-875c200a1222.png">
PlaceholderUtils PropertyPlaceholderHelper TimePlaceholderUtils BusinessTimeUtils
maybe we can left class in task-api ,because common depends on task -api
<img width="983" alt="image" src="https://user-images.githubusercontent.com/33984497/182791857-6198cb0a-4c9e-4007-8681-8ad58920db55.png">
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11295
|
https://github.com/apache/dolphinscheduler/pull/11355
|
e9ccaffbe07158c68e999e65186ea37d6ed33ab0
|
05932bcf55443e48aafda2201ba2d90806f19c00
| 2022-08-04T07:41:32Z |
java
| 2022-08-10T02:20:16Z |
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/ParameterUtils.java
|
/*
* 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.dolphinscheduler.common.utils;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.enums.CommandType;
import org.apache.dolphinscheduler.common.utils.placeholder.BusinessTimeUtils;
import org.apache.dolphinscheduler.common.utils.placeholder.PlaceholderUtils;
import org.apache.dolphinscheduler.common.utils.placeholder.TimePlaceholderUtils;
import org.apache.dolphinscheduler.plugin.task.api.model.Property;
import org.apache.commons.lang3.StringUtils;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,295 |
[Improvement][common,task-api] have duplicate classes
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
<img width="874" alt="image" src="https://user-images.githubusercontent.com/33984497/182791206-4e6e5132-9810-4a61-ad4d-875c200a1222.png">
PlaceholderUtils PropertyPlaceholderHelper TimePlaceholderUtils BusinessTimeUtils
maybe we can left class in task-api ,because common depends on task -api
<img width="983" alt="image" src="https://user-images.githubusercontent.com/33984497/182791857-6198cb0a-4c9e-4007-8681-8ad58920db55.png">
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11295
|
https://github.com/apache/dolphinscheduler/pull/11355
|
e9ccaffbe07158c68e999e65186ea37d6ed33ab0
|
05932bcf55443e48aafda2201ba2d90806f19c00
| 2022-08-04T07:41:32Z |
java
| 2022-08-10T02:20:16Z |
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/ParameterUtils.java
|
import java.util.Map.Entry;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* parameter parse utils
*/
public class ParameterUtils {
private static final Pattern DATE_PARSE_PATTERN = Pattern.compile("\\$\\[([^\\$\\]]+)]");
private static final Pattern DATE_START_PATTERN = Pattern.compile("^[0-9]");
private ParameterUtils() {
throw new UnsupportedOperationException("Construct ParameterUtils");
}
/**
* convert parameters place holders
*
* @param parameterString parameter
* @param parameterMap parameter map
* @return convert parameters place holders
*/
public static String convertParameterPlaceholders(String parameterString, Map<String, String> parameterMap) {
if (StringUtils.isEmpty(parameterString)) {
return parameterString;
}
Date cronTime;
if (parameterMap != null && !parameterMap.isEmpty()) {
parameterString = PlaceholderUtils.replacePlaceholders(parameterString, parameterMap, true);
}
if (parameterMap != null && null != parameterMap.get(Constants.PARAMETER_DATETIME)) {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,295 |
[Improvement][common,task-api] have duplicate classes
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
<img width="874" alt="image" src="https://user-images.githubusercontent.com/33984497/182791206-4e6e5132-9810-4a61-ad4d-875c200a1222.png">
PlaceholderUtils PropertyPlaceholderHelper TimePlaceholderUtils BusinessTimeUtils
maybe we can left class in task-api ,because common depends on task -api
<img width="983" alt="image" src="https://user-images.githubusercontent.com/33984497/182791857-6198cb0a-4c9e-4007-8681-8ad58920db55.png">
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11295
|
https://github.com/apache/dolphinscheduler/pull/11355
|
e9ccaffbe07158c68e999e65186ea37d6ed33ab0
|
05932bcf55443e48aafda2201ba2d90806f19c00
| 2022-08-04T07:41:32Z |
java
| 2022-08-10T02:20:16Z |
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/ParameterUtils.java
|
String cronTimeStr = parameterMap.get(Constants.PARAMETER_DATETIME);
cronTime = DateUtils.parse(cronTimeStr, Constants.PARAMETER_FORMAT_TIME, null);
} else {
cronTime = new Date();
}
if (cronTime != null) {
return dateTemplateParse(parameterString, cronTime);
}
return parameterString;
}
/**
* handle escapes
*
* @param inputString input string
* @return string filter escapes
*/
public static String handleEscapes(String inputString) {
if (!StringUtils.isEmpty(inputString)) {
return inputString.replace("%", "////%").replaceAll("[\n|\r\t]", "_");
}
return inputString;
}
/**
* format convert
*
* @param paramsMap params map
* @return Map of converted
* see org.apache.dolphinscheduler.server.utils.ParamUtils.convert
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,295 |
[Improvement][common,task-api] have duplicate classes
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
<img width="874" alt="image" src="https://user-images.githubusercontent.com/33984497/182791206-4e6e5132-9810-4a61-ad4d-875c200a1222.png">
PlaceholderUtils PropertyPlaceholderHelper TimePlaceholderUtils BusinessTimeUtils
maybe we can left class in task-api ,because common depends on task -api
<img width="983" alt="image" src="https://user-images.githubusercontent.com/33984497/182791857-6198cb0a-4c9e-4007-8681-8ad58920db55.png">
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11295
|
https://github.com/apache/dolphinscheduler/pull/11355
|
e9ccaffbe07158c68e999e65186ea37d6ed33ab0
|
05932bcf55443e48aafda2201ba2d90806f19c00
| 2022-08-04T07:41:32Z |
java
| 2022-08-10T02:20:16Z |
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/ParameterUtils.java
|
*/
public static Map<String, String> convert(Map<String, Property> paramsMap) {
Map<String, String> map = new HashMap<>();
Iterator<Entry<String, Property>> iter = paramsMap.entrySet().iterator();
while (iter.hasNext()) {
Map.Entry<String, Property> en = iter.next();
map.put(en.getKey(), en.getValue().getValue());
}
return map;
}
private static String dateTemplateParse(String templateStr, Date date) {
if (templateStr == null) {
return null;
}
StringBuffer newValue = new StringBuffer(templateStr.length());
Matcher matcher = DATE_PARSE_PATTERN.matcher(templateStr);
while (matcher.find()) {
String key = matcher.group(1);
if (DATE_START_PATTERN.matcher(key).matches()) {
continue;
}
String value = TimePlaceholderUtils.getPlaceHolderTime(key, date);
assert value != null;
matcher.appendReplacement(newValue, value);
}
matcher.appendTail(newValue);
return newValue.toString();
}
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,295 |
[Improvement][common,task-api] have duplicate classes
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
<img width="874" alt="image" src="https://user-images.githubusercontent.com/33984497/182791206-4e6e5132-9810-4a61-ad4d-875c200a1222.png">
PlaceholderUtils PropertyPlaceholderHelper TimePlaceholderUtils BusinessTimeUtils
maybe we can left class in task-api ,because common depends on task -api
<img width="983" alt="image" src="https://user-images.githubusercontent.com/33984497/182791857-6198cb0a-4c9e-4007-8681-8ad58920db55.png">
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11295
|
https://github.com/apache/dolphinscheduler/pull/11355
|
e9ccaffbe07158c68e999e65186ea37d6ed33ab0
|
05932bcf55443e48aafda2201ba2d90806f19c00
| 2022-08-04T07:41:32Z |
java
| 2022-08-10T02:20:16Z |
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/placeholder/PlaceholderUtils.java
|
/*
* 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.dolphinscheduler.common.utils.placeholder;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* placeholder utils
*/
public class PlaceholderUtils {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,295 |
[Improvement][common,task-api] have duplicate classes
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
<img width="874" alt="image" src="https://user-images.githubusercontent.com/33984497/182791206-4e6e5132-9810-4a61-ad4d-875c200a1222.png">
PlaceholderUtils PropertyPlaceholderHelper TimePlaceholderUtils BusinessTimeUtils
maybe we can left class in task-api ,because common depends on task -api
<img width="983" alt="image" src="https://user-images.githubusercontent.com/33984497/182791857-6198cb0a-4c9e-4007-8681-8ad58920db55.png">
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11295
|
https://github.com/apache/dolphinscheduler/pull/11355
|
e9ccaffbe07158c68e999e65186ea37d6ed33ab0
|
05932bcf55443e48aafda2201ba2d90806f19c00
| 2022-08-04T07:41:32Z |
java
| 2022-08-10T02:20:16Z |
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/placeholder/PlaceholderUtils.java
|
private static final Logger logger = LoggerFactory.getLogger(PlaceholderUtils.class);
/**
* Prefix of the position to be replaced
*/
public static final String PLACEHOLDER_PREFIX = "${";
/**
* The suffix of the position to be replaced
*/
public static final String PLACEHOLDER_SUFFIX = "}";
/**
* Replaces all placeholders of format {@code ${name}} with the value returned
* from the supplied {@link PropertyPlaceholderHelper.PlaceholderResolver}.
*
* @param value the value containing the placeholders to be replaced
* @param paramsMap placeholder data dictionary
* @param ignoreUnresolvablePlaceholders ignoreUnresolvablePlaceholders
* @return the supplied value with placeholders replaced inline
*/
public static String replacePlaceholders(String value,
Map<String, String> paramsMap,
boolean ignoreUnresolvablePlaceholders) {
PropertyPlaceholderHelper strictHelper = getPropertyPlaceholderHelper(false);
//
PropertyPlaceholderHelper nonStrictHelper = getPropertyPlaceholderHelper(true);
PropertyPlaceholderHelper helper = (ignoreUnresolvablePlaceholders ? nonStrictHelper : strictHelper);
//
return helper.replacePlaceholders(value, new PropertyPlaceholderResolver(value, paramsMap));
}
/**
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,295 |
[Improvement][common,task-api] have duplicate classes
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
<img width="874" alt="image" src="https://user-images.githubusercontent.com/33984497/182791206-4e6e5132-9810-4a61-ad4d-875c200a1222.png">
PlaceholderUtils PropertyPlaceholderHelper TimePlaceholderUtils BusinessTimeUtils
maybe we can left class in task-api ,because common depends on task -api
<img width="983" alt="image" src="https://user-images.githubusercontent.com/33984497/182791857-6198cb0a-4c9e-4007-8681-8ad58920db55.png">
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11295
|
https://github.com/apache/dolphinscheduler/pull/11355
|
e9ccaffbe07158c68e999e65186ea37d6ed33ab0
|
05932bcf55443e48aafda2201ba2d90806f19c00
| 2022-08-04T07:41:32Z |
java
| 2022-08-10T02:20:16Z |
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/placeholder/PlaceholderUtils.java
|
* Creates a new {@code PropertyPlaceholderHelper} that uses the supplied prefix and suffix.
* @param ignoreUnresolvablePlaceholders indicates whether unresolvable placeholders should
* be ignored ({@code true}) or cause an exception ({@code false})
* @return PropertyPlaceholderHelper
*/
public static PropertyPlaceholderHelper getPropertyPlaceholderHelper(boolean ignoreUnresolvablePlaceholders) {
return new PropertyPlaceholderHelper(PLACEHOLDER_PREFIX, PLACEHOLDER_SUFFIX, null, ignoreUnresolvablePlaceholders);
}
/**
* Placeholder replacement resolver
*/
private static class PropertyPlaceholderResolver implements PropertyPlaceholderHelper.PlaceholderResolver {
private final String value;
private final Map<String, String> paramsMap;
public PropertyPlaceholderResolver(String value, Map<String, String> paramsMap) {
this.value = value;
this.paramsMap = paramsMap;
}
@Override
public String resolvePlaceholder(String placeholderName) {
try {
return paramsMap.get(placeholderName);
} catch (Exception ex) {
logger.error("resolve placeholder '{}' in [ {} ]", placeholderName, value, ex);
return null;
}
}
}
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,295 |
[Improvement][common,task-api] have duplicate classes
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
<img width="874" alt="image" src="https://user-images.githubusercontent.com/33984497/182791206-4e6e5132-9810-4a61-ad4d-875c200a1222.png">
PlaceholderUtils PropertyPlaceholderHelper TimePlaceholderUtils BusinessTimeUtils
maybe we can left class in task-api ,because common depends on task -api
<img width="983" alt="image" src="https://user-images.githubusercontent.com/33984497/182791857-6198cb0a-4c9e-4007-8681-8ad58920db55.png">
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11295
|
https://github.com/apache/dolphinscheduler/pull/11355
|
e9ccaffbe07158c68e999e65186ea37d6ed33ab0
|
05932bcf55443e48aafda2201ba2d90806f19c00
| 2022-08-04T07:41:32Z |
java
| 2022-08-10T02:20:16Z |
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/placeholder/PropertyPlaceholderHelper.java
|
/*
* 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
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,295 |
[Improvement][common,task-api] have duplicate classes
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
<img width="874" alt="image" src="https://user-images.githubusercontent.com/33984497/182791206-4e6e5132-9810-4a61-ad4d-875c200a1222.png">
PlaceholderUtils PropertyPlaceholderHelper TimePlaceholderUtils BusinessTimeUtils
maybe we can left class in task-api ,because common depends on task -api
<img width="983" alt="image" src="https://user-images.githubusercontent.com/33984497/182791857-6198cb0a-4c9e-4007-8681-8ad58920db55.png">
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11295
|
https://github.com/apache/dolphinscheduler/pull/11355
|
e9ccaffbe07158c68e999e65186ea37d6ed33ab0
|
05932bcf55443e48aafda2201ba2d90806f19c00
| 2022-08-04T07:41:32Z |
java
| 2022-08-10T02:20:16Z |
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/placeholder/PropertyPlaceholderHelper.java
|
* 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.dolphinscheduler.common.utils.placeholder;
import static java.util.Objects.requireNonNull;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import java.util.*;
/**
* Utility class for working with Strings that have placeholder values in them. A placeholder takes the form
* {@code ${name}}. Using {@code PropertyPlaceholderHelper} these placeholders can be substituted for
* user-supplied values. <p> Values for substitution can be supplied using a {@link Properties} instance or
* using a {@link PlaceholderResolver}.
*
* @author Juergen Hoeller
* @author Rob Harrop
* @since 3.0
*/
public class PropertyPlaceholderHelper {
private static final Log logger = LogFactory.getLog(PropertyPlaceholderHelper.class);
private static final Map<String, String> wellKnownSimplePrefixes = new HashMap<>(4);
static {
wellKnownSimplePrefixes.put("}", "{");
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,295 |
[Improvement][common,task-api] have duplicate classes
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
<img width="874" alt="image" src="https://user-images.githubusercontent.com/33984497/182791206-4e6e5132-9810-4a61-ad4d-875c200a1222.png">
PlaceholderUtils PropertyPlaceholderHelper TimePlaceholderUtils BusinessTimeUtils
maybe we can left class in task-api ,because common depends on task -api
<img width="983" alt="image" src="https://user-images.githubusercontent.com/33984497/182791857-6198cb0a-4c9e-4007-8681-8ad58920db55.png">
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11295
|
https://github.com/apache/dolphinscheduler/pull/11355
|
e9ccaffbe07158c68e999e65186ea37d6ed33ab0
|
05932bcf55443e48aafda2201ba2d90806f19c00
| 2022-08-04T07:41:32Z |
java
| 2022-08-10T02:20:16Z |
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/placeholder/PropertyPlaceholderHelper.java
|
wellKnownSimplePrefixes.put("]", "[");
wellKnownSimplePrefixes.put(")", "(");
}
private final String placeholderPrefix;
private final String placeholderSuffix;
private final String simplePrefix;
private final String valueSeparator;
private final boolean ignoreUnresolvablePlaceholders;
/**
* Creates a new {@code PropertyPlaceholderHelper} that uses the supplied prefix and suffix.
*
* @param placeholderPrefix the prefix that denotes the start of a placeholder
* @param placeholderSuffix the suffix that denotes the end of a placeholder
* @param valueSeparator the separating character between the placeholder variable
* and the associated default value, if any
* @param ignoreUnresolvablePlaceholders indicates whether unresolvable placeholders should
* be ignored ({@code true}) or cause an exception ({@code false})
*/
public PropertyPlaceholderHelper(String placeholderPrefix, String placeholderSuffix,
String valueSeparator, boolean ignoreUnresolvablePlaceholders) {
requireNonNull((Object) placeholderPrefix, "'placeholderPrefix' must not be null");
requireNonNull((Object) placeholderSuffix, "'placeholderSuffix' must not be null");
this.placeholderPrefix = placeholderPrefix;
this.placeholderSuffix = placeholderSuffix;
String simplePrefixForSuffix = wellKnownSimplePrefixes.get(this.placeholderSuffix);
if (simplePrefixForSuffix != null && this.placeholderPrefix.endsWith(simplePrefixForSuffix)) {
this.simplePrefix = simplePrefixForSuffix;
} else {
this.simplePrefix = this.placeholderPrefix;
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,295 |
[Improvement][common,task-api] have duplicate classes
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
<img width="874" alt="image" src="https://user-images.githubusercontent.com/33984497/182791206-4e6e5132-9810-4a61-ad4d-875c200a1222.png">
PlaceholderUtils PropertyPlaceholderHelper TimePlaceholderUtils BusinessTimeUtils
maybe we can left class in task-api ,because common depends on task -api
<img width="983" alt="image" src="https://user-images.githubusercontent.com/33984497/182791857-6198cb0a-4c9e-4007-8681-8ad58920db55.png">
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11295
|
https://github.com/apache/dolphinscheduler/pull/11355
|
e9ccaffbe07158c68e999e65186ea37d6ed33ab0
|
05932bcf55443e48aafda2201ba2d90806f19c00
| 2022-08-04T07:41:32Z |
java
| 2022-08-10T02:20:16Z |
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/placeholder/PropertyPlaceholderHelper.java
|
this.valueSeparator = valueSeparator;
this.ignoreUnresolvablePlaceholders = ignoreUnresolvablePlaceholders;
}
/**
* Replaces all placeholders of format {@code ${name}} with the value returned
* from the supplied {@link PlaceholderResolver}.
*
* @param value the value containing the placeholders to be replaced
* @param placeholderResolver the {@code PlaceholderResolver} to use for replacement
* @return the supplied value with placeholders replaced inline
*/
public String replacePlaceholders(String value, PlaceholderResolver placeholderResolver) {
requireNonNull((Object) value, "'value' must not be null");
return parseStringValue(value, placeholderResolver, new HashSet<String>());
}
protected String parseStringValue(
String value, PlaceholderResolver placeholderResolver, Set<String> visitedPlaceholders) {
StringBuilder result = new StringBuilder(value);
int startIndex = value.indexOf(this.placeholderPrefix);
while (startIndex != -1) {
int endIndex = findPlaceholderEndIndex(result, startIndex);
if (endIndex != -1) {
String placeholder = result.substring(startIndex + this.placeholderPrefix.length(), endIndex);
String originalPlaceholder = placeholder;
if (!visitedPlaceholders.add(originalPlaceholder)) {
throw new IllegalArgumentException(
"Circular placeholder reference '" + originalPlaceholder + "' in property definitions");
}
placeholder = parseStringValue(placeholder, placeholderResolver, visitedPlaceholders);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,295 |
[Improvement][common,task-api] have duplicate classes
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
<img width="874" alt="image" src="https://user-images.githubusercontent.com/33984497/182791206-4e6e5132-9810-4a61-ad4d-875c200a1222.png">
PlaceholderUtils PropertyPlaceholderHelper TimePlaceholderUtils BusinessTimeUtils
maybe we can left class in task-api ,because common depends on task -api
<img width="983" alt="image" src="https://user-images.githubusercontent.com/33984497/182791857-6198cb0a-4c9e-4007-8681-8ad58920db55.png">
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11295
|
https://github.com/apache/dolphinscheduler/pull/11355
|
e9ccaffbe07158c68e999e65186ea37d6ed33ab0
|
05932bcf55443e48aafda2201ba2d90806f19c00
| 2022-08-04T07:41:32Z |
java
| 2022-08-10T02:20:16Z |
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/placeholder/PropertyPlaceholderHelper.java
|
String propVal = placeholderResolver.resolvePlaceholder(placeholder);
if (propVal == null && this.valueSeparator != null) {
int separatorIndex = placeholder.indexOf(this.valueSeparator);
if (separatorIndex != -1) {
String actualPlaceholder = placeholder.substring(0, separatorIndex);
String defaultValue = placeholder.substring(separatorIndex + this.valueSeparator.length());
propVal = placeholderResolver.resolvePlaceholder(actualPlaceholder);
if (propVal == null) {
propVal = defaultValue;
}
}
}
if (propVal != null) {
propVal = parseStringValue(propVal, placeholderResolver, visitedPlaceholders);
result.replace(startIndex, endIndex + this.placeholderSuffix.length(), propVal);
if (logger.isTraceEnabled()) {
logger.trace("Resolved placeholder '" + placeholder + "'");
}
startIndex = result.indexOf(this.placeholderPrefix, startIndex + propVal.length());
} else if (this.ignoreUnresolvablePlaceholders) {
startIndex = result.indexOf(this.placeholderPrefix, endIndex + this.placeholderSuffix.length());
} else {
throw new IllegalArgumentException("Could not resolve placeholder '" +
placeholder + "'" + " in value \"" + value + "\"");
}
visitedPlaceholders.remove(originalPlaceholder);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,295 |
[Improvement][common,task-api] have duplicate classes
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
<img width="874" alt="image" src="https://user-images.githubusercontent.com/33984497/182791206-4e6e5132-9810-4a61-ad4d-875c200a1222.png">
PlaceholderUtils PropertyPlaceholderHelper TimePlaceholderUtils BusinessTimeUtils
maybe we can left class in task-api ,because common depends on task -api
<img width="983" alt="image" src="https://user-images.githubusercontent.com/33984497/182791857-6198cb0a-4c9e-4007-8681-8ad58920db55.png">
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11295
|
https://github.com/apache/dolphinscheduler/pull/11355
|
e9ccaffbe07158c68e999e65186ea37d6ed33ab0
|
05932bcf55443e48aafda2201ba2d90806f19c00
| 2022-08-04T07:41:32Z |
java
| 2022-08-10T02:20:16Z |
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/placeholder/PropertyPlaceholderHelper.java
|
} else {
startIndex = -1;
}
}
return result.toString();
}
private int findPlaceholderEndIndex(CharSequence buf, int startIndex) {
int index = startIndex + this.placeholderPrefix.length();
int withinNestedPlaceholder = 0;
while (index < buf.length()) {
if (substringMatch(buf, index, this.placeholderSuffix)) {
if (withinNestedPlaceholder > 0) {
withinNestedPlaceholder--;
index = index + this.placeholderSuffix.length();
} else {
return index;
}
} else if (substringMatch(buf, index, this.simplePrefix)) {
withinNestedPlaceholder++;
index = index + this.simplePrefix.length();
} else {
index++;
}
}
return -1;
}
/**
* Strategy interface used to resolve replacement values for placeholders contained in Strings.
*/
public interface PlaceholderResolver {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,295 |
[Improvement][common,task-api] have duplicate classes
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
<img width="874" alt="image" src="https://user-images.githubusercontent.com/33984497/182791206-4e6e5132-9810-4a61-ad4d-875c200a1222.png">
PlaceholderUtils PropertyPlaceholderHelper TimePlaceholderUtils BusinessTimeUtils
maybe we can left class in task-api ,because common depends on task -api
<img width="983" alt="image" src="https://user-images.githubusercontent.com/33984497/182791857-6198cb0a-4c9e-4007-8681-8ad58920db55.png">
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11295
|
https://github.com/apache/dolphinscheduler/pull/11355
|
e9ccaffbe07158c68e999e65186ea37d6ed33ab0
|
05932bcf55443e48aafda2201ba2d90806f19c00
| 2022-08-04T07:41:32Z |
java
| 2022-08-10T02:20:16Z |
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/placeholder/PropertyPlaceholderHelper.java
|
/**
* Resolve the supplied placeholder name to the replacement value.
*
* @param placeholderName the name of the placeholder to resolve
* @return the replacement value, or {@code null} if no replacement is to be made
*/
String resolvePlaceholder(String placeholderName);
}
/**
* Test whether the given string matches the given substring
* at the given index.
*
* @param str the original string (or StringBuilder)
* @param index the index in the original string to start matching against
* @param substring the substring to match at the given index
* @return whether the given string matches the given substring
*/
public static boolean substringMatch(CharSequence str, int index, CharSequence substring) {
for (int j = 0; j < substring.length(); j++) {
int i = index + j;
if (i >= str.length() || str.charAt(i) != substring.charAt(j)) {
return false;
}
}
return true;
}
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,295 |
[Improvement][common,task-api] have duplicate classes
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
<img width="874" alt="image" src="https://user-images.githubusercontent.com/33984497/182791206-4e6e5132-9810-4a61-ad4d-875c200a1222.png">
PlaceholderUtils PropertyPlaceholderHelper TimePlaceholderUtils BusinessTimeUtils
maybe we can left class in task-api ,because common depends on task -api
<img width="983" alt="image" src="https://user-images.githubusercontent.com/33984497/182791857-6198cb0a-4c9e-4007-8681-8ad58920db55.png">
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11295
|
https://github.com/apache/dolphinscheduler/pull/11355
|
e9ccaffbe07158c68e999e65186ea37d6ed33ab0
|
05932bcf55443e48aafda2201ba2d90806f19c00
| 2022-08-04T07:41:32Z |
java
| 2022-08-10T02:20:16Z |
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/placeholder/TimePlaceholderUtils.java
|
/*
* 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.
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,295 |
[Improvement][common,task-api] have duplicate classes
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
<img width="874" alt="image" src="https://user-images.githubusercontent.com/33984497/182791206-4e6e5132-9810-4a61-ad4d-875c200a1222.png">
PlaceholderUtils PropertyPlaceholderHelper TimePlaceholderUtils BusinessTimeUtils
maybe we can left class in task-api ,because common depends on task -api
<img width="983" alt="image" src="https://user-images.githubusercontent.com/33984497/182791857-6198cb0a-4c9e-4007-8681-8ad58920db55.png">
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11295
|
https://github.com/apache/dolphinscheduler/pull/11355
|
e9ccaffbe07158c68e999e65186ea37d6ed33ab0
|
05932bcf55443e48aafda2201ba2d90806f19c00
| 2022-08-04T07:41:32Z |
java
| 2022-08-10T02:20:16Z |
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/placeholder/TimePlaceholderUtils.java
|
*/
package org.apache.dolphinscheduler.common.utils.placeholder;
import static org.apache.dolphinscheduler.common.Constants.ADD_CHAR;
import static org.apache.dolphinscheduler.common.Constants.ADD_STRING;
import static org.apache.dolphinscheduler.common.Constants.DIVISION_CHAR;
import static org.apache.dolphinscheduler.common.Constants.DIVISION_STRING;
import static org.apache.dolphinscheduler.common.Constants.LEFT_BRACE_CHAR;
import static org.apache.dolphinscheduler.common.Constants.LEFT_BRACE_STRING;
import static org.apache.dolphinscheduler.common.Constants.MULTIPLY_CHAR;
import static org.apache.dolphinscheduler.common.Constants.STAR;
import static org.apache.dolphinscheduler.common.Constants.N;
import static org.apache.dolphinscheduler.common.Constants.P;
import static org.apache.dolphinscheduler.common.Constants.RIGHT_BRACE_CHAR;
import static org.apache.dolphinscheduler.common.Constants.SUBTRACT_CHAR;
import static org.apache.dolphinscheduler.common.Constants.SUBTRACT_STRING;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.utils.DateUtils;
import org.apache.commons.lang3.StringUtils;
import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Stack;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* time place holder utils
*/
public class TimePlaceholderUtils {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,295 |
[Improvement][common,task-api] have duplicate classes
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
<img width="874" alt="image" src="https://user-images.githubusercontent.com/33984497/182791206-4e6e5132-9810-4a61-ad4d-875c200a1222.png">
PlaceholderUtils PropertyPlaceholderHelper TimePlaceholderUtils BusinessTimeUtils
maybe we can left class in task-api ,because common depends on task -api
<img width="983" alt="image" src="https://user-images.githubusercontent.com/33984497/182791857-6198cb0a-4c9e-4007-8681-8ad58920db55.png">
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11295
|
https://github.com/apache/dolphinscheduler/pull/11355
|
e9ccaffbe07158c68e999e65186ea37d6ed33ab0
|
05932bcf55443e48aafda2201ba2d90806f19c00
| 2022-08-04T07:41:32Z |
java
| 2022-08-10T02:20:16Z |
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/placeholder/TimePlaceholderUtils.java
|
private static final Logger logger = LoggerFactory.getLogger(TimePlaceholderUtils.class);
/**
* Prefix of the position to be replaced
*/
public static final String PLACEHOLDER_PREFIX = "$[";
/**
* The suffix of the position to be replaced
*/
public static final String PLACEHOLDER_SUFFIX = "]";
/**
* Replaces all placeholders of format {@code ${name}} with the value returned
* from the supplied {@link PropertyPlaceholderHelper.PlaceholderResolver}.
*
* @param value the value containing the placeholders to be replaced
* @param date custom date
* @param ignoreUnresolvablePlaceholders ignore unresolvable placeholders
* @return the supplied value with placeholders replaced inline
*/
public static String replacePlaceholders(String value, Date date, boolean ignoreUnresolvablePlaceholders) {
PropertyPlaceholderHelper strictHelper = getPropertyPlaceholderHelper(false);
PropertyPlaceholderHelper nonStrictHelper = getPropertyPlaceholderHelper(true);
PropertyPlaceholderHelper helper = (ignoreUnresolvablePlaceholders ? nonStrictHelper : strictHelper);
return helper.replacePlaceholders(value, new TimePlaceholderResolver(value, date));
}
/**
* Creates a new {@code PropertyPlaceholderHelper} that uses the supplied prefix and suffix.
*
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,295 |
[Improvement][common,task-api] have duplicate classes
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
<img width="874" alt="image" src="https://user-images.githubusercontent.com/33984497/182791206-4e6e5132-9810-4a61-ad4d-875c200a1222.png">
PlaceholderUtils PropertyPlaceholderHelper TimePlaceholderUtils BusinessTimeUtils
maybe we can left class in task-api ,because common depends on task -api
<img width="983" alt="image" src="https://user-images.githubusercontent.com/33984497/182791857-6198cb0a-4c9e-4007-8681-8ad58920db55.png">
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11295
|
https://github.com/apache/dolphinscheduler/pull/11355
|
e9ccaffbe07158c68e999e65186ea37d6ed33ab0
|
05932bcf55443e48aafda2201ba2d90806f19c00
| 2022-08-04T07:41:32Z |
java
| 2022-08-10T02:20:16Z |
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/placeholder/TimePlaceholderUtils.java
|
* @param ignoreUnresolvablePlaceholders indicates whether unresolvable placeholders should
* be ignored ({@code true}) or cause an exception ({@code false})
*/
private static PropertyPlaceholderHelper getPropertyPlaceholderHelper(boolean ignoreUnresolvablePlaceholders) {
return new PropertyPlaceholderHelper(PLACEHOLDER_PREFIX, PLACEHOLDER_SUFFIX, null, ignoreUnresolvablePlaceholders);
}
/**
* calculate expression's value
*
* @param expression expression
* @return expression's value
*/
public static Integer calculate(String expression) {
expression = StringUtils.trim(expression);
expression = convert(expression);
List<String> result = string2List(expression);
result = convert2SuffixList(result);
return calculate(result);
}
/**
* Change the sign in the expression to P (positive) N (negative)
*
* @param expression
* @return eg. "-3+-6*(+8)-(-5) -> S3+S6*(P8)-(S5)"
*/
private static String convert(String expression) {
char[] arr = expression.toCharArray();
for (int i = 0; i < arr.length; i++) {
if (arr[i] == SUBTRACT_CHAR) {
if (i == 0) {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,295 |
[Improvement][common,task-api] have duplicate classes
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
<img width="874" alt="image" src="https://user-images.githubusercontent.com/33984497/182791206-4e6e5132-9810-4a61-ad4d-875c200a1222.png">
PlaceholderUtils PropertyPlaceholderHelper TimePlaceholderUtils BusinessTimeUtils
maybe we can left class in task-api ,because common depends on task -api
<img width="983" alt="image" src="https://user-images.githubusercontent.com/33984497/182791857-6198cb0a-4c9e-4007-8681-8ad58920db55.png">
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11295
|
https://github.com/apache/dolphinscheduler/pull/11355
|
e9ccaffbe07158c68e999e65186ea37d6ed33ab0
|
05932bcf55443e48aafda2201ba2d90806f19c00
| 2022-08-04T07:41:32Z |
java
| 2022-08-10T02:20:16Z |
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/placeholder/TimePlaceholderUtils.java
|
arr[i] = N;
} else {
char c = arr[i - 1];
if (c == ADD_CHAR || c == SUBTRACT_CHAR || c == MULTIPLY_CHAR || c == DIVISION_CHAR || c == LEFT_BRACE_CHAR) {
arr[i] = N;
}
}
} else if (arr[i] == ADD_CHAR) {
if (i == 0) {
arr[i] = P;
} else {
char c = arr[i - 1];
if (c == ADD_CHAR || c == SUBTRACT_CHAR || c == MULTIPLY_CHAR || c == DIVISION_CHAR || c == LEFT_BRACE_CHAR) {
arr[i] = P;
}
}
}
}
return new String(arr);
}
/**
* to suffix expression
*
* @param srcList
* @return
*/
private static List<String> convert2SuffixList(List<String> srcList) {
List<String> result = new ArrayList<>();
Stack<String> stack = new Stack<>();
for (int i = 0; i < srcList.size(); i++) {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,295 |
[Improvement][common,task-api] have duplicate classes
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
<img width="874" alt="image" src="https://user-images.githubusercontent.com/33984497/182791206-4e6e5132-9810-4a61-ad4d-875c200a1222.png">
PlaceholderUtils PropertyPlaceholderHelper TimePlaceholderUtils BusinessTimeUtils
maybe we can left class in task-api ,because common depends on task -api
<img width="983" alt="image" src="https://user-images.githubusercontent.com/33984497/182791857-6198cb0a-4c9e-4007-8681-8ad58920db55.png">
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11295
|
https://github.com/apache/dolphinscheduler/pull/11355
|
e9ccaffbe07158c68e999e65186ea37d6ed33ab0
|
05932bcf55443e48aafda2201ba2d90806f19c00
| 2022-08-04T07:41:32Z |
java
| 2022-08-10T02:20:16Z |
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/placeholder/TimePlaceholderUtils.java
|
if (Character.isDigit(srcList.get(i).charAt(0))) {
result.add(srcList.get(i));
} else {
switch (srcList.get(i).charAt(0)) {
case LEFT_BRACE_CHAR:
stack.push(srcList.get(i));
break;
case RIGHT_BRACE_CHAR:
while (!LEFT_BRACE_STRING.equals(stack.peek())) {
result.add(stack.pop());
}
stack.pop();
break;
default:
while (!stack.isEmpty() && compare(stack.peek(), srcList.get(i))) {
result.add(stack.pop());
}
stack.push(srcList.get(i));
break;
}
}
}
while (!stack.isEmpty()) {
result.add(stack.pop());
}
return result;
}
/**
* Calculate the suffix expression
*
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,295 |
[Improvement][common,task-api] have duplicate classes
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
<img width="874" alt="image" src="https://user-images.githubusercontent.com/33984497/182791206-4e6e5132-9810-4a61-ad4d-875c200a1222.png">
PlaceholderUtils PropertyPlaceholderHelper TimePlaceholderUtils BusinessTimeUtils
maybe we can left class in task-api ,because common depends on task -api
<img width="983" alt="image" src="https://user-images.githubusercontent.com/33984497/182791857-6198cb0a-4c9e-4007-8681-8ad58920db55.png">
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11295
|
https://github.com/apache/dolphinscheduler/pull/11355
|
e9ccaffbe07158c68e999e65186ea37d6ed33ab0
|
05932bcf55443e48aafda2201ba2d90806f19c00
| 2022-08-04T07:41:32Z |
java
| 2022-08-10T02:20:16Z |
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/placeholder/TimePlaceholderUtils.java
|
* @param result
* @return
*/
private static Integer calculate(List<String> result) {
Stack<Integer> stack = new Stack<>();
for (int i = 0; i < result.size(); i++) {
if (Character.isDigit(result.get(i).charAt(0))) {
stack.push(Integer.parseInt(result.get(i)));
} else {
Integer backInt = stack.pop();
Integer frontInt = 0;
char op = result.get(i).charAt(0);
if (!(op == P || op == N)) {
frontInt = stack.pop();
}
Integer res = 0;
switch (result.get(i).charAt(0)) {
case P:
res = frontInt + backInt;
break;
case N:
res = frontInt - backInt;
break;
case ADD_CHAR:
res = frontInt + backInt;
break;
case SUBTRACT_CHAR:
res = frontInt - backInt;
break;
case MULTIPLY_CHAR:
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,295 |
[Improvement][common,task-api] have duplicate classes
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
<img width="874" alt="image" src="https://user-images.githubusercontent.com/33984497/182791206-4e6e5132-9810-4a61-ad4d-875c200a1222.png">
PlaceholderUtils PropertyPlaceholderHelper TimePlaceholderUtils BusinessTimeUtils
maybe we can left class in task-api ,because common depends on task -api
<img width="983" alt="image" src="https://user-images.githubusercontent.com/33984497/182791857-6198cb0a-4c9e-4007-8681-8ad58920db55.png">
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11295
|
https://github.com/apache/dolphinscheduler/pull/11355
|
e9ccaffbe07158c68e999e65186ea37d6ed33ab0
|
05932bcf55443e48aafda2201ba2d90806f19c00
| 2022-08-04T07:41:32Z |
java
| 2022-08-10T02:20:16Z |
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/placeholder/TimePlaceholderUtils.java
|
res = frontInt * backInt;
break;
case DIVISION_CHAR:
res = frontInt / backInt;
break;
default:
break;
}
stack.push(res);
}
}
return stack.pop();
}
/**
* string to list
*
* @param expression
* @return list
*/
private static List<String> string2List(String expression) {
List<String> result = new ArrayList<>();
String num = "";
for (int i = 0; i < expression.length(); i++) {
if (Character.isDigit(expression.charAt(i))) {
num = num + expression.charAt(i);
} else {
if (!num.isEmpty()) {
result.add(num);
}
result.add(expression.charAt(i) + "");
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,295 |
[Improvement][common,task-api] have duplicate classes
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
<img width="874" alt="image" src="https://user-images.githubusercontent.com/33984497/182791206-4e6e5132-9810-4a61-ad4d-875c200a1222.png">
PlaceholderUtils PropertyPlaceholderHelper TimePlaceholderUtils BusinessTimeUtils
maybe we can left class in task-api ,because common depends on task -api
<img width="983" alt="image" src="https://user-images.githubusercontent.com/33984497/182791857-6198cb0a-4c9e-4007-8681-8ad58920db55.png">
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11295
|
https://github.com/apache/dolphinscheduler/pull/11355
|
e9ccaffbe07158c68e999e65186ea37d6ed33ab0
|
05932bcf55443e48aafda2201ba2d90806f19c00
| 2022-08-04T07:41:32Z |
java
| 2022-08-10T02:20:16Z |
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/placeholder/TimePlaceholderUtils.java
|
num = "";
}
}
if (!num.isEmpty()) {
result.add(num);
}
return result;
}
/**
* compare loginUser level
*
* @param peek
* @param cur
* @return true or false
*/
private static boolean compare(String peek, String cur) {
if (STAR.equals(peek) && (DIVISION_STRING.equals(cur) || STAR.equals(cur) || ADD_STRING.equals(cur) || SUBTRACT_STRING.equals(cur))) {
return true;
} else if (DIVISION_STRING.equals(peek) && (DIVISION_STRING.equals(cur) || STAR.equals(cur) || ADD_STRING.equals(cur) || SUBTRACT_STRING.equals(cur))) {
return true;
} else if (ADD_STRING.equals(peek) && (ADD_STRING.equals(cur) || SUBTRACT_STRING.equals(cur))) {
return true;
} else {
return SUBTRACT_STRING.equals(peek) && (ADD_STRING.equals(cur) || SUBTRACT_STRING.equals(cur));
}
}
/**
* Placeholder replacement resolver
*/
private static class TimePlaceholderResolver implements
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,295 |
[Improvement][common,task-api] have duplicate classes
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
<img width="874" alt="image" src="https://user-images.githubusercontent.com/33984497/182791206-4e6e5132-9810-4a61-ad4d-875c200a1222.png">
PlaceholderUtils PropertyPlaceholderHelper TimePlaceholderUtils BusinessTimeUtils
maybe we can left class in task-api ,because common depends on task -api
<img width="983" alt="image" src="https://user-images.githubusercontent.com/33984497/182791857-6198cb0a-4c9e-4007-8681-8ad58920db55.png">
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11295
|
https://github.com/apache/dolphinscheduler/pull/11355
|
e9ccaffbe07158c68e999e65186ea37d6ed33ab0
|
05932bcf55443e48aafda2201ba2d90806f19c00
| 2022-08-04T07:41:32Z |
java
| 2022-08-10T02:20:16Z |
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/placeholder/TimePlaceholderUtils.java
|
PropertyPlaceholderHelper.PlaceholderResolver {
private final String value;
private final Date date;
public TimePlaceholderResolver(String value, Date date) {
this.value = value;
this.date = date;
}
@Override
public String resolvePlaceholder(String placeholderName) {
try {
return calculateTime(placeholderName, date);
} catch (Exception ex) {
logger.error("resolve placeholder '{}' in [ {} ]", placeholderName, value, ex);
return null;
}
}
}
/**
* return the formatted date according to the corresponding date format
*
* @param expression date expression
* @param date date
* @return reformat date
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,295 |
[Improvement][common,task-api] have duplicate classes
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
<img width="874" alt="image" src="https://user-images.githubusercontent.com/33984497/182791206-4e6e5132-9810-4a61-ad4d-875c200a1222.png">
PlaceholderUtils PropertyPlaceholderHelper TimePlaceholderUtils BusinessTimeUtils
maybe we can left class in task-api ,because common depends on task -api
<img width="983" alt="image" src="https://user-images.githubusercontent.com/33984497/182791857-6198cb0a-4c9e-4007-8681-8ad58920db55.png">
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11295
|
https://github.com/apache/dolphinscheduler/pull/11355
|
e9ccaffbe07158c68e999e65186ea37d6ed33ab0
|
05932bcf55443e48aafda2201ba2d90806f19c00
| 2022-08-04T07:41:32Z |
java
| 2022-08-10T02:20:16Z |
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/placeholder/TimePlaceholderUtils.java
|
*/
public static String getPlaceHolderTime(String expression, Date date) {
if (StringUtils.isBlank(expression)) {
return null;
}
if (null == date) {
return null;
}
return calculateTime(expression, date);
}
/**
* calculate time
*
* @param date date
* @return calculate time
*/
private static String calculateTime(String expression, Date date) {
String value;
try {
if (expression.startsWith(Constants.TIMESTAMP)) {
String timeExpression = expression.substring(Constants.TIMESTAMP.length() + 1, expression.length() - 1);
Map.Entry<Date, String> entry = calcTimeExpression(timeExpression, date);
String dateStr = DateUtils.format(entry.getKey(), entry.getValue(), null);
Date timestamp = DateUtils.parse(dateStr, Constants.PARAMETER_FORMAT_TIME, null);
value = String.valueOf(timestamp.getTime() / 1000);
} else {
Map.Entry<Date, String> entry = calcTimeExpression(expression, date);
value = DateUtils.format(entry.getKey(), entry.getValue(), null);
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,295 |
[Improvement][common,task-api] have duplicate classes
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
<img width="874" alt="image" src="https://user-images.githubusercontent.com/33984497/182791206-4e6e5132-9810-4a61-ad4d-875c200a1222.png">
PlaceholderUtils PropertyPlaceholderHelper TimePlaceholderUtils BusinessTimeUtils
maybe we can left class in task-api ,because common depends on task -api
<img width="983" alt="image" src="https://user-images.githubusercontent.com/33984497/182791857-6198cb0a-4c9e-4007-8681-8ad58920db55.png">
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11295
|
https://github.com/apache/dolphinscheduler/pull/11355
|
e9ccaffbe07158c68e999e65186ea37d6ed33ab0
|
05932bcf55443e48aafda2201ba2d90806f19c00
| 2022-08-04T07:41:32Z |
java
| 2022-08-10T02:20:16Z |
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/placeholder/TimePlaceholderUtils.java
|
} catch (Exception e) {
logger.error(e.getMessage(), e);
throw e;
}
return value;
}
/**
* calculate time expresstion
*
* @param expression expresstion
* @param date date
* @return map with date, date format
*/
public static Map.Entry<Date, String> calcTimeExpression(String expression, Date date) {
Map.Entry<Date, String> resultEntry;
if (expression.startsWith(Constants.ADD_MONTHS)) {
resultEntry = calcMonths(expression, date);
} else if (expression.startsWith(Constants.MONTH_BEGIN)) {
resultEntry = calcMonthBegin(expression, date);
} else if (expression.startsWith(Constants.MONTH_END)) {
resultEntry = calcMonthEnd(expression, date);
} else if (expression.startsWith(Constants.WEEK_BEGIN)) {
resultEntry = calcWeekStart(expression, date);
} else if (expression.startsWith(Constants.WEEK_END)) {
resultEntry = calcWeekEnd(expression, date);
} else {
resultEntry = calcMinutes(expression, date);
}
return resultEntry;
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,295 |
[Improvement][common,task-api] have duplicate classes
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
<img width="874" alt="image" src="https://user-images.githubusercontent.com/33984497/182791206-4e6e5132-9810-4a61-ad4d-875c200a1222.png">
PlaceholderUtils PropertyPlaceholderHelper TimePlaceholderUtils BusinessTimeUtils
maybe we can left class in task-api ,because common depends on task -api
<img width="983" alt="image" src="https://user-images.githubusercontent.com/33984497/182791857-6198cb0a-4c9e-4007-8681-8ad58920db55.png">
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11295
|
https://github.com/apache/dolphinscheduler/pull/11355
|
e9ccaffbe07158c68e999e65186ea37d6ed33ab0
|
05932bcf55443e48aafda2201ba2d90806f19c00
| 2022-08-04T07:41:32Z |
java
| 2022-08-10T02:20:16Z |
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/placeholder/TimePlaceholderUtils.java
|
/**
* get first day of month
*
* @param expression expresstion
* @param date date
* @return first day of month
*/
public static Map.Entry<Date, String> calcMonthBegin(String expression, Date date) {
String addMonthExpr = expression.substring(Constants.MONTH_BEGIN.length() + 1, expression.length() - 1);
String[] params = addMonthExpr.split(Constants.COMMA);
if (params.length == 2) {
String dateFormat = params[0];
String dayExpr = params[1];
Integer day = calculate(dayExpr);
Date targetDate = DateUtils.getFirstDayOfMonth(date);
targetDate = org.apache.commons.lang.time.DateUtils.addDays(targetDate, day);
return new AbstractMap.SimpleImmutableEntry<>(targetDate, dateFormat);
}
throw new RuntimeException("expression not valid");
}
/**
* get last day of month
*
* @param expression expresstion
* @param date date
* @return last day of month
*/
public static Map.Entry<Date, String> calcMonthEnd(String expression, Date date) {
String addMonthExpr = expression.substring(Constants.MONTH_END.length() + 1, expression.length() - 1);
String[] params = addMonthExpr.split(Constants.COMMA);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,295 |
[Improvement][common,task-api] have duplicate classes
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
<img width="874" alt="image" src="https://user-images.githubusercontent.com/33984497/182791206-4e6e5132-9810-4a61-ad4d-875c200a1222.png">
PlaceholderUtils PropertyPlaceholderHelper TimePlaceholderUtils BusinessTimeUtils
maybe we can left class in task-api ,because common depends on task -api
<img width="983" alt="image" src="https://user-images.githubusercontent.com/33984497/182791857-6198cb0a-4c9e-4007-8681-8ad58920db55.png">
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11295
|
https://github.com/apache/dolphinscheduler/pull/11355
|
e9ccaffbe07158c68e999e65186ea37d6ed33ab0
|
05932bcf55443e48aafda2201ba2d90806f19c00
| 2022-08-04T07:41:32Z |
java
| 2022-08-10T02:20:16Z |
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/placeholder/TimePlaceholderUtils.java
|
if (params.length == 2) {
String dateFormat = params[0];
String dayExpr = params[1];
Integer day = calculate(dayExpr);
Date targetDate = DateUtils.getLastDayOfMonth(date);
targetDate = org.apache.commons.lang.time.DateUtils.addDays(targetDate, day);
return new AbstractMap.SimpleImmutableEntry<>(targetDate, dateFormat);
}
throw new RuntimeException("expression not valid");
}
/**
* get first day of week
*
* @param expression expresstion
* @param date date
* @return monday
*/
public static Map.Entry<Date, String> calcWeekStart(String expression, Date date) {
String addMonthExpr = expression.substring(Constants.WEEK_BEGIN.length() + 1, expression.length() - 1);
String[] params = addMonthExpr.split(Constants.COMMA);
if (params.length == 2) {
String dateFormat = params[0];
String dayExpr = params[1];
Integer day = calculate(dayExpr);
Date targetDate = DateUtils.getMonday(date);
targetDate = org.apache.commons.lang.time.DateUtils.addDays(targetDate, day);
return new AbstractMap.SimpleImmutableEntry<>(targetDate, dateFormat);
}
throw new RuntimeException("expression not valid");
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,295 |
[Improvement][common,task-api] have duplicate classes
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
<img width="874" alt="image" src="https://user-images.githubusercontent.com/33984497/182791206-4e6e5132-9810-4a61-ad4d-875c200a1222.png">
PlaceholderUtils PropertyPlaceholderHelper TimePlaceholderUtils BusinessTimeUtils
maybe we can left class in task-api ,because common depends on task -api
<img width="983" alt="image" src="https://user-images.githubusercontent.com/33984497/182791857-6198cb0a-4c9e-4007-8681-8ad58920db55.png">
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11295
|
https://github.com/apache/dolphinscheduler/pull/11355
|
e9ccaffbe07158c68e999e65186ea37d6ed33ab0
|
05932bcf55443e48aafda2201ba2d90806f19c00
| 2022-08-04T07:41:32Z |
java
| 2022-08-10T02:20:16Z |
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/placeholder/TimePlaceholderUtils.java
|
/**
* get last day of week
*
* @param expression expresstion
* @param date date
* @return last day of week
*/
public static Map.Entry<Date, String> calcWeekEnd(String expression, Date date) {
String addMonthExpr = expression.substring(Constants.WEEK_END.length() + 1, expression.length() - 1);
String[] params = addMonthExpr.split(Constants.COMMA);
if (params.length == 2) {
String dateFormat = params[0];
String dayExpr = params[1];
Integer day = calculate(dayExpr);
Date targetDate = DateUtils.getSunday(date);
targetDate = org.apache.commons.lang.time.DateUtils.addDays(targetDate, day);
return new AbstractMap.SimpleImmutableEntry<>(targetDate, dateFormat);
}
throw new RuntimeException("Expression not valid");
}
/**
* calc months expression
*
* @param expression expresstion
* @param date date
* @return calc months
*/
public static Map.Entry<Date, String> calcMonths(String expression, Date date) {
String addMonthExpr = expression.substring(Constants.ADD_MONTHS.length() + 1, expression.length() - 1);
String[] params = addMonthExpr.split(Constants.COMMA);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,295 |
[Improvement][common,task-api] have duplicate classes
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
<img width="874" alt="image" src="https://user-images.githubusercontent.com/33984497/182791206-4e6e5132-9810-4a61-ad4d-875c200a1222.png">
PlaceholderUtils PropertyPlaceholderHelper TimePlaceholderUtils BusinessTimeUtils
maybe we can left class in task-api ,because common depends on task -api
<img width="983" alt="image" src="https://user-images.githubusercontent.com/33984497/182791857-6198cb0a-4c9e-4007-8681-8ad58920db55.png">
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11295
|
https://github.com/apache/dolphinscheduler/pull/11355
|
e9ccaffbe07158c68e999e65186ea37d6ed33ab0
|
05932bcf55443e48aafda2201ba2d90806f19c00
| 2022-08-04T07:41:32Z |
java
| 2022-08-10T02:20:16Z |
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/placeholder/TimePlaceholderUtils.java
|
if (params.length == 2) {
String dateFormat = params[0];
String monthExpr = params[1];
Integer addMonth = calculate(monthExpr);
Date targetDate = org.apache.commons.lang.time.DateUtils.addMonths(date, addMonth);
return new AbstractMap.SimpleImmutableEntry<>(targetDate, dateFormat);
}
throw new RuntimeException("expression not valid");
}
/**
* calculate time expression
*
* @param expression expresstion
* @param date date
* @return calculate time expression with date,format
*/
public static Map.Entry<Date, String> calcMinutes(String expression, Date date) {
if (expression.contains("+")) {
int index = expression.lastIndexOf('+');
if (Character.isDigit(expression.charAt(index + 1))) {
String addMinuteExpr = expression.substring(index + 1);
Date targetDate = org.apache.commons.lang3.time.DateUtils
.addMinutes(date, calcMinutes(addMinuteExpr));
String dateFormat = expression.substring(0, index);
return new AbstractMap.SimpleImmutableEntry<>(targetDate, dateFormat);
}
} else if (expression.contains("-")) {
int index = expression.lastIndexOf('-');
if (Character.isDigit(expression.charAt(index + 1))) {
String addMinuteExpr = expression.substring(index + 1);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,295 |
[Improvement][common,task-api] have duplicate classes
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
<img width="874" alt="image" src="https://user-images.githubusercontent.com/33984497/182791206-4e6e5132-9810-4a61-ad4d-875c200a1222.png">
PlaceholderUtils PropertyPlaceholderHelper TimePlaceholderUtils BusinessTimeUtils
maybe we can left class in task-api ,because common depends on task -api
<img width="983" alt="image" src="https://user-images.githubusercontent.com/33984497/182791857-6198cb0a-4c9e-4007-8681-8ad58920db55.png">
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11295
|
https://github.com/apache/dolphinscheduler/pull/11355
|
e9ccaffbe07158c68e999e65186ea37d6ed33ab0
|
05932bcf55443e48aafda2201ba2d90806f19c00
| 2022-08-04T07:41:32Z |
java
| 2022-08-10T02:20:16Z |
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/placeholder/TimePlaceholderUtils.java
|
Date targetDate = org.apache.commons.lang.time.DateUtils
.addMinutes(date, 0 - calcMinutes(addMinuteExpr));
String dateFormat = expression.substring(0, index);
return new AbstractMap.SimpleImmutableEntry<>(targetDate, dateFormat);
}
return new AbstractMap.SimpleImmutableEntry<>(date, expression);
}
return new AbstractMap.SimpleImmutableEntry<>(date, expression);
}
/**
* calculate need minutes
*
* @param minuteExpression minute expression
* @return calculate need minutes
*/
public static Integer calcMinutes(String minuteExpression) {
int index = minuteExpression.indexOf('/');
String calcExpression;
if (index == -1) {
calcExpression = String.format("60*24*(%s)", minuteExpression);
} else {
calcExpression = String.format("60*24*(%s)%s", minuteExpression.substring(0, index),
minuteExpression.substring(index));
}
return calculate(calcExpression);
}
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,295 |
[Improvement][common,task-api] have duplicate classes
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
<img width="874" alt="image" src="https://user-images.githubusercontent.com/33984497/182791206-4e6e5132-9810-4a61-ad4d-875c200a1222.png">
PlaceholderUtils PropertyPlaceholderHelper TimePlaceholderUtils BusinessTimeUtils
maybe we can left class in task-api ,because common depends on task -api
<img width="983" alt="image" src="https://user-images.githubusercontent.com/33984497/182791857-6198cb0a-4c9e-4007-8681-8ad58920db55.png">
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11295
|
https://github.com/apache/dolphinscheduler/pull/11355
|
e9ccaffbe07158c68e999e65186ea37d6ed33ab0
|
05932bcf55443e48aafda2201ba2d90806f19c00
| 2022-08-04T07:41:32Z |
java
| 2022-08-10T02:20:16Z |
dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/ParameterUtilsTest.java
|
/*
* 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.dolphinscheduler.common.utils;
import static org.apache.dolphinscheduler.common.utils.placeholder.TimePlaceholderUtils.replacePlaceholders;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.utils.placeholder.PlaceholderUtils;
import java.text.ParseException;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,295 |
[Improvement][common,task-api] have duplicate classes
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
<img width="874" alt="image" src="https://user-images.githubusercontent.com/33984497/182791206-4e6e5132-9810-4a61-ad4d-875c200a1222.png">
PlaceholderUtils PropertyPlaceholderHelper TimePlaceholderUtils BusinessTimeUtils
maybe we can left class in task-api ,because common depends on task -api
<img width="983" alt="image" src="https://user-images.githubusercontent.com/33984497/182791857-6198cb0a-4c9e-4007-8681-8ad58920db55.png">
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11295
|
https://github.com/apache/dolphinscheduler/pull/11355
|
e9ccaffbe07158c68e999e65186ea37d6ed33ab0
|
05932bcf55443e48aafda2201ba2d90806f19c00
| 2022-08-04T07:41:32Z |
java
| 2022-08-10T02:20:16Z |
dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/ParameterUtilsTest.java
|
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.junit.MockitoJUnitRunner;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@RunWith(MockitoJUnitRunner.class)
public class ParameterUtilsTest {
public static final Logger logger = LoggerFactory.getLogger(ParameterUtilsTest.class);
/**
* Test convertParameterPlaceholders
*/
@Test
public void testConvertParameterPlaceholders() throws ParseException {
Assert.assertNull(ParameterUtils.convertParameterPlaceholders(null, null));
Map<String, String> parameterMap = new HashMap<String, String>();
parameterMap.put("testParameter", "testParameter");
Assert.assertNull(ParameterUtils.convertParameterPlaceholders(null, parameterMap));
String parameterString = "test_parameter";
Assert.assertEquals(parameterString, ParameterUtils.convertParameterPlaceholders(parameterString, parameterMap));
//
parameterMap.put("testParameter2", "${testParameter}");
Assert.assertEquals(parameterString, PlaceholderUtils.replacePlaceholders(parameterString, parameterMap, true));
//
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,295 |
[Improvement][common,task-api] have duplicate classes
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
<img width="874" alt="image" src="https://user-images.githubusercontent.com/33984497/182791206-4e6e5132-9810-4a61-ad4d-875c200a1222.png">
PlaceholderUtils PropertyPlaceholderHelper TimePlaceholderUtils BusinessTimeUtils
maybe we can left class in task-api ,because common depends on task -api
<img width="983" alt="image" src="https://user-images.githubusercontent.com/33984497/182791857-6198cb0a-4c9e-4007-8681-8ad58920db55.png">
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11295
|
https://github.com/apache/dolphinscheduler/pull/11355
|
e9ccaffbe07158c68e999e65186ea37d6ed33ab0
|
05932bcf55443e48aafda2201ba2d90806f19c00
| 2022-08-04T07:41:32Z |
java
| 2022-08-10T02:20:16Z |
dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/ParameterUtilsTest.java
|
Date cronTime = new Date();
Assert.assertEquals(parameterString, replacePlaceholders(parameterString, cronTime, true));
//
Date cronTimeStr = DateUtils.stringToDate("2019-02-02 00:00:00");
Assert.assertEquals(parameterString, replacePlaceholders(parameterString, cronTimeStr, true));
}
@Test
public void testConvertParameterPlaceholders2() {
String parameterString =
"${user} is userName, '$[1]' '$[add_months(yyyyMMdd,12*2)]' '$[add_months(yyyyMMdd,-12*2)]' '$[add_months(yyyyMMdd,3)]' '$[add_months(yyyyMMdd,-4)]' "
+ "'$[yyyyMMdd+7*2]' '$[yyyyMMdd-7*2]' '$[yyyyMMdd+3]' '$[0]' '$[yyyyMMdd-3]' '$[HHmmss+2/24]' '$[HHmmss-1/24]' '$[HHmmss+3/24/60]' '$[HHmmss-2/24/60]' '$[3]'";
Map<String, String> parameterMap = new HashMap<>();
parameterMap.put("user", "Kris");
parameterMap.put(Constants.PARAMETER_DATETIME, "20201201123000");
parameterString = ParameterUtils.convertParameterPlaceholders(parameterString, parameterMap);
Assert.assertEquals("Kris is userName, '$[1]' '20221201' '20181201' '20210301' '20200801' '20201215' '20201117' '20201204' '$[0]' '20201128' '143000' '113000' '123300' '122800' '$[3]'",
parameterString);
}
/**
* Test handleEscapes
*/
@Test
public void testHandleEscapes() throws Exception {
Assert.assertNull(ParameterUtils.handleEscapes(null));
Assert.assertEquals("", ParameterUtils.handleEscapes(""));
Assert.assertEquals("test Parameter", ParameterUtils.handleEscapes("test Parameter"));
Assert.assertEquals("////%test////%Parameter", ParameterUtils.handleEscapes("%test%Parameter"));
}
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,295 |
[Improvement][common,task-api] have duplicate classes
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
<img width="874" alt="image" src="https://user-images.githubusercontent.com/33984497/182791206-4e6e5132-9810-4a61-ad4d-875c200a1222.png">
PlaceholderUtils PropertyPlaceholderHelper TimePlaceholderUtils BusinessTimeUtils
maybe we can left class in task-api ,because common depends on task -api
<img width="983" alt="image" src="https://user-images.githubusercontent.com/33984497/182791857-6198cb0a-4c9e-4007-8681-8ad58920db55.png">
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11295
|
https://github.com/apache/dolphinscheduler/pull/11355
|
e9ccaffbe07158c68e999e65186ea37d6ed33ab0
|
05932bcf55443e48aafda2201ba2d90806f19c00
| 2022-08-04T07:41:32Z |
java
| 2022-08-10T02:20:16Z |
dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/placeholder/TimePlaceholderUtilsTest.java
|
/*
* 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.dolphinscheduler.common.utils.placeholder;
import org.apache.dolphinscheduler.common.utils.DateUtils;
import java.util.Date;
import java.util.TimeZone;
import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
public class TimePlaceholderUtilsTest {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,295 |
[Improvement][common,task-api] have duplicate classes
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
<img width="874" alt="image" src="https://user-images.githubusercontent.com/33984497/182791206-4e6e5132-9810-4a61-ad4d-875c200a1222.png">
PlaceholderUtils PropertyPlaceholderHelper TimePlaceholderUtils BusinessTimeUtils
maybe we can left class in task-api ,because common depends on task -api
<img width="983" alt="image" src="https://user-images.githubusercontent.com/33984497/182791857-6198cb0a-4c9e-4007-8681-8ad58920db55.png">
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11295
|
https://github.com/apache/dolphinscheduler/pull/11355
|
e9ccaffbe07158c68e999e65186ea37d6ed33ab0
|
05932bcf55443e48aafda2201ba2d90806f19c00
| 2022-08-04T07:41:32Z |
java
| 2022-08-10T02:20:16Z |
dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/placeholder/TimePlaceholderUtilsTest.java
|
private Date date;
@BeforeClass
public static void setup() {
TimeZone.setDefault(TimeZone.getTimeZone("Asia/Shanghai"));
}
@Before
public void init() {
date = DateUtils.parse("20170101010101", "yyyyMMddHHmmss", null);
}
@Test
public void replacePlaceholdersT() {
Assert.assertEquals("2017test12017:***2016-12-31,20170102,20170130,20161227,20161231", TimePlaceholderUtils
.replacePlaceholders("$[yyyy]test1$[yyyy:***]$[yyyy-MM-dd-1],$[month_begin(yyyyMMdd, 1)],$[month_end(yyyyMMdd, -1)],$[week_begin(yyyyMMdd, 1)],$[week_end(yyyyMMdd, -1)]",
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,295 |
[Improvement][common,task-api] have duplicate classes
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
<img width="874" alt="image" src="https://user-images.githubusercontent.com/33984497/182791206-4e6e5132-9810-4a61-ad4d-875c200a1222.png">
PlaceholderUtils PropertyPlaceholderHelper TimePlaceholderUtils BusinessTimeUtils
maybe we can left class in task-api ,because common depends on task -api
<img width="983" alt="image" src="https://user-images.githubusercontent.com/33984497/182791857-6198cb0a-4c9e-4007-8681-8ad58920db55.png">
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11295
|
https://github.com/apache/dolphinscheduler/pull/11355
|
e9ccaffbe07158c68e999e65186ea37d6ed33ab0
|
05932bcf55443e48aafda2201ba2d90806f19c00
| 2022-08-04T07:41:32Z |
java
| 2022-08-10T02:20:16Z |
dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/placeholder/TimePlaceholderUtilsTest.java
|
date, true));
Assert.assertEquals("1483200061,1483290061,1485709261,1482771661,1483113600,1483203661", TimePlaceholderUtils.replacePlaceholders("$[timestamp(yyyyMMdd00mmss)],"
+ "$[timestamp(month_begin(yyyyMMddHHmmss, 1))],"
+ "$[timestamp(month_end(yyyyMMddHHmmss, -1))],"
+ "$[timestamp(week_begin(yyyyMMddHHmmss, 1))],"
+ "$[timestamp(week_end(yyyyMMdd000000, -1))],"
+ "$[timestamp(yyyyMMddHHmmss)]",
date, true));
}
@Test
public void calcMinutesT() {
Assert.assertEquals("Sun Jan 01 01:01:01 CST 2017=yyyy", TimePlaceholderUtils.calcMinutes("yyyy", date).toString());
Assert.assertEquals("Sun Jan 08 01:01:01 CST 2017=yyyyMMdd", TimePlaceholderUtils.calcMinutes("yyyyMMdd+7*1", date).toString());
Assert.assertEquals("Sun Dec 25 01:01:01 CST 2016=yyyyMMdd", TimePlaceholderUtils.calcMinutes("yyyyMMdd-7*1", date).toString());
Assert.assertEquals("Mon Jan 02 01:01:01 CST 2017=yyyyMMdd", TimePlaceholderUtils.calcMinutes("yyyyMMdd+1", date).toString());
Assert.assertEquals("Sat Dec 31 01:01:01 CST 2016=yyyyMMdd", TimePlaceholderUtils.calcMinutes("yyyyMMdd-1", date).toString());
Assert.assertEquals("Sun Jan 01 02:01:01 CST 2017=yyyyMMddHH", TimePlaceholderUtils.calcMinutes("yyyyMMddHH+1/24", date).toString());
Assert.assertEquals("Sun Jan 01 00:01:01 CST 2017=yyyyMMddHH", TimePlaceholderUtils.calcMinutes("yyyyMMddHH-1/24", date).toString());
}
@Test
public void calcMonthsT() {
Assert.assertEquals("Mon Jan 01 01:01:01 CST 2018=yyyyMMdd", TimePlaceholderUtils.calcMonths("add_months(yyyyMMdd,12*1)", date).toString());
Assert.assertEquals("Fri Jan 01 01:01:01 CST 2016=yyyyMMdd", TimePlaceholderUtils.calcMonths("add_months(yyyyMMdd,-12*1)", date).toString());
}
@Test
public void testGetPlaceHolderTime() {
Assert.assertEquals("20170101", TimePlaceholderUtils.getPlaceHolderTime("yyyyMMdd", date));
}
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,067 |
[Feature][Api] Refactor org.apache.dolphinscheduler.api.controller.QueueController
|
[[DSIP-7] [API] Suggest refactor the backend api](https://github.com/apache/dolphinscheduler/issues/10257#) #10257
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Refactor org.apache.dolphinscheduler.api.controller.QueueController
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11067
|
https://github.com/apache/dolphinscheduler/pull/11154
|
877441519711c729951ba811f91cdb088d4f1e96
|
a50f110d3e541a5b832825facea628cddec01e9e
| 2022-07-20T05:55:38Z |
java
| 2022-08-10T03:34:37Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/QueueController.java
|
/*
* 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.dolphinscheduler.api.controller;
import static org.apache.dolphinscheduler.api.enums.Status.CREATE_QUEUE_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.QUERY_QUEUE_LIST_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.UPDATE_QUEUE_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.VERIFY_QUEUE_ERROR;
import org.apache.dolphinscheduler.api.aspect.AccessLogAnnotation;
import org.apache.dolphinscheduler.api.exceptions.ApiException;
import org.apache.dolphinscheduler.api.service.QueueService;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,067 |
[Feature][Api] Refactor org.apache.dolphinscheduler.api.controller.QueueController
|
[[DSIP-7] [API] Suggest refactor the backend api](https://github.com/apache/dolphinscheduler/issues/10257#) #10257
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Refactor org.apache.dolphinscheduler.api.controller.QueueController
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11067
|
https://github.com/apache/dolphinscheduler/pull/11154
|
877441519711c729951ba811f91cdb088d4f1e96
|
a50f110d3e541a5b832825facea628cddec01e9e
| 2022-07-20T05:55:38Z |
java
| 2022-08-10T03:34:37Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/QueueController.java
|
import org.apache.dolphinscheduler.api.utils.Result;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.utils.ParameterUtils;
import org.apache.dolphinscheduler.dao.entity.User;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import springfox.documentation.annotations.ApiIgnore;
/**
* queue controller
*/
@Api(tags = "QUEUE_TAG")
@RestController
@RequestMapping("/queues")
public class QueueController extends BaseController {
@Autowired
private QueueService queueService;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,067 |
[Feature][Api] Refactor org.apache.dolphinscheduler.api.controller.QueueController
|
[[DSIP-7] [API] Suggest refactor the backend api](https://github.com/apache/dolphinscheduler/issues/10257#) #10257
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Refactor org.apache.dolphinscheduler.api.controller.QueueController
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11067
|
https://github.com/apache/dolphinscheduler/pull/11154
|
877441519711c729951ba811f91cdb088d4f1e96
|
a50f110d3e541a5b832825facea628cddec01e9e
| 2022-07-20T05:55:38Z |
java
| 2022-08-10T03:34:37Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/QueueController.java
|
/**
* query queue list
*
* @param loginUser login user
* @return queue list
*/
@ApiOperation(value = "queryList", notes = "QUERY_QUEUE_LIST_NOTES")
@GetMapping(value = "/list")
@ResponseStatus(HttpStatus.OK)
@ApiException(QUERY_QUEUE_LIST_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result queryList(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser) {
Map<String, Object> result = queueService.queryList(loginUser);
return returnDataList(result);
}
/**
* query queue list paging
*
* @param loginUser login user
* @param pageNo page number
* @param searchVal search value
* @param pageSize page size
* @return queue list
*/
@ApiOperation(value = "queryQueueListPaging", notes = "QUERY_QUEUE_LIST_PAGING_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "searchVal", value = "SEARCH_VAL", dataType = "String"),
@ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "1"),
@ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "20")
})
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,067 |
[Feature][Api] Refactor org.apache.dolphinscheduler.api.controller.QueueController
|
[[DSIP-7] [API] Suggest refactor the backend api](https://github.com/apache/dolphinscheduler/issues/10257#) #10257
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Refactor org.apache.dolphinscheduler.api.controller.QueueController
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11067
|
https://github.com/apache/dolphinscheduler/pull/11154
|
877441519711c729951ba811f91cdb088d4f1e96
|
a50f110d3e541a5b832825facea628cddec01e9e
| 2022-07-20T05:55:38Z |
java
| 2022-08-10T03:34:37Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/QueueController.java
|
@GetMapping()
@ResponseStatus(HttpStatus.OK)
@ApiException(QUERY_QUEUE_LIST_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result queryQueueListPaging(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam("pageNo") Integer pageNo,
@RequestParam(value = "searchVal", required = false) String searchVal,
@RequestParam("pageSize") Integer pageSize) {
Result result = checkPageParams(pageNo, pageSize);
if (!result.checkResult()) {
return result;
}
searchVal = ParameterUtils.handleEscapes(searchVal);
result = queueService.queryList(loginUser, searchVal, pageNo, pageSize);
return result;
}
/**
* create queue
*
* @param loginUser login user
* @param queue queue
* @param queueName queue name
* @return create result
*/
@ApiOperation(value = "createQueue", notes = "CREATE_QUEUE_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "queue", value = "YARN_QUEUE_NAME", required = true, dataType = "String"),
@ApiImplicitParam(name = "queueName", value = "QUEUE_NAME", required = true, dataType = "String")
})
@PostMapping()
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,067 |
[Feature][Api] Refactor org.apache.dolphinscheduler.api.controller.QueueController
|
[[DSIP-7] [API] Suggest refactor the backend api](https://github.com/apache/dolphinscheduler/issues/10257#) #10257
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Refactor org.apache.dolphinscheduler.api.controller.QueueController
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11067
|
https://github.com/apache/dolphinscheduler/pull/11154
|
877441519711c729951ba811f91cdb088d4f1e96
|
a50f110d3e541a5b832825facea628cddec01e9e
| 2022-07-20T05:55:38Z |
java
| 2022-08-10T03:34:37Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/QueueController.java
|
@ResponseStatus(HttpStatus.CREATED)
@ApiException(CREATE_QUEUE_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result createQueue(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value = "queue") String queue,
@RequestParam(value = "queueName") String queueName) {
Map<String, Object> result = queueService.createQueue(loginUser, queue, queueName);
return returnDataList(result);
}
/**
* update queue
*
* @param loginUser login user
* @param queue queue
* @param id queue id
* @param queueName queue name
* @return update result code
*/
@ApiOperation(value = "updateQueue", notes = "UPDATE_QUEUE_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "QUEUE_ID", required = true, dataType = "Int", example = "100"),
@ApiImplicitParam(name = "queue", value = "YARN_QUEUE_NAME", required = true, dataType = "String"),
@ApiImplicitParam(name = "queueName", value = "QUEUE_NAME", required = true, dataType = "String")
})
@PutMapping(value = "/{id}")
@ResponseStatus(HttpStatus.CREATED)
@ApiException(UPDATE_QUEUE_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result updateQueue(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@PathVariable(value = "id") int id,
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,067 |
[Feature][Api] Refactor org.apache.dolphinscheduler.api.controller.QueueController
|
[[DSIP-7] [API] Suggest refactor the backend api](https://github.com/apache/dolphinscheduler/issues/10257#) #10257
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Refactor org.apache.dolphinscheduler.api.controller.QueueController
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11067
|
https://github.com/apache/dolphinscheduler/pull/11154
|
877441519711c729951ba811f91cdb088d4f1e96
|
a50f110d3e541a5b832825facea628cddec01e9e
| 2022-07-20T05:55:38Z |
java
| 2022-08-10T03:34:37Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/QueueController.java
|
@RequestParam(value = "queue") String queue,
@RequestParam(value = "queueName") String queueName) {
Map<String, Object> result = queueService.updateQueue(loginUser, id, queue, queueName);
return returnDataList(result);
}
/**
* verify queue and queue name
*
* @param loginUser login user
* @param queue queue
* @param queueName queue name
* @return true if the queue name not exists, otherwise return false
*/
@ApiOperation(value = "verifyQueue", notes = "VERIFY_QUEUE_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "queue", value = "YARN_QUEUE_NAME", required = true, dataType = "String"),
@ApiImplicitParam(name = "queueName", value = "QUEUE_NAME", required = true, dataType = "String")
})
@PostMapping(value = "/verify")
@ResponseStatus(HttpStatus.OK)
@ApiException(VERIFY_QUEUE_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result verifyQueue(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value = "queue") String queue,
@RequestParam(value = "queueName") String queueName
) {
return queueService.verifyQueue(queue, queueName);
}
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,067 |
[Feature][Api] Refactor org.apache.dolphinscheduler.api.controller.QueueController
|
[[DSIP-7] [API] Suggest refactor the backend api](https://github.com/apache/dolphinscheduler/issues/10257#) #10257
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Refactor org.apache.dolphinscheduler.api.controller.QueueController
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11067
|
https://github.com/apache/dolphinscheduler/pull/11154
|
877441519711c729951ba811f91cdb088d4f1e96
|
a50f110d3e541a5b832825facea628cddec01e9e
| 2022-07-20T05:55:38Z |
java
| 2022-08-10T03:34:37Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/QueueService.java
|
/*
* 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.dolphinscheduler.api.service;
import org.apache.dolphinscheduler.api.utils.Result;
import org.apache.dolphinscheduler.dao.entity.Queue;
import org.apache.dolphinscheduler.dao.entity.User;
import java.util.Map;
/**
* queue service
*/
public interface QueueService {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,067 |
[Feature][Api] Refactor org.apache.dolphinscheduler.api.controller.QueueController
|
[[DSIP-7] [API] Suggest refactor the backend api](https://github.com/apache/dolphinscheduler/issues/10257#) #10257
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Refactor org.apache.dolphinscheduler.api.controller.QueueController
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11067
|
https://github.com/apache/dolphinscheduler/pull/11154
|
877441519711c729951ba811f91cdb088d4f1e96
|
a50f110d3e541a5b832825facea628cddec01e9e
| 2022-07-20T05:55:38Z |
java
| 2022-08-10T03:34:37Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/QueueService.java
|
/**
* query queue list
*
* @param loginUser login user
* @return queue list
*/
Map<String, Object> queryList(User loginUser);
/**
* query queue list paging
*
* @param loginUser login user
* @param pageNo page number
* @param searchVal search value
* @param pageSize page size
* @return queue list
*/
Result queryList(User loginUser, String searchVal, Integer pageNo, Integer pageSize);
/**
* create queue
*
* @param loginUser login user
* @param queue queue
* @param queueName queue name
* @return create result
*/
Map<String, Object> createQueue(User loginUser, String queue, String queueName);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,067 |
[Feature][Api] Refactor org.apache.dolphinscheduler.api.controller.QueueController
|
[[DSIP-7] [API] Suggest refactor the backend api](https://github.com/apache/dolphinscheduler/issues/10257#) #10257
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Refactor org.apache.dolphinscheduler.api.controller.QueueController
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11067
|
https://github.com/apache/dolphinscheduler/pull/11154
|
877441519711c729951ba811f91cdb088d4f1e96
|
a50f110d3e541a5b832825facea628cddec01e9e
| 2022-07-20T05:55:38Z |
java
| 2022-08-10T03:34:37Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/QueueService.java
|
/**
* update queue
*
* @param loginUser login user
* @param queue queue
* @param id queue id
* @param queueName queue name
* @return update result code
*/
Map<String, Object> updateQueue(User loginUser, int id, String queue, String queueName);
/**
* verify queue and queueName
*
* @param queue queue
* @param queueName queue name
* @return true if the queue name not exists, otherwise return false
*/
Result<Object> verifyQueue(String queue, String queueName);
/**
* Make sure queue with given name exists, and create the queue if not exists
*
* ONLY for python gateway server, and should not use this in web ui function
*
* @param queue queue value
* @param queueName queue name
* @return Queue object
*/
Queue createQueueIfNotExists(String queue, String queueName);
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,067 |
[Feature][Api] Refactor org.apache.dolphinscheduler.api.controller.QueueController
|
[[DSIP-7] [API] Suggest refactor the backend api](https://github.com/apache/dolphinscheduler/issues/10257#) #10257
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Refactor org.apache.dolphinscheduler.api.controller.QueueController
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11067
|
https://github.com/apache/dolphinscheduler/pull/11154
|
877441519711c729951ba811f91cdb088d4f1e96
|
a50f110d3e541a5b832825facea628cddec01e9e
| 2022-07-20T05:55:38Z |
java
| 2022-08-10T03:34:37Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/QueueServiceImpl.java
|
/*
* 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.dolphinscheduler.api.service.impl;
import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.YARN_QUEUE_CREATE;
import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.YARN_QUEUE_UPDATE;
import org.apache.dolphinscheduler.api.enums.Status;
import org.apache.dolphinscheduler.api.exceptions.ServiceException;
import org.apache.dolphinscheduler.api.service.QueueService;
import org.apache.dolphinscheduler.api.utils.PageInfo;
import org.apache.dolphinscheduler.api.utils.Result;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,067 |
[Feature][Api] Refactor org.apache.dolphinscheduler.api.controller.QueueController
|
[[DSIP-7] [API] Suggest refactor the backend api](https://github.com/apache/dolphinscheduler/issues/10257#) #10257
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Refactor org.apache.dolphinscheduler.api.controller.QueueController
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11067
|
https://github.com/apache/dolphinscheduler/pull/11154
|
877441519711c729951ba811f91cdb088d4f1e96
|
a50f110d3e541a5b832825facea628cddec01e9e
| 2022-07-20T05:55:38Z |
java
| 2022-08-10T03:34:37Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/QueueServiceImpl.java
|
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.enums.AuthorizationType;
import org.apache.dolphinscheduler.common.enums.UserType;
import org.apache.dolphinscheduler.dao.entity.Queue;
import org.apache.dolphinscheduler.dao.entity.User;
import org.apache.dolphinscheduler.dao.mapper.QueueMapper;
import org.apache.dolphinscheduler.dao.mapper.UserMapper;
import org.apache.commons.lang3.StringUtils;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
/**
* queue service impl
*/
@Service
public class QueueServiceImpl extends BaseServiceImpl implements QueueService {
private static final Logger logger = LoggerFactory.getLogger(QueueServiceImpl.class);
@Autowired
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,067 |
[Feature][Api] Refactor org.apache.dolphinscheduler.api.controller.QueueController
|
[[DSIP-7] [API] Suggest refactor the backend api](https://github.com/apache/dolphinscheduler/issues/10257#) #10257
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Refactor org.apache.dolphinscheduler.api.controller.QueueController
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11067
|
https://github.com/apache/dolphinscheduler/pull/11154
|
877441519711c729951ba811f91cdb088d4f1e96
|
a50f110d3e541a5b832825facea628cddec01e9e
| 2022-07-20T05:55:38Z |
java
| 2022-08-10T03:34:37Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/QueueServiceImpl.java
|
private QueueMapper queueMapper;
@Autowired
private UserMapper userMapper;
/**
* Check the queue new object valid or not
*
* @param queue The queue object want to create
*/
private void createQueueValid(Queue queue) throws ServiceException {
if (StringUtils.isEmpty(queue.getQueue())) {
throw new ServiceException(Status.REQUEST_PARAMS_NOT_VALID_ERROR, Constants.QUEUE);
} else if (StringUtils.isEmpty(queue.getQueueName())) {
throw new ServiceException(Status.REQUEST_PARAMS_NOT_VALID_ERROR, Constants.QUEUE_NAME);
} else if (checkQueueExist(queue.getQueue())) {
throw new ServiceException(Status.QUEUE_VALUE_EXIST, queue.getQueue());
} else if (checkQueueNameExist(queue.getQueueName())) {
throw new ServiceException(Status.QUEUE_NAME_EXIST, queue.getQueueName());
}
}
/**
* Check queue update object valid or not
*
* @param existsQueue The exists queue object
* @param updateQueue The queue object want to update
*/
private void updateQueueValid(Queue existsQueue, Queue updateQueue) throws ServiceException {
if (Objects.isNull(existsQueue)) {
throw new ServiceException(Status.QUEUE_NOT_EXIST, updateQueue.getQueue());
} else if (Objects.equals(existsQueue, updateQueue)) {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,067 |
[Feature][Api] Refactor org.apache.dolphinscheduler.api.controller.QueueController
|
[[DSIP-7] [API] Suggest refactor the backend api](https://github.com/apache/dolphinscheduler/issues/10257#) #10257
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Refactor org.apache.dolphinscheduler.api.controller.QueueController
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11067
|
https://github.com/apache/dolphinscheduler/pull/11154
|
877441519711c729951ba811f91cdb088d4f1e96
|
a50f110d3e541a5b832825facea628cddec01e9e
| 2022-07-20T05:55:38Z |
java
| 2022-08-10T03:34:37Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/QueueServiceImpl.java
|
throw new ServiceException(Status.NEED_NOT_UPDATE_QUEUE);
}
else if (StringUtils.isEmpty(updateQueue.getQueue())) {
throw new ServiceException(Status.REQUEST_PARAMS_NOT_VALID_ERROR, Constants.QUEUE);
} else if (StringUtils.isEmpty(updateQueue.getQueueName())) {
throw new ServiceException(Status.REQUEST_PARAMS_NOT_VALID_ERROR, Constants.QUEUE_NAME);
} else if (!Objects.equals(updateQueue.getQueue(), existsQueue.getQueue()) && checkQueueExist(updateQueue.getQueue())) {
throw new ServiceException(Status.QUEUE_VALUE_EXIST, updateQueue.getQueue());
} else if (!Objects.equals(updateQueue.getQueueName(), existsQueue.getQueueName()) && checkQueueNameExist(updateQueue.getQueueName())) {
throw new ServiceException(Status.QUEUE_NAME_EXIST, updateQueue.getQueueName());
}
}
/**
* query queue list
*
* @param loginUser login user
* @return queue list
*/
@Override
public Map<String, Object> queryList(User loginUser) {
Map<String, Object> result = new HashMap<>();
Set<Integer> ids = resourcePermissionCheckService.userOwnedResourceIdsAcquisition(AuthorizationType.QUEUE, loginUser.getId(), logger);
if (loginUser.getUserType().equals(UserType.GENERAL_USER)) {
ids = ids.isEmpty() ? new HashSet<>() : ids;
ids.add(Constants.DEFAULT_QUEUE_ID);
}
List<Queue> queueList = queueMapper.selectBatchIds(ids);
result.put(Constants.DATA_LIST, queueList);
putMsg(result, Status.SUCCESS);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,067 |
[Feature][Api] Refactor org.apache.dolphinscheduler.api.controller.QueueController
|
[[DSIP-7] [API] Suggest refactor the backend api](https://github.com/apache/dolphinscheduler/issues/10257#) #10257
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Refactor org.apache.dolphinscheduler.api.controller.QueueController
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11067
|
https://github.com/apache/dolphinscheduler/pull/11154
|
877441519711c729951ba811f91cdb088d4f1e96
|
a50f110d3e541a5b832825facea628cddec01e9e
| 2022-07-20T05:55:38Z |
java
| 2022-08-10T03:34:37Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/QueueServiceImpl.java
|
return result;
}
/**
* query queue list paging
*
* @param loginUser login user
* @param pageNo page number
* @param searchVal search value
* @param pageSize page size
* @return queue list
*/
@Override
public Result queryList(User loginUser, String searchVal, Integer pageNo, Integer pageSize) {
Result result = new Result();
PageInfo<Queue> pageInfo = new PageInfo<>(pageNo, pageSize);
Set<Integer> ids = resourcePermissionCheckService.userOwnedResourceIdsAcquisition(AuthorizationType.QUEUE, loginUser.getId(), logger);
if (ids.isEmpty()) {
result.setData(pageInfo);
putMsg(result, Status.SUCCESS);
return result;
}
Page<Queue> page = new Page<>(pageNo, pageSize);
IPage<Queue> queueList = queueMapper.queryQueuePaging(page, new ArrayList<>(ids), searchVal);
Integer count = (int) queueList.getTotal();
pageInfo.setTotal(count);
pageInfo.setTotalList(queueList.getRecords());
result.setData(pageInfo);
putMsg(result, Status.SUCCESS);
return result;
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,067 |
[Feature][Api] Refactor org.apache.dolphinscheduler.api.controller.QueueController
|
[[DSIP-7] [API] Suggest refactor the backend api](https://github.com/apache/dolphinscheduler/issues/10257#) #10257
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Refactor org.apache.dolphinscheduler.api.controller.QueueController
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11067
|
https://github.com/apache/dolphinscheduler/pull/11154
|
877441519711c729951ba811f91cdb088d4f1e96
|
a50f110d3e541a5b832825facea628cddec01e9e
| 2022-07-20T05:55:38Z |
java
| 2022-08-10T03:34:37Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/QueueServiceImpl.java
|
/**
* create queue
*
* @param loginUser login user
* @param queue queue
* @param queueName queue name
* @return create result
*/
@Override
@Transactional
public Map<String, Object> createQueue(User loginUser, String queue, String queueName) {
Map<String, Object> result = new HashMap<>();
if (!canOperatorPermissions(loginUser,null, AuthorizationType.QUEUE,YARN_QUEUE_CREATE)) {
throw new ServiceException(Status.USER_NO_OPERATION_PERM);
}
Queue queueObj = new Queue(queueName, queue);
createQueueValid(queueObj);
queueMapper.insert(queueObj);
result.put(Constants.DATA_LIST, queueObj);
putMsg(result, Status.SUCCESS);
permissionPostHandle(AuthorizationType.QUEUE, loginUser.getId(), Collections.singletonList(queueObj.getId()), logger);
return result;
}
/**
* update queue
*
* @param loginUser login user
* @param queue queue
* @param id queue id
* @param queueName queue name
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,067 |
[Feature][Api] Refactor org.apache.dolphinscheduler.api.controller.QueueController
|
[[DSIP-7] [API] Suggest refactor the backend api](https://github.com/apache/dolphinscheduler/issues/10257#) #10257
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Refactor org.apache.dolphinscheduler.api.controller.QueueController
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11067
|
https://github.com/apache/dolphinscheduler/pull/11154
|
877441519711c729951ba811f91cdb088d4f1e96
|
a50f110d3e541a5b832825facea628cddec01e9e
| 2022-07-20T05:55:38Z |
java
| 2022-08-10T03:34:37Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/QueueServiceImpl.java
|
* @return update result code
*/
@Override
public Map<String, Object> updateQueue(User loginUser, int id, String queue, String queueName) {
Map<String, Object> result = new HashMap<>();
if (!canOperatorPermissions(loginUser,new Object[]{id}, AuthorizationType.QUEUE,YARN_QUEUE_UPDATE)) {
throw new ServiceException(Status.USER_NO_OPERATION_PERM);
}
Queue updateQueue = new Queue(id, queueName, queue);
Queue existsQueue = queueMapper.selectById(id);
updateQueueValid(existsQueue, updateQueue);
if (checkIfQueueIsInUsing(existsQueue.getQueueName(), updateQueue.getQueueName())) {
Integer relatedUserNums = userMapper.updateUserQueue(existsQueue.getQueueName(), updateQueue.getQueueName());
logger.info("old queue have related {} user, exec update user success.", relatedUserNums);
}
queueMapper.updateById(updateQueue);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* verify queue and queueName
*
* @param queue queue
* @param queueName queue name
* @return true if the queue name not exists, otherwise return false
*/
@Override
public Result<Object> verifyQueue(String queue, String queueName) {
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.