Search in sources :

Example 1 with AMPipeDelimitAttrTokenizer

use of com.sun.identity.console.base.AMPipeDelimitAttrTokenizer in project OpenAM by OpenRock.

the class FederationViewBean method populateSAMLTable.

private void populateSAMLTable() {
    tablePopulated = true;
    FSSAMLServiceModel model = (FSSAMLServiceModel) getSAMLModel();
    Map attrValues = model.getAttributeValues();
    CCActionTableModel tblModel = (CCActionTableModel) propertySheetModel.getModel(SAML_TABLE);
    tblModel.clearAll();
    removePageSessionAttribute(SAML_TABLE_ATTRIBUTE);
    List cache = new ArrayList();
    for (Iterator iter = attrValues.keySet().iterator(); iter.hasNext(); ) {
        String name = (String) iter.next();
        Set values = (Set) attrValues.get(name);
        if (name.equals(TABLE_TRUSTED_PARTNERS)) {
            AMPipeDelimitAttrTokenizer tokenizer = AMPipeDelimitAttrTokenizer.getInstance();
            boolean firstEntry = true;
            int counter = 0;
            for (Iterator iter2 = values.iterator(); iter2.hasNext(); ) {
                if (!firstEntry) {
                    tblModel.appendRow();
                } else {
                    firstEntry = false;
                }
                String tokenizedValue = (String) iter2.next();
                Map map = AMAdminUtils.upCaseKeys(tokenizer.tokenizes(tokenizedValue));
                String partnerName = (String) map.get(SAMLConstants.PARTNERNAME);
                if (partnerName == null) {
                    partnerName = (String) map.get(SAMLConstants.SOURCEID);
                }
                tblModel.setValue(SAML_TRUSTED_PARTNER_VALUE, partnerName);
                tblModel.setValue(SAML_TRUSTED_PARTNER_HREF, Integer.toString(counter++));
                cache.add(tokenizedValue);
                // get trusted partner type
                SAMLPropertyXMLBuilder builder = SAMLPropertyXMLBuilder.getInstance();
                List profiles = (ArrayList) builder.getSAMLProperties(map);
                StringBuffer trustedPartnerSourceType = new StringBuffer();
                StringBuffer trustedPartnerDestinationType = new StringBuffer();
                int size = profiles.size();
                for (int i = 0; i < size; i++) {
                    if (((SAMLProperty) profiles.get(i)).getRole().equals("destination")) {
                        if (trustedPartnerDestinationType.length() != 0) {
                            trustedPartnerDestinationType.append(", ");
                        }
                        trustedPartnerDestinationType.append(getTrustedPartnersSelectType(((SAMLProperty) profiles.get(i)).getBindMethod()));
                    } else {
                        // source
                        if (trustedPartnerSourceType.length() != 0) {
                            trustedPartnerSourceType.append(", ");
                        }
                        trustedPartnerSourceType.append(getTrustedPartnersSelectType(((SAMLProperty) profiles.get(i)).getBindMethod()));
                    }
                }
                tblModel.setValue(SAML_TRUSTED_PARTNER_DESTINATION_TYPE, trustedPartnerDestinationType.toString());
                tblModel.setValue(SAML_TRUSTED_PARTNER_SOURCE_TYPE, trustedPartnerSourceType.toString());
            }
            break;
        }
    }
    setPageSessionAttribute(SAML_TABLE_ATTRIBUTE, (ArrayList) cache);
}
Also used : HashSet(java.util.HashSet) Set(java.util.Set) OrderedSet(com.sun.identity.shared.datastruct.OrderedSet) CCActionTableModel(com.sun.web.ui.model.CCActionTableModel) ArrayList(java.util.ArrayList) AMPipeDelimitAttrTokenizer(com.sun.identity.console.base.AMPipeDelimitAttrTokenizer) Iterator(java.util.Iterator) FSSAMLServiceModel(com.sun.identity.console.federation.model.FSSAMLServiceModel) ArrayList(java.util.ArrayList) OptionList(com.iplanet.jato.view.html.OptionList) List(java.util.List) HashMap(java.util.HashMap) Map(java.util.Map)

Example 2 with AMPipeDelimitAttrTokenizer

use of com.sun.identity.console.base.AMPipeDelimitAttrTokenizer in project OpenAM by OpenRock.

the class FSSAMLServiceViewBean method populatePipeSeparatedFormatTable.

private void populatePipeSeparatedFormatTable(String attrName, CCActionTableModel tmodel, Set values, String identifier, String columnName) {
    AMPipeDelimitAttrTokenizer tokenizer = AMPipeDelimitAttrTokenizer.getInstance();
    boolean firstEntry = true;
    int counter = 0;
    for (Iterator iter = values.iterator(); iter.hasNext(); counter++) {
        if (!firstEntry) {
            tmodel.appendRow();
        } else {
            firstEntry = false;
        }
        String tokenizedValue = (String) iter.next();
        Map map = AMAdminUtils.upCaseKeys(tokenizer.tokenizes(tokenizedValue));
        tmodel.setValue(columnName, (String) map.get(identifier));
        populateEditDupLink(tmodel, counter, attrName);
    }
}
Also used : AMPipeDelimitAttrTokenizer(com.sun.identity.console.base.AMPipeDelimitAttrTokenizer) Iterator(java.util.Iterator) HashMap(java.util.HashMap) Map(java.util.Map)

Aggregations

AMPipeDelimitAttrTokenizer (com.sun.identity.console.base.AMPipeDelimitAttrTokenizer)2 HashMap (java.util.HashMap)2 Iterator (java.util.Iterator)2 Map (java.util.Map)2 OptionList (com.iplanet.jato.view.html.OptionList)1 FSSAMLServiceModel (com.sun.identity.console.federation.model.FSSAMLServiceModel)1 OrderedSet (com.sun.identity.shared.datastruct.OrderedSet)1 CCActionTableModel (com.sun.web.ui.model.CCActionTableModel)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 List (java.util.List)1 Set (java.util.Set)1