}
}
private static AttributeSet compile(Hashtable ht, int vcsid)
{
AttributeSet attrSet = new AttributeSet();
attrSet.setAttributeSetID(vcsid);
int cnt = ht.size();
Enumeration iter = ht.keys();
String key;
Object val;
AttrInfo info;
ArrayList al;
Attribute attr = null;
while(iter.hasMoreElements())
{
key = iter.nextElement().toString();
val = ht.get(key);
if (val instanceof ArrayList)
{
al = (ArrayList)val;
cnt = al.size();
// Option Other
if (cnt == 2)
{
AttrInfo info0 = (AttrInfo)al.get(0);
AttrInfo info1 = (AttrInfo)al.get(1);
if (info0.typeId == AttributeTypes.ATTR_ID)
{
attr = ExtractAttr2(info0, info1);
attrSet.add(attr);
}
else if (info1.typeId == AttributeTypes.ATTR_ID)
{
attr = ExtractAttr2(info1, info0);
attrSet.add(attr);
}
else
{
//Unknow type.
}
}
// DateTime
else if (cnt == 3)
{
YMD ymd = new YMD(null, null, null);
for (int i = 0; i < cnt; i ++)
{
info = (AttrInfo)al.get(i);
switch(info.typeId)
{
case AttributeTypes.ATTR_DATE_D:
ymd.day = info.val[0];
break;
case AttributeTypes.ATTR_DATE_M:
ymd.month = info.val[0];
break;
case AttributeTypes.ATTR_DATE_Y:
ymd.year = info.val[0];
break;
}
}
YMD.FixYMD(ymd);
if (ymd.day != null && ymd.month!= null && ymd.year != null)
{
info = (AttrInfo)al.get(0);
ArrayList_removeRange(al, 0, cnt);
info.typeId = AttributeTypes.ATTR_TEXT_DATE;
info.val = new String[] { ymd.year + ymd.month + ymd.day };
al.add(info);
attr = ExtractAttr(info);
((Value)attr.getValue()[0]).setValueID(new Integer(ValueIds.COMPLETE_TEXT_DATE));
//attr.ValueList[0].ValueId = (int)ValueIds.COMPLETE_TEXT_DATE;
attrSet.add(attr);
}
}
}
else
{
info = (AttrInfo) val;
// Only year field.
if( info.typeId == AttributeTypes.ATTR_DATE_Y )
{
info.typeId = AttributeTypes.ATTR_DATE_Y;
info.val = info.val;
attr = ExtractAttr(info);
//((Value)attr.getValue()[0]).setValueID(new Integer(ValueIds.COMPLETE_TEXT_DATE));
((Value)attr.getValue()[0]).setValueID(new Integer(ValueIds.TEXT));
attrSet.add(attr);
}
else
{
attr = ExtractAttr(info);
if( attr.getType() == AttributeTypes.ATTR_TEXT )
{
((Value)attr.getValue()[0]).setValueID(new Integer(ValueIds.TEXT));
//attr.ValueList[0].ValueId = (int) ValueIds.TEXT;
}
attrSet.add(attr);
}
}
}
return attrSet;