Search in sources :

Example 21 with RepositoryObject

use of org.talend.core.model.repository.RepositoryObject in project tdi-studio-se by Talend.

the class MetadataColumnComparator method createNewRepositoryNode.

/**
     * dev Comment method "createNewRepositoryNode".
     * 
     * @param node
     * @param parameters
     * @param connection
     * @param iMetadataConnection
     * @return
     */
@SuppressWarnings("unchecked")
private RepositoryNode createNewRepositoryNode(RepositoryNode node, ConnectionParameters parameters, DatabaseConnection connection, IMetadataConnection iMetadataConnection) {
    ManagerConnection managerConnection = new ManagerConnection();
    boolean status = managerConnection.check(iMetadataConnection);
    connection.setDivergency(!status);
    ConnectionHelper.getTables(connection).clear();
    if (status) {
    // try {
    // List<MetadataTable> tablesFromDB = ExtractMetaDataFromDataBase.returnMetaTablesFormConnection(
    // iMetadataConnection, 500);
    // ExtractMetaDataUtils.getInstance().setReconnect(false);
    // for (MetadataTable table : tablesFromDB) {
    // List<MetadataColumn> columnsFromDB = new ArrayList<MetadataColumn>();
    // columnsFromDB.addAll(ExtractMetaDataFromDataBase.returnMetadataColumnsFormTable(iMetadataConnection,
    // table.getSourceName()));
    // table.getColumns().clear();
    // for (MetadataColumn column : columnsFromDB) {
    // column.setLabel(""); //$NON-NLS-1$
    // table.getColumns().add(column);
    // }
    // table.setLabel(""); //$NON-NLS-1$
    // ConnectionHelper.getTables(connection).add(table);
    // }
    // ExtractMetaDataUtils.getInstance().setReconnect(true);
    // } catch (Exception e) {
    // if (parameters != null) {
    // parameters.setConnectionComment(e.getMessage());
    // }
    // return null;
    // }
    } else {
        if (parameters != null) {
            parameters.setConnectionComment(managerConnection.getMessageException() == null ? "" : //$NON-NLS-1$
            managerConnection.getMessageException());
        }
    }
    DatabaseConnectionItem item = PropertiesFactory.eINSTANCE.createDatabaseConnectionItem();
    Property connectionProperty = PropertiesFactory.eINSTANCE.createProperty();
    connectionProperty.setAuthor(((RepositoryContext) CorePlugin.getContext().getProperty(Context.REPOSITORY_CONTEXT_KEY)).getUser());
    connectionProperty.setVersion(VersionUtils.DEFAULT_VERSION);
    //$NON-NLS-1$
    connectionProperty.setStatusCode("");
    item.setProperty(connectionProperty);
    // TDI-18665
    updatePackage(iMetadataConnection);
    DatabaseConnection dbConn = (DatabaseConnection) iMetadataConnection.getCurrentConnection();
    item.setConnection(dbConn);
    RepositoryObject object = new RepositoryObject(connectionProperty);
    //$NON-NLS-1$
    object.setLabel("");
    ItemState state = PropertiesFactory.eINSTANCE.createItemState();
    state.setDeleted(false);
    item.setState(state);
    if (node == null) {
        node = new RepositoryNode(null, null, ENodeType.SYSTEM_FOLDER);
    }
    RepositoryNode newNode = new RepositoryNode(object, node, ENodeType.SYSTEM_FOLDER);
    return newNode;
}
Also used : ManagerConnection(org.talend.metadata.managment.repository.ManagerConnection) SqlBuilderRepositoryObject(org.talend.sqlbuilder.dbstructure.SqlBuilderRepositoryObject) MetadataTableRepositoryObject(org.talend.sqlbuilder.dbstructure.DBTreeProvider.MetadataTableRepositoryObject) RepositoryObject(org.talend.core.model.repository.RepositoryObject) MetadataColumnRepositoryObject(org.talend.sqlbuilder.dbstructure.DBTreeProvider.MetadataColumnRepositoryObject) ItemState(org.talend.core.model.properties.ItemState) DatabaseConnection(org.talend.core.model.metadata.builder.connection.DatabaseConnection) RepositoryNode(org.talend.repository.model.RepositoryNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode) Property(org.talend.core.model.properties.Property) DatabaseConnectionItem(org.talend.core.model.properties.DatabaseConnectionItem)

Example 22 with RepositoryObject

use of org.talend.core.model.repository.RepositoryObject in project tdi-studio-se by Talend.

the class StatusManagerSettingPage method researchMaxVersion.

private void researchMaxVersion() {
    String version = statusCombo.getText();
    if ("".equals(version.trim())) {
        //$NON-NLS-1$
        version = VersionUtils.DEFAULT_VERSION;
    }
    for (RepositoryObject object : checkedObjects) {
    // if (VersionUtils.compareTo(version, object.getOldVersion()) < 0) {
    // version = object.getOldVersion();
    // }
    }
    statusCombo.setText(version);
}
Also used : RepositoryObject(org.talend.core.model.repository.RepositoryObject)

Aggregations

RepositoryObject (org.talend.core.model.repository.RepositoryObject)22 RepositoryNode (org.talend.repository.model.RepositoryNode)10 IRepositoryNode (org.talend.repository.model.IRepositoryNode)9 Property (org.talend.core.model.properties.Property)6 TableItem (org.eclipse.swt.widgets.TableItem)5 IPath (org.eclipse.core.runtime.IPath)4 IEditorPart (org.eclipse.ui.IEditorPart)4 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)4 ProjectRepositoryNode (org.talend.core.repository.model.ProjectRepositoryNode)4 IProjectRepositoryNode (org.talend.repository.model.nodes.IProjectRepositoryNode)4 ArrayList (java.util.ArrayList)3 ISelection (org.eclipse.jface.viewers.ISelection)3 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)3 WizardDialog (org.eclipse.jface.wizard.WizardDialog)3 GridData (org.eclipse.swt.layout.GridData)3 Item (org.talend.core.model.properties.Item)3 ERepositoryObjectType (org.talend.core.model.repository.ERepositoryObjectType)3 IUIRefresher (org.talend.core.services.IUIRefresher)3 InvocationTargetException (java.lang.reflect.InvocationTargetException)2 List (java.util.List)2