return keyVaultEntry;
}
@Override
public KeyVaultEntryModel convertToModel(KeyVaultEntry keyVaultEntry) {
KeyVaultEntryModel model = null;
if (keyVaultEntry != null) {
model = new KeyVaultEntryModel();
model.setId(keyVaultEntry.getId());
model.setName(keyVaultEntry.getName());
Domain parentDomain = keyVaultEntry.getParentDomain();
if (parentDomain != null) {
DomainEntityService domainEntityService = domainEntityServiceFactory.getDomainEntityService(parentDomain.getDomainType());
if (domainEntityService != null) {
model.setParentDomain(domainEntityService.createDomainModel(parentDomain));
}
}
for (Domain childDomain : keyVaultEntry.getChildDomains()) {
DomainEntityService domainEntityService = domainEntityServiceFactory.getDomainEntityService(childDomain.getDomainType());
if (domainEntityService != null) {
model.getChildDomains().add(domainEntityService.createDomainModel(childDomain));
}
}
model.setApplicationType(keyVaultEntry.getApplicationType());
model.setCreateDate(keyVaultEntry.getCreateDate());
User user = userService.getByEmail(keyVaultEntry.getChangedBy());
if (user != null) {
UserModel userModel = new UserModel();
userModel.setFirstName(user.getFirstName());
userModel.setLastName(user.getLastName());
userModel.setEmail(user.getEmail());
model.setCreatedBy(userModel);
}
}
return model;
}