Search in sources :

Example 1 with WSDataModelE

use of org.talend.mdm.repository.model.mdmserverobject.WSDataModelE in project tmdm-studio-se by Talend.

the class WSDataModelItemImpl method getWsDataModel.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public WSDataModelE getWsDataModel() {
    if (wsDataModel != null && wsDataModel.eIsProxy()) {
        InternalEObject oldWsDataModel = (InternalEObject) wsDataModel;
        wsDataModel = (WSDataModelE) eResolveProxy(oldWsDataModel);
        if (wsDataModel.eResource() == null && eResource() != null) {
            URI uri = EcoreUtil.getURI(wsDataModel);
            if (uri.hasFragment()) {
                uri = uri.trimFragment();
            }
            Resource resource = eResource().getResourceSet().getResource(uri, true);
            for (EObject object : resource.getContents()) {
                if (object instanceof WSDataModelE) {
                    wsDataModel = (WSDataModelE) object;
                    break;
                }
            }
        }
        if (wsDataModel != oldWsDataModel) {
            if (eNotificationRequired()) {
                eNotify(new ENotificationImpl(this, Notification.RESOLVE, MdmpropertiesPackage.WS_DATA_MODEL_ITEM__WS_DATA_MODEL, oldWsDataModel, wsDataModel));
            }
        }
    }
    return wsDataModel;
}
Also used : ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl) EObject(org.eclipse.emf.ecore.EObject) InternalEObject(org.eclipse.emf.ecore.InternalEObject) Resource(org.eclipse.emf.ecore.resource.Resource) WSDataModelE(org.talend.mdm.repository.model.mdmserverobject.WSDataModelE) URI(org.eclipse.emf.common.util.URI) InternalEObject(org.eclipse.emf.ecore.InternalEObject)

Example 2 with WSDataModelE

use of org.talend.mdm.repository.model.mdmserverobject.WSDataModelE in project tmdm-studio-se by Talend.

the class NewDataModelAction method createServerObject.

@Override
protected Item createServerObject(String key) {
    WSDataModelItem item = MdmpropertiesFactory.eINSTANCE.createWSDataModelItem();
    ItemState itemState = PropertiesFactory.eINSTANCE.createItemState();
    item.setState(itemState);
    // 
    WSDataModelE dataModel = newBlankDataModel(key);
    item.setWsDataModel(dataModel);
    if (parentItem != null) {
        item.getState().setPath(parentItem.getState().getPath());
        RepositoryResourceUtil.createItem(item, key);
        createERDocument(item);
        createMatchRuleMapInfo(item);
    }
    if (needCreateDataContainer) {
        createDataContainerObject(key);
    }
    return item;
}
Also used : WSDataModelItem(org.talend.mdm.repository.model.mdmproperties.WSDataModelItem) ItemState(org.talend.core.model.properties.ItemState) WSDataModelE(org.talend.mdm.repository.model.mdmserverobject.WSDataModelE)

Example 3 with WSDataModelE

use of org.talend.mdm.repository.model.mdmserverobject.WSDataModelE in project tmdm-studio-se by Talend.

the class MDMRepositoryViewServiceExt method getDataModelXsd.

public XSDSchema getDataModelXsd(TreeObject pObject, String filter, String dataModelName) {
    WSDataModelE wsDataModel = RepositoryQueryService.findDataModelByName(dataModelName);
    XSDSchema xsd = null;
    if (wsDataModel != null) {
        try {
            String schema = wsDataModel.getXsdSchema();
            xsd = Util.createXsdSchema(schema, pObject);
        } catch (Exception e) {
            log.error(e.getMessage(), e);
        }
    }
    return xsd;
}
Also used : WSDataModelE(org.talend.mdm.repository.model.mdmserverobject.WSDataModelE) XSDSchema(org.eclipse.xsd.XSDSchema)

Example 4 with WSDataModelE

use of org.talend.mdm.repository.model.mdmserverobject.WSDataModelE in project tmdm-studio-se by Talend.

