Android Open Source - SalesOrder Product






From Project

Back to project page SalesOrder.

License

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.

Java Source Code

package com.capgemini.SalesOrder.zgwsample_srv.v0.entitytypes;
/*/*from  w  ww . j  av a  2 s.  co  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.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;

/**
 * Product Entity Type 
 *
 * <br>key (ProductId)
 */
public class Product extends BaseEntityType 
{
  // Product properties
    private String WeightUnit;
    private BigDecimal WeightMeasure;
    private String MeasureUnit;
    private String TaxTarifCode;
    private String SupplierName;
    private String SupplierId;
    private String Description;
    private String Name;
    private String Category;
    private String TypeCode;
    private String ProductId;
    private BigDecimal Price;
    private String CurrencyCode;
    private BigDecimal Width;
    private BigDecimal Depth;
    private BigDecimal Height;
    private String DimUnit;
    private String ProductPicUrl;

  // 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");

  // Product navigation properties
  private  BusinessPartner supplier = null;

  private static Map<String, String> productLabels;

  private static Map<String, String> productTypes;  
  
  /**
   * Constructor
   * @param entry
   * @throws MalformedURLException
   */
  public Product(final IODataEntry entry, IParser parser, IODataSchema schema) throws MalformedURLException
  {
    super(entry);
    this.WeightUnit =  TypeConverter.getAsString(entry.getPropertyValue("WeightUnit"));
    this.WeightMeasure =  TypeConverter.getAsFloat(entry.getPropertyValue("WeightMeasure"));
    this.MeasureUnit =  TypeConverter.getAsString(entry.getPropertyValue("MeasureUnit"));
    this.TaxTarifCode =  TypeConverter.getAsString(entry.getPropertyValue("TaxTarifCode"));
    this.SupplierName =  TypeConverter.getAsString(entry.getPropertyValue("SupplierName"));
    this.SupplierId =  TypeConverter.getAsString(entry.getPropertyValue("SupplierId"));
    this.Description =  TypeConverter.getAsString(entry.getPropertyValue("Description"));
    this.Name =  TypeConverter.getAsString(entry.getPropertyValue("Name"));
    this.Category =  TypeConverter.getAsString(entry.getPropertyValue("Category"));
    this.TypeCode =  TypeConverter.getAsString(entry.getPropertyValue("TypeCode"));
    this.ProductId =  TypeConverter.getAsString(entry.getPropertyValue("ProductId"));
    this.Price =  TypeConverter.getAsFloat(entry.getPropertyValue("Price"));
    this.CurrencyCode =  TypeConverter.getAsString(entry.getPropertyValue("CurrencyCode"));
    this.Width =  TypeConverter.getAsFloat(entry.getPropertyValue("Width"));
    this.Depth =  TypeConverter.getAsFloat(entry.getPropertyValue("Depth"));
    this.Height =  TypeConverter.getAsFloat(entry.getPropertyValue("Height"));
    this.DimUnit =  TypeConverter.getAsString(entry.getPropertyValue("DimUnit"));
    this.ProductPicUrl =  TypeConverter.getAsString(entry.getPropertyValue("ProductPicUrl"));
      this.parser = parser;
        this.schema = schema;
   }
  
  /**
   * Product Constructor</br>
   * Dummy values may apply
   *
   */
  public Product( String ProductId) 
  {
    super(new ODataEntry());
    
        this.setProductId(ProductId);
  }

  // Product navigation properties

  /**
   * Supplier Query
   * @return - ODataQuery
   * @throws - MalformedURLException
   */
  public ODataQuery SupplierQuery() throws MalformedURLException
  {
    String url = getEntry().getId() + "/" + "Supplier";
    ODataQuery query = new ODataQuery(url);
    
    return query;
  }

  /**
   * Get Supplier  
   * @return - BusinessPartner
   * @throws - IllegalArgumentException, ParserException, MalformedURLException
   */
  public BusinessPartner Supplier(String data) throws IllegalArgumentException, ParserException, MalformedURLException
  {
    BusinessPartner result = null;
      
    List<IODataEntry> parsedSDMODataEntries = getParsedSDMODataEntries(data, parser, schema, "Product","Supplier");  

      result = new BusinessPartner (parsedSDMODataEntries.get(0), parser, schema);
        return result;
  }


  /**
   * Supplier Load method
   *
   * loads the navigation property entries into the entityType
   * @throws ParserException 
   * @throws IllegalArgumentException
   * @throws MalformedURLException
   *
   */
  public void loadSupplier(String data) throws IllegalArgumentException, ParserException, MalformedURLException
  {
    BusinessPartner semanticData = Supplier(data);
    setSupplier(semanticData);
  }

  // Product properties getters and setters
    
  /**
   * @return - String Qty. Unit
   */
  public String getWeightUnit()
  {
    return this.WeightUnit;
  }
  
