Search in sources :

Example 1 with JrxmlTempSubFolderNode

use of org.talend.dq.nodes.JrxmlTempSubFolderNode in project tdq-studio-se by Talend.

the class RepositoryNodeHelper method getJrxmlFileRepNodes.

/**
 * get JrxmlTempleteRepNodes which under the parentNode.
 *
 * @param parentNode
 * @param recursive
 * @return
 */
public static List<JrxmlTempleteRepNode> getJrxmlFileRepNodes(IRepositoryNode parentNode, boolean recursive) {
    List<JrxmlTempleteRepNode> result = new ArrayList<JrxmlTempleteRepNode>();
    List<IRepositoryNode> children = parentNode.getChildren();
    for (IRepositoryNode node : children) {
        if (node instanceof JrxmlTempleteRepNode) {
            result.add((JrxmlTempleteRepNode) node);
        } else if (node instanceof JrxmlTempFolderRepNode || node instanceof JrxmlTempSubFolderNode) {
            if (recursive) {
                result.addAll(getJrxmlFileRepNodes(node, recursive));
            }
        }
    }
    return result;
}
Also used : IRepositoryNode(org.talend.repository.model.IRepositoryNode) JrxmlTempFolderRepNode(org.talend.dq.nodes.JrxmlTempFolderRepNode) ArrayList(java.util.ArrayList) JrxmlTempleteRepNode(org.talend.dq.nodes.JrxmlTempleteRepNode) JrxmlTempSubFolderNode(org.talend.dq.nodes.JrxmlTempSubFolderNode)

Example 2 with JrxmlTempSubFolderNode

use of org.talend.dq.nodes.JrxmlTempSubFolderNode in project tdq-studio-se by Talend.

the class WorkspaceResourceHelper method checkSourceFileSubFolderNodeOpening.

/**
 * DOC xqliu Comment method "checkSourceFileSubFolderNodeOpening".
 *
 * @param node
 * @return
 */
public static ReturnCode checkSourceFileSubFolderNodeOpening(RepositoryNode node) {
    boolean opened = false;
    // $NON-NLS-1$
    String msg = "";
    List<IRepositoryNode> children = node.getChildren();
    for (IRepositoryNode iNode : children) {
        if (iNode instanceof SourceFileRepNode || iNode instanceof JrxmlTempleteRepNode) {
            ReturnCode rc = checkSourceFileNodeOpening((RepositoryNode) iNode);
            if (rc.isOk()) {
                opened = rc.isOk();
                msg += rc.getMessage();
            }
        } else if (iNode instanceof SourceFileSubFolderNode || iNode instanceof JrxmlTempSubFolderNode) {
            ReturnCode rc = checkSourceFileSubFolderNodeOpening((RepositoryNode) iNode);
            if (rc.isOk()) {
                opened = rc.isOk();
                msg += rc.getMessage();
            }
        }
    }
    return new ReturnCode(msg, opened);
}
Also used : ReturnCode(org.talend.utils.sugars.ReturnCode) IRepositoryNode(org.talend.repository.model.IRepositoryNode) SourceFileSubFolderNode(org.talend.dq.nodes.SourceFileSubFolderNode) SourceFileRepNode(org.talend.dq.nodes.SourceFileRepNode) JrxmlTempleteRepNode(org.talend.dq.nodes.JrxmlTempleteRepNode) RepositoryNode(org.talend.repository.model.RepositoryNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode) JrxmlTempSubFolderNode(org.talend.dq.nodes.JrxmlTempSubFolderNode)

Example 3 with JrxmlTempSubFolderNode

use of org.talend.dq.nodes.JrxmlTempSubFolderNode in project tdq-studio-se by Talend.

the class DeleteResourceProvider method shouldShowRenameFolderMenu.

