Skip to content

Commit

Permalink
TEIIDDES-2962 (cntd) added WEB and XMLDOC model categories
Browse files Browse the repository at this point in the history
  • Loading branch information
blafond committed Sep 28, 2017
1 parent 516440a commit 72107df
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 4 deletions.
Expand Up @@ -48,7 +48,9 @@
import org.teiid.designer.metamodels.relational.View;
import org.teiid.designer.metamodels.webservice.Interface;
import org.teiid.designer.metamodels.webservice.Operation;
import org.teiid.designer.metamodels.webservice.WebServicePackage;
import org.teiid.designer.metamodels.xml.XmlDocument;
import org.teiid.designer.metamodels.xml.XmlDocumentPackage;
import org.teiid.designer.roles.Crud;
import org.teiid.designer.roles.Permission;
import org.teiid.designer.roles.ui.Messages;
Expand Down Expand Up @@ -85,7 +87,8 @@ public class DataRolesModelTreeProvider implements ITreeContentProvider, ITableL
static final String ALL = "ALL"; //$NON-NLS-1$
static final String SOURCE = "SOURCE"; //$NON-NLS-1$
static final String VIEW = "VIEW"; //$NON-NLS-1$

static final String XMLDOC = "XMLDOC"; //$NON-NLS-1$
static final String WEB = "WEB"; //$NON-NLS-1$

// private Map<Object, Permission> permissionsMap;
private PermissionHandler handler;
Expand Down Expand Up @@ -666,6 +669,10 @@ public boolean match(Object element) {
if (!SOURCE.equalsIgnoreCase(type) ) return false;
} else if( modelType.equalsIgnoreCase(VIEW)) {
if( !VIEW.equalsIgnoreCase(type)) return false;
} else if( modelType.equalsIgnoreCase(WEB)) {
if( !WEB.equalsIgnoreCase(type)) return false;
} else if( modelType.equalsIgnoreCase(XMLDOC)) {
if( !XMLDOC.equalsIgnoreCase(type)) return false;
}
}

Expand All @@ -683,7 +690,14 @@ private String getModelType(Resource res) throws ModelerCoreException {
if (ModelType.PHYSICAL_LITERAL == mType) {
return SOURCE;
}


String mmURI = ma.getPrimaryMetamodelUri();
if( mmURI.equalsIgnoreCase(WebServicePackage.eNS_URI)) {
return WEB;
}
if( mmURI.equalsIgnoreCase(XmlDocumentPackage.eNS_URI)) {
return XMLDOC;
}
return VIEW;
}

Expand Down
Expand Up @@ -52,6 +52,8 @@ public class CrudPanel extends DataRolePanel {
static final String ALL = "ALL"; //$NON-NLS-1$
static final String SOURCE = "SOURCE"; //$NON-NLS-1$
static final String VIEW = "VIEW"; //$NON-NLS-1$
static final String XMLDOC = "XMLDOC"; //$NON-NLS-1$
static final String WEB = "WEB"; //$NON-NLS-1$
static final String FILTER = "Filter"; //$NON-NLS-1$

// Model Filter Variables
Expand Down Expand Up @@ -286,7 +288,7 @@ public void modifyText(ModifyEvent e) {
// Model Type Combo
// Model Types = ALL, VIEW and SOURCE
modelTypeCombo = new Combo(filterGroup, SWT.NONE);
modelTypeCombo.setItems(new String[] {ALL, SOURCE, VIEW} );
modelTypeCombo.setItems(new String[] {ALL, SOURCE, VIEW, WEB, XMLDOC} );
modelTypeCombo.select(0);
GridDataFactory.fillDefaults().grab(false, false).hint(90, 10).applyTo(modelTypeCombo);

Expand Down
Expand Up @@ -203,6 +203,8 @@ public final class VdbEditor extends EditorPart implements IResourceChangeListen
static final String ALL = "ALL"; //$NON-NLS-1$
static final String SOURCE = "SOURCE"; //$NON-NLS-1$
static final String VIEW = "VIEW"; //$NON-NLS-1$
static final String XMLDOC = "XMLDOC"; //$NON-NLS-1$
static final String WEB = "WEB"; //$NON-NLS-1$
static final String FILTER = "Filter"; //$NON-NLS-1$

// static final String WEB_SERVICES_VIEW_MODEL_URI = "http://www.metamatrix.com/metamodels/WebService"; //$NON-NLS-1$
Expand Down Expand Up @@ -2442,7 +2444,7 @@ public void modifyText(ModifyEvent e) {
// Model Type Combo
// Model Types = ALL, VIEW and SOURCE
modelTypeCombo = new Combo(filterGroup, SWT.NONE);
modelTypeCombo.setItems(new String[] {ALL, SOURCE, VIEW} );
modelTypeCombo.setItems(new String[] {ALL, SOURCE, VIEW, WEB, XMLDOC} );
modelTypeCombo.select(0);
GridDataFactory.fillDefaults().grab(false, false).hint(90, 10).applyTo(modelTypeCombo);

Expand Down Expand Up @@ -2789,6 +2791,10 @@ public boolean select(Viewer viewer, Object parentElement, Object element) {
return ModelIdentifier.isRelationalSourceModel(((VdbModelEntry) element).findFileInWorkspace());
} else if( modelType.equalsIgnoreCase(VIEW)) {
return ModelIdentifier.isRelationalViewModel(((VdbModelEntry) element).findFileInWorkspace());
} else if( modelType.equalsIgnoreCase(XMLDOC) ) {
return ModelIdentifier.isXmlViewModel(((VdbModelEntry) element).findFileInWorkspace());
} else if( modelType.equalsIgnoreCase(WEB) ) {
return ModelIdentifier.isWebServicesViewModel(((VdbModelEntry) element).findFileInWorkspace());
}
return false;
}
Expand Down

0 comments on commit 72107df

Please sign in to comment.