private void createExtendedObject(String realm,String entityName,String location,String role) throws SAML2MetaException, JAXBException, AMConsoleException {
  SAML2MetaManager samlManager=getSAML2MetaManager();
  EntityDescriptorElement entityDescriptor=samlManager.getEntityDescriptor(realm,entityName);
  ObjectFactory objFactory=new ObjectFactory();
  EntityConfigElement entityConfigElement=objFactory.createEntityConfigElement();
  entityConfigElement.setEntityID(entityName);
  if (location.equals("remote")) {
    entityConfigElement.setHosted(false);
  }
 else {
    entityConfigElement.setHosted(true);
  }
  List configList=entityConfigElement.getIDPSSOConfigOrSPSSOConfigOrAuthnAuthorityConfig();
  BaseConfigType baseConfigIDP=null;
  BaseConfigType baseConfigSP=null;
  BaseConfigType baseConfigAuth=null;
  AttributeAuthorityDescriptorElement attrauthDescriptor=samlManager.getAttributeAuthorityDescriptor(realm,entityName);
  AuthnAuthorityDescriptorElement authnauthDescriptor=samlManager.getAuthnAuthorityDescriptor(realm,entityName);
  AttributeQueryDescriptorElement attrQueryDescriptor=samlManager.getAttributeQueryDescriptor(realm,entityName);
  IDPSSODescriptorElement idpssoDesc=samlManager.getIDPSSODescriptor(realm,entityName);
  SPSSODescriptorElement spssoDesc=samlManager.getSPSSODescriptor(realm,entityName);
  XACMLAuthzDecisionQueryDescriptorElement xacmlAuthzDescriptor=samlManager.getPolicyEnforcementPointDescriptor(realm,entityName);
  XACMLPDPDescriptorElement xacmlPDPDescriptor=samlManager.getPolicyDecisionPointDescriptor(realm,entityName);
  if (isDualRole(entityDescriptor)) {
    baseConfigIDP=objFactory.createIDPSSOConfigElement();
    baseConfigSP=objFactory.createSPSSOConfigElement();
    baseConfigIDP=addAttributeType(extendedMetaIdpMap,baseConfigIDP);
    baseConfigSP=addAttributeType(extendedMetaSpMap,baseConfigSP);
    configList.add(baseConfigIDP);
    configList.add(baseConfigSP);
  }
 else   if (role.equals(EntityModel.IDENTITY_PROVIDER) || (idpssoDesc != null)) {
    baseConfigIDP=objFactory.createIDPSSOConfigElement();
    baseConfigIDP=addAttributeType(extendedMetaIdpMap,baseConfigIDP);
    configList.add(baseConfigIDP);
  }
 else   if (role.equals(EntityModel.SERVICE_PROVIDER) || (spssoDesc != null)) {
    baseConfigSP=objFactory.createSPSSOConfigElement();
    baseConfigSP=addAttributeType(extendedMetaSpMap,baseConfigSP);
    configList.add(baseConfigSP);
  }
  if (role.equals(EntityModel.SAML_ATTRAUTHORITY) || (attrauthDescriptor != null)) {
    baseConfigAuth=objFactory.createAttributeAuthorityConfigElement();
    baseConfigAuth=addAttributeType(extAttrAuthMap,baseConfigAuth);
    configList.add(baseConfigAuth);
  }
  if (role.equals(EntityModel.SAML_AUTHNAUTHORITY) || (authnauthDescriptor != null)) {
    baseConfigAuth=objFactory.createAuthnAuthorityConfigElement();
    baseConfigAuth=addAttributeType(extAuthnAuthMap,baseConfigAuth);
    configList.add(baseConfigAuth);
  }
  if (role.equals(EntityModel.SAML_ATTRQUERY) || (attrQueryDescriptor != null)) {
    baseConfigAuth=objFactory.createAttributeQueryConfigElement();
    baseConfigAuth=addAttributeType(extattrQueryMap,baseConfigAuth);
    configList.add(baseConfigAuth);
  }
  if (role.equals(EntityModel.POLICY_DECISION_POINT_DESCRIPTOR) || (xacmlPDPDescriptor != null)) {
    baseConfigAuth=objFactory.createXACMLPDPConfigElement();
    baseConfigAuth=addAttributeType(xacmlPDPExtendedMeta,baseConfigAuth);
    configList.add(baseConfigAuth);
  }
  if (role.equals(EntityModel.POLICY_ENFORCEMENT_POINT_DESCRIPTOR) || (xacmlAuthzDescriptor != null)) {
    baseConfigAuth=objFactory.createXACMLAuthzDecisionQueryConfigElement();
    baseConfigAuth=addAttributeType(xacmlPEPExtendedMeta,baseConfigAuth);
    configList.add(baseConfigAuth);
  }
  samlManager.setEntityConfig(realm,entityConfigElement);
}

