Back to project page SalesOrder.
The source code is released under:
GNU General Public License
If you think the Android project SalesOrder listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.capgemini.SalesOrder.zgwsample_srv.v0.entitytypes; /*/* ww w. ja v a2 s. c o m*/ Auto-Generated by SAP NetWeaver Gateway Productivity Accelerator, Version 1.1.1 */ import java.math.BigDecimal; import java.net.MalformedURLException; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import com.sap.gwpa.proxy.BaseEntityType; import com.sap.gwpa.proxy.ODataQuery; import com.sap.gwpa.proxy.TypeConverter; import com.sap.mobile.lib.parser.IODataEntry; import com.sap.mobile.lib.parser.IODataProperty; import com.sap.mobile.lib.parser.IODataSchema; import com.sap.mobile.lib.parser.IODataServiceDocument; import com.sap.mobile.lib.parser.IParser; import com.sap.mobile.lib.parser.ODataEntry; import com.sap.mobile.lib.parser.ParserException; /** * SalesOrderLineItem Entity Type * * <br>key (SoItemPos, SoId) */ public class SalesOrderLineItem extends BaseEntityType { // SalesOrderLineItem properties private BigDecimal GrossAmount; private String CurrencyCode; private String Note; private String ProductId; private String SoItemPos; private String SoId; private BigDecimal GrossAmountExt; private BigDecimal NetAmount; private BigDecimal NetAmountExt; private BigDecimal TaxAmount; private BigDecimal TaxAmountExt; private Date DeliveryDate; private BigDecimal Quantity; private String QuantityUnit; // reference to the parser private IParser parser; // reference to the schema private IODataSchema schema; private DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); // SalesOrderLineItem navigation properties private Product product = null; private static Map<String, String> salesorderlineitemLabels; private static Map<String, String> salesorderlineitemTypes; /** * Constructor * @param entry * @throws MalformedURLException */ public SalesOrderLineItem(final IODataEntry entry, IParser parser, IODataSchema schema) throws MalformedURLException { super(entry); this.GrossAmount = TypeConverter.getAsFloat(entry.getPropertyValue("GrossAmount")); this.CurrencyCode = TypeConverter.getAsString(entry.getPropertyValue("CurrencyCode")); this.Note = TypeConverter.getAsString(entry.getPropertyValue("Note")); this.ProductId = TypeConverter.getAsString(entry.getPropertyValue("ProductId")); this.SoItemPos = TypeConverter.getAsString(entry.getPropertyValue("SoItemPos")); this.SoId = TypeConverter.getAsString(entry.getPropertyValue("SoId")); this.GrossAmountExt = TypeConverter.getAsFloat(entry.getPropertyValue("GrossAmountExt")); this.NetAmount = TypeConverter.getAsFloat(entry.getPropertyValue("NetAmount")); this.NetAmountExt = TypeConverter.getAsFloat(entry.getPropertyValue("NetAmountExt")); this.TaxAmount = TypeConverter.getAsFloat(entry.getPropertyValue("TaxAmount")); this.TaxAmountExt = TypeConverter.getAsFloat(entry.getPropertyValue("TaxAmountExt")); this.DeliveryDate = TypeConverter.getAsDate(entry.getPropertyValue("DeliveryDate")); this.Quantity = TypeConverter.getAsFloat(entry.getPropertyValue("Quantity")); this.QuantityUnit = TypeConverter.getAsString(entry.getPropertyValue("QuantityUnit")); this.parser = parser; this.schema = schema; } /** * SalesOrderLineItem Constructor</br> * Dummy values may apply * */ public SalesOrderLineItem( String SoItemPos, String SoId) { super(new ODataEntry()); this.setSoItemPos(SoItemPos); this.setSoId(SoId); } // SalesOrderLineItem navigation properties /** * Product Query * @return - ODataQuery * @throws - MalformedURLException */ public ODataQuery ProductQuery() throws MalformedURLException { String url = getEntry().getId() + "/" + "Product"; ODataQuery query = new ODataQuery(url); return query; } /** * Get Product * @return - Product * @throws - IllegalArgumentException, ParserException, MalformedURLException */ public Product Product(String data) throws IllegalArgumentException, ParserException, MalformedURLException { Product result = null; List<IODataEntry> parsedSDMODataEntries = getParsedSDMODataEntries(data, parser, schema, "SalesOrderLineItem","Product"); result = new Product (parsedSDMODataEntries.get(0), parser, schema); return result; } /** * Product Load method * * loads the navigation property entries into the entityType * @throws ParserException * @throws IllegalArgumentException * @throws MalformedURLException * */ public void loadProduct(String data) throws IllegalArgumentException, ParserException, MalformedURLException { Product semanticData = Product(data); setProduct(semanticData); } // SalesOrderLineItem properties getters and setters /** * @return - BigDecimal Gross Amt. */ public BigDecimal getGrossAmount() { return this.GrossAmount; } /** * @param GrossAmount - Gross Amt. */ public void setGrossAmount(BigDecimal GrossAmount) { this.GrossAmount = GrossAmount; getEntry().putPropertyValue("GrossAmount", String.valueOf(this.GrossAmount.floatValue())); } /** * @return - String Currency */ public String getCurrencyCode() { return this.CurrencyCode; } /** * @param CurrencyCode - Currency */ public void setCurrencyCode(String CurrencyCode) { this.CurrencyCode = CurrencyCode; getEntry().putPropertyValue("CurrencyCode", CurrencyCode); } /** * @return - String Description */ public String getNote() { return this.Note; } /** * @param Note - Description */ public void setNote(String Note) { this.Note = Note; getEntry().putPropertyValue("Note", Note); } /** * @return - String Product ID */ public String getProductId() { return this.ProductId; } /** * @param ProductId - Product ID */ public void setProductId(String ProductId) { this.ProductId = ProductId; getEntry().putPropertyValue("ProductId", ProductId); } /** * @return - String PO Item Pos */ public String getSoItemPos() { return this.SoItemPos; } /** * @param SoItemPos - PO Item Pos */ public void setSoItemPos(String SoItemPos) { this.SoItemPos = SoItemPos; getEntry().putPropertyValue("SoItemPos", SoItemPos); } /** * @return - String Sa. Ord. ID */ public String getSoId() { return this.SoId; } /** * @param SoId - Sa. Ord. ID */ public void setSoId(String SoId) { this.SoId = SoId; getEntry().putPropertyValue("SoId", SoId); } /** * @return - BigDecimal Amount */ public BigDecimal getGrossAmountExt() { return this.GrossAmountExt; } /** * @param GrossAmountExt - Amount */ public void setGrossAmountExt(BigDecimal GrossAmountExt) { this.GrossAmountExt = GrossAmountExt; getEntry().putPropertyValue("GrossAmountExt", String.valueOf(this.GrossAmountExt.floatValue())); } /** * @return - BigDecimal Net Amt. */ public BigDecimal getNetAmount() { return this.NetAmount; } /** * @param NetAmount - Net Amt. */ public void setNetAmount(BigDecimal NetAmount) { this.NetAmount = NetAmount; getEntry().putPropertyValue("NetAmount", String.valueOf(this.NetAmount.floatValue())); } /** * @return - BigDecimal Amount */ public BigDecimal getNetAmountExt() { return this.NetAmountExt; } /** * @param NetAmountExt - Amount */ public void setNetAmountExt(BigDecimal NetAmountExt) { this.NetAmountExt = NetAmountExt; getEntry().putPropertyValue("NetAmountExt", String.valueOf(this.NetAmountExt.floatValue())); } /** * @return - BigDecimal Tax Amt. */ public BigDecimal getTaxAmount() { return this.TaxAmount; } /** * @param TaxAmount - Tax Amt. */ public void setTaxAmount(BigDecimal TaxAmount) { this.TaxAmount = TaxAmount; getEntry().putPropertyValue("TaxAmount", String.valueOf(this.TaxAmount.floatValue())); } /** * @return - BigDecimal Amount */ public BigDecimal getTaxAmountExt() { return this.TaxAmountExt; } /** * @param TaxAmountExt - Amount */ public void setTaxAmountExt(BigDecimal TaxAmountExt) { this.TaxAmountExt = TaxAmountExt; getEntry().putPropertyValue("TaxAmountExt", String.valueOf(this.TaxAmountExt.floatValue())); } /** * @return - Date Time Stamp */ public Date getDeliveryDate() { return this.DeliveryDate; } /** * @param DeliveryDate - Time Stamp */ public void setDeliveryDate(Date DeliveryDate) { this.DeliveryDate = DeliveryDate; getEntry().putPropertyValue("DeliveryDate", dateFormat.format(DeliveryDate)); } /** * @return - BigDecimal Quantity */ public BigDecimal getQuantity() { return this.Quantity; } /** * @param Quantity - Quantity */ public void setQuantity(BigDecimal Quantity) { this.Quantity = Quantity; getEntry().putPropertyValue("Quantity", String.valueOf(this.Quantity.floatValue())); } /** * @return - String Qty. Unit */ public String getQuantityUnit() { return this.QuantityUnit; } /** * @param QuantityUnit - Qty. Unit */ public void setQuantityUnit(String QuantityUnit) { this.QuantityUnit = QuantityUnit; getEntry().putPropertyValue("QuantityUnit", QuantityUnit); } /** * @return - representation of the Entity Type object in OData4SAP format */ public String getStringPayload() { String xml = null; xml = getEntry().toXMLString(); return xml; } /** * @return - self ODataQuery object * @throws MalformedURLException */ public ODataQuery getEntityQuery() throws MalformedURLException { return new ODataQuery(getEntry().getSelfLink().getUrl()); } /** * @return - the date format. */ public DateFormat getDateFormat() { return this.dateFormat; } // SalesOrderLineItem navigation properties setters and getters /** * Returns navigation property * Returns null if was not expanded * @throws MalformedURLException */ public Product getProduct() throws MalformedURLException { if (null == product) { //load InlineEntries for Product List<IODataEntry> inlineEntries = getInlineEntries(getEntry(),"Product"); if (null != inlineEntries) { product = new Product(inlineEntries.get(0), parser, schema); } } return product; } /** * Sets navigation property * @param product - the navigation property to set. */ public void setProduct(Product product) { this.product = product; } /** * Static method that loads all of the entity type property labels. * This method is called when the service class is initialized. * @param service Service document object containing all of the entity type properties. */ public static void loadLabels(IODataServiceDocument service) { List<IODataProperty> properties = getSchemaPropertiesFromCollection(service, "SalesOrderLineItemCollection" ); salesorderlineitemLabels = new HashMap<String, String>(); salesorderlineitemTypes = new HashMap<String, String>(); if (properties != null) { for (IODataProperty property : properties) { salesorderlineitemLabels.put(property.getName(), property.getLabel()); salesorderlineitemTypes.put(property.getName(), property.getType()); } } } /** * Static method that returns the type for a given property name. * @param propertyName Property name. * @return Property label. */ public static String getTypeForProperty(String propertyName) { return getLabelFromDictionary(salesorderlineitemTypes, propertyName); } /** * Static method that returns the label for a given property name. * @param propertyName Property name. * @return Property label. */ public static String getLabelForProperty(String propertyName) { return getLabelFromDictionary(salesorderlineitemLabels, propertyName); } }