public void Sync() { var rowstamp = ConfigFacade.Lookup <long>(ConfigurationConstants.PersonGroupAssociationRowstampKey); var dto = GetPersonGroupSearchDTO(); var personGroupAssociation = FetchNew(rowstamp, EntityName, dto); var attributeHolders = personGroupAssociation as AttributeHolder[] ?? personGroupAssociation.ToArray(); if (!attributeHolders.Any()) { //nothing to update return; } var usersUsed = GetDistinctValuesOfColumn(attributeHolders, PersonIdColumn); var personGroupsUsed = GetDistinctValuesOfColumn(attributeHolders, PersonGroupColumn); //first we will fetch all the desidered entities from the database using a single query (each) var users = FindUsers(usersUsed); var groups = DAO.FindByQuery <PersonGroup>(PersonGroup.PersonGroupByNames, personGroupsUsed); var syncOk = DoSync(attributeHolders, users, groups); //If the sync was not ok, try it again later SetRowstampIfBigger(ConfigurationConstants.PersonGroupAssociationRowstampKey, syncOk ? GetLastRowstamp(attributeHolders) : null, rowstamp); }
public void Sync() { var rowstamp = ConfigFacade.Lookup <long>(ConfigurationConstants.UserRowstampKey); var dto = BuildDTO(); var maximoUsers = FetchNew(rowstamp, EntityName, dto); var attributeHolders = maximoUsers as AttributeHolder[] ?? maximoUsers.ToArray(); if (!attributeHolders.Any()) { //nothing to update return; } var usersToSave = ConvertMaximoUsersToUserEntity(attributeHolders); SaveOrUpdateUsers(usersToSave); SetRowstampIfBigger(ConfigurationConstants.UserRowstampKey, GetLastRowstamp(attributeHolders), rowstamp); }
public void Sync() { var rowstamp = ConfigFacade.Lookup <long>(ConfigurationConstants.PersonGroupRowstampKey); var dto = new SearchRequestDto(); //let´s search just for persongroups that begin with the prefix dto.AppendSearchEntry(PersonGroupColumn, HapagPersonGroupConstants.BaseHapagPrefix); //ignoring rowstamp cache due to the fact that Maximo rowstamps got wrong //fetch all var personGroup = FetchNew(0L, EntityName, dto); var attributeHolders = personGroup as AttributeHolder[] ?? personGroup.ToArray(); if (!attributeHolders.Any()) { //nothing to update return; } var personGroupToSave = ConvertMaximoPersonGroupToPersonGroupEntity(attributeHolders); var resultList = _hlagLocationManager.UpdateCacheOnSync(personGroupToSave); _hlagLocationManager.UpdateCache(resultList); SetRowstampIfBigger(ConfigurationConstants.PersonGroupRowstampKey, GetLastRowstamp(attributeHolders), rowstamp); }
public Bot(IServiceProvider serviceProvider, ConfigFacade configFacade) { mServiceProvider = serviceProvider; mConfigFacade = configFacade; }