Created
March 21, 2020 19:35
-
-
Save theopendle/ddb055a31804109e1f7526832066d502 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.tipi.core.models.StaticDataSourceModel; | |
import com.tipi.core.services.DataSourceService; | |
import lombok.extern.slf4j.Slf4j; | |
import org.apache.sling.api.SlingHttpServletRequest; | |
import org.apache.sling.models.annotations.Model; | |
import org.apache.sling.models.annotations.injectorspecific.OSGiService; | |
import org.apache.sling.models.annotations.injectorspecific.Self; | |
import org.osgi.service.component.annotations.Component; | |
import javax.annotation.PostConstruct; | |
@Model( | |
adaptables = {SlingHttpServletRequest.class}, | |
adapters = {StaticDataSourceModel.class} | |
) | |
@Component | |
@Slf4j | |
public class StaticDataSourceModelImpl implements StaticDataSourceModel { | |
@OSGiService | |
private DataSourceService dataSourceService; | |
@Self | |
private SlingHttpServletRequest request; | |
@Override | |
@PostConstruct | |
public void init() { | |
request = dataSourceService.getDataFromSource(request); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment