Search in sources :

Example 1 with HCatalogConnectionItem

use of org.talend.repository.model.hcatalog.HCatalogConnectionItem in project tbd-studio-se by Talend.

the class HCatalogRepositoryContentHandler method create.

@Override
public Resource create(IProject project, Item item, int classifierID, IPath path) throws PersistenceException {
    if (item.eClass() == HCatalogPackage.Literals.HCATALOG_CONNECTION_ITEM) {
        Resource itemResource = null;
        ERepositoryObjectType type;
        type = HCatalogRepositoryNodeType.HCATALOG;
        itemResource = create(project, (HCatalogConnectionItem) item, path, type);
        return itemResource;
    }
    return null;
}
Also used : Resource(org.eclipse.emf.ecore.resource.Resource) HCatalogConnectionItem(org.talend.repository.model.hcatalog.HCatalogConnectionItem) ERepositoryObjectType(org.talend.core.model.repository.ERepositoryObjectType)

Example 2 with HCatalogConnectionItem

use of org.talend.repository.model.hcatalog.HCatalogConnectionItem in project tbd-studio-se by Talend.

the class HCatalogDragAndDropHandler method getCorrespondingComponentName.

@Override
public IComponentName getCorrespondingComponentName(Item item, ERepositoryObjectType type) {
    RepositoryComponentSetting setting = null;
    if (item instanceof HCatalogConnectionItem) {
        setting = new RepositoryComponentSetting();
        setting.setName(HCATALOG);
        setting.setRepositoryType(HCATALOG);
        setting.setWithSchema(true);
        setting.setInputComponent(INPUT);
        setting.setOutputComponent(OUTPUT);
        List<Class<Item>> list = new ArrayList<Class<Item>>();
        Class clazz = null;
        try {
            clazz = Class.forName(HCatalogConnectionItem.class.getName());
        } catch (ClassNotFoundException e) {
            ExceptionHandler.process(e);
        }
        list.add(clazz);
        setting.setClasses(list.toArray(new Class[0]));
    }
    return setting;
}
Also used : HCatalogConnectionItem(org.talend.repository.model.hcatalog.HCatalogConnectionItem) Item(org.talend.core.model.properties.Item) RepositoryComponentSetting(org.talend.core.repository.RepositoryComponentSetting) HCatalogConnectionItem(org.talend.repository.model.hcatalog.HCatalogConnectionItem) ArrayList(java.util.ArrayList)

Example 3 with HCatalogConnectionItem

use of org.talend.repository.model.hcatalog.HCatalogConnectionItem in project tbd-studio-se by Talend.

the class CreateHCatalogSchemaAction method doRun.

@Override
protected void doRun() {
    if (repositoryNode == null) {
        repositoryNode = getCurrentRepositoryNode();
    }
    HCatalogConnection connection = null;
    MetadataTable metadataTable = null;
    boolean creation = false;
    if (repositoryNode.getType() == ENodeType.REPOSITORY_ELEMENT) {
        ERepositoryObjectType nodeType = (ERepositoryObjectType) repositoryNode.getProperties(EProperties.CONTENT_TYPE);
        String metadataTableLabel = (String) repositoryNode.getProperties(EProperties.LABEL);
        HCatalogConnectionItem item = null;
        if (nodeType == ERepositoryObjectType.METADATA_CON_TABLE) {
            item = (HCatalogConnectionItem) repositoryNode.getObject().getProperty().getItem();
            connection = (HCatalogConnection) item.getConnection();
            metadataTable = TableHelper.findByLabel(connection, metadataTableLabel);
            creation = false;
        } else if (nodeType == HCatalogRepositoryNodeType.HCATALOG) {
            item = (HCatalogConnectionItem) repositoryNode.getObject().getProperty().getItem();
            connection = (HCatalogConnection) item.getConnection();
            creation = true;
        } else {
            return;
        }
        boolean isOK = true;
        if (creation) {
            isOK = checkHCatalogConnection((HCatalogConnection) item.getConnection());
        }
        if (isOK) {
            openHCatalogSchemaWizard(item, metadataTable, false, creation);
        }
    }
}
Also used : HCatalogConnection(org.talend.repository.model.hcatalog.HCatalogConnection) MetadataTable(org.talend.core.model.metadata.builder.connection.MetadataTable) HCatalogConnectionItem(org.talend.repository.model.hcatalog.HCatalogConnectionItem) ERepositoryObjectType(org.talend.core.model.repository.ERepositoryObjectType)

Example 4 with HCatalogConnectionItem

use of org.talend.repository.model.hcatalog.HCatalogConnectionItem in project tbd-studio-se by Talend.

the class HCatalogRepositoryContentHandler method save.

@Override
public Resource save(Item item) throws PersistenceException {
    if (item.eClass() == HCatalogPackage.Literals.HCATALOG_CONNECTION_ITEM) {
        Resource itemResource = null;
        itemResource = save((HCatalogConnectionItem) item);
        return itemResource;
    }
    return null;
}
Also used : Resource(org.eclipse.emf.ecore.resource.Resource) HCatalogConnectionItem(org.talend.repository.model.hcatalog.HCatalogConnectionItem)

Example 5 with HCatalogConnectionItem

use of org.talend.repository.model.hcatalog.HCatalogConnectionItem in project tbd-studio-se by Talend.

the class HCatalogDragAndDropHandler method filterNeededComponents.

@Override
public List<IComponent> filterNeededComponents(Item item, RepositoryNode seletetedNode, ERepositoryObjectType type) {
    List<IComponent> neededComponents = new ArrayList<IComponent>();
    if (!(item instanceof HCatalogConnectionItem)) {
        return neededComponents;
    }
    IComponentsService service = GlobalServiceRegister.getDefault().getService(IComponentsService.class);
    Collection<IComponent> components = service.getComponentsFactory().readComponents();
    for (IComponent component : components) {
        if (isValid(item, type, seletetedNode, component, HCATALOG) && !neededComponents.contains(component)) {
            neededComponents.add(component);
        }
    }
    return neededComponents;
}
Also used : IComponentsService(org.talend.core.model.components.IComponentsService) IComponent(org.talend.core.model.components.IComponent) ArrayList(java.util.ArrayList) HCatalogConnectionItem(org.talend.repository.model.hcatalog.HCatalogConnectionItem)

Aggregations

HCatalogConnectionItem (org.talend.repository.model.hcatalog.HCatalogConnectionItem)5 ArrayList (java.util.ArrayList)2 Resource (org.eclipse.emf.ecore.resource.Resource)2 ERepositoryObjectType (org.talend.core.model.repository.ERepositoryObjectType)2 IComponent (org.talend.core.model.components.IComponent)1 IComponentsService (org.talend.core.model.components.IComponentsService)1 MetadataTable (org.talend.core.model.metadata.builder.connection.MetadataTable)1 Item (org.talend.core.model.properties.Item)1 RepositoryComponentSetting (org.talend.core.repository.RepositoryComponentSetting)1 HCatalogConnection (org.talend.repository.model.hcatalog.HCatalogConnection)1