com.sap.sl.sdk.authoring.businesslayer
Interface BusinessLayerFactory


public interface BusinessLayerFactory

Provides methods to create a business layer, its business layer items and views, custom and query script properties, lists of values, parameters, and object formats.

The business layer you create is validated at save time. See RelationalBusinessLayer.

In this release, you can create the following types of lists of values:

See SlContext.getService(Class) to get an instance of the factory.


Method Summary
 AggregateIncompatibility createAggregateIncompatibility(RelationalBusinessLayer businessLayer)
          Creates an aggregate incompatibility and adds it to the given relational business layer.
<T extends BlItem>
T
createBlItem(java.lang.Class<T> type, java.lang.String name, BlContainer parent)
          Creates a business layer item.
 BusinessHierarchicalLov createBusinessHierarchicalLov(java.lang.String name, BusinessLayer businessLayer)
          Creates a business hierarchical list of values and adds it to the given business layer.
 BusinessHierarchicalLovColumn createBusinessHierarchicalLovColumn(BusinessHierarchicalLov businessHierarchicalLov, Dimension dimension)
          Creates a column of business hierarchical list of values based on a dimension and adds it to the given list of values.
 BusinessLayerView createBusinessLayerView(java.lang.String name, BusinessLayer businessLayer)
          Creates a business layer view for the given business layer.
 BusinessQueryLov createBusinessQueryLov(java.lang.String name, BusinessLayer businessLayer)
          Creates a list of values based on a query built from business objects and adds it to the given business layer.
 CustomDateTimeFormat createCustomDateTimeFormat(BusinessObject businessObject)
          Creates a custom date-time format and adds it to the given business object.
 CustomNumberFormat createCustomNumberFormat(BusinessObject businessObject)
          Creates a custom number format and adds it to the given business object.
 CustomProperty createCustomProperty(java.lang.String key, java.lang.String value, BlItem blItem)
          Creates a custom property for the given business layer item.
 CustomProperty createCustomProperty(java.lang.String key, java.lang.String value, BusinessLayer businessLayer)
          Creates a custom property for the given business layer.
 CustomProperty createCustomProperty(java.lang.String key, java.lang.String value, Parameter parameter)
          Creates a custom property for the given parameter.
 DateValue createDateValue(java.util.Date value)
          Creates a value of type Date that can be used as an answer to a prompt.
 HierarchicalValue createHierarchicalValue()
          Creates a value for an answer to a prompt that accepts hierarchical lists of values.
 IntervalAnswer createIntervalAnswer()
          Creates an answer to a prompt that accepts a set of values between two values.
 MultipleValueAnswer createMultipleValueAnswer()
          Creates an answer to a prompt that accepts multiple values.
 NavigationPath createNavigationPath(java.lang.String name, BusinessLayer businessLayer)
          Creates a custom navigation path and adds it to the given business layer.
 NumericValue createNumericValue(java.lang.Double value)
          Creates a value of type Numeric that can be used as an answer to a prompt.
 Parameter createParameter(java.lang.String name, BusinessLayer businessLayer)
          Creates a parameter and adds it to the given business layer.
 Parameter createParameter(java.lang.String name, DataFoundation dataFoundation)
          Creates a parameter and attaches it to the given data foundation.
 PredefinedDateTimeFormat createPredefinedDateTimeFormat(BusinessObject businessObject)
          Creates a predefined date-time format and adds it to the given business object.
 PredefinedNumberFormat createPredefinedNumberFormat(BusinessObject businessObject)
          Creates a predefined number format and adds it to the given business object.
 QueryScriptProperty createQueryScriptProperty(java.lang.String key, java.lang.String value, BusinessLayer businessLayer)
          Creates a custom query script property.
 RelationalBusinessLayer createRelationalBusinessLayer(java.lang.String name, java.lang.String datafoundationPath)
          Creates a relational business layer linked to a data foundation.
 SingleValueAnswer createSingleValueAnswer()
          Creates an answer to a prompt that accepts a single value.
 SQLQueryLov createSQLQueryLov(java.lang.String name, BusinessLayer businessLayer)
          Creates an SQL-based list of values and adds it to the given business layer.
 StaticLov createStaticLov(java.lang.String name, BusinessLayer businessLayer)
          Creates a static list of values and adds it to the given business layer.
 StaticLovColumn createStaticLovColumn(java.lang.String name, StaticLov staticLov)
          Creates a column for a static list of values and adds it to the given list.
 StaticLovRow createStaticLovRow(StaticLov staticLov)
          Creates a row for a static list of values and adds it to the given list.
 StringValue createStringValue(java.lang.String value)
          Creates a value of type String that can be used as an answer to a prompt.
 

