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;
}
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);
}
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;
}
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);
}
// ~
}
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();
}
Aggregations