com.genesys.provisioning.models.Converters Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of provisioning Show documentation
Show all versions of provisioning Show documentation
A Java library to interface to Genesys Provisioning public API
package com.genesys.provisioning.models;
import java.util.Map;
import java.util.List;
import java.util.ArrayList;
import com.genesys.internal.provisioning.model.AddUserDataData;
import com.genesys.internal.provisioning.model.AddUserDataDataWwe;
import com.genesys.internal.provisioning.model.UpdateUserDataData;
import com.genesys.internal.provisioning.model.UpdateUserDataDataWwe;
import com.genesys.internal.provisioning.model.CreateUserSuccessResponseDataPerson;
import com.genesys.internal.provisioning.model.CreateUserSuccessResponseDataPersonCfgAgentInfo;
import com.genesys.internal.provisioning.model.GetImportStatusResponseData;
import com.genesys.internal.provisioning.model.ExportFileDataFilterParameters;
import com.genesys.internal.provisioning.model.Extension;
public class Converters {
public static AddUserDataData convertUserToAddUserDataData(User in) {
if(in == null) return null;
AddUserDataData out = new AddUserDataData();
out.setChangePasswordOnNextLogin(in.getChangePasswordOnNextLogin());
out.setEmailAddress(in.getEmailAddress());
out.setEmployeeID(in.getEmployeeID());
out.setExternalID(in.getExternalID());
out.setEnabled(in.getEnabled());
out.setFolder(in.getFolder());
out.setUserName(in.getUserName());
out.setFirstName(in.getFirstName());
out.setLastName(in.getLastName());
out.setLoginCode(in.getLoginCode());
out.setPassword(in.getPassword());
out.setPlaceNames(in.getPlaceNames());
out.setIsAgent(in.getIsAgent());
out.setWwe(convertWwePropertiesToAddUserDataDataWwe(in.getWwe()));
out.setSwitchNames(in.getSwitchNames());
out.setPhones(convertPhonesToExtensions(in.getPhones()));
out.setSupportSoftPhone(in.getSupportSoftPhone());
out.setSipPhoneType(convertSipPhoneTypeToAddUserSipPhoneTypeEnum(in.getSipPhoneType()));
out.setSkills(convertSkillsToSkills(in.getSkills()));
out.setAgentGroups(in.getAgentGroups());
out.setAccessGroups(in.getAccessGroups());
out.setVoiceMail(in.getVoiceMail());
out.setWrapUpTime(doubleToString(in.getWrapUpTime()));
return out;
}
public static UpdateUserDataData convertUserToUpdateUserDataData(User in) {
if(in == null) return null;
UpdateUserDataData out = new UpdateUserDataData();
out.setChangePasswordOnNextLogin(in.getChangePasswordOnNextLogin());
out.setEmailAddress(in.getEmailAddress());
out.setEmployeeID(in.getEmployeeID());
out.setExternalID(in.getExternalID());
out.setEnabled(in.getEnabled());
out.setUserName(in.getUserName());
out.setFirstName(in.getFirstName());
out.setLastName(in.getLastName());
out.setLoginCode(in.getLoginCode());
out.setPassword(in.getPassword());
out.setPlaceNames(in.getPlaceNames());
out.setWwe(convertWwePropertiesToUpdateUserDataDataWwe(in.getWwe()));
out.setSwitchNames(in.getSwitchNames());
out.setPhones(convertPhonesToExtensions(in.getPhones()));
out.setSupportSoftPhone(in.getSupportSoftPhone());
out.setSipPhoneType(convertSipPhoneTypeToUpdateUserSipPhoneTypeEnum(in.getSipPhoneType()));
out.setSkills(convertSkillsToSkills(in.getSkills()));
out.setAgentGroups(in.getAgentGroups());
out.setAccessGroups(in.getAccessGroups());
out.setVoiceMail(in.getVoiceMail());
out.setWrapUpTime(doubleToString(in.getWrapUpTime()));
return out;
}
public static Person convertCreateUserSuccessResponseDataPersonToPerson(CreateUserSuccessResponseDataPerson in) {
Person out = new Person();
out.setDBID(in.getDBID());
out.setTenantDBID(in.getTenantDBID());
out.setLastName(in.getLastName());
out.setFirstName(in.getFirstName());
out.setUserName(in.getUserName());
out.setPassword(in.getPassword());
out.setIsAgent(in.getIsAgent());
out.setIsAdmin(in.getIsAdmin());
out.setState(in.getState());
out.setIsExternalAuth(in.getIsExternalAuth());
out.setChangePasswordOnNextLogin(in.getChangePasswordOnNextLogin());
out.setPasswordHashAlgorithm(in.getPasswordHashAlgorithm());
out.setPasswordUpdatingDate(in.getPasswordUpdatingDate());
out.setEmailAddress(in.getEmailAddress());
out.setAgentInfo(convertCreateUserSuccessResponseDataPersonCfgAgentInfoToAgentInfo(in.getCfgAgentInfo()));
out.setId(in.getId());
return out;
}
public static AgentInfo convertCreateUserSuccessResponseDataPersonCfgAgentInfoToAgentInfo(CreateUserSuccessResponseDataPersonCfgAgentInfo in) {
if(in == null) return null;
AgentInfo out = new AgentInfo();
out.setPlaceDBID(in.getPlaceDBID());
out.setSiteDBID(in.getSiteDBID());
out.setContractDBID(in.getContractDBID());
out.setCapacityRuleDBID(in.getCapacityRuleDBID());
return out;
}
public static List convertPhonesToExtensions(List in) {
if(in == null) return null;
List out = new ArrayList();
for(Phone i:in) out.add(convertPhoneToExtension(i));
return out;
}
public static Extension convertPhoneToExtension(Phone in) {
if(in == null) return null;
Extension out = new Extension();
out.setNumber(in.getNumber());
out.setDescription(in.getDescription());
out.setIsDefault(in.getIsDefault());
out.setPlaceName(in.getPlaceName());
return out;
}
public static List convertSkillsToSkills(List in) {
if(in == null) return null;
List out = new ArrayList();
for(Skill i:in) out.add(convertSkillToSkill(i));
return out;
}
public static com.genesys.internal.provisioning.model.Skill convertSkillToSkill(Skill in) {
if(in == null) return null;
com.genesys.internal.provisioning.model.Skill out = new com.genesys.internal.provisioning.model.Skill();
out.setLevel(in.getLevel());
out.setName(in.getName());
return out;
}
public static AddUserDataData.SipPhoneTypeEnum convertSipPhoneTypeToAddUserSipPhoneTypeEnum(SipPhoneType in) {
if(in == null) return null;
switch(in) {
case DISABLE_CTI: return AddUserDataData.SipPhoneTypeEnum.DISABLE_CTI;
case GENESYS_SOFTPHONE: return AddUserDataData.SipPhoneTypeEnum.GENESYS_SOFTPHONE;
case GENESYS_420HT_AUDIOCODES_4XXHD: return AddUserDataData.SipPhoneTypeEnum.GENESYS_420HT_AUDIOCODES_4XXHD;
case GENERIC_PHONE: return AddUserDataData.SipPhoneTypeEnum.GENERIC_PHONE;
}
return null;
}
public static UpdateUserDataData.SipPhoneTypeEnum convertSipPhoneTypeToUpdateUserSipPhoneTypeEnum(SipPhoneType in) {
if(in == null) return null;
switch(in) {
case DISABLE_CTI: return UpdateUserDataData.SipPhoneTypeEnum.DISABLE_CTI;
case GENESYS_SOFTPHONE: return UpdateUserDataData.SipPhoneTypeEnum.GENESYS_SOFTPHONE;
case GENESYS_420HT_AUDIOCODES_4XXHD: return UpdateUserDataData.SipPhoneTypeEnum.GENESYS_420HT_AUDIOCODES_4XXHD;
case GENERIC_PHONE: return UpdateUserDataData.SipPhoneTypeEnum.GENERIC_PHONE;
}
return null;
}
public static AddUserDataDataWwe convertWwePropertiesToAddUserDataDataWwe(WweProperties in) {
if(in == null) return null;
AddUserDataDataWwe out = new AddUserDataDataWwe();
out.setRoles(in.getRoles());
return out;
}
public static UpdateUserDataDataWwe convertWwePropertiesToUpdateUserDataDataWwe(WweProperties in) {
if(in == null) return null;
UpdateUserDataDataWwe out = new UpdateUserDataDataWwe();
out.setRoles(in.getRoles());
return out;
}
public static List convertMapListToSkills(List