the class RepositoryResourceUtil method getBusinessConceptKey.

public static WSConceptKey getBusinessConceptKey(WSGetBusinessConceptKey businessConcepKey) throws XtentisException {
    String pk = businessConcepKey.getWsDataModelPK().getPk();
    String concept = businessConcepKey.getConcept();
    WSDataModelE dataModel = RepositoryQueryService.findDataModelByName(pk);
    if (dataModel != null) {
        try {
            XSDSchema xsdSchema = Util.getXSDSchema(dataModel.getXsdSchema());
            for (XSDIdentityConstraintDefinition idDef : xsdSchema.getIdentityConstraintDefinitions()) {
                if (idDef.getName().equals(concept)) {
                    WSConceptKey key = new WSConceptKey();
                    // 
                    XSDXPathDefinition selector = idDef.getSelector();
                    key.setSelector(selector.getValue());
                    // 
                    EList<XSDXPathDefinition> fields = idDef.getFields();
                    List<String> keyFields = new ArrayList<String>();
                    for (XSDXPathDefinition pathDef : fields) {
                        keyFields.add(pathDef.getValue());
                    }
                    key.getFields().clear();
                    key.getFields().addAll(keyFields);
                    return key;
                }
            }
        } catch (Exception e) {
            log.error(e.getMessage(), e);
        }
    }
    return null;
}
Also used : WSDataModelE(org.talend.mdm.repository.model.mdmserverobject.WSDataModelE) ArrayList(java.util.ArrayList) XSDIdentityConstraintDefinition(org.eclipse.xsd.XSDIdentityConstraintDefinition) XSDXPathDefinition(org.eclipse.xsd.XSDXPathDefinition) WSConceptKey(com.amalto.workbench.webservices.WSConceptKey) CoreException(org.eclipse.core.runtime.CoreException) PartInitException(org.eclipse.ui.PartInitException) LoginException(org.talend.commons.exception.LoginException) InvocationTargetException(java.lang.reflect.InvocationTargetException) IOException(java.io.IOException) XtentisException(com.amalto.workbench.utils.XtentisException) FileNotFoundException(java.io.FileNotFoundException) PersistenceException(org.talend.commons.exception.PersistenceException) XSDSchema(org.eclipse.xsd.XSDSchema)

Example 5 with WSDataModelE

use of org.talend.mdm.repository.model.mdmserverobject.WSDataModelE in project tmdm-studio-se by Talend.

the class UserSecurityComboBoxDialogCellEditor method getSchemaFromRepository.

private String getSchemaFromRepository() {
    String schema = null;
    WSDataModelE wsDataModel = RepositoryQueryService.findDataModelByName(dataModelName);
    if (wsDataModel != null) {
        schema = wsDataModel.getXsdSchema();
    }
    return schema;
}
Also used : WSDataModelE(org.talend.mdm.repository.model.mdmserverobject.WSDataModelE)

Aggregations

WSDataModelE (org.talend.mdm.repository.model.mdmserverobject.WSDataModelE)11 WSDataModelItem (org.talend.mdm.repository.model.mdmproperties.WSDataModelItem)4 XSDSchema (org.eclipse.xsd.XSDSchema)3 File (java.io.File)2 FileInputStream (java.io.FileInputStream)2 ENotificationImpl (org.eclipse.emf.ecore.impl.ENotificationImpl)2 ItemState (org.talend.core.model.properties.ItemState)2 ImportExchangeOptionsDialog (com.amalto.workbench.dialogs.ImportExchangeOptionsDialog)1 XtentisException (com.amalto.workbench.utils.XtentisException)1 WSConceptKey (com.amalto.workbench.webservices.WSConceptKey)1 WSDataModel (com.amalto.workbench.webservices.WSDataModel)1 FileFilter (java.io.FileFilter)1 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 ArrayList (java.util.ArrayList)1 CoreException (org.eclipse.core.runtime.CoreException)1 URI (org.eclipse.emf.common.util.URI)1 EObject (org.eclipse.emf.ecore.EObject)1