  /**
   * @param WeightUnit - Qty. Unit
   */
  public void setWeightUnit(String WeightUnit)
  {
    this.WeightUnit = WeightUnit;
    
    getEntry().putPropertyValue("WeightUnit", WeightUnit);
  }
    
  /**
   * @return - BigDecimal Wt. Measure
   */
  public BigDecimal getWeightMeasure()
  {
    return this.WeightMeasure;
  }
  
  /**
   * @param WeightMeasure - Wt. Measure
   */
  public void setWeightMeasure(BigDecimal WeightMeasure)
  {
    this.WeightMeasure = WeightMeasure;
    
    getEntry().putPropertyValue("WeightMeasure",  String.valueOf(this.WeightMeasure.floatValue()));
  }
    
  /**
   * @return - String Qty. Unit
   */
  public String getMeasureUnit()
  {
    return this.MeasureUnit;
  }
  
  /**
   * @param MeasureUnit - Qty. Unit
   */
  public void setMeasureUnit(String MeasureUnit)
  {
    this.MeasureUnit = MeasureUnit;
    
    getEntry().putPropertyValue("MeasureUnit", MeasureUnit);
  }
    
  /**
   * @return - String Prod. Tax Code
   */
  public String getTaxTarifCode()
  {
    return this.TaxTarifCode;
  }
  
  /**
   * @param TaxTarifCode - Prod. Tax Code
   */
  public void setTaxTarifCode(String TaxTarifCode)
  {
    this.TaxTarifCode = TaxTarifCode;
    
  }
    
  /**
   * @return - String Company Name
   */
  public String getSupplierName()
  {
    return this.SupplierName;
  }
  
  /**
   * @param SupplierName - Company Name
   */
  public void setSupplierName(String SupplierName)
  {
    this.SupplierName = SupplierName;
    
    getEntry().putPropertyValue("SupplierName", SupplierName);
  }
    
  /**
   * @return - String Bus. Part. ID
   */
  public String getSupplierId()
  {
    return this.SupplierId;
  }
  
  /**
   * @param SupplierId - Bus. Part. ID
   */
  public void setSupplierId(String SupplierId)
  {
    this.SupplierId = SupplierId;
    
    getEntry().putPropertyValue("SupplierId", SupplierId);
  }
    
  /**
   * @return - String Description
   */
  public String getDescription()
  {
    return this.Description;
  }
  
  /**
   * @param Description - Description
   */
  public void setDescription(String Description)
  {
    this.Description = Description;
    
    getEntry().putPropertyValue("Description", Description);
  }
    
  /**
   * @return - String Description
   */
  public String getName()
  {
    return this.Name;
  }
  
  /**
   * @param Name - Description
   */
  public void setName(String Name)
  {
    this.Name = Name;
    
    getEntry().putPropertyValue("Name", Name);
  }
    
  /**
   * @return - String Prod. Cat.
   */
  public String getCategory()
  {
    return this.Category;
  }
  
  /**
   * @param Category - Prod. Cat.
   */
  public void setCategory(String Category)
  {
    this.Category = Category;
    
    getEntry().putPropertyValue("Category", Category);
  }
    
  /**
   * @return - String Prod. Type Code
   */
  public String getTypeCode()
  {
    return this.TypeCode;
  }
  
  /**
   * @param TypeCode - Prod. Type Code
   */
  public void setTypeCode(String TypeCode)
  {
    this.TypeCode = TypeCode;
    
    getEntry().putPropertyValue("TypeCode", TypeCode);
  }
    
  /**
   * @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 - BigDecimal Price
   */
  public BigDecimal getPrice()
  {
    return this.Price;
  }
  
