
com.sap.cloud.sdk.s4hana.datamodel.odata.services.DefaultSegmentService Maven / Gradle / Ivy
/*
* Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved.
*/
package com.sap.cloud.sdk.s4hana.datamodel.odata.services;
import javax.annotation.Nonnull;
import javax.inject.Named;
import com.sap.cloud.sdk.s4hana.datamodel.odata.namespaces.segment.SegmentByKeyFluentHelper;
import com.sap.cloud.sdk.s4hana.datamodel.odata.namespaces.segment.SegmentFluentHelper;
import com.sap.cloud.sdk.s4hana.datamodel.odata.namespaces.segment.SegmentTextByKeyFluentHelper;
import com.sap.cloud.sdk.s4hana.datamodel.odata.namespaces.segment.SegmentTextFluentHelper;
import com.sap.cloud.sdk.s4hana.datamodel.odata.namespaces.segment.batch.DefaultSegmentServiceBatch;
/**
*
* This service enables you to read segment master data in an API call. It is based on the OData protocol, and can be
* consumed in Fiori apps and on other user interfaces.
*
*
*
* Reference:
* SAP
* API Business Hub
*
* Details:
*
*
* OData Service:
* API_SEGMENT_SRV
*
*
* API Version:
* 1
*
*
* Communication Scenario:
* SAP Business Objects Cloud for Planning Integration (SAP_COM_0087)
*
*
* Scope Items:
* oData Integration with SAP Business Objects Cloud for
* Planning (1YB)
*
*
*
*/
@Named( "com.sap.cloud.sdk.s4hana.datamodel.odata.services.DefaultSegmentService" )
public class DefaultSegmentService implements SegmentService
{
@Nonnull
private final String servicePath;
/**
* Creates a service using {@link SegmentService#DEFAULT_SERVICE_PATH} to send the requests.
*
*/
public DefaultSegmentService()
{
servicePath = SegmentService.DEFAULT_SERVICE_PATH;
}
/**
* Creates a service using the provided service path to send the requests.
*
* Used by the fluent {@link #withServicePath(String)} method.
*
*/
private DefaultSegmentService( @Nonnull final String servicePath )
{
this.servicePath = servicePath;
}
@Override
@Nonnull
public DefaultSegmentService withServicePath( @Nonnull final String servicePath )
{
return new DefaultSegmentService(servicePath);
}
/**
* {@inheritDoc}
*
*/
@Override
@Nonnull
public DefaultSegmentServiceBatch batch()
{
return new DefaultSegmentServiceBatch(this);
}
@Override
@Nonnull
public SegmentFluentHelper getAllSegment()
{
return new SegmentFluentHelper(servicePath);
}
@Override
@Nonnull
public SegmentByKeyFluentHelper getSegmentByKey( final String segment )
{
return new SegmentByKeyFluentHelper(servicePath, segment);
}
@Override
@Nonnull
public SegmentTextFluentHelper getAllSegmentText()
{
return new SegmentTextFluentHelper(servicePath);
}
@Override
@Nonnull
public SegmentTextByKeyFluentHelper getSegmentTextByKey( final String language, final String segment )
{
return new SegmentTextByKeyFluentHelper(servicePath, language, segment);
}
}