Package org.intermine.api.profile
Class InvalidBag
- java.lang.Object
-
- org.intermine.api.profile.StorableBag
-
- org.intermine.api.profile.InvalidBag
-
- All Implemented Interfaces:
Taggable,WebSearchable
public class InvalidBag extends StorableBag
A class representing a bag that is invalid because it does not conform to the current model.- Author:
- Alex Kalderimis.
-
-
Field Summary
Fields Modifier and Type Field Description protected static org.apache.log4j.LoggerLOG-
Fields inherited from class org.intermine.api.profile.StorableBag
profileId, savedBagId
-
-
Constructor Summary
Constructors Modifier Constructor Description InvalidBag(java.lang.String name, java.lang.String type, java.lang.String desc, java.util.Date createdAt, ObjectStore os, java.lang.Integer savedBagId, java.lang.Integer profileId, ObjectStoreBag osb, ObjectStoreWriter userprofileObjectStore)Constructor.InvalidBag(java.lang.String name, java.lang.String type, java.lang.String description, java.util.Date createdAt, ObjectStore os, ObjectStoreWriter uosw)Minimal constructor.protectedInvalidBag(SavedBag savedBag, java.lang.Integer profileId, ObjectStore os, ObjectStoreWriter userprofileObjectStore)Constructor callable by the ProfileManager.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description InterMineBagamendTo(java.lang.String newType)Fix this bag by changing its type.voiddelete()Delete this bag from the userprofile database, bag should not be used after this method has been called.java.util.DategetDateCreated()Get the date that this bag was created at.java.lang.StringgetDescription()Return the description of this object.java.lang.StringgetName()The name (or identifier) used as the primary key for storing this object.ObjectStoreBaggetOsb()Return a reference to the object store bag contained in the production database.intgetSize()Returns the size of the bag.java.lang.StringgetState()Return a string representing the state of this bag (eg.java.lang.StringgetTitle()The user-friendly title for this object.java.lang.StringgetType()Get the unqualified name of class that the objects in this bag represent.ObjectStoreWritergetUserProfileWriter()Get a reference to a connection to the database where user data is persisted.protected InvalidBagrename(java.lang.String newName)Returns a new Invalid Bag identical to this one, but with the given name.-
Methods inherited from class org.intermine.api.profile.StorableBag
addBagValues, addObserver, deleteAllBagValues, deleteSomeBagValues, fireEvent, getContents, getContentsOrderByExtraValue, getProfileId, getSavedBagId, getTagType, removeObserver, saveWithBagValues, size, storeSavedBag
-
-
-
-
Constructor Detail
-
InvalidBag
public InvalidBag(java.lang.String name, java.lang.String type, java.lang.String desc, java.util.Date createdAt, ObjectStore os, java.lang.Integer savedBagId, java.lang.Integer profileId, ObjectStoreBag osb, ObjectStoreWriter userprofileObjectStore) throws ObjectStoreExceptionConstructor.- Parameters:
name- The name of this bag.type- The type it is meant to have.desc- A free text description of the bag.createdAt- When this list was first created.os- The production object store.profileId- The internal DB id of the profile of the user this list belongs to.savedBagId- The internal DB id of the saved bag this list represents.osb- The bag that represents the production DB level stored set of object ids.userprofileObjectStore- The user-profile object store writer.- Throws:
ObjectStoreException- If a ObjectStoreBag needs to be created and there is a problem doing so.
-
InvalidBag
public InvalidBag(java.lang.String name, java.lang.String type, java.lang.String description, java.util.Date createdAt, ObjectStore os, ObjectStoreWriter uosw) throws ObjectStoreExceptionMinimal constructor. This constructor only requires the minimal set of values.- Parameters:
name- The name of the list.type- The erstwhile type of the list.description- A free text description of the list.createdAt- When the list was first created.os- A connection to the production object store.uosw- The writer to the user-profile object store.- Throws:
ObjectStoreException- If there is a problem creating an ObjectStoreBag
-
InvalidBag
protected InvalidBag(SavedBag savedBag, java.lang.Integer profileId, ObjectStore os, ObjectStoreWriter userprofileObjectStore) throws ObjectStoreException
Constructor callable by the ProfileManager.- Parameters:
savedBag- The saved bag retrieved from the DB.profileId- The id of the user profile.os- The production object store.userprofileObjectStore- The userprofile object store.- Throws:
ObjectStoreException- If there is a problem creating an ObjectStoreBag.
-
-
Method Detail
-
rename
protected InvalidBag rename(java.lang.String newName) throws ObjectStoreException
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.- Parameters:
newName- The new name- Returns:
- A new invalid bag with the given 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.
-
getName
public java.lang.String getName()
Description copied from interface:TaggableThe name (or identifier) used as the primary key for storing this object.- Specified by:
getNamein interfaceTaggable- Specified by:
getNamein classStorableBag- Returns:
- the bags's name
-
getTitle
public java.lang.String getTitle()
Description copied from interface:WebSearchableThe user-friendly title for this object.- Returns:
- the bag's name
-
getSize
public int getSize()
Description copied from class:StorableBagReturns the size of the bag.- Specified by:
getSizein classStorableBag- Returns:
- the number of items in this bag.
-
getType
public java.lang.String getType()
Description copied from class:StorableBagGet the unqualified name of class that the objects in this bag represent.- Specified by:
getTypein classStorableBag- Returns:
- the bag's (now defunct) type
-
getDateCreated
public java.util.Date getDateCreated()
Description copied from class:StorableBagGet the date that this bag was created at.- Specified by:
getDateCreatedin classStorableBag- Returns:
- the bags's DOB
-
getDescription
public java.lang.String getDescription()
Description copied from interface:WebSearchableReturn the description of this object.- Specified by:
getDescriptionin interfaceWebSearchable- Specified by:
getDescriptionin classStorableBag- Returns:
- an optional string describing the bag. Never null.
-
getOsb
public ObjectStoreBag getOsb()
Description copied from class:StorableBagReturn a reference to the object store bag contained in the production database.- Specified by:
getOsbin classStorableBag- Returns:
- the production DB level collection of object ids.
-
getState
public java.lang.String getState()
Description copied from class:StorableBagReturn a string representing the state of this bag (eg. CURRENT).- Specified by:
getStatein classStorableBag- Returns:
- The state of this bag. Always returns "NOT CURRENT"
-
getUserProfileWriter
public ObjectStoreWriter getUserProfileWriter()
Description copied from class:StorableBagGet a reference to a connection to the database where user data is persisted.- Specified by:
getUserProfileWriterin classStorableBag- Returns:
- The connection to the user-profile DB
-
delete
public void delete() throws ObjectStoreExceptionDelete this bag from the userprofile database, bag should not be used after this method has been called. Delete the ids from the production database too.- Overrides:
deletein classStorableBag- Throws:
ObjectStoreException- if problem deleting bag
-
amendTo
public InterMineBag amendTo(java.lang.String newType) throws UnknownBagTypeException, ObjectStoreException
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.- Parameters:
newType- The new type of this list. This must be a valid type in the current model.- Returns:
- A valid InterMineBag.
- Throws:
UnknownBagTypeException- If the new type is not in the current model.ObjectStoreException- If there is a problem saving state to the DB.
-
-