use of com.amalto.workbench.utils.XSDAnnotationsStructure in project tmdm-studio-se by Talend.
the class ElementForeignKeyFilterCommitHandler method doSubmit.
@Override
protected boolean doSubmit() throws CommitException {
XSDAnnotationsStructure xsdAnnoStruct = getXSDAnnotationStruct();
try {
xsdAnnoStruct.setFKFilter(getCommitedObj().getValue());
doUpdateFKAnnotationStructure(xsdAnnoStruct);
} catch (Exception e) {
throw new CommitException(e.getMessage(), e);
}
return true;
}
use of com.amalto.workbench.utils.XSDAnnotationsStructure in project tmdm-studio-se by Talend.
the class LanguageInfoSection method initUIContents.
@Override
protected void initUIContents(XSDComponent editedObj) {
super.initUIContents(editedObj);
langInfos.clear();
XSDAnnotationsStructure xsdAnnoStruct = new XSDAnnotationsStructure(curXSDComponent);
for (Entry<String, String> eachLang2Label : getLang2Info(xsdAnnoStruct).entrySet()) {
langInfos.add(new LanguageInfo(Util.iso2lang.get(eachLang2Label.getKey()), eachLang2Label.getKey(), eachLang2Label.getValue()));
}
}
use of com.amalto.workbench.utils.XSDAnnotationsStructure in project tmdm-studio-se by Talend.
the class LookupFieldsSection method initUIContents.
@Override
protected void initUIContents(XSDComponent editedObj) {
super.initUIContents(editedObj);
lookupFields.clear();
XSDAnnotationsStructure annoStruct = new XSDAnnotationsStructure(curXSDComponent);
for (String eachLookUpFields : annoStruct.getLookupFields().values()) lookupFields.add(eachLookUpFields);
compElements.setElementsHolder(new XSDComponentChildElementsHolder(curXSDComponent));
}
use of com.amalto.workbench.utils.XSDAnnotationsStructure in project tmdm-studio-se by Talend.
the class AddBrowseItemsWizard method createNewTreeObject.
private TreeObject createNewTreeObject(XSDElementDeclaration decl, String browseItem) {
WSView view = new WSView();
view.setIsTransformerActive(new WSBoolean(false));
// $NON-NLS-1$
view.setTransformerPK("");
view.setName(browseItem);
EList<XSDIdentityConstraintDefinition> idtylist = decl.getIdentityConstraintDefinitions();
List<String> keys = new ArrayList<String>();
for (XSDIdentityConstraintDefinition idty : idtylist) {
EList<XSDXPathDefinition> xpathList = idty.getFields();
for (XSDXPathDefinition path : xpathList) {
String key = decl.getName();
// remove
// $NON-NLS-1$//$NON-NLS-2$
key = key.replaceFirst("#.*", "");
// $NON-NLS-1$
key += "/" + path.getValue();
keys.add(key);
}
}
view.getSearchableBusinessElements().addAll(keys);
view.getViewableBusinessElements().addAll(keys);
StringBuffer desc = new StringBuffer();
LinkedHashMap<String, String> labels = new LinkedHashMap<String, String>();
if (decl.getAnnotation() != null) {
labels = new XSDAnnotationsStructure(decl.getAnnotation()).getLabels();
}
if (labels.size() == 0) {
// $NON-NLS-1$
labels.put("EN", decl.getName());
}
for (String lan : labels.keySet()) {
// $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
desc.append("[" + lan.toUpperCase() + ":" + labels.get(lan) + "]");
}
view.setDescription(desc.toString());
WSPutView wrap = new WSPutView();
wrap.setWsView(view);
WSViewPK viewPk = new WSViewPK();
viewPk.setPk(browseItem);
WSDeleteView delView = new WSDeleteView();
delView.setWsViewPK(viewPk);
WSGetView getView = new WSGetView();
getView.setWsViewPK(viewPk);
service.putView(wrap);
// add node in the root
TreeParent root = page.getXObject().getServerRoot();
TreeObject obj = new // no storage to save
TreeObject(// no storage to save
browseItem, // no storage to save
root, // no storage to save
TreeObject.VIEW, // no storage to save
viewPk, // no storage to save
null);
return obj;
}
use of com.amalto.workbench.utils.XSDAnnotationsStructure in project tmdm-studio-se by Talend.
the class DataModelMainPage method getStructureByActiveItem.
public XSDAnnotationsStructure getStructureByActiveItem() {
XSDComponent xSDCom = null;
XSDAnnotationsStructure struc = null;
IStructuredSelection selection = (TreeSelection) getTreeViewer().getSelection();
if (selection.getFirstElement() instanceof Element) {
TreePath tPath = ((TreeSelection) selection).getPaths()[0];
for (int i = 0; i < tPath.getSegmentCount(); i++) {
if (tPath.getSegment(i) instanceof XSDAnnotation) {
xSDCom = (XSDAnnotation) (tPath.getSegment(i));
}
}
} else {
xSDCom = (XSDComponent) selection.getFirstElement();
}
if (xSDCom != null) {
struc = new XSDAnnotationsStructure(xSDCom);
}
return struc;
}
Aggregations