Class DefaultCommonApplicationService<P extends Application>
- java.lang.Object
-
- com.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService<P>
-
- com.broadleafcommerce.data.tracking.core.tenant.service.DefaultCommonApplicationService<P>
-
- All Implemented Interfaces:
CrudEntityService<P>
,CommonApplicationService<P>
public class DefaultCommonApplicationService<P extends Application> extends BaseCrudEntityService<P> implements CommonApplicationService<P>
-
-
Field Summary
Fields Modifier and Type Field Description static String
CACHE_BY_APPLICATION_CONTEXT_ID
static String
CACHE_BY_APPLICATION_URL
-
Constructor Summary
Constructors Constructor Description DefaultCommonApplicationService(CommonApplicationRepository<Trackable> repository, CrudEntityHelper helper)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.springframework.web.util.UriComponents
convertUrlToUri(@NonNull String url)
Converts a url to UriComponentsOptional<P>
getApplicationFromRequestUrl(@NonNull String requestUrl)
Find an Application by a given request urlprotected Optional<P>
getApplicationFromUri(org.springframework.web.util.UriComponents uri)
Returns an application that matches the request uri, specifically looking at the hostP
readByContextId(String id, ContextInfo context)
Read a single instance of an entity in the form of a business domain.Optional<P>
readByIdentifierValueAndIdentifierType(@NonNull String identifierValue, @NonNull String identifierType)
Read an Application by its identifier value and type-
Methods inherited from class com.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService
convertFromPersistentDomain, convertToPersistentDomain, create, createAll, createAllAllowingPartialSuccess, delete, getHelper, getRepository, getSortPositionStrategy, readAll, readAll, readAll, readAllByContextId, replace, replaceAll, replaceAllAllowingPartialSuccess, setSortPositionStrategy, update, updateAll, updateAllAllowingPartialSuccess, updateSort
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.broadleafcommerce.data.tracking.core.service.CrudEntityService
create, createAll, createAllAllowingPartialSuccess, delete, readAll, readAll, readAll, readAllByContextId, replace, replaceAll, replaceAllAllowingPartialSuccess, update, updateAll, updateAllAllowingPartialSuccess, updateSort
-
-
-
-
Field Detail
-
CACHE_BY_APPLICATION_CONTEXT_ID
public static final String CACHE_BY_APPLICATION_CONTEXT_ID
- See Also:
- Constant Field Values
-
CACHE_BY_APPLICATION_URL
public static final String CACHE_BY_APPLICATION_URL
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DefaultCommonApplicationService
public DefaultCommonApplicationService(CommonApplicationRepository<Trackable> repository, CrudEntityHelper helper)
-
-
Method Detail
-
readByContextId
@Cacheable(value="trackingCacheByApplicationContextId", keyGenerator="trackingCacheByApplicationContextId", condition="@cacheStateManager.isEnabled(#root.caches, #root.args)") public P readByContextId(String id, ContextInfo context)
Description copied from interface:CrudEntityService
Read a single instance of an entity in the form of a business domain.- Specified by:
readByContextId
in interfaceCrudEntityService<P extends Application>
- Overrides:
readByContextId
in classBaseCrudEntityService<P extends Application>
- Parameters:
id
- The context id for the entity. This is the id by which the business recognizes the item.context
- Context information used to discriminate the correct version of an entity by context id when multiple verions may be available across sandboxes, catalogs and applications.- Returns:
- The narrowed entity instance in the form of a business instance
-
readByIdentifierValueAndIdentifierType
public Optional<P> readByIdentifierValueAndIdentifierType(@NonNull @NonNull String identifierValue, @NonNull @NonNull String identifierType)
Description copied from interface:CommonApplicationService
Read an Application by its identifier value and type- Specified by:
readByIdentifierValueAndIdentifierType
in interfaceCommonApplicationService<P extends Application>
- Parameters:
identifierValue
- the value to look foridentifierType
- the identifier type of the application- Returns:
- the application that matches the identifier value
-
getApplicationFromRequestUrl
@Cacheable(value="trackingCacheByApplicationUrl", condition="@cacheStateManager.isEnabled(#root.caches, #root.args)") public Optional<P> getApplicationFromRequestUrl(@NonNull @NonNull String requestUrl)
Description copied from interface:CommonApplicationService
Find an Application by a given request url- Specified by:
getApplicationFromRequestUrl
in interfaceCommonApplicationService<P extends Application>
- Parameters:
requestUrl
- the url to try to match against- Returns:
- an Application associated with the given url
-
getApplicationFromUri
protected Optional<P> getApplicationFromUri(org.springframework.web.util.UriComponents uri)
Returns an application that matches the request uri, specifically looking at the host- Parameters:
uri
- the UriComponents that make up the request- Returns:
- optional containing the Application that matches the request
-
convertUrlToUri
protected org.springframework.web.util.UriComponents convertUrlToUri(@NonNull @NonNull String url)
Converts a url to UriComponents- Parameters:
url
- the url to convert- Returns:
- UriComponents for the given url
-
-