|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.kuali.kfs.module.purap.util.ItemParserBase
public class ItemParserBase
| Field Summary | |
|---|---|
protected static String[] |
COMMODITY_CODE_DISABLED_FORMAT
|
protected static String[] |
DEFAULT_FORMAT
The default format defines the expected item property names and their order in the import file. |
| Constructor Summary | |
|---|---|
ItemParserBase()
|
|
| Method Summary | |
|---|---|
protected void |
checkItemClass(Class<? extends PurApItem> itemClass)
Checks whether the specified item class is a subclass of PurApItem; throws exceptions if not. |
protected void |
checkItemFile(org.apache.struts.upload.FormFile itemFile)
Checks whether the specified item import file is not null and of a valid format; throws exceptions if conditions not satisfied. |
protected PurApItem |
genItemWithRetrievedAttributes(Map<String,String> itemMap,
Class<? extends PurApItem> itemClass)
Generates an item instance and populates it with the specified attribute map. |
protected String |
getAttributeLabel(Class clazz,
String attributeName)
Retrieves the attribute label for the specified attribute. |
String |
getExpectedItemFormatAsString(Class<? extends PurApItem> itemClass)
Returns the expected format of the items to be imported. |
String[] |
getItemFormat()
Returns the defined format of item lines in the item import file. |
List<PurApItem> |
importItems(org.apache.struts.upload.FormFile itemFile,
Class<? extends PurApItem> itemClass,
String documentNumber)
Parses the items from the specified import file line by line, and generates items of the specified type from the parsed data. |
PurApItem |
parseItem(String itemLine,
Class<? extends PurApItem> itemClass,
String documentNumber)
Parses the specified item line into an instance of the specified PurApItem subclass. |
protected void |
populateExtraAttributes(PurApItem item,
String documentNumber)
Populates extra item attributes not contained in the imported item data to default values. |
protected Map<String,String> |
retrieveItemAttributes(String itemLine)
Parses a line of item data from a csv file and retrieves the attributes as key-value string pairs into a map. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final String[] DEFAULT_FORMAT
protected static final String[] COMMODITY_CODE_DISABLED_FORMAT
| Constructor Detail |
|---|
public ItemParserBase()
| Method Detail |
|---|
public String[] getItemFormat()
ItemParser
getItemFormat in interface ItemParserItemParser.getItemFormat()public String getExpectedItemFormatAsString(Class<? extends PurApItem> itemClass)
ItemParser
getExpectedItemFormatAsString in interface ItemParseritemClass - the class of the items to be imported
ItemParser.getExpectedItemFormatAsString(java.lang.Class)
protected String getAttributeLabel(Class clazz,
String attributeName)
clazz - the class in which the specified attribute is definedattributeName - the name of the specified attribute
protected void checkItemClass(Class<? extends PurApItem> itemClass)
itemClass - the specified item classprotected void checkItemFile(org.apache.struts.upload.FormFile itemFile)
itemClass - the specified item import fileprotected Map<String,String> retrieveItemAttributes(String itemLine)
itemLine - a string read from a line in the item import file
protected PurApItem genItemWithRetrievedAttributes(Map<String,String> itemMap,
Class<? extends PurApItem> itemClass)
itemMap - the specified attribute map from which attributes are populateditemClass - the class of which the new item instance shall be created
protected void populateExtraAttributes(PurApItem item,
String documentNumber)
item - the item to be populateddocumentNumber - the number of the docment that contains the item
public PurApItem parseItem(String itemLine,
Class<? extends PurApItem> itemClass,
String documentNumber)
ItemParser
parseItem in interface ItemParseritemLine - the item line string to be parseditemClass - the subclass of the item to be generateddocumentNumber - the number of the docment that contains the item to be generated
ItemParser.parseItem(java.lang.String,java.lang.Class,java.lang.String)
public List<PurApItem> importItems(org.apache.struts.upload.FormFile itemFile,
Class<? extends PurApItem> itemClass,
String documentNumber)
ItemParser
importItems in interface ItemParseritemFile - the input file from which items are parseditemClass - a subclass of PurApItem, of which new items shall be generateddocumentNumber - the number of the docment that contains the items to be imported
org.kuali.kfs.module.purap.util.ItemParser#parseItem(org.apache.struts.upload.FormFile,java.lang.Class,java.lang.String)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||