main/src/main/java/org/onap/policy/pap/main/rest/depundep/ProviderBase.java
/**
     * Processes a policy request.
     *
     * @param request PDP policy request
     * @param processor function that processes the request
     * @throws PfModelException if an error occurred
     */
Processes a policy request.
@param request PDP policy request
@param processor function that processes the request
@throws PfModelException if an error occurred
Processes a policy request . @param request PDP policy request @param processor function that processes the request @throws PfModelException if an error occurred
protected <T> void process(T request, BiConsumerWithEx<SessionData, T> processor) throws PfModelException {
        synchronized (updateLock) {
            Collection<Pair<PdpUpdate, PdpStateChange>> requests = Collections.emptyList();
            try (PolicyModelsProvider dao = daoFactory.create()) {
                SessionData data = new SessionData(dao);
                processor.accept(data, request);
                data.updateDb();
                requests = data.getPdpRequests();
            } catch (PfModelException | PfModelRuntimeException e) {
                logger.warn(DEPLOY_FAILED, e);
                throw e;
            } catch (RuntimeException e) {
                logger.warn(DEPLOY_FAILED, e);
                throw new PfModelException(Status.INTERNAL_SERVER_ERROR, "request failed", e);
            }
            requests.forEach(pair -> requestMap.addRequest(pair.getLeft(), pair.getRight()));
        }
    }
protected < T > void process ( T request , BiConsumerWithEx < SessionData , T > processor ) throws PfModelException { synchronized ( updateLock ) { Collection < Pair < PdpUpdate , PdpStateChange > > requests = Collections . emptyList ( ) ; try ( PolicyModelsProvider dao = daoFactory . create ( ) ) { SessionData data = new SessionData ( dao ) ; processor . accept ( data , request ) ; data . updateDb ( ) ; requests = data . getPdpRequests ( ) ; } catch ( PfModelException | PfModelRuntimeException e ) { logger . warn ( DEPLOY_FAILED , e ) ; throw e ; } catch ( RuntimeException e ) { logger . warn ( DEPLOY_FAILED , e ) ; throw new PfModelException ( Status . INTERNAL_SERVER_ERROR , "request failed" , e ) ; } requests . forEach ( pair -> requestMap . addRequest ( pair . getLeft ( ) , pair . getRight ( ) ) ) ; } }
Processes a policy request.
Processes a policy request .
// list of requests to be published to the PDPs // make all of the DB updates // publish the requests