Skip to content

Commit

Permalink
TEIIDDES-1937 Added define view procedure action and accompanying act…
Browse files Browse the repository at this point in the history
…ion guide constants

  * Commented out the Create REST WAR action set for 8.3 release
  * added JIRA to handle re-instating it when 1937 is completed.
  • Loading branch information
blafond committed Dec 2, 2013
1 parent 045f604 commit 55d2fc9
Show file tree
Hide file tree
Showing 4 changed files with 108 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ interface COMMAND_IDS {
String NEW_OBJECT_BASE_TABLE = "org.teiid.designer.newObjectBaseTable"; //$NON-NLS-1$
String NEW_OBJECT_VIEW_TABLE = "org.teiid.designer.newObjectViewTable"; //$NON-NLS-1$
String DEFINE_VIEW_TABLE = "org.teiid.designer.defineViewTable"; //$NON-NLS-1$
String DEFINE_VIEW_PROCEDURE = "org.teiid.designer.defineViewProcedure"; //$NON-NLS-1$
String NEW_OBJECT_REST_PROCEDURE = "org.teiid.designer.newObjectRestProcedure"; //$NON-NLS-1$
String NEW_OBJECT_SOURCE_FUNCTION = "org.teiid.designer.newObjectSourceFunction"; //$NON-NLS-1$

Expand Down Expand Up @@ -214,6 +215,7 @@ interface COMMAND_DESC {
String NEW_OBJECT_BASE_TABLE = "Create new relational table"; //$NON-NLS-1$
String NEW_OBJECT_VIEW_TABLE = "Create new relational view table"; //$NON-NLS-1$
String DEFINE_VIEW_TABLE = "Define relational view table by creating or selecting existing table"; //$NON-NLS-1$
String DEFINE_VIEW_PROCEDURE = "Define relational view procedure by creating or selecting existing procedure"; //$NON-NLS-1$
String NEW_OBJECT_REST_PROCEDURE = "Create new relational view REST procedure"; //$NON-NLS-1$
String NEW_OBJECT_SOURCE_FUNCTION = "Create new relational source function"; //$NON-NLS-1$

Expand Down Expand Up @@ -277,6 +279,7 @@ interface COMMAND_LABELS {
String NEW_OBJECT_BASE_TABLE = Messages.CreateNewRelationalBaseTable;
String NEW_OBJECT_VIEW_TABLE = Messages.CreateNewRelationalViewTable;
String DEFINE_VIEW_TABLE = Messages.DefineRelationalViewTable;
String DEFINE_VIEW_PROCEDURE = Messages.DefineRelationalViewProcedure;
String NEW_OBJECT_REST_PROCEDURE = Messages.CreateNewRelationalViewRESTProcedure;
String NEW_OBJECT_SOURCE_FUNCTION = Messages.CreateNewRelationalSourceFunction;

Expand Down Expand Up @@ -337,6 +340,7 @@ interface COMMAND_LABELS_SHORT {
String NEW_OBJECT_BASE_TABLE = Messages.CreateNewRelationalBaseTable_Short;
String NEW_OBJECT_VIEW_TABLE = Messages.CreateNewRelationalViewTable_Short;
String DEFINE_VIEW_TABLE = Messages.DefineRelationalViewTable;
String DEFINE_VIEW_PROCEDURE = Messages.DefineRelationalViewProcedure;
String NEW_OBJECT_REST_PROCEDURE = Messages.CreateNewRelationalViewRESTProcedure_Short;
String NEW_OBJECT_SOURCE_FUNCTION = Messages.CreateNewRelationalSourceFunction_Short;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,11 @@ static void loadHandlers() {
COMMAND_LABELS.DEFINE_VIEW_TABLE,
COMMAND_LABELS_SHORT.DEFINE_VIEW_TABLE,
COMMAND_DESC.DEFINE_VIEW_TABLE);
addActionHandler(
COMMAND_IDS.DEFINE_VIEW_PROCEDURE,
COMMAND_LABELS.DEFINE_VIEW_PROCEDURE,
COMMAND_LABELS_SHORT.DEFINE_VIEW_PROCEDURE,
COMMAND_DESC.DEFINE_VIEW_PROCEDURE);
addActionHandler(
COMMAND_IDS.NEW_OBJECT_REST_PROCEDURE,
COMMAND_LABELS.NEW_OBJECT_REST_PROCEDURE,
Expand Down Expand Up @@ -492,6 +497,12 @@ public static void executeAction(String id, Properties properties, boolean synch
action.run();
return;
}

if (id.equalsIgnoreCase(COMMAND_IDS.DEFINE_VIEW_PROCEDURE)) {
DefineViewProcedureAction action = new DefineViewProcedureAction(properties);
action.run();
return;
}

// CONNECTIONPROFILE OPTIONS
if( id.equalsIgnoreCase(COMMAND_IDS.CREATE_CONNECTION_JDBC)) {
Expand Down Expand Up @@ -832,6 +843,10 @@ public static String getImageId(String id) {
return Images.NEW_VIRTUAL_TABLE_ICON;
}

if( id.equalsIgnoreCase(COMMAND_IDS.DEFINE_VIEW_PROCEDURE)) {
return Images.NEW_VIRTUAL_PROCEDURE_ICON;
}

if( id.equalsIgnoreCase(COMMAND_IDS.NEW_OBJECT_REST_PROCEDURE)) {
return Images.NEW_VIRTUAL_PROCEDURE_ICON;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,18 +137,19 @@ private void init() {
// Generate REST WAR
// Deploy REST WAR
// =============================================================================
infoList = new ArrayList<AdvisorActionInfo>();
infoList.add(AdvisorActionFactory.getActionInfo(COMMAND_IDS.DEFINE_TEIID_MODEL_PROJECT));
infoList.add(AdvisorActionFactory.getActionInfo(COMMAND_IDS.DEFINE_SOURCE));
infoList.add(AdvisorActionFactory.getActionInfo(COMMAND_IDS.DEFINE_VIEW_TABLE));
infoList.add(AdvisorActionFactory.getActionInfo(COMMAND_IDS.PREVIEW_DATA));
infoList.add(AdvisorActionFactory.getActionInfo(COMMAND_IDS.DEFINE_VDB));
infoList.add(AdvisorActionFactory.getActionInfo(COMMAND_IDS.DEPLOY_VDB));
infoList.add(AdvisorActionFactory.getActionInfo(COMMAND_IDS.GENERATE_REST_WAR));
infoList.add(AdvisorActionFactory.getActionInfo(COMMAND_IDS.DEPLOY_WAR));

infoArray = infoList.toArray(new AdvisorActionInfo[infoList.size()]);
actionInfoMap.put(CREATE_REST_WAR, infoArray);
// infoList = new ArrayList<AdvisorActionInfo>();
// infoList.add(AdvisorActionFactory.getActionInfo(COMMAND_IDS.DEFINE_TEIID_MODEL_PROJECT));
// infoList.add(AdvisorActionFactory.getActionInfo(COMMAND_IDS.DEFINE_SOURCE));
// infoList.add(AdvisorActionFactory.getActionInfo(COMMAND_IDS.DEFINE_VIEW_TABLE));
// infoList.add(AdvisorActionFactory.getActionInfo(COMMAND_IDS.DEFINE_VIEW_PROCEDURE));
// infoList.add(AdvisorActionFactory.getActionInfo(COMMAND_IDS.PREVIEW_DATA));
// infoList.add(AdvisorActionFactory.getActionInfo(COMMAND_IDS.DEFINE_VDB));
// infoList.add(AdvisorActionFactory.getActionInfo(COMMAND_IDS.DEPLOY_VDB));
// infoList.add(AdvisorActionFactory.getActionInfo(COMMAND_IDS.GENERATE_REST_WAR));
// infoList.add(AdvisorActionFactory.getActionInfo(COMMAND_IDS.DEPLOY_WAR));
//
// infoArray = infoList.toArray(new AdvisorActionInfo[infoList.size()]);
// actionInfoMap.put(CREATE_REST_WAR, infoArray);

// =============================================================================
// JBossWS-CXF (SOAP) War actions set:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
/*
* JBoss, Home of Professional Open Source.
*
* See the LEGAL.txt file distributed with this work for information regarding copyright ownership and licensing.
*
* See the AUTHORS.txt file distributed with this work for a full listing of individual contributors.
*/
package org.teiid.designer.advisor.ui.actions;

import java.util.Properties;

import org.eclipse.core.resources.IProject;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.window.Window;
import org.eclipse.ui.IWorkbenchWindow;
import org.teiid.designer.advisor.ui.AdvisorUiConstants;
import org.teiid.designer.advisor.ui.AdvisorUiPlugin;
import org.teiid.designer.transformation.ui.editors.DefineViewProcedureDialog;
import org.teiid.designer.ui.viewsupport.DesignerPropertiesUtil;
import org.teiid.designer.ui.viewsupport.IPropertiesContext;
import org.teiid.designer.ui.viewsupport.ModelerUiViewUtils;

/**
*
*/
public class DefineViewProcedureAction extends Action implements AdvisorUiConstants {

private Properties designerProperties;

/**
* Construct an instance of NewModelAction.
*/
public DefineViewProcedureAction() {
super();
setText("Define View Procedure"); //$NON-NLS-1$
setToolTipText("Define View Procedure Tooltip"); //$NON-NLS-1$
setImageDescriptor(AdvisorUiPlugin.getDefault().getImageDescriptor(Images.NEW_VIRTUAL_PROCEDURE_ICON));

}

/**
* @param properties the designer properties
*/
public DefineViewProcedureAction( Properties properties ) {
this();
this.designerProperties = properties;
}

/* (non-Javadoc)
* @see org.eclipse.jface.action.IAction#run()
*/
@Override
public void run() {
if( !ModelerUiViewUtils.workspaceHasOpenModelProjects() ) {
IProject newProject = ModelerUiViewUtils.queryUserToCreateModelProject();

if( newProject != null ) {
DesignerPropertiesUtil.setProjectName(designerProperties, newProject.getName());
} else {
DesignerPropertiesUtil.setProjectStatus(this.designerProperties, IPropertiesContext.NO_OPEN_PROJECT);
return;
}
}

final IWorkbenchWindow iww = AdvisorUiPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow();

DefineViewProcedureDialog sdDialog = new DefineViewProcedureDialog(iww.getShell(), this.designerProperties);

sdDialog.open();

if (sdDialog.getReturnCode() == Window.OK) {
// Should do nothing since the user can select or create new project or do nothing
// and the property for the Project will be set in the "designerProperties"
}
}
}

0 comments on commit 55d2fc9

Please sign in to comment.