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

org.randombits.confluence.metadata.impl.handler.ContentEntityObjectHandler Maven / Gradle / Ivy

There is a newer version: 7.4.1
Show newest version
package org.randombits.confluence.metadata.impl.handler;

import com.atlassian.confluence.core.ContentEntityManager;
import com.atlassian.confluence.core.ContentEntityObject;
import org.randombits.confluence.metadata.AbstractTypeHandler;
import org.randombits.confluence.metadata.reference.ContentReference;
import org.springframework.beans.factory.annotation.Qualifier;

/**
 * Handles {@link org.randombits.confluence.metadata.reference.ContentReference}s.
 */
public class ContentEntityObjectHandler extends AbstractTypeHandler {

    public static final String LEGACY_ALIAS = "ContentOption";

    public static final String ALIAS = "ContentReference";

    private final ContentEntityManager contentEntityManager;

    public ContentEntityObjectHandler( @Qualifier("contentEntityManager") ContentEntityManager contentEntityManager ) {
        super( ContentEntityObject.class, ContentReference.class );
        this.contentEntityManager = contentEntityManager;
    }

    @Override
    protected ContentEntityObject doGetOriginal( ContentReference stored ) {
        return contentEntityManager.getById( stored.getId() );
    }

    @Override
    protected ContentReference doGetStored( ContentEntityObject original ) {
        return new ContentReference( original );
    }

    @Override
    protected String getAlias() {
        return ALIAS;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy