package cn.com.origin.autocode.jfom.util;

import java.util.ArrayList;
import java.util.List;

import com.teamcenter.rac.kernel.TCPreferenceService;

public class test {
	
	public static void main(String[] args) {
		
		List<String> list1 = new ArrayList<String>();
		list1.add("");
		list1.add("");
		list1.add("qq");
		list1.add("qq");
		list1.add("qq222s");
		System.out.println(list1.indexOf("ww"));
		
		System.out.println();
		System.out.println();
		
		String[] prefValues = {"aaa|111:aa/22:bb/33:cc","bbb|111:aa/22:bb/33:cc"};
		if (prefValues != null) {
			for (String value : prefValues) {
				JFomBZJBean bean = new JFomBZJBean();
				List<String> zhNameList = new ArrayList<String>();
				List<String> enNameList = new ArrayList<String>();
				String keyStr = null;
				String[] values = value.split("\\|");
				if (values != null && values.length == 2){
					keyStr = values[0];
					String[] values2 = values[1].split("\\/");
					if(values2!=null && values2.length>0){
						for(String names : values2){
							String[] values3 = names.split("\\:");
							if(values3!=null && values3.length==2){
								zhNameList.add(values3[0]);
								enNameList.add(values3[1]);
								System.out.println( values3[0] + "  |  "+values3[1]);
							}
						}
					}
				}
				System.out.println(keyStr);
				bean.setZhName(zhNameList);
				bean.setEnName(enNameList);
				//formMap.put(keyStr, bean);
			}
		}
		
		System.out.println();
		
		 prefValues = new String[]{"Item@true@Item,prop1:属性1/prop2:属性2|Rev,prop1:属性1/prop2:属性2|Form,prop1:属性1/prop2:属性2",
				"Desgin@true@||Form,prop1:属性1/prop2:属性2"};
		//for(String str:strs){
		String desc = "12::aaaa";
		String bzjFL = desc.substring(desc.indexOf("::")+2,desc.length());
		System.out.println(bzjFL);
		
		System.out.println("");

			for (String value : prefValues) {
				System.out.println("");
				JFomBean bean = new JFomBean();
				String[] values1 = value.split("@");
				if (values1.length != 3) {
					return ;
				}
				// 设置类型
				bean.setItemType(values1[0]);
				System.out.println("Type = "+values1[0]);
				if (values1[1].trim().toUpperCase().endsWith("TRUE")) {
					// 设置单位
					bean.setIsHaveUnit(true);
					
				}
				System.out.println("Boolean = "+ values1[1]);
				// 分割属性
				String[] values2 = values1[2].split("\\|");
				if (values2.length != 3) {
					return ;
				}
				// 对象属性
				String[] items = values2[0].split("\\,");
				if (items != null && items.length == 2) {
					String[] props1 = items[1].split("\\/");
					if(props1!=null && props1.length>0){
						List<String> propRelList = new ArrayList<String>();
						List<String> propDisList = new ArrayList<String>();
						for(String prop:props1){
							String[] props = prop.split("\\:");
							if(props!=null && props.length==2){
								propRelList.add(props[0]);
								propDisList.add(props[1]);
								System.out.print("ITEM REL = "+props[0] + "| DIS = "+props[1]);;
							}
						}
						bean.setItemRelPropList(propRelList);
						//bean.setItemDisPropList(propDisList);
					}
				}
				System.out.println("");
				// 版本属性
				String[] revs = values2[1].split("\\,");
				if (revs != null && revs.length == 2) {
					String[] props1 = revs[1].split("\\/");
					if(props1!=null && props1.length>0){
						List<String> propRelList = new ArrayList<String>();
						List<String> propDisList = new ArrayList<String>();
						for(String prop:props1){
							String[] props = prop.split("\\:");
							if(props!=null && props.length==2){
								propRelList.add(props[0]);
								propDisList.add(props[1]);
								System.out.print("REV REL = "+props[0] + "| DIS = "+props[1]);;
								
							}
						}
						bean.setRevRelPropList(propRelList);
						//bean.setRevDisPropList(propDisList);
					}
				}
				System.out.println("");
				// 表单属性
				String[] forms = values2[2].split("\\,");
				if (forms != null && forms.length == 2) {
					String[] props1 = forms[1].split("\\/");
					if(props1!=null && props1.length>0){
						List<String> propRelList = new ArrayList<String>();
						List<String> propDisList = new ArrayList<String>();
						for(String prop:props1){
							String[] props = prop.split("\\:");
							if(props!=null && props.length==2){
								propRelList.add(props[0]);
								propDisList.add(props[1]);
								System.out.print("FORM REL = "+props[0] + "| DIS = "+props[1]);;
							}
						}
						bean.setFormRelPropList(propRelList);
						//bean.setFormDisPropList(propDisList);
					}
				}
				//beanList.add(bean);
			}
		
		}
	}

//}
