Search in sources :

Example 1 with AnalysisCategory

use of org.talend.dataquality.analysis.category.AnalysisCategory in project tdq-studio-se by Talend.

the class ViewerDataFactory method createTreeData.

public static Object createTreeData() {
    List<AnalysisTypeNode> returnList = new ArrayList<AnalysisTypeNode>();
    // use CategoryHandler
    AnalysisCategories analysisCategories = CategoryHandler.getAnalysisCategories();
    // use this tree (use label attribute of each Category instance)
    EList<AnalysisCategory> categories = analysisCategories.getCategories();
    for (AnalysisCategory category : categories) {
        AnalysisTypeNode typeNode = new AnalysisTypeNode(category.getLabel(), category.getAnalysisType().getLiteral(), null);
        if (category.getSubCategories() != null) {
            List<AnalysisTypeNode> subCategories = new ArrayList<AnalysisTypeNode>();
            for (AnalysisCategory subCategory : category.getSubCategories()) {
                // the Semantic analysis must not appear in TOS DQ.
                String label = subCategory.getLabel();
                if (org.talend.commons.utils.platform.PluginChecker.isOnlyTopLoaded()) {
                    if (label.equals("Semantic-aware Analysis")) {
                        // $NON-NLS-1$
                        continue;
                    }
                }
                subCategories.add(new AnalysisTypeNode(label, label, typeNode));
            }
            typeNode.setChildren(subCategories.toArray());
        }
        returnList.add(typeNode);
    }
    return returnList;
}
Also used : AnalysisTypeNode(org.talend.dataprofiler.core.model.nodes.analysis.AnalysisTypeNode) AnalysisCategory(org.talend.dataquality.analysis.category.AnalysisCategory) ArrayList(java.util.ArrayList) AnalysisCategories(org.talend.dataquality.analysis.category.AnalysisCategories)

Example 2 with AnalysisCategory

use of org.talend.dataquality.analysis.category.AnalysisCategory in project tdq-studio-se by Talend.

the class AnalysisCategoryItemProvider method getText.

/**
 * This returns the label text for the adapted class.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public String getText(Object object) {
    AnalysisType labelValue = ((AnalysisCategory) object).getAnalysisType();
    String label = labelValue == null ? null : labelValue.toString();
    return label == null || label.length() == 0 ? getString("_UI_AnalysisCategory_type") : getString("_UI_AnalysisCategory_type") + " " + label;
}
Also used : AnalysisType(org.talend.dataquality.analysis.AnalysisType) AnalysisCategory(org.talend.dataquality.analysis.category.AnalysisCategory)

Example 3 with AnalysisCategory

use of org.talend.dataquality.analysis.category.AnalysisCategory in project tdq-studio-se by Talend.

the class CategoryHandlerTest method testGetAnalysisCategories.

/**
 * Test method for {@link org.talend.dq.analysis.category.CategoryHandler#getAnalysisCategories()}.
 */
@Test
public void testGetAnalysisCategories() {
    AnalysisCategories analysisCategories = CategoryHandler.getAnalysisCategories();
    Assert.assertNotNull(analysisCategories);
    EList<AnalysisCategory> categories = analysisCategories.getCategories();
    Assert.assertNotNull(categories);
    Assert.assertFalse(categories.isEmpty());
    for (AnalysisCategory analysisCategory : categories) {
        // $NON-NLS-1$
        System.out.println("-" + analysisCategory.getLabel());
        if (!analysisCategory.getSubCategories().isEmpty()) {
            for (AnalysisCategory subCategory : analysisCategory.getSubCategories()) {
                // $NON-NLS-1$
                System.out.println("\t+--" + subCategory.getLabel());
            }
        }
    }
}
Also used : AnalysisCategory(org.talend.dataquality.analysis.category.AnalysisCategory) AnalysisCategories(org.talend.dataquality.analysis.category.AnalysisCategories) Test(org.junit.Test)

Aggregations

AnalysisCategory (org.talend.dataquality.analysis.category.AnalysisCategory)3 AnalysisCategories (org.talend.dataquality.analysis.category.AnalysisCategories)2 ArrayList (java.util.ArrayList)1 Test (org.junit.Test)1 AnalysisTypeNode (org.talend.dataprofiler.core.model.nodes.analysis.AnalysisTypeNode)1 AnalysisType (org.talend.dataquality.analysis.AnalysisType)1