use of org.talend.commons.exception.BusinessException in project tdq-studio-se by Talend.
the class DuplicateAction method getSelctionNode.
private RepositoryNode getSelctionNode(String newLabel, Property property) throws BusinessException {
RepositoryNode recursiveFind = null;
if (property != null) {
if (property.getItem() instanceof TDQFileItem) {
// if the model element is null, means that it is a file item.
recursiveFind = findNodeForTDQFileItem(newLabel);
} else {
// find the related node by the model element
recursiveFind = RepositoryNodeHelper.recursiveFind(property);
}
}
if (recursiveFind == null) {
BusinessException createBusinessException = ExceptionFactory.getInstance().createBusinessException(// $NON-NLS-1$
DefaultMessagesImpl.getString("DuplicateAction.NodeNull", newLabel));
throw createBusinessException;
}
RepositoryNode parent = recursiveFind.getParent();
CommonViewer dqCommonViewer = RepositoryNodeHelper.getDQCommonViewer();
if (dqCommonViewer != null && !dqCommonViewer.getExpandedState(parent)) {
dqCommonViewer.setExpandedState(parent, true);
}
return recursiveFind;
}
use of org.talend.commons.exception.BusinessException in project tesb-studio-se by Talend.
the class ESBService method copyJobForService.
private Item copyJobForService(final Item item, final IPath path, final String newName) {
try {
final Item newItem = ProxyRepositoryFactory.getInstance().copy(item, path, newName);
if (newItem instanceof ConnectionItem) {
Connection connection = ((ConnectionItem) newItem).getConnection();
if (connection != null) {
connection.setLabel(newName);
connection.setName(newName);
connection.getSupplierDependency().clear();
}
}
ProxyRepositoryFactory.getInstance().save(newItem);
return newItem;
} catch (PersistenceException e) {
ExceptionHandler.process(e);
} catch (BusinessException e) {
ExceptionHandler.process(e);
}
return null;
}
use of org.talend.commons.exception.BusinessException in project tdi-studio-se by Talend.
the class ComponentsUtils method loadComponent.
private static void loadComponent(Set<IComponent> componentsList, ComponentDefinition componentDefinition, String paletteType) {
try {
Component currentComponent = new Component(componentDefinition, paletteType);
Collection<IComponentFactoryFilter> filters = ComponentsFactoryProviderManager.getInstance().getProviders();
boolean hiddenComponent = false;
for (IComponentFactoryFilter filter : filters) {
if (!filter.isAvailable(currentComponent.getName())) {
hiddenComponent = true;
break;
}
}
// just don't load it
if (hiddenComponent && !(currentComponent.getOriginalFamilyName().contains("Technical") || currentComponent.isTechnical())) {
return;
}
// hide it
if (hiddenComponent && (currentComponent.getOriginalFamilyName().contains("Technical") || currentComponent.isTechnical())) {
currentComponent.setVisible(false);
currentComponent.setTechnical(true);
}
componentsList.add(currentComponent);
} catch (BusinessException e) {
ExceptionHandler.process(e);
}
}
use of org.talend.commons.exception.BusinessException in project tdi-studio-se by Talend.
the class SelectDeleteProjectDialog method getProjectItem.
private List<Project> getProjectItem() {
if (login) {
List<Project> projectList = new ArrayList<Project>();
if (projectItemList != null && !projectItemList.isEmpty()) {
Iterator<Object> iter = projectItemList.iterator();
while (iter.hasNext()) {
Object project = iter.next();
if (project instanceof Project) {
projectList.add((Project) project);
}
}
}
return projectList;
}
if (!projects.isEmpty()) {
return projects;
}
ProxyRepositoryFactory repositoryFactory = ProxyRepositoryFactory.getInstance();
Project[] projects = null;
try {
projects = repositoryFactory.readProject();
} catch (PersistenceException e) {
CommonExceptionHandler.process(e);
} catch (BusinessException e) {
CommonExceptionHandler.process(e);
}
for (Project p : projects) {
this.projects.add(p);
}
if (projects != null) {
return this.projects;
}
return Collections.emptyList();
}
use of org.talend.commons.exception.BusinessException in project tdi-studio-se by Talend.
the class DBTreeProvider method getMetadataConnection.
/**
* @return MetadataConnection
*/
@SuppressWarnings("unchecked")
private Container getMetadataConnection() {
ProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
ProjectManager pManager = ProjectManager.getInstance();
Container container = null;
try {
container = factory.getMetadata(pManager.getCurrentProject(), ERepositoryObjectType.METADATA_CONNECTIONS);
pManager.retrieveReferencedProjects();
for (Project p : pManager.getAllReferencedProjects()) {
RootContainer rContainer = factory.getMetadata(p, ERepositoryObjectType.METADATA_CONNECTIONS);
if (container == null) {
container = rContainer;
} else if (rContainer != null) {
Iterator iterator = rContainer.absoluteKeySet().iterator();
while (iterator.hasNext()) {
Object id = iterator.next();
container.addMember(id, rContainer.getAbsoluteMember(id));
}
}
}
} catch (PersistenceException e) {
//$NON-NLS-1$
SqlBuilderPlugin.log(Messages.getString("DBTreeProvider.logMessage"), e);
} catch (BusinessException e) {
//$NON-NLS-1$
SqlBuilderPlugin.log(Messages.getString("DBTreeProvider.logMessage"), e);
}
return container;
}
Aggregations