@Transactional
public List<SynchronizationInfo> importRosters() throws ConnectorException {
Connector connector = connectorDAO
.findUniqueByName(PredefinedConnectors.TIM.getName());
if (connector == null) {
throw new ConnectorException(_("Tim connector not found"));
}
if (!connector.areConnectionValuesValid()) {
throw new ConnectorException(
_("Connection values of Tim connector are invalid"));
}
Map<String, String> properties = connector.getPropertiesAsMap();
String url = properties.get(PredefinedConnectorProperties.SERVER_URL);
String userName = properties
.get(PredefinedConnectorProperties.USERNAME);
String password = properties
.get(PredefinedConnectorProperties.PASSWORD);
int nrDaysRosterFromTim = Integer.parseInt(properties
.get(PredefinedConnectorProperties.TIM_NR_DAYS_ROSTER));
int productivityFactor = Integer.parseInt(properties
.get(PredefinedConnectorProperties.TIM_PRODUCTIVITY_FACTOR));
String departmentIds = properties
.get(PredefinedConnectorProperties.TIM_DEPARTAMENTS_IMPORT_ROSTER);
if (StringUtils.isBlank(departmentIds)) {
LOG.warn("No departments configured");
throw new ConnectorException(_("No departments configured"));
}
String[] departmentIdsArray = StringUtils.stripAll(StringUtils.split(
departmentIds, ","));