Search in sources :

Example 21 with Trace

use of com.enonic.xp.trace.Trace in project xp by enonic.

the class ContentServiceImpl method getByPath.

@Override
public Content getByPath(final ContentPath path) {
    final Trace trace = Tracer.newTrace("content.getByPath");
    if (trace == null) {
        return doGetByPath(path);
    }
    return Tracer.trace(trace, () -> {
        trace.put("path", path);
        final Content content = doGetByPath(path);
        trace.put("id", content.getId());
        return content;
    });
}
Also used : Trace(com.enonic.xp.trace.Trace) Content(com.enonic.xp.content.Content)

Example 22 with Trace

use of com.enonic.xp.trace.Trace in project xp by enonic.

the class ContentServiceImpl method find.

@Override
public FindContentIdsByQueryResult find(final ContentQuery query) {
    final Trace trace = Tracer.newTrace("content.find");
    if (trace == null) {
        return doFind(query);
    }
    return Tracer.trace(trace, () -> {
        trace.put("query", query.getQueryExpr() != null ? query.getQueryExpr().toString() : "");
        trace.put("from", query.getFrom());
        trace.put("size", query.getSize());
        final FindContentIdsByQueryResult result = doFind(query);
        trace.put("hits", result.getTotalHits());
        return result;
    });
}
Also used : Trace(com.enonic.xp.trace.Trace) FindContentIdsByQueryResult(com.enonic.xp.content.FindContentIdsByQueryResult)

Example 23 with Trace

use of com.enonic.xp.trace.Trace in project xp by enonic.

the class ContentServiceImpl method getNearestSite.

@Override
public Site getNearestSite(final ContentId contentId) {
    final Trace trace = Tracer.newTrace("content.getNearestSite");
    if (trace == null) {
        return doGetNearestSite(contentId);
    }
    return Tracer.trace(trace, () -> {
        trace.put("id", contentId);
        final Site site = doGetNearestSite(contentId);
        if (site != null) {
            trace.put("path", site.getPath());
        }
        return site;
    });
}
Also used : Trace(com.enonic.xp.trace.Trace) Site(com.enonic.xp.site.Site)

Example 24 with Trace

use of com.enonic.xp.trace.Trace in project xp by enonic.

the class ContentServiceImpl method getByIdAndVersionId.

@Override
public Content getByIdAndVersionId(final ContentId contentId, final ContentVersionId versionId) {
    final Trace trace = Tracer.newTrace("content.getByIdAndVersionId");
    if (trace == null) {
        return doGetByIdAndVersionId(contentId, versionId);
    }
    return Tracer.trace(trace, () -> {
        trace.put("contentId", contentId);
        trace.put("versionId", versionId);
        final Content content = doGetByIdAndVersionId(contentId, versionId);
        if (content != null) {
            trace.put("path", content.getPath());
        }
        return content;
    });
}
Also used : Trace(com.enonic.xp.trace.Trace) Content(com.enonic.xp.content.Content)

Example 25 with Trace

use of com.enonic.xp.trace.Trace in project xp by enonic.

the class PageHandlerWorker method execute.

@Override
public PortalResponse execute() throws Exception {
    final ContentResolverResult resolvedContent = contentResolver.resolve(this.request);
    final Content content = resolvedContent.getContentOrElseThrow();
    if (content.getType().isShortcut()) {
        return renderShortcut(content);
    }
    final Site site = resolvedContent.getNearestSiteOrElseThrow();
    final PageResolverResult resolvedPage = pageResolver.resolve(request.getMode(), content, site);
    final Content effectiveContent = Content.create(content).page(resolvedPage.getEffectivePage()).build();
    final DescriptorKey pageDescriptorKey = resolvedPage.getController();
    this.request.setSite(site);
    this.request.setContent(effectiveContent);
    this.request.setApplicationKey(pageDescriptorKey != null ? pageDescriptorKey.getApplicationKey() : null);
    this.request.setPageDescriptor(pageDescriptorKey != null ? this.pageDescriptorService.getByKey(pageDescriptorKey) : null);
    final Trace trace = Tracer.current();
    if (trace != null) {
        trace.put("contentPath", effectiveContent.getPath().toString());
        trace.put("type", "page");
    }
    return rendererDelegate.render(effectiveContent, this.request);
}
Also used : ContentResolverResult(com.enonic.xp.portal.impl.ContentResolverResult) Site(com.enonic.xp.site.Site) Trace(com.enonic.xp.trace.Trace) Content(com.enonic.xp.content.Content) DescriptorKey(com.enonic.xp.page.DescriptorKey)

Aggregations

Trace (com.enonic.xp.trace.Trace)37 Content (com.enonic.xp.content.Content)6 PortalResponse (com.enonic.xp.portal.PortalResponse)6 Node (com.enonic.xp.node.Node)4 PortalRequest (com.enonic.xp.portal.PortalRequest)4 Site (com.enonic.xp.site.Site)4 DescriptorKey (com.enonic.xp.page.DescriptorKey)3 ContentResolver (com.enonic.xp.portal.impl.ContentResolver)3 ApplicationKey (com.enonic.xp.app.ApplicationKey)2 ContentResolverResult (com.enonic.xp.portal.impl.ContentResolverResult)2 WebResponse (com.enonic.xp.web.WebResponse)2 Matcher (java.util.regex.Matcher)2 Attachment (com.enonic.xp.attachment.Attachment)1 FindContentByParentResult (com.enonic.xp.content.FindContentByParentResult)1 FindContentIdsByQueryResult (com.enonic.xp.content.FindContentIdsByQueryResult)1 Media (com.enonic.xp.content.Media)1 ThrottlingException (com.enonic.xp.exception.ThrottlingException)1 ReadImageParams (com.enonic.xp.image.ReadImageParams)1 ImageOrientation (com.enonic.xp.media.ImageOrientation)1 FindNodesByParentResult (com.enonic.xp.node.FindNodesByParentResult)1