Skip to content

Commit

Permalink
1.fix osc personal space obtain cloud main account id error
Browse files Browse the repository at this point in the history
  • Loading branch information
krihy committed Sep 14, 2023
1 parent 17825e4 commit 6c3e3ec
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -840,6 +840,7 @@ private void initVariables(Map<String, Object> variables, TaskEntity taskEntity,
FlowTaskUtil.setTaskCreator(variables, authenticationFacade.currentUser());
FlowTaskUtil.setTaskSubmitter(variables, JsonUtils.fromJson(taskEntity.getSubmitter(), ExecutorInfo.class));
FlowTaskUtil.setRiskLevelDescriber(variables, riskLevelDescriber);
FlowTaskUtil.setCloudMainAccountId(variables, authenticationFacade.currentUser().getUid());
}

private TemplateVariables buildTemplateVariables(CreateFlowInstanceReq flowInstanceReq, ConnectionConfig config) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,6 @@ public class RuntimeTaskConstants {
public static final String RISKLEVEL_DESCRIBER = "riskLevelDescriber";
public static final String RISKLEVEL = "riskLevel";
public static final String SUCCESS_CREATE_EXT_INS = "successCreateExternalApprovalInstance";
public static final String CLOUD_MAIN_ACCOUNT_ID = "cloudMainAccountId";

}
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,15 @@ public static Long getTaskId(@NonNull DelegateExecution execution) {
return internalGet(value, Long.class).orElseThrow(() -> new VerifyException("TaskId is absent"));
}

public static void setCloudMainAccountId(@NonNull Map<String, Object> variables, String cloudMainAccountId) {
variables.put(RuntimeTaskConstants.CLOUD_MAIN_ACCOUNT_ID, cloudMainAccountId);
}

public static String getCloudMainAccountId(@NonNull DelegateExecution execution) {
Object value = execution.getVariables().get(RuntimeTaskConstants.CLOUD_MAIN_ACCOUNT_ID);
return internalGet(value, String.class).orElseThrow(() -> new VerifyException("Cloud main account is absent"));
}

public static void setSchemaName(@NonNull Map<String, Object> variables, @NonNull String schema) {
variables.put(RuntimeTaskConstants.SCHEMA_NAME, schema);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
import com.oceanbase.odc.service.flow.task.model.OnlineSchemaChangeTaskResult;
import com.oceanbase.odc.service.flow.util.FlowTaskUtil;
import com.oceanbase.odc.service.iam.OrganizationService;
import com.oceanbase.odc.service.iam.model.Organization;
import com.oceanbase.odc.service.iam.model.User;
import com.oceanbase.odc.service.onlineschemachange.model.OnlineSchemaChangeParameters;
import com.oceanbase.odc.service.onlineschemachange.model.OnlineSchemaChangeScheduleTaskParameters;
Expand Down Expand Up @@ -98,9 +97,7 @@ protected Void start(Long taskId, TaskService taskService, DelegateExecution exe
this.status = TaskStatus.RUNNING;
this.flowTaskId = taskId;
// for public cloud
Optional<Organization> organization = organizationService.get(organizationId);
String uid = organization.get().getName();

String uid = FlowTaskUtil.getCloudMainAccountId(execution);
OnlineSchemaChangeParameters parameter = FlowTaskUtil.getOnlineSchemaChangeParameter(execution);
ConnectionConfig connectionConfig = FlowTaskUtil.getConnectionConfig(execution);
String schema = FlowTaskUtil.getSchemaName(execution);
Expand Down

0 comments on commit 6c3e3ec

Please sign in to comment.