zhongrj
2024-12-24 64e6ac37d0bc034f849efa1d94792a7ef97c3adb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package org.springblade.modules.resource.rule.oss;
 
import com.yomahub.liteflow.annotation.LiteflowComponent;
import com.yomahub.liteflow.core.NodeComponent;
import org.springblade.core.oss.props.OssProperties;
import org.springblade.modules.resource.rule.context.OssContext;
import org.springblade.modules.resource.entity.Oss;
 
/**
 * OSS数据创建
 *
 * @author Chill
 */
@LiteflowComponent(id = "ossDataRule", name = "OSS数据创建")
public class OssDataRule extends NodeComponent {
    @Override
    public void process() throws Exception {
        OssContext contextBean = this.getContextBean(OssContext.class);
        String prefix = contextBean.getPrefix();
        Oss oss = contextBean.getOss();
        OssProperties ossProperties = contextBean.getOssProperties();
        // 若采用默认设置则开启多租户模式, 若是用户自定义oss则不开启
        if (oss.getEndpoint().equals(ossProperties.getEndpoint()) && oss.getAccessKey().equals(ossProperties.getAccessKey()) && ossProperties.getTenantMode()) {
            contextBean.setOssRule(new MyOssRule(Boolean.TRUE,prefix));
        } else {
            contextBean.setOssRule(new MyOssRule(Boolean.FALSE,prefix));
        }
    }
}