Search in sources :

Example 6 with WSViewE

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

the class NewViewAction method newView.

protected WSViewE newView(String key) {
    WSBooleanE wsBool = MdmserverobjectFactory.eINSTANCE.createWSBooleanE();
    wsBool.set_true(false);
    WSViewE view = MdmserverobjectFactory.eINSTANCE.createWSViewE();
    view.setName(key);
    // $NON-NLS-1$
    view.setDescription("");
    view.setTransformerPK(null);
    view.setIsTransformerActive(wsBool);
    return view;
}
Also used : WSBooleanE(org.talend.mdm.repository.model.mdmserverobject.WSBooleanE) WSViewE(org.talend.mdm.repository.model.mdmserverobject.WSViewE)

Example 7 with WSViewE

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

the class ViewOperatorUpdator method updateConditionOperator.

public boolean updateConditionOperator(Item item) {
    boolean modified = false;
    List<String> opers = getOperators();
    if (item != null && item instanceof WSViewItem) {
        WSViewItem viewItem = (WSViewItem) item;
        WSViewE wsView = viewItem.getWsView();
        EList<WSWhereConditionE> whereConditions = wsView.getWhereConditions();
        if (whereConditions != null) {
            for (WSWhereConditionE whereConditionE : whereConditions) {
                WSWhereOperatorE operator = whereConditionE.getOperator();
                if (!opers.contains(operator.getValue())) {
                    operator.setValue(WSWhereOperator.CONTAINS.name());
                    modified = true;
                }
            }
        }
    }
    return modified;
}
Also used : WSWhereOperatorE(org.talend.mdm.repository.model.mdmserverobject.WSWhereOperatorE) WSViewItem(org.talend.mdm.repository.model.mdmproperties.WSViewItem) WSViewE(org.talend.mdm.repository.model.mdmserverobject.WSViewE) WSWhereConditionE(org.talend.mdm.repository.model.mdmserverobject.WSWhereConditionE)

Example 8 with WSViewE

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

the class ViewValidator method validate.

@Override
public ValidationReport validate(String uri, InputStream inputstream, NestedValidatorContext context) {
    ViewValidationReport viewValidationReport = new ViewValidationReport(uri);
    // $NON-NLS-1$
    String fileName = uri.substring(uri.lastIndexOf("/") + 1);
    String viewName = getViewName(fileName);
    // $NON-NLS-1$ //$NON-NLS-2$
    viewName = viewName.replace("$", "#");
    IRepositoryViewObject viewObj = RepositoryResourceUtil.findViewObjectByName(IServerObjectRepositoryType.TYPE_VIEW, viewName);
    if (viewObj != null) {
        WSViewItem item = (WSViewItem) viewObj.getProperty().getItem();
        WSViewE view = (WSViewE) item.getMDMServerObject();
        EList<WSWhereConditionE> whereConditions = view.getWhereConditions();
        if (whereConditions != null && whereConditions.size() > 0) {
            for (WSWhereConditionE conditionE : whereConditions) {
                String userVarValue = conditionE.getRightValueOrPath();
                boolean isValid = UserVarValueValidator.validate(userVarValue);
                if (!isValid) {
                    String validateMsg = Messages.bind(Messages.ViewValidator_error, userVarValue, viewName);
                    viewValidationReport.addValidationMessage(new ValidationMessage(validateMsg, -1, -1));
                }
            }
        }
    }
    return viewValidationReport;
}
Also used : ValidationMessage(org.eclipse.wst.xml.core.internal.validation.core.ValidationMessage) WSViewItem(org.talend.mdm.repository.model.mdmproperties.WSViewItem) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) WSViewE(org.talend.mdm.repository.model.mdmserverobject.WSViewE) WSWhereConditionE(org.talend.mdm.repository.model.mdmserverobject.WSWhereConditionE)

Aggregations

WSViewE (org.talend.mdm.repository.model.mdmserverobject.WSViewE)8 WSViewItem (org.talend.mdm.repository.model.mdmproperties.WSViewItem)5 WSWhereConditionE (org.talend.mdm.repository.model.mdmserverobject.WSWhereConditionE)3 ENotificationImpl (org.eclipse.emf.ecore.impl.ENotificationImpl)2 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)2 WSWhereOperatorE (org.talend.mdm.repository.model.mdmserverobject.WSWhereOperatorE)2 URI (org.eclipse.emf.common.util.URI)1 EObject (org.eclipse.emf.ecore.EObject)1 InternalEObject (org.eclipse.emf.ecore.InternalEObject)1 Resource (org.eclipse.emf.ecore.resource.Resource)1 Point (org.eclipse.swt.graphics.Point)1 IEditorPart (org.eclipse.ui.IEditorPart)1 PartInitException (org.eclipse.ui.PartInitException)1 ValidationMessage (org.eclipse.wst.xml.core.internal.validation.core.ValidationMessage)1 Test (org.junit.Test)1 ItemState (org.talend.core.model.properties.ItemState)1 MDMServerDef (org.talend.mdm.repository.model.mdmmetadata.MDMServerDef)1 WSBooleanE (org.talend.mdm.repository.model.mdmserverobject.WSBooleanE)1 ViewBrowserInput (org.talend.mdm.repository.ui.editors.ViewBrowserInput)1 SelectServerDefDialog (org.talend.mdm.workbench.serverexplorer.ui.dialogs.SelectServerDefDialog)1