use of org.broadleafcommerce.cms.url.domain.URLHandler in project BroadleafCommerce by BroadleafCommerce.
the class URlHandlerDaoImpl method findAllURLHandlers.
@Override
public List<URLHandler> findAllURLHandlers() {
CriteriaBuilder builder = em.getCriteriaBuilder();
CriteriaQuery<URLHandler> criteria = builder.createQuery(URLHandler.class);
Root<URLHandlerImpl> handler = criteria.from(URLHandlerImpl.class);
criteria.select(handler);
TypedQuery<URLHandler> query = em.createQuery(criteria);
query.setHint(QueryHints.HINT_CACHEABLE, true);
try {
return query.getResultList();
} catch (NoResultException e) {
return new ArrayList<URLHandler>();
}
}
use of org.broadleafcommerce.cms.url.domain.URLHandler in project BroadleafCommerce by BroadleafCommerce.
the class URLHandlerServiceTest method testRegExStartsWithSpecialRegExChar.
@Test
public void testRegExStartsWithSpecialRegExChar() {
URLHandler h = handlerService.checkForMatches("/merchandise/shirts-tops/mens");
String expectedNewURL = "/merchandise/shirts/mens";
assertTrue(h != null);
assertTrue(expectedNewURL.equals(h.getNewURL()));
}
use of org.broadleafcommerce.cms.url.domain.URLHandler in project BroadleafCommerce by BroadleafCommerce.
the class URLHandlerServiceTest method createHandler.
protected URLHandler createHandler(String incomingUrl, String newUrl) {
URLHandler handler = new URLHandlerImpl();
handler.setIncomingURL(incomingUrl);
handler.setNewURL(newUrl);
handler.setUrlRedirectType(URLRedirectType.REDIRECT_PERM);
return handler;
}
use of org.broadleafcommerce.cms.url.domain.URLHandler in project BroadleafCommerce by BroadleafCommerce.
the class URLHandlerServiceTest method testForSubPackageBadMatchSimpleUrl.
@Test
public void testForSubPackageBadMatchSimpleUrl() {
URLHandler h = handlerService.checkForMatches("/simple_url/test");
assertTrue(h == null);
}
use of org.broadleafcommerce.cms.url.domain.URLHandler in project BroadleafCommerce by BroadleafCommerce.
the class URLHandlerServiceTest method testFoundSimpleUrl.
@Test
public void testFoundSimpleUrl() {
URLHandler h = handlerService.checkForMatches("/simple_url");
assertTrue(h.getNewURL().equals("/NewSimpleUrl"));
}
Aggregations