|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.hd.d.pg2k.svrCore.uploader.ExhibitHandlerBeanBase
org.hd.d.pg2k.svrCore.uploader.UploadInfoBean
public final class UploadInfoBean
Bean that collects information about an exhibit to upload. Backs upload.jsp and, unusally, is stored in the session as the author provides data about the exhibit.
This validates information its is presented with as far as possible, syntactically and semantically. For example, it tries to ensure that a correct and unique exhibit name is created, and warns if new (possibly-misspelt) words have been introduced.
This holds the filename and optional description, location, etc data, and output can be dumped as a new-style properties file.
This is thread-safe, all methods being synchronized where necessary.
In general, our upload process should observe the following:
| Field Summary | |
|---|---|
private java.lang.String |
description
Description text or "" if none; never null. |
private java.lang.String |
mainWords
Main body words; valid string of hyphen-separated words where; can be "" but never null. |
private int |
number
The number in the current series; never negative. |
private static long |
serialVersionUID
Unique Serialisation class ID generated by http://random.hd.org/. |
private AllExhibitImmutableData |
uploadAeid
Aeid for upload area; should be set. |
| Fields inherited from class org.hd.d.pg2k.svrCore.uploader.ExhibitHandlerBeanBase |
|---|
onlyAllowExtant, SETTER_ALL |
| Constructor Summary | |
|---|---|
UploadInfoBean()
Create a new instance. |
|
| Method Summary | |
|---|---|
boolean |
canMakeValidName()
Returns true if we can construct a valid name. |
boolean |
enoughInfo()
When enough exhibit information has been collected, this returns true. |
boolean |
enoughValidUniqueInfo()
Returns true when we have enough, valid, unique info to save an exhibit. |
java.lang.String |
getDescription()
Get description text or "" if none; never null. |
java.lang.String |
getFullName()
Assemble complete name. |
java.lang.String |
getMainWords()
Set main body words; valid string of hyphen-separated words where; can be "" but never null. |
java.lang.String |
getName(boolean fullName)
Assemble complete name. |
java.lang.String |
getNewMainWords()
Get main words that would be new to the Gallery: return the empty string "" if none. |
int |
getNumber()
Gets number in series of exhibit; never negative. |
int |
incNumberIfNonZero()
Increment number-in-series value iff already positive and returns new value; never negative. |
private static java.lang.String |
makeValidWordString(java.lang.String in)
Forces string to a superficially valid word string. |
boolean |
nameUniqueInAuxDatabase()
Check if the name is unique against the upload data set. |
boolean |
nameUniqueInMainDatabase()
Check if the name is unique against the production data set. |
void |
setDescription(java.lang.String description)
Set description text or "" or "-" if none; never null. |
void |
setFullName(java.lang.String name)
Set all parameters from a supplied full name. |
void |
setMainWords(java.lang.String mainWords)
Set main body words; valid string of hyphen-separated words where; can be "" but never null. |
void |
setNumber(int number)
Sets number in series for exhibit; if negative the value is ignored. |
void |
setNumber(java.lang.String number)
Sets number in series for exhibit; if null or "" or unparsable or negative the value is ignored. |
void |
setUploadAeid(AllExhibitImmutableData uploadAeid)
|
void |
tryToSanitise()
Tries to reparse as the system will see the name. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private AllExhibitImmutableData uploadAeid
private int number
private java.lang.String mainWords
private java.lang.String description
private static final long serialVersionUID
| Constructor Detail |
|---|
public UploadInfoBean()
| Method Detail |
|---|
public void setUploadAeid(AllExhibitImmutableData uploadAeid)
public int getNumber()
public void setNumber(java.lang.String number)
public void setNumber(int number)
public int incNumberIfNonZero()
private static java.lang.String makeValidWordString(java.lang.String in)
The input must not be null.
This does not of itself make the string valid to use as a main or attribute word string (it does not check the contents of the words).
This limits the length of the value.
This returns the original string if valid.
public java.lang.String getMainWords()
public void setMainWords(java.lang.String mainWords)
Trailing words may not be attribute words and the final one may not be a number.
Any non-valid word characters (eg including spaces) will be converted to hyphens.
This tries very hard to keep as much of its input as possible.
public java.lang.String getNewMainWords()
public java.lang.String getDescription()
public void setDescription(java.lang.String description)
This tries hard to preserve any input given to it, replacing illegal characters with spaces, and truncating to maximum length.
If the input string is OK it should be stored intact.
public boolean enoughInfo()
Optional information need not be present for this to return true.
public void tryToSanitise()
If enoughInfo() is true, this will assemble the complete name and the reset the component parts by reparsing it with ExhibitName.
This should make clear any ambiguities in, for example, putting attribute words at the end of the main words section.
We only reset the parts about which there may be ambiguity, ie main words, attribute words, and number-in-series.
If enoughInfo() is not true, this does nothing.
public java.lang.String getName(boolean fullName)
This may not be valid because it may be too long.
The name starts with the category directory and the final name.
public java.lang.String getFullName()
This may not be valid because it may be too long.
The name starts with the category directory and the final name.
public void setFullName(java.lang.String name)
public boolean canMakeValidName()
We should make sure that we can insert a ``_moreXXXX/_moreYY/'' section and not get an overlong-name.
public boolean nameUniqueInMainDatabase()
We just check the short name.
public boolean nameUniqueInAuxDatabase()
We just check the short name.
public boolean enoughValidUniqueInfo()
This is the "master" test of acceptability.
|
DHD Multimedia Gallery V1.57.21 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||