private void createExtendedObject ( String realm , String entityName , String location , String role ) throws SAML2MetaException , JAXBException , AMConsoleException { SAML2MetaManager samlManager = getSAML2MetaManager ( ) ; EntityDescriptorElement entityDescriptor = samlManager . getEntityDescriptor ( realm , entityName ) ; ObjectFactory objFactory = new ObjectFactory ( ) ; EntityConfigElement entityConfigElement = objFactory . createEntityConfigElement ( ) ; entityConfigElement . setEntityID ( entityName ) ; if ( location . equals ( "remote" ) ) { entityConfigElement . setHosted ( false ) ; } else { entityConfigElement . setHosted ( true ) ; } List configList = entityConfigElement . getIDPSSOConfigOrSPSSOConfigOrAuthnAuthorityConfig ( ) ; BaseConfigType baseConfigIDP = null ; BaseConfigType baseConfigSP = null ; BaseConfigType baseConfigAuth = null ; AttributeAuthorityDescriptorElement attrauthDescriptor = samlManager . getAttributeAuthorityDescriptor ( realm , entityName ) ; AuthnAuthorityDescriptorElement authnauthDescriptor = samlManager . getAuthnAuthorityDescriptor ( realm , entityName ) ; AttributeQueryDescriptorElement attrQueryDescriptor = samlManager . getAttributeQueryDescriptor ( realm , entityName ) ; IDPSSODescriptorElement idpssoDesc = samlManager . getIDPSSODescriptor ( realm , entityName ) ; SPSSODescriptorElement spssoDesc = samlManager . getSPSSODescriptor ( realm , entityName ) ; XACMLAuthzDecisionQueryDescriptorElement xacmlAuthzDescriptor = samlManager . getPolicyEnforcementPointDescriptor ( realm , entityName ) ; XACMLPDPDescriptorElement xacmlPDPDescriptor = samlManager . getPolicyDecisionPointDescriptor ( realm , entityName ) ; if ( isDualRole ( entityDescriptor ) ) { baseConfigIDP = objFactory . createIDPSSOConfigElement ( ) ; baseConfigSP = objFactory . createSPSSOConfigElement ( ) ; baseConfigIDP = addAttributeType ( extendedMetaIdpMap , baseConfigIDP ) ; baseConfigSP = addAttributeType ( extendedMetaSpMap , baseConfigSP ) ; configList . add ( baseConfigIDP ) ; configList . add ( baseConfigSP ) ; } else if ( role . equals ( EntityModel . IDENTITY_PROVIDER ) || ( idpssoDesc != null ) ) { baseConfigIDP = objFactory . createIDPSSOConfigElement ( ) ; baseConfigIDP = addAttributeType ( extendedMetaIdpMap , baseConfigIDP ) ; configList . add ( baseConfigIDP ) ; } else if ( role . equals ( EntityModel . SERVICE_PROVIDER ) || ( spssoDesc != null ) ) { baseConfigSP = objFactory . createSPSSOConfigElement ( ) ; baseConfigSP = addAttributeType ( extendedMetaSpMap , baseConfigSP ) ; configList . add ( baseConfigSP ) ; } if ( role . equals ( EntityModel . SAML_ATTRAUTHORITY ) || ( attrauthDescriptor != null ) ) { baseConfigAuth = objFactory . createAttributeAuthorityConfigElement ( ) ; baseConfigAuth = addAttributeType ( extAttrAuthMap , baseConfigAuth ) ; configList . add ( baseConfigAuth ) ; } if ( role . equals ( EntityModel . SAML_AUTHNAUTHORITY ) || ( authnauthDescriptor != null ) ) { baseConfigAuth = objFactory . createAuthnAuthorityConfigElement ( ) ; baseConfigAuth = addAttributeType ( extAuthnAuthMap , baseConfigAuth ) ; configList . add ( baseConfigAuth ) ; } if ( role . equals ( EntityModel . SAML_ATTRQUERY ) || ( attrQueryDescriptor != null ) ) { baseConfigAuth = objFactory . createAttributeQueryConfigElement ( ) ; baseConfigAuth = addAttributeType ( extattrQueryMap , baseConfigAuth ) ; configList . add ( baseConfigAuth ) ; } if ( role . equals ( EntityModel . POLICY_DECISION_POINT_DESCRIPTOR ) || ( xacmlPDPDescriptor != null ) ) { baseConfigAuth = objFactory . createXACMLPDPConfigElement ( ) ; baseConfigAuth = addAttributeType ( xacmlPDPExtendedMeta , baseConfigAuth ) ; configList . add ( baseConfigAuth ) ; } if ( role . equals ( EntityModel . POLICY_ENFORCEMENT_POINT_DESCRIPTOR ) || ( xacmlAuthzDescriptor != null ) ) { baseConfigAuth = objFactory . createXACMLAuthzDecisionQueryConfigElement ( ) ; baseConfigAuth = addAttributeType ( xacmlPEPExtendedMeta , baseConfigAuth ) ; configList . add ( baseConfigAuth ) ; } samlManager . setEntityConfig ( realm , entityConfigElement ) ; }
creates the extended config object when it does not exist .
