0%

Check_Attribute_Definition

public void checkAttributeDefinition(String strAttrName) throws Exception{
        System.out.println("Context user:" + context.getUser());
        String attName = strAttrName;
        AttributeType attrType = new AttributeType(attName);

        if(attrType != null) {
            attrType.open(context);
            System.out.println("Attribute Schema: " + attrType.getName());
            System.out.println("Max Length: " + attrType.getMaxLength());
            System.out.println("Is Multivalue: " + attrType.isMultiVal());
            System.out.println("Choices::" + attrType.getChoices());
            System.out.println("Is Multiline: " + attrType.isMultiLine());
            System.out.println("Is Range value: " + attrType.isRangeVal());
            System.out.println("Is Single value: " + attrType.isSingleVal());
            System.out.println("Is Hidden value: " + attrType.isHidden());
            System.out.println("Default Value:" + attrType.getDefaultValue());
            System.out.println("Data Type:" + attrType.getDataType());
            System.out.println("Attribute Description:" + attrType.getDescription());
            String queryTrigger = "print attribute \"" + attName + "\" select trigger dump |";
            System.out.println("Trigger::" + MqlUtil.mqlCommand(context, queryTrigger));
            System.out.println("Is Dimension Attribute: " + UOMUtil.isAssociatedWithDimension(context, attName));
            if (UOMUtil.isAssociatedWithDimension(context, attName)) {
                System.out.println("Attribute Dimension:" + attrType.getDimension(context));
            }
        }
        String queryType = "list type * select name attribute[" + attName + "] dump |";
        String result = MQLUtils.mql(context, queryType);
        String[] tempArr = result.split("\\n");
        StringList attDefinedType = new StringList();
        for(String strType: tempArr) {
            String[] tempType = strType.split("\\|");
            if(tempType.length > 1 && "True".equalsIgnoreCase(tempType[1])){
                attDefinedType.add(tempType[0]);
            }
        }
        if(attDefinedType.size() > 0){
            System.out.println("Defined on Fllowing Types::<" + String.join(",", attDefinedType) + ">.");
        }
    }