public void vrun() { Organization org = ofy().load().key(orgKey).now(); if (org == null) { // Org has been deleted return; } org.setSourceOrgInfo(updatedSourceOrgInfo); BaseDao.partialUpdate(org); }
public void upsert(EventSourceInfo sourceInfo) { Key<Organization> orgKey = sourceInfo.getOrgKey(); Organization org = ofy().load().key(orgKey).now(); SourceOrganizationInfo persistedOrgInfo = org.getSourceOrgInfo(); if (persistedOrgInfo == null) { persistedOrgInfo = new SourceOrganizationInfo(); } boolean updateRequired = false; if ((persistedOrgInfo.getId() == null) || !persistedOrgInfo.getId().equals(rootOrgId)) { persistedOrgInfo.setId(rootOrgId); updateRequired = true; } if ((persistedOrgInfo.getListingOrg() == null) || !persistedOrgInfo.getListingOrg().equals(orgKey)) { persistedOrgInfo.setListingOrg(KeyWrapper.create(orgKey)); updateRequired = true; } if (updateRequired) { ofy().transact(new UpdateOrgConfigTxn(orgKey, persistedOrgInfo)); } }