use of com.amalto.workbench.webservices.WSGetBusinessConceptKey in project tmdm-studio-se by Talend.
the class ViewMainPage method doSave.
@Override
public void doSave(IProgressMonitor monitor) {
super.doSave(monitor);
if (this.viewName != null && this.viewName.length() > 0) {
if (viewName.matches("Browse_items.*")) {
// $NON-NLS-1$
// lastDataModelName=XpathSelectDialog.getDataModelName();
// $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
String concept = viewName.replaceAll("Browse_items_", "").replaceAll("#.*", "");
java.util.List<String> avaiList = getAvailableDataModel();
if (avaiList.size() > 0) {
lastDataModelName = avaiList.get(0);
}
if (concept != null && concept.length() > 0 && lastDataModelName != null && lastDataModelName.length() > 0) {
// if(concept!=null&&concept.length()>0&&lastDataModelName!=null&&lastDataModelName.length()>0){
// keys validate
java.util.List<String> toAddViewableList = new ArrayList<String>();
WSGetBusinessConceptKey wsGetBusinessConceptKey = new WSGetBusinessConceptKey(concept, new WSDataModelPK(lastDataModelName));
WSConceptKey wsConceptKey = null;
try {
wsConceptKey = getBusinessConceptKey(wsGetBusinessConceptKey);
} catch (XtentisException e) {
log.error(e.getMessage(), e);
}
if (wsConceptKey != null) {
java.util.List<String> viewableList = new ArrayList<String>();
java.util.List<Line> vlines = (java.util.List<Line>) viewableViewer.getViewer().getInput();
for (int j = 0; j < vlines.size(); j++) {
Line item = vlines.get(j);
viewableList.add(item.keyValues.get(0).value);
}
java.util.List<String> keys = wsConceptKey.getFields();
for (int i = 0; i < keys.size(); i++) {
if (".".equals(wsConceptKey.getSelector())) {
// $NON-NLS-1$//$NON-NLS-2$
keys.set(i, "/" + concept + "/" + keys.get(i));
} else {
keys.set(i, wsConceptKey.getSelector() + keys.get(i));
}
}
java.util.List<String> ids = wsConceptKey.getFields();
for (String id : ids) {
// need to care about more case
if (id.startsWith("/")) {
// $NON-NLS-1$
id = id.substring(1);
} else if (id.startsWith("//")) {
// $NON-NLS-1$
id = id.substring(2);
}
if (!viewableList.contains(id)) {
toAddViewableList.add(0, id);
}
}
}
// show verify report
if (toAddViewableList.size() > 0) {
String msg = Messages.ViewMainPage_Msg;
for (Object element : toAddViewableList) {
String toAddItem = (String) element;
// $NON-NLS-1$
msg += (toAddItem + "\n");
}
msg += Messages.ViewMainPage_Addtions;
MessageDialog.openInformation(this.getSite().getShell(), Messages.ViewMainPage_VerifyReport, msg);
}
// auto fix
IRunnableWithProgress autoFixProcess = new AutoFixProgress(toAddViewableList, viewableViewer, this.getSite().getShell());
try {
new ProgressMonitorDialog(this.getSite().getShell()).run(false, true, autoFixProcess);
} catch (InvocationTargetException e) {
log.error(e.getMessage(), e);
} catch (InterruptedException e) {
log.error(e.getMessage(), e);
}
}
}
}
}
use of com.amalto.workbench.webservices.WSGetBusinessConceptKey in project tmdm-studio-se by Talend.
the class AddBrowseItemsWizardR method getKeyElements.
private static List<String> getKeyElements(String datamodel, String concept) {
java.util.List<String> idList = new ArrayList<String>();
WSGetBusinessConceptKey wsGetBusinessConceptKey = new WSGetBusinessConceptKey(concept, new WSDataModelPK(datamodel));
WSConceptKey wsConceptKey;
try {
wsConceptKey = RepositoryResourceUtil.getBusinessConceptKey(wsGetBusinessConceptKey);
} catch (Exception e) {
log.error(e.getMessage(), e);
return idList;
}
List<String> ids = wsConceptKey.getFields();
for (String id : ids) {
// need to care about more case
if (id.startsWith("/")) {
// $NON-NLS-1$
id = id.substring(1);
} else if (id.startsWith("//")) {
// $NON-NLS-1$
id = id.substring(2);
}
idList.add(concept + '/' + id);
}
return idList;
}
Aggregations