Search in sources :

Example 1 with SimpleDataSource

use of com.adobe.granite.ui.components.ds.SimpleDataSource in project aem-core-wcm-components by Adobe-Marketing-Cloud.

the class OptionsImplTest method setUpMockDataSource.

private void setUpMockDataSource() {
    Resource dataSourceResource = context.resourceResolver().getResource(CONTENT_ROOT + "/dataDatasource/datasource/items");
    SimpleDataSource dataSource = new SimpleDataSource(dataSourceResource.listChildren());
    context.request().setAttribute(DataSource.class.getName(), dataSource);
}
Also used : SimpleDataSource(com.adobe.granite.ui.components.ds.SimpleDataSource) Resource(org.apache.sling.api.resource.Resource) SimpleDataSource(com.adobe.granite.ui.components.ds.SimpleDataSource) DataSource(com.adobe.granite.ui.components.ds.DataSource)

Example 2 with SimpleDataSource

use of com.adobe.granite.ui.components.ds.SimpleDataSource in project aem-core-wcm-components by Adobe-Marketing-Cloud.

the class AllowedTitleSizesDataSourceServlet method doGet.

@Override
protected void doGet(@Nonnull SlingHttpServletRequest request, @Nonnull SlingHttpServletResponse response) throws ServletException, IOException {
    SimpleDataSource allowedTypesDataSource = new SimpleDataSource(getAllowedTypes(request).iterator());
    request.setAttribute(DataSource.class.getName(), allowedTypesDataSource);
}
Also used : SimpleDataSource(com.adobe.granite.ui.components.ds.SimpleDataSource) SimpleDataSource(com.adobe.granite.ui.components.ds.SimpleDataSource) DataSource(com.adobe.granite.ui.components.ds.DataSource)

Example 3 with SimpleDataSource

use of com.adobe.granite.ui.components.ds.SimpleDataSource in project aem-core-wcm-components by Adobe-Marketing-Cloud.

the class FormActionTypeDataSourceServlet method doGet.

@Override
protected void doGet(@Nonnull SlingHttpServletRequest request, @Nonnull SlingHttpServletResponse response) throws ServletException, IOException {
    SimpleDataSource actionTypeDataSource = new SimpleDataSource(getActionTypeResources(request.getResourceResolver()).iterator());
    request.setAttribute(DataSource.class.getName(), actionTypeDataSource);
}
Also used : SimpleDataSource(com.adobe.granite.ui.components.ds.SimpleDataSource) SimpleDataSource(com.adobe.granite.ui.components.ds.SimpleDataSource) DataSource(com.adobe.granite.ui.components.ds.DataSource)

Example 4 with SimpleDataSource

use of com.adobe.granite.ui.components.ds.SimpleDataSource in project aem-core-wcm-components by Adobe-Marketing-Cloud.

the class FormActionTypeSettingsDataSourceServlet method doGet.

@Override
protected void doGet(@Nonnull SlingHttpServletRequest request, @Nonnull SlingHttpServletResponse response) throws ServletException, IOException {
    SimpleDataSource actionTypeSettingsDataSource = new SimpleDataSource(getSettingsDialogs(request.getResourceResolver()).iterator());
    request.setAttribute(DataSource.class.getName(), actionTypeSettingsDataSource);
}
Also used : SimpleDataSource(com.adobe.granite.ui.components.ds.SimpleDataSource) SimpleDataSource(com.adobe.granite.ui.components.ds.SimpleDataSource) DataSource(com.adobe.granite.ui.components.ds.DataSource)

Example 5 with SimpleDataSource

use of com.adobe.granite.ui.components.ds.SimpleDataSource in project aem-core-wcm-components by Adobe-Marketing-Cloud.

the class WorkflowModelDataSourceServlet method doGet.

@Override
protected void doGet(@Nonnull SlingHttpServletRequest request, @Nonnull SlingHttpServletResponse response) throws ServletException, IOException {
    try {
        WorkflowSession workflowSession = request.getResourceResolver().adaptTo(WorkflowSession.class);
        ArrayList<Resource> resources = new ArrayList<>();
        if (workflowSession != null) {
            WorkflowModel[] models = workflowSession.getModels();
            for (WorkflowModel model : models) {
                resources.add(new WorkflowModelResource(model, request.getResourceResolver()));
            }
        }
        SimpleDataSource dataSource = new SimpleDataSource(resources.iterator());
        request.setAttribute(DataSource.class.getName(), dataSource);
    } catch (WorkflowException e) {
        throw new ServletException(e);
    }
}
Also used : ServletException(javax.servlet.ServletException) SimpleDataSource(com.adobe.granite.ui.components.ds.SimpleDataSource) WorkflowSession(com.adobe.granite.workflow.WorkflowSession) WorkflowException(com.adobe.granite.workflow.WorkflowException) ArrayList(java.util.ArrayList) Resource(org.apache.sling.api.resource.Resource) WorkflowModel(com.adobe.granite.workflow.model.WorkflowModel) SimpleDataSource(com.adobe.granite.ui.components.ds.SimpleDataSource) DataSource(com.adobe.granite.ui.components.ds.DataSource)

Aggregations

SimpleDataSource (com.adobe.granite.ui.components.ds.SimpleDataSource)6 DataSource (com.adobe.granite.ui.components.ds.DataSource)5 Resource (org.apache.sling.api.resource.Resource)3 OptionItem (com.adobe.cq.wcm.core.components.models.form.OptionItem)1 WorkflowException (com.adobe.granite.workflow.WorkflowException)1 WorkflowSession (com.adobe.granite.workflow.WorkflowSession)1 WorkflowModel (com.adobe.granite.workflow.model.WorkflowModel)1 ArrayList (java.util.ArrayList)1 RequestDispatcher (javax.servlet.RequestDispatcher)1 ServletException (javax.servlet.ServletException)1 RequestDispatcherOptions (org.apache.sling.api.request.RequestDispatcherOptions)1 ChildResource (org.apache.sling.models.annotations.injectorspecific.ChildResource)1