0 votes
in PDMLink by (user.hidden) (690 points)

1 Answer

0 votes
by (user.hidden) (690 points)
edited by (user.hidden)
public static HashMap getIBAValueMap(IBAHolder ibaHolder) throws Exception { 
        HashMap ibaValueMap = new HashMap();
        ibaHolder = IBAValueHelper.service.refreshAttributeContainer(ibaHolder, null, WTContext.getContext().getLocale(), null);
        //Logger logger = LogR.getLogger(Util.class.getName());

logger.info("Testing message");

DefaultAttributeContainer defaultattributecontainer = (DefaultAttributeContainer) ibaHolder.getAttributeContainer();        
        if (defaultattributecontainer != null){
            AbstractValueView aabstractvalueview[] = defaultattributecontainer.getAttributeValues();
            for (int i = 0; i < aabstractvalueview.length; i++) {
                String name = aabstractvalueview[i].getDefinition().getName();
                String value = null;
                if(aabstractvalueview[i] instanceof URLValueDefaultView) {
                   URLValueDefaultView urlv = (URLValueDefaultView) aabstractvalueview[i];
                   value = urlv.getDescription();
                }
                else {
                    value = IBAValueUtility.getLocalizedIBAValueDisplayString(aabstractvalueview[i], WTContext.getContext().getLocale());
                }

Object eValue = (Object) ibaValueMap.get(name);
                if(eValue == null){
                    ibaValueMap.put(name, value);
                } else {
                    ArrayList al = new ArrayList();
                    if(eValue instanceof ArrayList){
                        al = (ArrayList)eValue;
                        al.add(value);
                    } else {
                        al.add(eValue);
                        al.add(value);
                    }     
                    ibaValueMap.put(name, al);
                }
            }           
        }
        return ibaValueMap;
    }

 

Welcome to Windchill Guru, where you can ask questions and receive answers from other members of the community. I recommend everyone to Register

Categories

...