private boolean shouldShowRenameFolderMenu(RepositoryNode node) {
    boolean show = false;
    if (node instanceof AnalysisSubFolderRepNode) {
        AnalysisSubFolderRepNode anaSubFolderNode = (AnalysisSubFolderRepNode) node;
        show = !anaSubFolderNode.isVirtualFolder();
    } else if (node instanceof ReportSubFolderRepNode) {
        ReportSubFolderRepNode repSubFolderNode = (ReportSubFolderRepNode) node;
        show = !repSubFolderNode.isVirtualFolder();
    } else if (node instanceof UserDefIndicatorSubFolderRepNode || node instanceof PatternRegexSubFolderRepNode || node instanceof PatternSqlSubFolderRepNode || node instanceof RulesSQLSubFolderRepNode || node instanceof RulesParserSubFolderRepNode || node instanceof DBConnectionSubFolderRepNode || node instanceof DFConnectionSubFolderRepNode || node instanceof JrxmlTempSubFolderNode) {
        show = true;
    }
    return show;
}
Also used : PatternSqlSubFolderRepNode(org.talend.dq.nodes.PatternSqlSubFolderRepNode) UserDefIndicatorSubFolderRepNode(org.talend.dq.nodes.UserDefIndicatorSubFolderRepNode) PatternRegexSubFolderRepNode(org.talend.dq.nodes.PatternRegexSubFolderRepNode) RulesSQLSubFolderRepNode(org.talend.dq.nodes.RulesSQLSubFolderRepNode) DBConnectionSubFolderRepNode(org.talend.dq.nodes.DBConnectionSubFolderRepNode) DFConnectionSubFolderRepNode(org.talend.dq.nodes.DFConnectionSubFolderRepNode) ReportSubFolderRepNode(org.talend.dq.nodes.ReportSubFolderRepNode) RulesParserSubFolderRepNode(org.talend.dq.nodes.RulesParserSubFolderRepNode) AnalysisSubFolderRepNode(org.talend.dq.nodes.AnalysisSubFolderRepNode) JrxmlTempSubFolderNode(org.talend.dq.nodes.JrxmlTempSubFolderNode)

Example 4 with JrxmlTempSubFolderNode

use of org.talend.dq.nodes.JrxmlTempSubFolderNode in project tdq-studio-se by Talend.

the class LocalRepositoryObjectCRUD method moveFolderRepNode.

/**
 * move Folder Node.
 *
 * @param sourceNode
 * @param targetNode
 * @throws PersistenceException
 */
private void moveFolderRepNode(IRepositoryNode sourceNode, IRepositoryNode targetNode) throws PersistenceException {
    // MOD yyin 20130125 TDQ-5392
    IPath oldPath = null;
    List<String> jrxmlFileNames = null;
    List<JrxmlTempleteRepNode> jrxmlFileRepNodes = new ArrayList<JrxmlTempleteRepNode>();
    if (sourceNode instanceof JrxmlTempSubFolderNode) {
        // remeber the old path
        oldPath = RepositoryNodeHelper.getPath(sourceNode);
        // find all jrxml files in this folder
        jrxmlFileRepNodes = RepositoryNodeHelper.getJrxmlFileRepNodes(sourceNode, true);
        // remember the files name
        jrxmlFileNames = RepNodeUtils.getListOfJrxmlNameWithPath(oldPath, jrxmlFileRepNodes);
    }
    // ~
    moveFolder(sourceNode, targetNode);
    // ADD yyin 20130125 TDQ-5392
    if (sourceNode instanceof JrxmlTempSubFolderNode) {
        // use two array :old file names and new file names, to call the method.
        IPath newPath = RepositoryNodeHelper.getPath(targetNode);
        List<String> jrxmlFileNamesAfterMove = new ArrayList<String>();
        for (JrxmlTempleteRepNode jrxml : jrxmlFileRepNodes) {
            // check it there some sub folder under the source node
            IPath relativeTo = RepositoryNodeHelper.getPath(jrxml.getParent()).makeRelativeTo(oldPath);
            IPath tempPath = newPath.append(RepNodeUtils.getSeparator()).append(sourceNode.getLabel()).append(RepNodeUtils.getSeparator());
            if (relativeTo.segmentCount() > 0) {
                // if there are some sub folder under the source node
                tempPath = tempPath.append(relativeTo).append(RepNodeUtils.getSeparator());
            }
            jrxmlFileNamesAfterMove.add(tempPath.append(RepositoryNodeHelper.getFileNameOfTheNode(jrxml)).toOSString());
        }
        // update the depended reports
        RepNodeUtils.updateJrxmlRelatedReport(jrxmlFileNames, jrxmlFileNamesAfterMove);
    }
// ~
}
Also used : IPath(org.eclipse.core.runtime.IPath) ArrayList(java.util.ArrayList) JrxmlTempleteRepNode(org.talend.dq.nodes.JrxmlTempleteRepNode) JrxmlTempSubFolderNode(org.talend.dq.nodes.JrxmlTempSubFolderNode)

