/** * Upgrades the ObjectStoreBag with a new ObjectStoreBag containing the collection of elements * given in input * @param values the collection of elements to add * @param updateBagValues id true if we upgrade the bagvalues table * @throws ObjectStoreException if an error occurs fetching a new ID */ public void upgradeOsb(Collection<Integer> values, boolean updateBagValues) throws ObjectStoreException { ObjectStoreWriter oswProduction = null; SavedBag savedBag = (SavedBag) uosw.getObjectById(savedBagId, SavedBag.class); try { oswProduction = os.getNewWriter(); osb = oswProduction.createObjectStoreBag(); oswProduction.addAllToBag(osb, values); savedBag.setOsbId(osb.getBagId()); savedBag.setState(BagState.CURRENT.toString()); state = BagState.CURRENT; uosw.store(savedBag); if (updateBagValues) { updateBagValues(); } } finally { if (oswProduction != null) { oswProduction.close(); } } }
/** * Upgrades the ObjectStoreBag with a new ObjectStoreBag containing the collection of elements * given in input * @param values the collection of elements to add * @param updateBagValues id true if we upgrade the bagvalues table * @throws ObjectStoreException if an error occurs fetching a new ID */ public void upgradeOsb(Collection<Integer> values, boolean updateBagValues) throws ObjectStoreException { ObjectStoreWriter oswProduction = null; SavedBag savedBag = (SavedBag) uosw.getObjectById(savedBagId, SavedBag.class); try { oswProduction = os.getNewWriter(); osb = oswProduction.createObjectStoreBag(); oswProduction.addAllToBag(osb, values); savedBag.setOsbId(osb.getBagId()); savedBag.setState(BagState.CURRENT.toString()); state = BagState.CURRENT; uosw.store(savedBag); if (updateBagValues) { updateBagValues(); } } finally { if (oswProduction != null) { oswProduction.close(); } } }
/** * Perform the actual insertion of data into the userprofile database. * @return The object that represents the database record for this bag. * @throws ObjectStoreException If we cannot store the bag. */ protected SavedBag storeSavedBag() throws ObjectStoreException { SavedBag savedBag = new SavedBag(); savedBag.setId(getSavedBagId()); if (profileId != null) { savedBag.setName(getName()); savedBag.setType(getType()); savedBag.setDescription(getDescription()); savedBag.setDateCreated(getDateCreated()); savedBag.proxyUserProfile(new ProxyReference(null, profileId, UserProfile.class)); savedBag.setOsbId(getOsb().getBagId()); savedBag.setState(getState()); getUserProfileWriter().store(savedBag); } else if (savedBag.getId() == null) { // Even if the list is not saved because we're using an anonymous profile, still // give it an ID so that calling code can manipulate all lists by ID savedBag.setId(getUserProfileWriter().getSerial()); } return savedBag; }
/** * Perform the actual insertion of data into the userprofile database. * @return The object that represents the database record for this bag. * @throws ObjectStoreException If we cannot store the bag. */ protected SavedBag storeSavedBag() throws ObjectStoreException { SavedBag savedBag = new SavedBag(); savedBag.setId(getSavedBagId()); if (profileId != null) { savedBag.setName(getName()); savedBag.setType(getType()); savedBag.setDescription(getDescription()); savedBag.setDateCreated(getDateCreated()); savedBag.proxyUserProfile(new ProxyReference(null, profileId, UserProfile.class)); savedBag.setOsbId(getOsb().getBagId()); savedBag.setState(getState()); getUserProfileWriter().store(savedBag); } else if (savedBag.getId() == null) { // Even if the list is not saved because we're using an anonymous profile, still // give it an ID so that calling code can manipulate all lists by ID savedBag.setId(getUserProfileWriter().getSerial()); } return savedBag; }