Method Detail

createRelationalBusinessLayer

RelationalBusinessLayer createRelationalBusinessLayer(java.lang.String name,
                                                      java.lang.String datafoundationPath)
Creates a relational business layer linked to a data foundation.

For example:

 businessLayer = businessLayerFactory.createRelationalBusinessLayer("myBusinessLayer", "dfPath");
 ...
 

Parameters:
name - The business layer name
datafoundationPath - The local path to an existing data foundation
Returns:
A RelationalBusinessLayer object
Since:
14.1

createBlItem

<T extends BlItem> T createBlItem(java.lang.Class<T> type,
                                  java.lang.String name,
                                  BlContainer parent)
Creates a business layer item.

Example:

 SlContext context = ...;
 RelationalBusinessLayer businessLayer = ...;
 
 RootFolder rootFolder = businessLayer.getRootFolder();
 
 BusinessLayerFactory businessLayerFactory = context.getService(BusinessLayerFactory.class);
 Dimension dimension = businessLayerFactory.createBlItem(Dimension.class, "New Dimension", rootFolder);
 dimension.setSelect("table.column");
 

Parameters:
type - One of the following class objects:
name - The business item name
parent - The business item that will be the container of the business item to be created. It must be attached directly or indirectly to a business layer. See BlContainer.getChildren().
Returns:
The created business layer item
Since:
14.1

createCustomProperty

CustomProperty createCustomProperty(java.lang.String key,
                                    java.lang.String value,
                                    BusinessLayer businessLayer)
Creates a custom property for the given business layer.

Example:

 customProperty businessLayerFactory.createCustomProperty("MyKey", "MyValue", businessLayer);
 ...
 

Parameters:
key - The key of the custom property
value - The value of the custom property
businessLayer - The business layer to which the custom property is added
Returns:
A CustomProperty object
Since:
14.1.2

createCustomProperty

CustomProperty createCustomProperty(java.lang.String key,
                                    java.lang.String value,
                                    BlItem blItem)
Creates a custom property for the given business layer item.

Example:

 customProperty businessLayerFactory.createCustomProperty("MyDimKey", "MyDimValue", myDimension);
 ...
 

Parameters:
key - The key of the custom property
value - The value of the custom property
blItem - The business layer item to which the custom property is added
Returns:
A CustomProperty object
Since:
14.1.2

createCustomProperty

CustomProperty createCustomProperty(java.lang.String key,
                                    java.lang.String value,
                                    Parameter parameter)
Creates a custom property for the given parameter.

Example:

 customProperty businessLayerFactory.createCustomProperty("MyKey", "MyValue", myParameter);
 ...
 

Parameters:
key - The key of the custom property
value - The value of the custom property
arameter - The parameter to which the custom property is added
Returns:
A CustomProperty object
Since:
14.1.2

createBusinessLayerView

BusinessLayerView createBusinessLayerView(java.lang.String name,
                                          BusinessLayer businessLayer)
Creates a business layer view for the given business layer.

Example:

 businessLayer = businessLayerFactory.createRelationalBusinessLayer("MyBusinessLayer", "dfPath");
 ...          
 BusinessLayerView view = businessLayerFactory.createBusinessLayerView("View", businessLayer);
 businessLayer.getBusinessLayerViews().add(view);
 

Parameters:
name - The name of the business layer view
businessLayer - The business layer to which the business layer view is added
Returns:
A BusinessLayerView object
Since:
14.1.2
See Also:
BusinessLayer.getBusinessLayerViews()

createStaticLov

StaticLov createStaticLov(java.lang.String name,
                          BusinessLayer businessLayer)
Creates a static list of values and adds it to the given business layer.

Example:

 StaticLov staticLov = businessLayerFactory.createStaticLov("StaticLov", businessLayer);
 staticLov.setDescription("Description of StaticLov");     
 

Parameters:
name - The name of the list of values
businessLayer - The business layer
Returns:
A StaticLov object
Since:
14.1.3
See Also:
Lov.setDescription(String)