Example 5 with JrxmlTempSubFolderNode

use of org.talend.dq.nodes.JrxmlTempSubFolderNode in project tdq-studio-se by Talend.

the class DQDeleteAction method checkSourceFilesEditorOpening.

/**
 * DOC xqliu Comment method "checkSourceFilesEditorOpening".
 *
 * @param deleteElements
 * @return
 */
@SuppressWarnings({ "hiding", "rawtypes", "unchecked" })
private Object[] checkSourceFilesEditorOpening(Object[] deleteElements) {
    List list = new ArrayList();
    boolean opened = false;
    // $NON-NLS-1$
    String openSourceFileNames = "";
    for (Object obj : deleteElements) {
        if (obj instanceof SourceFileRepNode || obj instanceof JrxmlTempleteRepNode) {
            ReturnCode rc = WorkspaceResourceHelper.checkSourceFileNodeOpening((RepositoryNode) obj);
            if (rc.isOk()) {
                opened = rc.isOk();
                openSourceFileNames += rc.getMessage();
            } else {
                list.add(obj);
            }
        } else if (obj instanceof SourceFileSubFolderNode || obj instanceof JrxmlTempSubFolderNode) {
            ReturnCode rc = WorkspaceResourceHelper.checkSourceFileSubFolderNodeOpening((RepositoryNode) obj);
            if (rc.isOk()) {
                opened = rc.isOk();
                openSourceFileNames += rc.getMessage();
            } else {
                list.add(obj);
            }
        } else {
            list.add(obj);
        }
    }
    if (opened) {
        WorkspaceResourceHelper.showSourceFilesOpeningWarnMessages(openSourceFileNames);
    }
    return list.toArray();
}
Also used : ReturnCode(org.talend.utils.sugars.ReturnCode) ArrayList(java.util.ArrayList) SourceFileSubFolderNode(org.talend.dq.nodes.SourceFileSubFolderNode) List(java.util.List) ArrayList(java.util.ArrayList) SourceFileRepNode(org.talend.dq.nodes.SourceFileRepNode) JrxmlTempleteRepNode(org.talend.dq.nodes.JrxmlTempleteRepNode) DQRepositoryNode(org.talend.dq.nodes.DQRepositoryNode) RepositoryNode(org.talend.repository.model.RepositoryNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode) JrxmlTempSubFolderNode(org.talend.dq.nodes.JrxmlTempSubFolderNode)

Aggregations

JrxmlTempSubFolderNode (org.talend.dq.nodes.JrxmlTempSubFolderNode)5 JrxmlTempleteRepNode (org.talend.dq.nodes.JrxmlTempleteRepNode)4 ArrayList (java.util.ArrayList)3 IRepositoryNode (org.talend.repository.model.IRepositoryNode)3 SourceFileRepNode (org.talend.dq.nodes.SourceFileRepNode)2 SourceFileSubFolderNode (org.talend.dq.nodes.SourceFileSubFolderNode)2 RepositoryNode (org.talend.repository.model.RepositoryNode)2 ReturnCode (org.talend.utils.sugars.ReturnCode)2 List (java.util.List)1 IPath (org.eclipse.core.runtime.IPath)1 AnalysisSubFolderRepNode (org.talend.dq.nodes.AnalysisSubFolderRepNode)1 DBConnectionSubFolderRepNode (org.talend.dq.nodes.DBConnectionSubFolderRepNode)1 DFConnectionSubFolderRepNode (org.talend.dq.nodes.DFConnectionSubFolderRepNode)1 DQRepositoryNode (org.talend.dq.nodes.DQRepositoryNode)1 JrxmlTempFolderRepNode (org.talend.dq.nodes.JrxmlTempFolderRepNode)1 PatternRegexSubFolderRepNode (org.talend.dq.nodes.PatternRegexSubFolderRepNode)1 PatternSqlSubFolderRepNode (org.talend.dq.nodes.PatternSqlSubFolderRepNode)1 ReportSubFolderRepNode (org.talend.dq.nodes.ReportSubFolderRepNode)1 RulesParserSubFolderRepNode (org.talend.dq.nodes.RulesParserSubFolderRepNode)1 RulesSQLSubFolderRepNode (org.talend.dq.nodes.RulesSQLSubFolderRepNode)1