Search in sources :

Example 61 with RepositoryNode

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

the class GenerateSelectSQLAction method getPrePostfix.

/**
     * Get Prepostfix.
     * 
     * @param node the selected node
     * @return PrePostfix
     */
private String getPrePostfix(IRepositoryNode node) {
    RepositoryNode root = SQLBuilderRepositoryNodeManager.getRoot((RepositoryNode) node);
    DatabaseConnection connection = (DatabaseConnection) ((ConnectionItem) root.getObject().getProperty().getItem()).getConnection();
    if (TextUtil.isDoubleQuotesNeededDbType(connection.getDatabaseType())) {
        //$NON-NLS-1$
        return "\"";
    }
    //$NON-NLS-1$
    return "";
}
Also used : DatabaseConnection(org.talend.core.model.metadata.builder.connection.DatabaseConnection) IRepositoryNode(org.talend.repository.model.IRepositoryNode) RepositoryNode(org.talend.repository.model.RepositoryNode)

Example 62 with RepositoryNode

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

the class MetadataRefreshAction method run.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.jface.action.Action#run()
     * 
     */
@Override
public void run() {
    SQLBuilderRepositoryNodeManager.saveMetadataColumn(repositorynodes, columnNodes);
    for (RepositoryNode node : repositorynodes) {
        dialog.refreshNode(node);
    }
    dialog.refreshNode(SQLBuilderRepositoryNodeManager.getRoot(repositorynodes.get(0)));
}
Also used : RepositoryNode(org.talend.repository.model.RepositoryNode)

Example 63 with RepositoryNode

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

the class JobVersionUtilsTest method testGetCurrentVersion.

/**
     * Test method for
     * {@link org.talend.repository.utils.JobVersionUtils#getCurrentVersion(org.talend.repository.model.RepositoryNode)}
     * .
     * 
     * @throws PersistenceException
     */
@Test
public void testGetCurrentVersion() throws PersistenceException {
    repositoryObject = createRepositoryObject("job1");
    RepositoryNode childrenNode = mock(RepositoryNode.class);
    when(childrenNode.getObject()).thenReturn(repositoryObject);
    when(childrenNode.getId()).thenReturn(repositoryObject.getProperty().getId());
    List<IRepositoryNode> children = new ArrayList<IRepositoryNode>();
    children.add(childrenNode);
    RepositoryNode folderNode = mock(RepositoryNode.class);
    when(folderNode.getObject()).thenReturn(folder);
    when(folderNode.getId()).thenReturn(folder.getId());
    when(folderNode.getChildren()).thenReturn(children);
    // test,one situation
    String vesion = JobVersionUtils.getCurrentVersion(folderNode);
    assertEquals(vesion, "0.1");
    // test,two situation
    repositoryObject.getProperty().setVersion("0.2");
    String vesion2 = JobVersionUtils.getCurrentVersion(folderNode);
    assertEquals(vesion2, "0.2");
}
Also used : IRepositoryNode(org.talend.repository.model.IRepositoryNode) ArrayList(java.util.ArrayList) RepositoryNode(org.talend.repository.model.RepositoryNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode) Test(org.junit.Test)

Example 64 with RepositoryNode

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

the class AbstractRootNodeContentProviderTest method testTopNodeLoad.

@Test
public void testTopNodeLoad() {
    if (contentProvider == null) {
        return;
    }
    final ERepositoryObjectType testType = getTestType();
    assertNotNull(testType);
    RepositoryNode testNode = ProjectRepositoryNode.getInstance().getRootRepositoryNode(testType);
    assertNotNull(testNode);
    Object[] elements = null;
    if (isRoot()) {
        elements = contentProvider.getElements(root);
    } else {
        elements = contentProvider.getChildren(root);
    }
    assertNotNull(elements);
    // must children
    assert (elements.length > 0);
    assert (Arrays.asList(elements).contains(testNode));
}
Also used : ERepositoryObjectType(org.talend.core.model.repository.ERepositoryObjectType) ProjectRepositoryNode(org.talend.core.repository.model.ProjectRepositoryNode) RepositoryNode(org.talend.repository.model.RepositoryNode) Test(org.junit.Test)

Example 65 with RepositoryNode

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

the class JobTopNodesPropertyTesterTest method testIsJobDesignsNode4WrongType.

@Test
public void testIsJobDesignsNode4WrongType() {
    RepositoryNode node = new RepositoryNode(null, null, ENodeType.SYSTEM_FOLDER);
    node.setProperties(EProperties.CONTENT_TYPE, ERepositoryObjectType.CONTEXT);
    assertFalse(tester.isJobDesignsNode(node));
}
Also used : ProjectRepositoryNode(org.talend.core.repository.model.ProjectRepositoryNode) RepositoryNode(org.talend.repository.model.RepositoryNode) Test(org.junit.Test)

Aggregations

RepositoryNode (org.talend.repository.model.RepositoryNode)250 IRepositoryNode (org.talend.repository.model.IRepositoryNode)94 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)74 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)44 ERepositoryObjectType (org.talend.core.model.repository.ERepositoryObjectType)44 ProjectRepositoryNode (org.talend.core.repository.model.ProjectRepositoryNode)42 Item (org.talend.core.model.properties.Item)38 ArrayList (java.util.ArrayList)33 PersistenceException (org.talend.commons.exception.PersistenceException)27 IProxyRepositoryFactory (org.talend.repository.model.IProxyRepositoryFactory)27 ProcessItem (org.talend.core.model.properties.ProcessItem)23 RepositoryObject (org.talend.core.model.repository.RepositoryObject)22 ISelection (org.eclipse.jface.viewers.ISelection)20 ConnectionItem (org.talend.core.model.properties.ConnectionItem)20 IProjectRepositoryNode (org.talend.repository.model.nodes.IProjectRepositoryNode)20 List (java.util.List)18 Property (org.talend.core.model.properties.Property)18 DatabaseConnectionItem (org.talend.core.model.properties.DatabaseConnectionItem)17 MetadataColumnRepositoryObject (org.talend.core.repository.model.repositoryObject.MetadataColumnRepositoryObject)16 WizardDialog (org.eclipse.jface.wizard.WizardDialog)13