createStaticLovColumn

StaticLovColumn createStaticLovColumn(java.lang.String name,
                                      StaticLov staticLov)
Creates a column for a static list of values and adds it to the given list.

Example:

 StaticLov staticLov = businessLayerFactory.createStaticLov("StaticLov", businessLayer);
 staticLov.setDescription("Description of StaticLov");
      
 StaticLovColumn staticLovColumn1 = businessLayerFactory.createStaticLovColumn("Column1", staticLov);
 staticLovColumn1.setHidden(true);
 staticLovColumn1.setDataType(LovParameterDataType.NUMERIC);
      
 StaticLovColumn staticLovColumn2 = businessLayerFactory.createStaticLovColumn("Column2", staticLov);
 ...
 

Parameters:
name - The column name
staticLov - The static list of values
Returns:
A StaticLovColumn object
Since:
14.1.3
See Also:
StaticLovColumn.setHidden(boolean), StaticLovColumn.setDataType(LovParameterDataType)

createStaticLovRow

StaticLovRow createStaticLovRow(StaticLov staticLov)
Creates a row for a static list of values and adds it to the given list.

Example:

 StaticLov staticLov = businessLayerFactory.createStaticLov("StaticLov", businessLayer);
 ...
 StaticLovColumn staticLovColumn1 = businessLayerFactory.createStaticLovColumn("Column1", staticLov);
 ...
 StaticLovRow staticLovRow1 = businessLayerFactory.createStaticLovRow(staticLov);
 staticLovRow1.getValues().add(businessLayerFactory.createNumericValue(18.9));
 staticLovRow1.getValues().add(businessLayerFactory.createStringValue("Value"));
 staticLovRow1.getValues().add(businessLayerFactory.createDateValue(Date.valueOf("2013-07-14")));     
 ...          
 

Parameters:
staticLov - The static list of values
Returns:
A StaticLovRow object
Since:
14.1.3
See Also:
createNumericValue(Double), createStringValue(String), createDateValue(Date), StaticLovRow.getValues()

createSQLQueryLov

SQLQueryLov createSQLQueryLov(java.lang.String name,
                              BusinessLayer businessLayer)
Creates an SQL-based list of values and adds it to the given business layer.

Example:

 SQLQueryLov sqlQueryLov = businessLayerFactory.createSQLQueryLov("SQLQueryLov", businessLayer);
 sqlQueryLov.setDescription("Description of SQLQueryLov");
 sqlQueryLov.setSQLExpression("SELECT * FROM CUSTORDER");
 ...
 

Parameters:
name - The name of the list of values
businessLayer - The business layer
Returns:
An SQLQueryLov object
Since:
14.1.3
See Also:
Lov.setDescription(String), SQLQueryLov.setSQLExpression(String)

createBusinessHierarchicalLov

BusinessHierarchicalLov createBusinessHierarchicalLov(java.lang.String name,
                                                      BusinessLayer businessLayer)
Creates a business hierarchical list of values and adds it to the given business layer.

Example:

                
 BusinessHierarchicalLov businessHierarchicalLov = businessLayerFactory.createBusinessHierarchicalLov("BusinessHierarchicalLov", businessLayer);
 businessHierarchicalLov.setDescription("Description of BusinessHierarchicalLov");
 ...
 

Parameters:
name - The name of the list of values
businessLayer - The business layer
Returns:
A BusinessHierarchicalLov object
Since:
14.1.3
See Also:
Lov.setDescription(String)

createBusinessHierarchicalLovColumn

BusinessHierarchicalLovColumn createBusinessHierarchicalLovColumn(BusinessHierarchicalLov businessHierarchicalLov,
                                                                  Dimension dimension)
Creates a column of business hierarchical list of values based on a dimension and adds it to the given list of values.

Example:

 BusinessHierarchicalLov businessHierarchicalLov = businessLayerFactory.createBusinessHierarchicalLov("BusinessHierarchicalLov", businessLayer);
 businessHierarchicalLov.setDescription("Description of BusinessHierarchicalLov");
 ...          
 businessLayerFactory.createBusinessHierarchicalLovColumn(businessHierarchicalLov, dimension);
 

Parameters:
businessHierarchicalLov - The list of values
dimension - The dimension
Returns:
A BusinessHierarchicalLov object
Since:
14.1.3
See Also:
Lov.setDescription(String)

