本文整理汇总了Java中org.ofbiz.service.ModelParam类的典型用法代码示例。如果您正苦于以下问题:Java ModelParam类的具体用法?Java ModelParam怎么用?Java ModelParam使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ModelParam类属于org.ofbiz.service包,在下文中一共展示了ModelParam类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: induceFieldInfoFromServiceParam
import org.ofbiz.service.ModelParam; //导入依赖的package包/类
public boolean induceFieldInfoFromServiceParam(String defaultFieldType) {
if (UtilValidate.isEmpty(this.getServiceName()) || UtilValidate.isEmpty(this.getAttributeName())) return false;
DispatchContext dispatchContext = this.getModelForm().dispatchContext;
try {
ModelService modelService = dispatchContext.getModelService(this.getServiceName());
if (modelService != null) {
ModelParam modelParam = modelService.getParam(this.getAttributeName());
if (modelParam != null) {
if (UtilValidate.isNotEmpty(modelParam.entityName) && UtilValidate.isNotEmpty(modelParam.fieldName)) {
this.entityName = modelParam.entityName;
this.fieldName = modelParam.fieldName;
if (this.induceFieldInfoFromEntityField(defaultFieldType)) {
return true;
}
}
this.induceFieldInfoFromServiceParam(modelService, modelParam, defaultFieldType);
return true;
}
}
} catch (GenericServiceException e) {
Debug.logError(e, "error getting service parameter definition for auto-field with serviceName: " + this.getServiceName() + ", and attributeName: " + this.getAttributeName(), module);
}
return false;
}
示例2: getAutoFieldsServiceTag
import org.ofbiz.service.ModelParam; //导入依赖的package包/类
private void getAutoFieldsServiceTag(Element element, Set<String> fieldNames) throws GenericServiceException {
String serviceName = UtilFormatOut.checkNull(element.getAttribute("service-name"));
String defaultFieldType = UtilFormatOut.checkNull(element.getAttribute("default-field-type"));
if (UtilValidate.isNotEmpty(serviceName) && (!("hidden".equals(defaultFieldType)))) {
ModelService modelService = dispatchContext.getModelService(serviceName);
List<ModelParam> modelParams = modelService.getInModelParamList();
Iterator<ModelParam> modelParamIter = modelParams.iterator();
while (modelParamIter.hasNext()) {
ModelParam modelParam = modelParamIter.next();
// skip auto params that the service engine populates...
if ("userLogin".equals(modelParam.name) || "locale".equals(modelParam.name) || "timeZone".equals(modelParam.name)) {
continue;
}
if (modelParam.formDisplay) {
if (UtilValidate.isNotEmpty(modelParam.entityName) && UtilValidate.isNotEmpty(modelParam.fieldName)) {
ModelEntity modelEntity;
modelEntity = delegator.getModelEntity(modelParam.entityName);
if (modelEntity != null) {
ModelField modelField = modelEntity.getField(modelParam.fieldName);
if (modelField != null) {
fieldNames.add(modelField.getName());
}
}
}
}
}
}
}
示例3: induceFieldInfoFromServiceParam
import org.ofbiz.service.ModelParam; //导入依赖的package包/类
private boolean induceFieldInfoFromServiceParam(String defaultFieldType, ModelReader entityModelReader,
DispatchContext dispatchContext) {
if (UtilValidate.isEmpty(this.getServiceName()) || UtilValidate.isEmpty(this.getAttributeName()))
return false;
try {
ModelService modelService = dispatchContext.getModelService(this.getServiceName());
if (modelService != null) {
ModelParam modelParam = modelService.getParam(this.getAttributeName());
if (modelParam != null) {
if (UtilValidate.isNotEmpty(modelParam.entityName) && UtilValidate.isNotEmpty(modelParam.fieldName)) {
this.entityName = modelParam.entityName;
this.fieldName = modelParam.fieldName;
if (this.induceFieldInfoFromEntityField(defaultFieldType, entityModelReader)) {
return true;
}
}
this.induceFieldInfoFromServiceParam(modelService, modelParam, defaultFieldType);
return true;
}
}
} catch (GenericServiceException e) {
Debug.logError(e,
"error getting service parameter definition for auto-field with serviceName: " + this.getServiceName()
+ ", and attributeName: " + this.getAttributeName(), module);
}
return false;
}
示例4: addFieldFromServiceParam
import org.ofbiz.service.ModelParam; //导入依赖的package包/类
public ModelFormField addFieldFromServiceParam(ModelService modelService, ModelParam modelParam, String defaultFieldType, int defaultPosition) {
// create field def from service param def
ModelFormField newFormField = new ModelFormField(this);
newFormField.setName(modelParam.name);
newFormField.setServiceName(modelService.name);
newFormField.setAttributeName(modelParam.name);
newFormField.setTitle(modelParam.formLabel);
newFormField.setRequiredField(!modelParam.optional);
newFormField.induceFieldInfoFromServiceParam(modelService, modelParam, defaultFieldType);
newFormField.setPosition(defaultPosition);
return this.addUpdateField(newFormField);
}
示例5: getParametersMap
import org.ofbiz.service.ModelParam; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public Map<String, String> getParametersMap(Map<String, Object> context, String defaultServiceName) {
Map<String, String> autServiceParams = new HashMap<String, String>();
LocalDispatcher dispatcher = (LocalDispatcher) context.get("dispatcher");
if (dispatcher == null) {
Debug.logError(
"We can not append auto service Parameters since we could not find dispatcher in the current context",
module);
return autServiceParams;
}
if (UtilValidate.isEmpty(serviceName))
serviceName = defaultServiceName;
FlexibleStringExpander toExpand = FlexibleStringExpander.getInstance(serviceName);
ModelService service = null;
try {
service = dispatcher.getDispatchContext().getModelService(toExpand.toString());
} catch (GenericServiceException e) {
Debug.logError("Resolve service throw an error : " + e, module);
}
if (service == null) {
Debug.logError("We can not append auto service Parameters since we could not find service with name ["
+ serviceName + "]", module);
return autServiceParams;
}
Iterator<ModelParam> paramsIter = service.getInModelParamList().iterator();
if (paramsIter != null) {
while (paramsIter.hasNext()) {
ModelParam param = paramsIter.next();
if (param.getInternal())
continue;
String paramName = param.getName();
FlexibleMapAccessor<Object> fma = FlexibleMapAccessor.getInstance(paramName);
if (!excludeList.contains(paramName)) {
Object flexibleValue = fma.get(context);
if (UtilValidate.isEmpty(flexibleValue) && context.containsKey("parameters")) {
flexibleValue = fma.get((Map<String, ? extends Object>) context.get("parameters"));
}
if (UtilValidate.isNotEmpty(flexibleValue) || sendIfEmpty) {
autServiceParams.put(paramName, String.valueOf(flexibleValue));
}
}
}
}
return autServiceParams;
}