use of org.talend.core.model.repository.IRepositoryViewObject in project tdi-studio-se by Talend.
the class ExportItemUtil method getOtherVersions.
/**
* return a collection of items that have the same id as the input items params and a different version. <br>
* WARNING : when calling this method the global TOS model will be updated with all the items versions
*
* @param items all the items to get the different version of.
* @return list of all the items with same id as input items and different versions
* @throws PersistenceException if could not load some items //MOD sgandon 31/03/2010 bug 12229: changed
* getAllVersions into getOtherVersions.
*/
private Collection<Item> getOtherVersions(Collection<Item> items) throws PersistenceException {
Collection<Item> itemsVersions = new ArrayList<Item>();
for (Item item : items) {
org.talend.core.model.general.Project itemProject = new org.talend.core.model.general.Project(pManager.getProject(item));
List<IRepositoryViewObject> allVersion = ProxyRepositoryFactory.getInstance().getAllVersion(itemProject, item.getProperty().getId(), false);
for (IRepositoryViewObject repositoryObject : allVersion) {
Item anyVersionItem = repositoryObject.getProperty().getItem();
if (!anyVersionItem.equals(item)) {
itemsVersions.add(anyVersionItem);
}
// else same item so ignor it
}
}
return itemsVersions;
}
use of org.talend.core.model.repository.IRepositoryViewObject in project tdi-studio-se by Talend.
the class ExportProjectsAsAction method getLinksFromProject.
/**
* DOC zwang Comment method "getLinksFromProject".
*
* @param project
* @return
*/
private List<LinkTargetStore> getLinksFromProject(Project project) {
List<IMPORTType> imports = null;
String linkTarget = null;
RootContainer<String, IRepositoryViewObject> routines = getRoutineFromProject(project);
List<LinkTargetStore> paths = new ArrayList<LinkTargetStore>();
String language = project.getLanguage().getName().trim();
for (IRepositoryViewObject obj : routines.getMembers()) {
RoutineItem routine = (RoutineItem) obj.getProperty().getItem();
imports = routine.getImports();
if (language != null) {
if (project != null && ECodeLanguage.JAVA.getName().equals(language)) {
IPath containerPath = getContainerFullPath(project.getTechnicalLabel());
for (IMPORTType importType : imports) {
try {
LinkTargetStore store = new LinkTargetStore();
IPath newFilePath = containerPath.append(ExportProjectsAsAction.LIB + java.io.File.separatorChar + ECodeLanguage.JAVA.getName() + java.io.File.separatorChar + importType.getMODULE());
linkTarget = EXTERNAL_LIB_JAVA_PATH + java.io.File.separatorChar + importType.getMODULE();
URI path = new URI(linkTarget.replace(java.io.File.separatorChar, '/'));
store.file = ResourcesPlugin.getWorkspace().getRoot().getFile(newFilePath);
store.uri = path;
paths.add(store);
} catch (Exception e) {
ExceptionHandler.process(e);
}
}
}
}
}
return paths;
}
use of org.talend.core.model.repository.IRepositoryViewObject in project tdi-studio-se by Talend.
the class ExportProjectsAsAction method getRoutineFromProject.
/**
* DOC bqian Comment method "getRouineFromProject".
*
* @param project
*/
private RootContainer<String, IRepositoryViewObject> getRoutineFromProject(Project project) {
ProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
RootContainer<String, IRepositoryViewObject> routines = null;
try {
routines = factory.getRoutineFromProject(project);
} catch (PersistenceException e) {
// TODO Auto-generated catch block
// e.printStackTrace();
ExceptionHandler.process(e);
}
return routines;
}
use of org.talend.core.model.repository.IRepositoryViewObject in project tdi-studio-se by Talend.
the class SchemaTypeProcessor method selectRepositoryNode.
@Override
protected boolean selectRepositoryNode(Viewer viewer, RepositoryNode parentNode, RepositoryNode node) {
if (super.selectRepositoryNode(viewer, parentNode, node)) {
IRepositoryViewObject object = node.getObject();
if (object != null) {
// query
if (object instanceof Query) {
return false;
}
}
// cdc
ICDCProviderService cdcService = null;
if (PluginChecker.isCDCPluginLoaded()) {
cdcService = (ICDCProviderService) GlobalServiceRegister.getDefault().getService(ICDCProviderService.class);
}
String repositoryType = getRepositoryType();
if (ERepositoryCategoryType.CDC.getName().equals(repositoryType) && (object != null)) {
if (object.getRepositoryObjectType() == ERepositoryObjectType.METADATA_CONNECTIONS) {
DatabaseConnectionItem item = (DatabaseConnectionItem) object.getProperty().getItem();
DatabaseConnection connection = (DatabaseConnection) item.getConnection();
if (cdcService != null && cdcService.canCreateCDCConnection(connection)) {
return true;
}
return false;
}
if (object instanceof MetadataTable) {
return ((MetadataTableRepositoryObject) object).getTable().isActivatedCDC();
}
}
return true;
}
return false;
}
use of org.talend.core.model.repository.IRepositoryViewObject in project tesb-studio-se by Talend.
the class CheckCXFNodesService method checkNode.
/*
* (non-Javadoc)
*
* @see
* org.talend.designer.core.ICheckNodesService#checkNode(org.talend.designer
* .core.ui.editor.nodes.Node)
*/
public void checkNode(Node node) {
if (!node.getComponent().getName().equals("cSOAP")) {
//$NON-NLS-1$
return;
}
//$NON-NLS-1$
final IElementParameter serviceParam = node.getElementParameter("SERVICE_TYPE");
// Select WSDL
if (serviceParam != null && "wsdlURL".equals(serviceParam.getValue())) {
//$NON-NLS-1$
//$NON-NLS-1$
final IElementParameter wsdlFileParam = node.getElementParameter("WSDL_FILE");
//$NON-NLS-1$
final IElementParameter wsdlTypeParam = node.getElementParameter("WSDL_TYPE");
// Select File
if (wsdlTypeParam != null && "file".equals(wsdlTypeParam.getValue())) {
// WSDL file is empty
if (wsdlFileParam == null || wsdlFileParam.getValue() == null || wsdlFileParam.getValue().toString().isEmpty() || wsdlFileParam.getValue().toString().equals("\"\"")) {
//$NON-NLS-1$
String errorMessage = //$NON-NLS-1$
MessageFormat.format(//$NON-NLS-1$
CamelDesignerMessages.getString("CheckCXFNodesService_emptyError"), wsdlFileParam == null ? "" : wsdlFileParam.getDisplayName());
Problems.add(ProblemStatus.ERROR, (Element) node, errorMessage);
}
} else // Select Repository
if (wsdlTypeParam != null && "repo".equals(wsdlTypeParam.getValue())) {
//$NON-NLS-1$
final IElementParameter resourceParam = node.getElementParameterFromField(EParameterFieldType.ROUTE_RESOURCE_TYPE);
// WSDL file is empty
//$NON-NLS-1$
String errorMessage = "";
if (resourceParam == null || resourceParam.getValue() == null || resourceParam.getValue().toString().isEmpty()) {
errorMessage = //$NON-NLS-1$
MessageFormat.format(//$NON-NLS-1$
CamelDesignerMessages.getString("CheckCXFNodesService_emptyError"), wsdlFileParam.getDisplayName());
Problems.add(ProblemStatus.ERROR, (Element) node, errorMessage);
} else {
String id = (String) resourceParam.getValue();
try {
IRepositoryViewObject lastVersion = ProxyRepositoryFactory.getInstance().getLastVersion(id);
if (lastVersion == null) {
errorMessage = //$NON-NLS-1$
MessageFormat.format(//$NON-NLS-1$
CamelDesignerMessages.getString("CheckCXFNodesService_nonexistError"), wsdlFileParam.getDisplayName());
Problems.add(ProblemStatus.ERROR, (Element) node, errorMessage);
} else if (lastVersion.isDeleted()) {
errorMessage = //$NON-NLS-1$
MessageFormat.format(//$NON-NLS-1$
CamelDesignerMessages.getString("CheckCXFNodesService_removedError"), resourceParam.getDisplayName());
Problems.add(ProblemStatus.ERROR, (Element) node, errorMessage);
}
} catch (PersistenceException e) {
errorMessage = //$NON-NLS-1$
MessageFormat.format(//$NON-NLS-1$
CamelDesignerMessages.getString("CheckCXFNodesService_emptyError"), wsdlFileParam.getDisplayName());
Problems.add(ProblemStatus.ERROR, (Element) node, errorMessage);
}
}
}
} else // Select Service class
if (serviceParam != null && "serviceClass".equals(serviceParam.getValue())) {
//$NON-NLS-1$
//$NON-NLS-1$
final IElementParameter clazzParam = node.getElementParameter("SERVICE_CLASS");
// Service class is empty
if (clazzParam == null || clazzParam.getValue() == null || clazzParam.getValue().toString().isEmpty()) {
String errorMessage = //$NON-NLS-1$
MessageFormat.format(//$NON-NLS-1$
CamelDesignerMessages.getString("CheckCXFNodesService_emptyError"), clazzParam.getDisplayName());
Problems.add(ProblemStatus.ERROR, (Element) node, errorMessage);
}
}
}
Aggregations