createBusinessQueryLov

BusinessQueryLov createBusinessQueryLov(java.lang.String name,
                                        BusinessLayer businessLayer)
Creates a list of values based on a query built from business objects and adds it to the given business layer.

Example:

                
 BusinessQueryLov businessQueryLov = businessLayerFactory.createBusinessQueryLov("BusinessQueryLov", businessLayer);
 businessQueryLov.setDescription("Description of BusinessQueryLov");
 ...
 

Parameters:
name - The name of the list of values
businessLayer - The business layer
Returns:
A BusinessQueryLov object
Since:
14.2.3
See Also:
Lov.setDescription(String)

createParameter

Parameter createParameter(java.lang.String name,
                          DataFoundation dataFoundation)
Creates a parameter and attaches it to the given data foundation.

Example:

 Parameter parameter = businessLayerFactory.createParameter("prompt", dataFoundation);
 parameter.setUserPrompted(true);
 parameter.setPromptText(parameter.getName());
 parameter.setDataType(LovParameterDataType.STRING);
 ...
 parameter.setAssociatedLov(staticLov.getColumns().get(1)); 
 

Parameters:
name - The parameter name
dataFoundation - The data foundation
Returns:
A Parameter object
Since:
14.1.3
See Also:
Parameter.setUserPrompted(boolean), Parameter.setPromptText(String), Parameter.setDataType(LovParameterDataType), Parameter.setAssociatedLov(Object), StaticLov.getColumns()

createSingleValueAnswer

SingleValueAnswer createSingleValueAnswer()
Creates an answer to a prompt that accepts a single value.

Returns:
A SingleValueAnswer object
Since:
14.1.3

createMultipleValueAnswer

MultipleValueAnswer createMultipleValueAnswer()
Creates an answer to a prompt that accepts multiple values.

Returns:
A MultipleValueAnswer object
Since:
14.1.3

createIntervalAnswer

IntervalAnswer createIntervalAnswer()
Creates an answer to a prompt that accepts a set of values between two values.

Example:

 ...
 IntervalAnswer answer = businessLayerFactory.createIntervalAnswer();
 answer.setLowValue(businessLayerFactory.createStringValue("value1"));
 answer.setHighValue(businessLayerFactory.createStringValue("value2"));
 

Returns:
An IntervalAnswer object
Since:
14.1.3
See Also:
createStringValue(String), IntervalAnswer.setLowValue(TypedValue), IntervalAnswer.setHighValue(TypedValue)

createStringValue

StringValue createStringValue(java.lang.String value)
Creates a value of type String that can be used as an answer to a prompt.

Parameters:
value - The answer value
Returns:
A StringValue object
Since:
14.1.3

createDateValue

DateValue createDateValue(java.util.Date value)
Creates a value of type Date that can be used as an answer to a prompt.

Parameters:
value - The answer value
Returns:
A DateValue object
Since:
14.1.3

createNumericValue

NumericValue createNumericValue(java.lang.Double value)
Creates a value of type Numeric that can be used as an answer to a prompt.

Parameters:
value - The answer value
Returns:
A NumericValue object
Since:
14.1.3

createHierarchicalValue

HierarchicalValue createHierarchicalValue()
Creates a value for an answer to a prompt that accepts hierarchical lists of values.

Returns:
A HierarchicalValue object
Since:
14.1.3

createParameter

Parameter createParameter(java.lang.String name,
                          BusinessLayer businessLayer)
Creates a parameter and adds it to the given business layer.

Example:

 Parameter parameter = businessLayerFactory.createParameter("prompt", businessLayer);
 parameter.setUserPrompted(true);     
 parameter.setPromptText(parameter.getName());
 parameter.setDataType(LovParameterDataType.STRING);
 ...     
 parameter.setAssociatedLov(staticLov.getColumns().get(1));
 

Parameters:
name - The parameter name
businessLayer - The business layer to which the parameter is added
Returns:
A Parameter object
Since:
14.1.3
See Also:
Parameter.setUserPrompted(boolean), Parameter.setPromptText(String), Parameter.setDataType(LovParameterDataType), Parameter.setAssociatedLov(Object), StaticLov.getColumns()

createAggregateIncompatibility

