Exemplo n.º 1
0
 /**
  * Returns a new Invalid Bag identical to this one, but with the given name. The underlying
  * user-profile saved bag will be renamed at the same time, and this object marked as deleted.
  *
  * @param newName The new name
  * @throws ObjectStoreException if there is a problem renaming the underlying bag. If that
  *     happens, this bag will not be marked as deleted, and a new bag will not be created.
  * @return A new invalid bag with the given name.
  */
 protected InvalidBag rename(String newName) throws ObjectStoreException {
   InvalidBag renamed =
       new InvalidBag(
           newName, type, description, dateCreated, os, savedBagId, profileId, osb, uosw);
   SavedBag sb = renamed.storeSavedBag();
   renamed.savedBagId = sb.getId();
   deleted = true;
   return renamed;
 }
Exemplo n.º 2
0
 /**
  * Fix this bag by changing its type. If fixed, the DB will be corrected to store the new state,
  * and this bag will be marked as deleted.
  *
  * @param newType The new type of this list. This must be a valid type in the current model.
  * @return A valid InterMineBag.
  * @throws UnknownBagTypeException If the new type is not in the current model.
  * @throws ObjectStoreException If there is a problem saving state to the DB.
  */
 public InterMineBag amendTo(String newType) throws UnknownBagTypeException, ObjectStoreException {
   if (os.getModel().getClassDescriptorByName(newType) == null) {
     throw new UnknownBagTypeException(newType + " is not a valid class name");
   }
   fireEvent(new DeletionEvent(this));
   InvalidBag amended =
       new InvalidBag(
           name, newType, description, dateCreated, os, savedBagId, profileId, osb, uosw);
   SavedBag sb = amended.storeSavedBag();
   deleted = true;
   return new InterMineBag(os, sb.getId(), uosw);
 }
Exemplo n.º 3
0
  /**
   * Constructor callable by the ProfileManager.
   *
   * @param savedBag The saved bag retrieved from the DB.
   * @param profileId The id of the user profile.
   * @param os The production object store.
   * @param userprofileObjectStore The userprofile object store.
   * @throws ObjectStoreException If there is a problem creating an ObjectStoreBag.
   */
  protected InvalidBag(
      SavedBag savedBag,
      Integer profileId,
      ObjectStore os,
      ObjectStoreWriter userprofileObjectStore)
      throws ObjectStoreException {

    this.type = TypeUtil.unqualifiedName(savedBag.getType());
    this.name = savedBag.getName();
    this.description = savedBag.getDescription();
    this.dateCreated = savedBag.getDateCreated();

    checkArguments(os, userprofileObjectStore);
    this.os = os;
    this.osb = os.createObjectStoreBag();
    this.uosw = userprofileObjectStore;

    this.profileId = profileId;
    this.savedBagId = savedBag.getId();
  }