package cn.autoform.factory.impl;
|
|
import java.util.List;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Component;
|
|
import cn.autoform.factory.FormFactory;
|
import cn.autoform.factory.product.ProductMethod;
|
import cn.autoform.factory.product.ProductMethod.IOType;
|
import cn.autoform.util.thread.Keys;
|
import cn.autoform.util.thread.ThreadData;
|
import cn.autoform.util.tool.RequestContext;
|
import cn.autoform.web.mapper.formset.FormSetMapper;
|
|
@Component
|
public class ServicesFormFactoryImpl implements FormFactory {
|
|
@Autowired
|
FormSetMapper FormSetMapper;
|
|
@Autowired
|
private List<ProductMethod> productMethods;
|
|
@Override
|
public ProductMethod createFormMethod(IOType type) {
|
for (ProductMethod productMethod : productMethods) {
|
if (productMethod.getProductMethodThod().ordinal() == type.ordinal()) {
|
return productMethod;
|
}
|
}
|
return null;
|
}
|
|
@Override
|
public ProductMethod createFormMethod() {
|
return createFormMethod(getFlag());
|
}
|
|
private IOType getFlag(){
|
// String flag = FormSetMapper.getFlagByFormID(RequestContext.getFormId(), RequestContext.getTenantId());
|
// return "services".equals(flag) ? IOType.services : IOType.cloud;
|
return IOType.services;
|
}
|
}
|