• TC设置LOV属性


    TCProperty property = item.getLatestItemRevision().getTCProperty("xxx_lll_xxx");
    String lovTrueValueByDisplayValue1 = LOVUtil.getInstance().getLOVValueByDisplayValue(property.getLOV(), "组内");
    LOVUtil.getInstance().setStringTCLOVProperty(property,lovTrueValueByDisplayValue1);
    
    public String getLOVValueByDisplayValue(TCComponentListOfValues lov, Object object) {
    		if (lov == null) {
    			return "";
    		}
    		try {
    			TCComponentListOfValues[] childs = lov.getListOfFilters();
    			for (int i = 0; i < childs.length; i++) {
    				try {
    					if (childs[i] == null) {
    						continue;
    					}
    					String tmp = getLOVValueByDisplayValue(childs[i], object);
    					if (StringUtils.isNotEmpty(tmp)) {
    						return tmp;
    					}
    				} catch (Exception e) {
    					e.printStackTrace();
    				}
    			}
    			// 取LOV所有值与属性
    			ListOfValuesInfo valuesInfo = lov.getListOfValues(true);
    			Object[] values = valuesInfo.getListOfValues();
    			// String[] descriptions = valuesInfo.getDescriptions();
    			// 取值对应的属性
    			for (int i = 0; i < values.length; i++) {
    				if (valuesInfo.getDisplayableValue(values[i]).equals(object)) {
    					return values[i].toString();
    				}
    			}
    		} catch (Exception tce) {
    			tce.printStackTrace();
    			return "";
    		}
    		return "";
    	}
    
    public void setStringTCLOVProperty(TCProperty property,String value) {
    		try {
    			if(property.getLOV() != null) {
    				int type = property.getPropertyType();
    				String lovTrueValueByDisplayValue = LOVUtil.getInstance().getLOVValueByDisplayValue(property.getLOV(), value); //
    				if(lovTrueValueByDisplayValue != null) {
    					if(TCProperty.PROP_int == type) {
    						if(lovTrueValueByDisplayValue.trim().length() > 0){
    							int intValue = Integer.parseInt(lovTrueValueByDisplayValue);
    							property.setIntValue(intValue);
    						}else {
    							property.setNullVerdict(true);
    						}
    					}else if(TCProperty.PROP_double == type) {
    						if(lovTrueValueByDisplayValue.trim().length() > 0){
    							double doubleValue = Double.parseDouble(lovTrueValueByDisplayValue);
    							property.setDoubleValue(doubleValue);
    						}else {
    							property.setNullVerdict(true);
    						}
    					}else if(TCProperty.PROP_string == type) {
    						property.setStringValue(value);
    					}else {
    						property.setStringValue(value);
    					}
    				}
    			}
    		}catch (TCException e) {
    			e.printStackTrace();
    		}
    	}
  • 相关阅读:
    c++11之智能指针
    SurfaceFlinger与Surface概述
    android GUI 流程记录
    文章收藏
    android performance
    POJ3349
    java中的volatile和synchronized
    [原创]分期还款的名义利率与真实利率
    Java IO 流总结
    telegram
  • 原文地址:https://www.cnblogs.com/wwssgg/p/15464370.html
Copyright © 2020-2023  润新知