All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.enonic.xp.context.ContextAccessor Maven / Gradle / Ivy

There is a newer version: 7.14.4
Show newest version
package com.enonic.xp.context;

import com.enonic.xp.annotation.PublicApi;
import com.enonic.xp.content.ContentConstants;

@PublicApi
public final class ContextAccessor
    extends ThreadLocal
{
    public static final ContextAccessor INSTANCE = new ContextAccessor();

    @Override
    protected Context initialValue()
    {
        final Context context = ContextBuilder.create().build();
        context.getLocalScope().setAttribute( ContentConstants.BRANCH_DRAFT );
        context.getLocalScope().setAttribute( ContentConstants.CONTENT_REPO_ID );
        return context;
    }

    public static Context current()
    {
        return INSTANCE.get();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy