use of org.talend.core.ITDQPatternService in project tdi-studio-se by Talend.
the class ControllerRepositoryValueHander method fastRepositoryUpdateProperty.
private void fastRepositoryUpdateProperty(IElementParameter param) {
if (param != null && param.getValue() != null) {
IProxyRepositoryFactory factory = DesignerPlugin.getDefault().getProxyRepositoryFactory();
String linkedRepository = (String) param.getValue();
// value stored is the id, so we can get this item directly
Item item;
String displayName = "";
try {
IRepositoryViewObject object = factory.getLastVersion(linkedRepository.split(" - ")[0]);
if (object == null) {
return;
}
item = object.getProperty().getItem();
// Assert.isTrue(item instanceof ConnectionItem);
IESBService service = null;
if (GlobalServiceRegister.getDefault().isServiceRegistered(IESBService.class)) {
service = (IESBService) GlobalServiceRegister.getDefault().getService(IESBService.class);
}
if (service != null && ERepositoryObjectType.getItemType(item) == service.getServicesType()) {
lastItemUsed = (ConnectionItem) item;
displayName = "Service:" + service.getServiceLabel(item, linkedRepository);
} else if (item instanceof ConnectionItem) {
lastItemUsed = (ConnectionItem) item;
displayName = //$NON-NLS-1$
RepositoryObjectHelper.getRepositoryAliasName(lastItemUsed) + ":" + lastItemUsed.getProperty().getLabel();
}
if (item instanceof FileItem) {
// hywang add for 6484
lastFileItemUsed = (FileItem) item;
if (lastFileItemUsed instanceof RulesItem) {
displayName = //$NON-NLS-1$
"Rules:" + lastFileItemUsed.getProperty().getLabel();
}
}
if (item instanceof LinkRulesItem) {
lastLinkItem = (LinkRulesItem) item;
displayName = //$NON-NLS-1$
"Rules:" + lastLinkItem.getProperty().getLabel();
}
if (StringUtils.isEmpty(displayName)) {
ITDQPatternService tdqService = null;
try {
tdqService = (ITDQPatternService) GlobalServiceRegister.getDefault().getService(ITDQPatternService.class);
if (tdqService != null) {
displayName = tdqService.getPatternDisplayName(item);
}
} catch (RuntimeException e) {
// nothing to do
}
}
} catch (PersistenceException e) {
ExceptionHandler.process(e);
}
param.setListItemsDisplayName(new String[] { displayName });
param.setListItemsValue(new String[] { (String) param.getValue() });
}
}
use of org.talend.core.ITDQPatternService in project tdi-studio-se by Talend.
the class PropertyTypeController method processPattern.
// Added TDQ-13192 20170222
private Command processPattern(IElement elem) {
CompoundCommand compoundCommand = new CompoundCommand();
ITDQPatternService service = null;
if (GlobalServiceRegister.getDefault().isServiceRegistered(ITDQPatternService.class)) {
service = (ITDQPatternService) GlobalServiceRegister.getDefault().getService(ITDQPatternService.class);
}
if (service != null && elem instanceof Node) {
Node node = (Node) elem;
//$NON-NLS-1$
IElementParameter typeParam = node.getElementParameter("TYPE");
boolean hadSelected = service.selectPattern(typeParam, elem);
if (hadSelected) {
// create the command
//$NON-NLS-1$
final String showId = (String) node.getElementParameter("PATTERN_ID").getValue();
compoundCommand = new CompoundCommand();
Command command = new PropertyChangeCommand(elem, EParameterName.REPOSITORY_PROPERTY_TYPE.getName(), showId);
compoundCommand.add(command);
IElementParameter elementParameter = node.getElementParameter(EParameterName.REPOSITORY_PROPERTY_TYPE.getName());
String[] displayName = new String[1];
//$NON-NLS-1$
displayName[0] = (String) node.getElementParameter("PATTERN_NAME").getValue();
elementParameter.setListItemsDisplayName(displayName);
elementParameter.setListItemsValue(new String[] { showId });
}
}
return compoundCommand;
}
Aggregations