AggregateIncompatibility createAggregateIncompatibility(RelationalBusinessLayer businessLayer)
Creates an aggregate incompatibility and adds it to the given relational business layer.

Example:

 AggregateIncompatibility aggregateIncompatibility = businessLayerFactory.createAggregateIncompatibility(businessLayer);
 aggregateIncompatibility.setTableName(dataFoundationService.getTableFullName(table));     
 

Parameters:
businessLayer - The business layer to which the incompatibility is added
Returns:
An AggregateIncompatibility object
Since:
14.1.5

createNavigationPath

NavigationPath createNavigationPath(java.lang.String name,
                                    BusinessLayer businessLayer)
Creates a custom navigation path and adds it to the given business layer.

Example:

 NavigationPath navigationPath = businessLayerFactory.createNavigationPath("NavigationPath", businessLayer);
 navigationPath.setDescription("My description of NavigationPath");
 Dimension dimension = (Dimension) businessLayerService.getBlItem(businessLayer, "Dimperiod\\Date", true);
 navigationPath.getDimensions().add(dimension);
 

Parameters:
name - The name of the navigation path
businessLayer - The business layer to which the navigation path is added
Returns:
A NavigationPath object
Since:
14.1.6

createPredefinedDateTimeFormat

PredefinedDateTimeFormat createPredefinedDateTimeFormat(BusinessObject businessObject)
Creates a predefined date-time format and adds it to the given business object.

Example:

 PredefinedDateTimeFormat dateTimeFormat = businessLayerFactory.createPredefinedDateTimeFormat(businessObject);
 dateTimeFormat.setFormat(PredefinedDateTimeFormatTypes.ShortDate););
 

Parameters:
businessObject - The business object to which the date format is set
Returns:
A PredefinedDateTimeFormat object
Since:
14.2.0

createCustomDateTimeFormat

CustomDateTimeFormat createCustomDateTimeFormat(BusinessObject businessObject)
Creates a custom date-time format and adds it to the given business object.

Example:

 CustomDateTimeFormat dateTimeFormat = businessLayerFactory.createCustomDateTimeFormat(businessObject);
 dateTimeFormat.setDateTimeFormat().setFormat("mm'/'yyyy");
 dateTimeFormat.setDateTimeFormat().setColor(FormatColor.RED);     
 dateTimeFormat.setUndefinedFormat().setFormat("Date error");
 

Parameters:
businessObject - The business object to which the date format is set
Returns:
A CustomDateTimeFormat object
Since:
14.2.0

createPredefinedNumberFormat

PredefinedNumberFormat createPredefinedNumberFormat(BusinessObject businessObject)
Creates a predefined number format and adds it to the given business object.

Example:

 PredefinedNumberFormat numberFormat = businessLayerFactory.createPredefinedNumberFormat(businessObject);
 numberFormat.setFormat(PredefinedNumberFormatTypes.Boolean);
 

Parameters:
businessObject - The business object to which the number format is set
Returns:
A PredefinedNumberFormat object
Since:
14.2.0

createCustomNumberFormat

CustomNumberFormat createCustomNumberFormat(BusinessObject businessObject)
Creates a custom number format and adds it to the given business object.

Example:

 CustomNumberFormat numberFormat = businessLayerFactory.createCustomNumberFormat(businessObject);
 numberFormat.getPositiveFormat().setFormat("-#");
 numberFormat.getNegativeFormat().setFormat("-#");
 numberFormat.getNegativeFormat().setColor(FormatColor.RED);
 numberFormat.getZeroFormat().setFormat("-#");
 numberFormat.getUndefinedFormat().setFormat("Number error");
 

Parameters:
businessObject - The business object to which the number format is set
Returns:
A CustomNumberFormat object
Since:
14.2.0

createQueryScriptProperty

QueryScriptProperty createQueryScriptProperty(java.lang.String key,
                                              java.lang.String value,
                                              BusinessLayer businessLayer)
Creates a custom query script property.

Example:

 queryScriptProperty businessLayerFactory.createQueryScriptProperty("MyKey", "MyValue");
 ...
 

Parameters:
key - The key of the query script property
value - The value of the query script property
businessLayer - The business layer to which the custom query script property is added
Returns:
A QueryScriptProperty object
Since:
14.2.3


© Copyright 2016 SAP SE or an SAP affiliate company. All rights reserved.