Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[Feature-10983] [refactor] ResourcesController #10998

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* 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.dto.resources;

import org.apache.dolphinscheduler.spi.enums.ResourceType;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
* create directory request
*/
@Data
@ApiModel(value = "CREATE_RESOURCE_NOTES")
public class CreateDirectoryRequest {

@ApiModelProperty(name = "type", value = "RESOURCE_TYPE", required = true, example = "FILE")
private ResourceType type;

@ApiModelProperty(name = "name", value = "RESOURCE_NAME", required = true)
private String name;

@ApiModelProperty(name = "description", value = "RESOURCE_DESC")
private String description;

@ApiModelProperty(name = "pid", value = "RESOURCE_PID", required = true, example = "10")
private int pid;

@ApiModelProperty(name = "currentDir", value = "RESOURCE_CURRENT_DIR", required = true, example = "firstDir")
private String currentDir;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
* 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.dto.resources;

import org.apache.dolphinscheduler.spi.enums.ResourceType;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
* create resource request
*/
@Data
public class CreateResourceRequest {

@ApiModelProperty(name = "type", value = "RESOURCE_TYPE", notes = "FILE , UDF", required = true, example = "FILE")
private ResourceType type;

@ApiModelProperty(name = "fileName", value = "RESOURCE_NAME", required = true)
private String fileName;

@ApiModelProperty(name = "suffix", value = "SUFFIX", required = true)
private String suffix;

@ApiModelProperty(name = "description", value = "RESOURCE_DESC")
private String description;

@ApiModelProperty(name = "pid", value = "RESOURCE_PID", required = true, example = "10")
private int pid;

@ApiModelProperty(name = "content", value = "CONTENT", required = true)
private String content;

@ApiModelProperty(name = "currentDir", value = "RESOURCE_CURRENT_DIR", required = true, example = "firstDir")
private String currentDir;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* 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.dto.resources;

import org.apache.dolphinscheduler.api.utils.Result;

/**
* create resource response
*/
public class CreateResourceResponse extends Result {

private Object data;

public CreateResourceResponse(Result<Object> result) {
super();
this.setCode(result.getCode());
this.setMsg(result.getMsg());
this.setData(result.getData());
}

@Override
public Object getData() {
return data;
}

@Override
public void setData(Object data) {
this.data = data;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* 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.dto.resources;

import org.apache.dolphinscheduler.common.enums.UdfType;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
* create udf request
*/
@Data
public class CreateUdfRequest {

@ApiModelProperty(name = "type", value = "UDF_TYPE", required = true, dataType = "UdfType", example = "HIVE,SPARK")
private UdfType type;

@ApiModelProperty(name = "funcName", value = "FUNC_NAME", required = true, dataType = "String", example = "evaluate")
private String funcName;

@ApiModelProperty(name = "className", value = "CLASS_NAME", required = true, dataType = "String", example = "GetLength")
private String className;

@ApiModelProperty(name = "argTypes", value = "ARG_TYPES", dataType = "String", example = "String")
private String argTypes;

@ApiModelProperty(name = "database", value = "DATABASE_NAME", dataType = "String", example = "db")
private String database;

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

package org.apache.dolphinscheduler.api.dto.resources;

import lombok.Data;

/**
* resource content
*/
@Data
public class ResourceContent {

private String content;

private String alias;

private String fileName;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* 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.dto.resources;

import org.apache.dolphinscheduler.api.utils.Result;

/**
* resource response
*/
public class ResourceContentResponse extends Result<Object> {

private Object data;

public ResourceContentResponse(Result<Object> result) {
super();
this.setCode(result.getCode());
this.setMsg(result.getMsg());
this.setData(result.getData());
}

@Override
public Object getData() {
return data;
}

@Override
public void setData(Object data) {
this.data = data;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
* 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.dto.resources;

import org.apache.dolphinscheduler.api.enums.Status;
import org.apache.dolphinscheduler.api.utils.Result;
import org.apache.dolphinscheduler.common.Constants;

import java.util.List;
import java.util.Map;

/**
* resource list response
*/
public class ResourceListResponse extends Result<List<ResourceComponent>> {

private List<ResourceComponent> data;

public ResourceListResponse(Result<Object> result) {
super();
this.setCode(result.getCode());
this.setMsg(result.getMsg());
this.setData((List<ResourceComponent>) result.getData());
}

public ResourceListResponse(Map<String, Object> result) {
super();
Status status = (Status) result.get(Constants.STATUS);
if (null != status) {
this.setCode(status.getCode());
}
this.setMsg((String) result.get(Constants.MSG));
this.setData((List<ResourceComponent>) result.get(Constants.DATA_LIST));
}

@Override
public List<ResourceComponent> getData() {
return data;
}

@Override
public void setData(List<ResourceComponent> data) {
this.data = data;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* 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.dto.resources;

import org.apache.dolphinscheduler.api.utils.PageInfo;
import org.apache.dolphinscheduler.api.utils.Result;
import org.apache.dolphinscheduler.dao.entity.Resource;

/**
* resource page response
*/
public class ResourcePageResponse extends Result<PageInfo<Resource>> {

private PageInfo<Resource> data;

public ResourcePageResponse(Result<PageInfo<Resource>> result) {
super();
this.setCode(result.getCode());
this.setMsg(result.getMsg());
this.setData(result.getData());
}

@Override
public PageInfo<Resource> getData() {
return data;
}

@Override
public void setData(PageInfo<Resource> data) {
this.data = data;
}
}
Loading