Search in sources :

Example 1 with Modules

use of de.vitero.schema.licence.Modulestype.Modules in project openolat by klemens.

the class ViteroManager method getLicencedRoomSizes.

public List<Integer> getLicencedRoomSizes() throws VmsNotAvailableException {
    List<Integer> roomSizes = new ArrayList<Integer>();
    try {
        GetModulesForCustomerRequest licenceRequest = new GetModulesForCustomerRequest();
        licenceRequest.setCustomerid(viteroModule.getCustomerId());
        Modulestype modules = getLicenceWebService().getModulesForCustomer(licenceRequest);
        Modules modulesType = modules.getModules();
        for (Module module : modulesType.getModule()) {
            if ("ROOM".equals(module.getType())) {
                Integer roomSize = module.getRoomsize();
                if (!roomSizes.contains(roomSize)) {
                    roomSizes.add(roomSize);
                }
            }
        }
    } catch (SOAPFaultException f) {
        ErrorCode code = handleAxisFault(f);
        switch(code) {
            case invalidAttribut:
                log.error("ids <=0 or invalid attributs", f);
                break;
            default:
                logAxisError("Cannot get licence for customer: " + viteroModule.getCustomerId(), f);
        }
    } catch (WebServiceException e) {
        if (e.getCause() instanceof ConnectException) {
            throw new VmsNotAvailableException();
        }
        log.error("Cannot get licence for customer: " + viteroModule.getCustomerId(), e);
    }
    return roomSizes;
}
Also used : BigInteger(java.math.BigInteger) WebServiceException(javax.xml.ws.WebServiceException) GetModulesForCustomerRequest(de.vitero.schema.licence.GetModulesForCustomerRequest) Modules(de.vitero.schema.licence.Modulestype.Modules) ArrayList(java.util.ArrayList) SOAPFaultException(javax.xml.ws.soap.SOAPFaultException) ErrorCode(org.olat.modules.vitero.model.ErrorCode) ViteroModule(org.olat.modules.vitero.ViteroModule) Module(de.vitero.schema.licence.Modulestype.Modules.Module) Modulestype(de.vitero.schema.licence.Modulestype) ConnectException(java.net.ConnectException)

Example 2 with Modules

use of de.vitero.schema.licence.Modulestype.Modules in project OpenOLAT by OpenOLAT.

the class ViteroManager method getLicencedRoomSizes.

public List<Integer> getLicencedRoomSizes() throws VmsNotAvailableException {
    List<Integer> roomSizes = new ArrayList<Integer>();
    try {
        GetModulesForCustomerRequest licenceRequest = new GetModulesForCustomerRequest();
        licenceRequest.setCustomerid(viteroModule.getCustomerId());
        Modulestype modules = getLicenceWebService().getModulesForCustomer(licenceRequest);
        Modules modulesType = modules.getModules();
        for (Module module : modulesType.getModule()) {
            if ("ROOM".equals(module.getType())) {
                Integer roomSize = module.getRoomsize();
                if (!roomSizes.contains(roomSize)) {
                    roomSizes.add(roomSize);
                }
            }
        }
    } catch (SOAPFaultException f) {
        ErrorCode code = handleAxisFault(f);
        switch(code) {
            case invalidAttribut:
                log.error("ids <=0 or invalid attributs", f);
                break;
            default:
                logAxisError("Cannot get licence for customer: " + viteroModule.getCustomerId(), f);
        }
    } catch (WebServiceException e) {
        if (e.getCause() instanceof ConnectException) {
            throw new VmsNotAvailableException();
        }
        log.error("Cannot get licence for customer: " + viteroModule.getCustomerId(), e);
    }
    return roomSizes;
}
Also used : BigInteger(java.math.BigInteger) WebServiceException(javax.xml.ws.WebServiceException) GetModulesForCustomerRequest(de.vitero.schema.licence.GetModulesForCustomerRequest) Modules(de.vitero.schema.licence.Modulestype.Modules) ArrayList(java.util.ArrayList) SOAPFaultException(javax.xml.ws.soap.SOAPFaultException) ErrorCode(org.olat.modules.vitero.model.ErrorCode) ViteroModule(org.olat.modules.vitero.ViteroModule) Module(de.vitero.schema.licence.Modulestype.Modules.Module) Modulestype(de.vitero.schema.licence.Modulestype) ConnectException(java.net.ConnectException)

Aggregations

GetModulesForCustomerRequest (de.vitero.schema.licence.GetModulesForCustomerRequest)2 Modulestype (de.vitero.schema.licence.Modulestype)2 Modules (de.vitero.schema.licence.Modulestype.Modules)2 Module (de.vitero.schema.licence.Modulestype.Modules.Module)2 BigInteger (java.math.BigInteger)2 ConnectException (java.net.ConnectException)2 ArrayList (java.util.ArrayList)2 WebServiceException (javax.xml.ws.WebServiceException)2 SOAPFaultException (javax.xml.ws.soap.SOAPFaultException)2 ViteroModule (org.olat.modules.vitero.ViteroModule)2 ErrorCode (org.olat.modules.vitero.model.ErrorCode)2