Search in sources :

Example 1 with CreateGroupRequest

use of de.vitero.schema.group.CreateGroupRequest in project openolat by klemens.

the class ViteroManager method createGroup.

public int createGroup(String groupName) throws VmsNotAvailableException {
    try {
        CreateGroupRequest createRequest = new CreateGroupRequest();
        Groupnamecustomerid groupInfos = new Groupnamecustomerid();
        groupInfos.setGroupname(groupName + "_OLAT_" + UUID.randomUUID().toString().replace("-", ""));
        groupInfos.setCustomerid(viteroModule.getCustomerId());
        createRequest.setGroup(groupInfos);
        Groupid groupId = getGroupWebService().createGroup(createRequest);
        return groupId.getGroupid();
    } catch (SOAPFaultException f) {
        ErrorCode code = handleAxisFault(f);
        switch(code) {
            default:
                logAxisError("Cannot create a group", f);
        }
        return -1;
    } catch (WebServiceException e) {
        if (e.getCause() instanceof ConnectException) {
            throw new VmsNotAvailableException();
        }
        log.error("Cannot create a group.", e);
        return -1;
    }
}
Also used : WebServiceException(javax.xml.ws.WebServiceException) CreateGroupRequest(de.vitero.schema.group.CreateGroupRequest) Groupnamecustomerid(de.vitero.schema.group.Groupnamecustomerid) SOAPFaultException(javax.xml.ws.soap.SOAPFaultException) ErrorCode(org.olat.modules.vitero.model.ErrorCode) Groupid(de.vitero.schema.group.Groupid) ConnectException(java.net.ConnectException)

Example 2 with CreateGroupRequest

use of de.vitero.schema.group.CreateGroupRequest in project OpenOLAT by OpenOLAT.

the class ViteroManager method createGroup.

public int createGroup(String groupName) throws VmsNotAvailableException {
    try {
        CreateGroupRequest createRequest = new CreateGroupRequest();
        Groupnamecustomerid groupInfos = new Groupnamecustomerid();
        groupInfos.setGroupname(groupName + "_OLAT_" + UUID.randomUUID().toString().replace("-", ""));
        groupInfos.setCustomerid(viteroModule.getCustomerId());
        createRequest.setGroup(groupInfos);
        Groupid groupId = getGroupWebService().createGroup(createRequest);
        return groupId.getGroupid();
    } catch (SOAPFaultException f) {
        ErrorCode code = handleAxisFault(f);
        switch(code) {
            default:
                logAxisError("Cannot create a group", f);
        }
        return -1;
    } catch (WebServiceException e) {
        if (e.getCause() instanceof ConnectException) {
            throw new VmsNotAvailableException();
        }
        log.error("Cannot create a group.", e);
        return -1;
    }
}
Also used : WebServiceException(javax.xml.ws.WebServiceException) CreateGroupRequest(de.vitero.schema.group.CreateGroupRequest) Groupnamecustomerid(de.vitero.schema.group.Groupnamecustomerid) SOAPFaultException(javax.xml.ws.soap.SOAPFaultException) ErrorCode(org.olat.modules.vitero.model.ErrorCode) Groupid(de.vitero.schema.group.Groupid) ConnectException(java.net.ConnectException)

Aggregations

CreateGroupRequest (de.vitero.schema.group.CreateGroupRequest)2 Groupid (de.vitero.schema.group.Groupid)2 Groupnamecustomerid (de.vitero.schema.group.Groupnamecustomerid)2 ConnectException (java.net.ConnectException)2 WebServiceException (javax.xml.ws.WebServiceException)2 SOAPFaultException (javax.xml.ws.soap.SOAPFaultException)2 ErrorCode (org.olat.modules.vitero.model.ErrorCode)2