  /**
   * @param Price - Price
   */
  public void setPrice(BigDecimal Price)
  {
    this.Price = Price;
    
    getEntry().putPropertyValue("Price",  String.valueOf(this.Price.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 - BigDecimal Dimensions
   */
  public BigDecimal getWidth()
  {
    return this.Width;
  }
  
  /**
   * @param Width - Dimensions
   */
  public void setWidth(BigDecimal Width)
  {
    this.Width = Width;
    
    getEntry().putPropertyValue("Width",  String.valueOf(this.Width.floatValue()));
  }
    
  /**
   * @return - BigDecimal Dimensions
   */
  public BigDecimal getDepth()
  {
    return this.Depth;
  }
  
  /**
   * @param Depth - Dimensions
   */
  public void setDepth(BigDecimal Depth)
  {
    this.Depth = Depth;
    
    getEntry().putPropertyValue("Depth",  String.valueOf(this.Depth.floatValue()));
  }
    
  /**
   * @return - BigDecimal Dimensions
   */
  public BigDecimal getHeight()
  {
    return this.Height;
  }
  
  /**
   * @param Height - Dimensions
   */
  public void setHeight(BigDecimal Height)
  {
    this.Height = Height;
    
    getEntry().putPropertyValue("Height",  String.valueOf(this.Height.floatValue()));
  }
    
  /**
   * @return - String Dim. Unit
   */
  public String getDimUnit()
  {
    return this.DimUnit;
  }
  
  /**
   * @param DimUnit - Dim. Unit
   */
  public void setDimUnit(String DimUnit)
  {
    this.DimUnit = DimUnit;
    
    getEntry().putPropertyValue("DimUnit", DimUnit);
  }
    
  /**
   * @return - String Pic URL
   */
  public String getProductPicUrl()
  {
    return this.ProductPicUrl;
  }
  
  /**
   * @param ProductPicUrl - Pic URL
   */
  public void setProductPicUrl(String ProductPicUrl)
  {
    this.ProductPicUrl = ProductPicUrl;
    
    getEntry().putPropertyValue("ProductPicUrl", ProductPicUrl);
  }
  
  /**
   * @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;
  }

  // Product navigation properties setters and getters
  
  /**
   * Returns navigation property
   * Returns null if was not expanded
   * @throws MalformedURLException
   */
  public BusinessPartner getSupplier() throws MalformedURLException
  {
    if (null == supplier)
    {
      //load InlineEntries for Supplier
      List<IODataEntry> inlineEntries  = getInlineEntries(getEntry(),"Supplier");

      if (null != inlineEntries) 
      {
        supplier = new BusinessPartner(inlineEntries.get(0), parser, schema);
      }
    }
    return supplier;
  }

  /**
   * Sets navigation property
   * @param supplier - the navigation property to set.
   */
  public void setSupplier(BusinessPartner supplier) 
  {
    this.supplier = supplier;
  }
  

  /**
    * 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, "ProductCollection" );
        
      productLabels = new HashMap<String, String>();
      productTypes = new HashMap<String, String>();
      
      if (properties != null)
      {
          for (IODataProperty property : properties) 
          {
            productLabels.put(property.getName(), property.getLabel());
            productTypes.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(productTypes, 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(productLabels, propertyName);
    }
}




Java Source Code List

com.capgemini.SalesOrder.LoginActivity.java
com.capgemini.SalesOrder.Page1ListActivity.java
com.capgemini.SalesOrder.Page1ListAdapter.java
com.capgemini.SalesOrder.Page2ListActivity.java
com.capgemini.SalesOrder.Page2ListAdapter.java
com.capgemini.SalesOrder.Page3ListActivity.java
com.capgemini.SalesOrder.Page3ListAdapter.java
com.capgemini.SalesOrder.Page4DetailsActivity.java
com.capgemini.SalesOrder.Page4DetailsAdapter.java
com.capgemini.SalesOrder.Page5DetailsActivity.java
com.capgemini.SalesOrder.Page5DetailsAdapter.java
com.capgemini.SalesOrder.Page6DetailsActivity.java
com.capgemini.SalesOrder.Page6DetailsAdapter.java
com.capgemini.SalesOrder.SplashScreen.java
com.capgemini.SalesOrder.preferences.GatewaySettingsPreferencesActivity.java
com.capgemini.SalesOrder.preferences.MainPreferencesActivity.java
com.capgemini.SalesOrder.preferences.PreferencesUtilities.java
com.capgemini.SalesOrder.preferences.SUPSettingsPreferencesActivity.java
com.capgemini.SalesOrder.zgwsample_srv.ServiceVersionConfigurations.java
com.capgemini.SalesOrder.zgwsample_srv.v0.ZGWSAMPLE_SRVRequestHandler.java
com.capgemini.SalesOrder.zgwsample_srv.v0.ZGWSAMPLE_SRVService.java
com.capgemini.SalesOrder.zgwsample_srv.v0.entitytypes.BusinessPartner.java
com.capgemini.SalesOrder.zgwsample_srv.v0.entitytypes.Contact.java
com.capgemini.SalesOrder.zgwsample_srv.v0.entitytypes.Product.java
com.capgemini.SalesOrder.zgwsample_srv.v0.entitytypes.SalesOrderLineItem.java
com.capgemini.SalesOrder.zgwsample_srv.v0.entitytypes.SalesOrder.java
com.capgemini.SalesOrder.zgwsample_srv.v0.helpers.IZGWSAMPLE_SRVRequestHandlerListener.java
com.capgemini.SalesOrder.zgwsample_srv.v0.helpers.ListenerWrapper.java
com.capgemini.SalesOrder.zgwsample_srv.v0.helpers.ZGWSAMPLE_SRVLoginAsyncTask.java
com.capgemini.SalesOrder.zgwsample_srv.v0.helpers.ZGWSAMPLE_SRVRequestID.java