01: package com.sun.portal.sra.admin.util;
02:
03: import java.util.ArrayList;
04: import java.util.List;
05:
06: import com.sun.portal.admin.common.AttributeInfo;
07: import com.sun.identity.sm.AttributeSchema;
08:
09: public class HandlerUtils {
10:
11: public static int getPrivilegeInteger(String key) {
12: if (key.equals(""))
13: return AttributeInfo.READ_ONLY;
14: else
15: return AttributeInfo.READ_WRITE;
16: }
17:
18: public static int getTypeIntegerValue(AttributeSchema.Type type) {
19: String typeStr = type.toString();
20: if (typeStr.equals("list"))
21: return AttributeInfo.LIST_STRING;
22: else if (typeStr.equals("single"))
23: return AttributeInfo.SINGLE_STRING;
24: else if (typeStr.equals("multiple_choice"))
25: return AttributeInfo.MULTIPLE_CHOICE_STRING;
26: return AttributeInfo.UNKOWN_TYPE;
27: }
28:
29: public static List updateAttributeMap(AttributeSchema attribSchema) {
30: ArrayList valueList = new ArrayList();
31:
32: valueList.add(new Integer(getTypeIntegerValue(attribSchema
33: .getType())));
34: valueList.add("TODO: Default Description");
35: valueList.add(new Integer(getPrivilegeInteger(attribSchema
36: .getI18NKey())));
37: return valueList;
38: }
39:
40: }
|