Search in sources :

Example 1 with QueryElement

use of com.sun.identity.liberty.ws.idpp.jaxb.QueryElement in project OpenAM by OpenRock.

the class PPRequestHandler method processDSTRequest.

/**
     * Processes query/modify request.
     * @param request query or modify object.
     * @param requestMsg Request Message.
     * @param responseMsg Response Message.
     * @return Object processed response object.
     * @exception SOAPFaultException for the interaction redirects 
     * @exception Exception for any failure.
     */
public Object processDSTRequest(Object request, Message requestMsg, Message responseMsg) throws SOAPFaultException, DSTException {
    IDPPUtils.debug.message("PPRequestHandler:processRequest:Init");
    try {
        IDPPServiceManager serviceManager = IDPPServiceManager.getInstance();
        String providerID = serviceManager.getProviderID();
        ProviderHeader ph = new ProviderHeader(providerID);
        responseMsg.setProviderHeader(ph);
        if (serviceManager.isServiceInstanceUpdateEnabled()) {
            ServiceInstanceUpdateHeader siuHeader = getServiceInstanceUpdateHeader();
            responseMsg.setServiceInstanceUpdateHeader(siuHeader);
        }
        if (request instanceof QueryElement) {
            QueryElement query = (QueryElement) request;
            Document doc = IDPPUtils.getDocumentBuilder().newDocument();
            IDPPUtils.getMarshaller().setProperty("com.sun.xml.bind.namespacePrefixMapper", new NamespacePrefixMapperImpl());
            IDPPUtils.getMarshaller().marshal(query, doc);
            return processQueryRequest(query, providerID, requestMsg, doc);
        } else if (request instanceof ModifyElement) {
            ModifyElement modify = (ModifyElement) request;
            Document doc = IDPPUtils.getDocumentBuilder().newDocument();
            IDPPUtils.getMarshaller().setProperty("com.sun.xml.bind.namespacePrefixMapper", new NamespacePrefixMapperImpl());
            IDPPUtils.getMarshaller().marshal(modify, doc);
            return processModifyRequest(modify, providerID, requestMsg, doc);
        } else {
            IDPPUtils.debug.error("PPRequestHandler:processRequest:invalid" + " Request.");
            throw new DSTException(IDPPUtils.bundle.getString("invalidRequest"));
        }
    } catch (IDPPException ie) {
        IDPPUtils.debug.error("PPRequestHandler:processRequest fail", ie);
        throw new DSTException(ie);
    } catch (JAXBException je) {
        IDPPUtils.debug.error("PPRequestHandler:processRequest fail", je);
        throw new DSTException(IDPPUtils.bundle.getString("jaxbFailure"));
    } catch (SOAPBindingException sbe) {
        IDPPUtils.debug.error("PPRequestHandler:processRequest fail", sbe);
        throw new DSTException(sbe);
    }
}
Also used : ModifyElement(com.sun.identity.liberty.ws.idpp.jaxb.ModifyElement) ProviderHeader(com.sun.identity.liberty.ws.soapbinding.ProviderHeader) SOAPBindingException(com.sun.identity.liberty.ws.soapbinding.SOAPBindingException) JAXBException(javax.xml.bind.JAXBException) ServiceInstanceUpdateHeader(com.sun.identity.liberty.ws.soapbinding.ServiceInstanceUpdateHeader) NamespacePrefixMapperImpl(com.sun.identity.liberty.ws.soapbinding.NamespacePrefixMapperImpl) DSTException(com.sun.identity.liberty.ws.dst.DSTException) QueryElement(com.sun.identity.liberty.ws.idpp.jaxb.QueryElement) Document(org.w3c.dom.Document)

Example 2 with QueryElement

use of com.sun.identity.liberty.ws.idpp.jaxb.QueryElement in project OpenAM by OpenRock.

the class IDPPUtils method createQueryElement.

/**
      * Creates a Query Request element given a set of query expressions.
      * @param queryExpressions a list of query expressions
      * @param resourceID resource id.
      * @param includeCommonAttr include common attribute or not 
      * @return QueryElement JAXB object.
      */
public static QueryElement createQueryElement(List queryExpressions, String resourceID, boolean includeCommonAttr) throws JAXBException, IDPPException {
    QueryElement query = idppFactory.createQueryElement();
    if (queryExpressions == null || resourceID == null || queryExpressions.size() == 0) {
        debug.error("IDPPUtils:createQueryElement: Either query" + " expressions or resource id is null.");
        throw new IDPPException("ResourceID or query expressions are null");
    }
    query.setResourceID(createResourceIDElement(resourceID));
    query.setId(SAMLUtils.generateID());
    for (int i = 0; i < queryExpressions.size(); i++) {
        QueryType.QueryItemType item = idppFactory.createQueryTypeQueryItemType();
        item.setId(SAMLUtils.generateID());
        item.setIncludeCommonAttributes(includeCommonAttr);
        item.setItemID(SAMLUtils.generateID());
        item.setSelect(addIDPPPrefix((String) queryExpressions.get(i)));
        query.getQueryItem().add(item);
    }
    return query;
}
Also used : DSTString(com.sun.identity.liberty.ws.idpp.jaxb.DSTString) QueryElement(com.sun.identity.liberty.ws.idpp.jaxb.QueryElement) QueryType(com.sun.identity.liberty.ws.idpp.jaxb.QueryType)

Aggregations

QueryElement (com.sun.identity.liberty.ws.idpp.jaxb.QueryElement)2 DSTException (com.sun.identity.liberty.ws.dst.DSTException)1 DSTString (com.sun.identity.liberty.ws.idpp.jaxb.DSTString)1 ModifyElement (com.sun.identity.liberty.ws.idpp.jaxb.ModifyElement)1 QueryType (com.sun.identity.liberty.ws.idpp.jaxb.QueryType)1 NamespacePrefixMapperImpl (com.sun.identity.liberty.ws.soapbinding.NamespacePrefixMapperImpl)1 ProviderHeader (com.sun.identity.liberty.ws.soapbinding.ProviderHeader)1 SOAPBindingException (com.sun.identity.liberty.ws.soapbinding.SOAPBindingException)1 ServiceInstanceUpdateHeader (com.sun.identity.liberty.ws.soapbinding.ServiceInstanceUpdateHeader)1 JAXBException (javax.xml.bind.JAXBException)1 Document (org.w3c.dom.Document)1