Skip to content

Commit

Permalink
[TOOLS-4364] For CUBRID Admin 11.1.1.0002 (#187)
Browse files Browse the repository at this point in the history
http://jira.cubrid.org/browse/TOOLS-4364

fixed bug in CA-commit-id(cc5b33b) ,
CM-commit-id(7637e82)

- FK option is not display in Schema Compare Wizard.
- Error copy table in selected table's context menu.
- Added Synonym function. (ADD, DROP, EDIT AND DashboardEditor)
- When export, import for ERwin xml, Error about 'ON DELETE SET NULL' option. (same as 11.0)
- Update Version (11.1.0.0001 -> 11.1.1.0002)
  • Loading branch information
hwany7seo authored Aug 10, 2022
1 parent 81db759 commit 2381f2f
Show file tree
Hide file tree
Showing 74 changed files with 3,259 additions and 90 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
/*
* Copyright (C) 2013 Search Solution Corporation. All rights reserved by Search
* Solution.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: -
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer. - Redistributions in binary
* form must reproduce the above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or other materials provided
* with the distribution. - Neither the name of the <ORGANIZATION> nor the names
* of its contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/

package com.cubrid.common.core.common.model;

import java.util.Locale;

public class Synonym implements
Comparable<Synonym> {
private String name;
private String owner;
private String targetName;
private String targetOwner;
private String comment;

/**
* compare to the argument obj
*
* @param obj Synonym
* @return int
*/
public int compareTo(Synonym obj) {
return getUniqueName().compareTo(obj.getUniqueName());
}

/**
* compare to the argument obj
*
* @param obj Synonym
* @return int
*/
public int targetCompareTo(Synonym obj) {
return getTargetUniqueName().compareTo(obj.getTargetUniqueName());
}

/**
* @param obj the reference object with which to compare.
* @return true if this object is the same as the obj argument; false
* otherwise.
*/
@Override
public boolean equals(Object obj) {
return obj instanceof Synonym && getUniqueName().equals(((Synonym) obj).getUniqueName());
}

public boolean targetEquals(Object obj) {
return obj instanceof Synonym && getTargetUniqueName().equals(((Synonym) obj).getTargetUniqueName());
}

/**
* @return a hash code value for this object.
*/
@Override
public int hashCode() {
return name.hashCode();
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public String getOwner() {
return owner;
}

public void setOwner(String owner) {
this.owner = owner;
}

public String getTargetName() {
return targetName;
}

public void setTargetName(String name) {
this.targetName = name;
}

public String getTargetOwner() {
return targetOwner;
}

public void setTargetOwner(String owner) {
this.targetOwner = owner;
}

public void setComment(String comment) {
this.comment = comment;
}

public String getComment() {
return comment;
}

public String getUniqueName() {
return owner + "." + name;
}

public String getTargetUniqueName() {
return targetOwner + "." + targetName;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -749,6 +749,26 @@ public static String escapeKeyword(String text) {
return "[" + text + "]";
}

public static String escapeKeywordFromUniqueName(String text, boolean isSupportUserSchema) {
if (text == null) {
return null;
}

if (text.length() == 0) {
return "";
}

if (isSupportUserSchema) {
int idx = text.indexOf(".");
if (idx > 0) {
String ownerName = text.substring(0, idx);
String className = text.substring(idx + 1);
return escapeKeyword(ownerName) + "." + escapeKeyword(className);
}
}
return escapeKeyword(text);
}

/**
* Get the Key words map.
*
Expand Down
4 changes: 4 additions & 0 deletions com.cubrid.common.ui/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ Export-Package: .,
com.cubrid.common.ui.cubrid.trigger.action,
com.cubrid.common.ui.cubrid.trigger.dialog,
com.cubrid.common.ui.cubrid.trigger.editor,
com.cubrid.common.ui.cubrid.synonym,
com.cubrid.common.ui.cubrid.synonym.action,
com.cubrid.common.ui.cubrid.synonym.dialog,
com.cubrid.common.ui.cubrid.synonym.editor,
com.cubrid.common.ui.cubrid.user,
com.cubrid.common.ui.cubrid.user.action,
com.cubrid.common.ui.cubrid.user.dialog,
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions com.cubrid.common.ui/plugin.properties
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ cubridBrokerConfEditorPartName=Broker Editor
tableInfoEditorName=Edit Table
viewsDetailInfoName=View Dashboard
triggersDetailInfoName=Trigger Dashboard
synonymsDetailInfoName=Synonym Dashboard
serialsDetailInfoName=Serial Dashboard
schemaCompareName=Compare DB schema
dataCompareName=Compare DB data
Expand Down
7 changes: 7 additions & 0 deletions com.cubrid.common.ui/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,13 @@
id="com.cubrid.common.ui.cubrid.trigger.editor.TriggerDashboardEditorPart"
name="%triggersDetailInfoName">
</editor>
<editor
class="com.cubrid.common.ui.cubrid.synonym.editor.SynonymDashboardEditorPart"
default="false"
icon="icons/navigator/synonym_group.png"
id="com.cubrid.common.ui.cubrid.synonym.editor.SynonymDashboardEditorPart"
name="%triggersDetailInfoName">
</editor>
<editor
class="com.cubrid.common.ui.cubrid.user.editor.UserDashboardEditorPart"
default="false"
Expand Down
1 change: 1 addition & 0 deletions com.cubrid.common.ui/plugin_ko_KR.properties
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ cubridBrokerConfEditorPartName=\uBE0C\uB85C\uCEE4 \uC77C\uAD04 \uD3B8\uC9D1
tableInfoEditorName=\uD14C\uC774\uBE14 \uD3B8\uC9D1
viewsDetailInfoName=\uBDF0 \uB300\uC2DC\uBCF4\uB4DC
triggersDetailInfoName=\uD2B8\uB9AC\uAC70 \uB300\uC2DC\uBCF4\uB4DC
synonymsDetailInfoName=\ub3d9\uc758\uc5b4 \ub300\uc2dc\ubcf4\ub4dc
serialsDetailInfoName=\uC2DC\uB9AC\uC5BC \uB300\uC2DC\uBCF4\uB4DC
schemaCompareName=DB \uC2A4\uD0A4\uB9C8 \uBE44\uAD50
dataCompareName=DB \uB370\uC774\uD130 \uBE44\uAD50
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ public class Messages extends NLS {
public static String msgSysViewNum;
public static String msgToggleExitConfirm;
public static String msgTriggerNum;
public static String msgSynonymNum;
public static String msgUserTableNum;
public static String msgUserViewNum;
public static String msgZeroDateTimeBehavior1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ msgUserViewNum=User Views : {0}
msgSysViewNum=System Views : {0}
msgSerialNum=Serials : {0}
msgTriggerNum=Triggers : {0}
msgSynonymNum=Synonyms : {0}
msgFunctionNum=Functions : {0}
msgProcedureNum=Procedures : {0}
msgSPNum=Stored Procedures : {0}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ msgUserViewNum=\uc0ac\uc6a9\uc790 \ubdf0 : {0}
msgSysViewNum=\uc2dc\uc2a4\ud15c \ubdf0 : {0}
msgSerialNum=\uc2dc\ub9ac\uc5bc : {0}
msgTriggerNum=\ud2b8\ub9ac\uac70 : {0}
msgSynonymNum=\ub3d9\uc758\uc5b4 : {0}
msgFunctionNum=\ud568\uc218 : {0}
msgProcedureNum=\ud504\ub85c\uc2dc\uc800 : {0}
msgSPNum=\uc800\uc7a5 \ud568\uc218 : {0}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
import com.cubrid.common.ui.common.navigator.CubridNavigatorView;
import com.cubrid.common.ui.cubrid.serial.editor.SerialDashboardEditorPart;
import com.cubrid.common.ui.cubrid.serial.editor.SerialDashboardInput;
import com.cubrid.common.ui.cubrid.synonym.editor.SynonymDashboardEditorPart;
import com.cubrid.common.ui.cubrid.synonym.editor.SynonymDashboardInput;
import com.cubrid.common.ui.cubrid.table.dashboard.control.TableDashboardInput;
import com.cubrid.common.ui.cubrid.table.dashboard.control.TableDashboardPart;
import com.cubrid.common.ui.cubrid.trigger.editor.TriggerDashboardEditorPart;
Expand All @@ -59,6 +61,7 @@
import com.cubrid.common.ui.spi.model.ICubridNode;
import com.cubrid.common.ui.spi.model.NodeType;
import com.cubrid.common.ui.spi.progress.OpenSerialDetailInfoPartProgress;
import com.cubrid.common.ui.spi.progress.OpenSynonymDetailInfoPartProgress;
import com.cubrid.common.ui.spi.progress.OpenTablesDetailInfoPartProgress;
import com.cubrid.common.ui.spi.progress.OpenTriggerDetailInfoPartProgress;
import com.cubrid.common.ui.spi.progress.OpenViewsDetailInfoPartProgress;
Expand Down Expand Up @@ -184,7 +187,22 @@ public void run() {
}
}
openTriggersDetailInfoEditor(NodeUtil.getCubridDatabase(node));
}else if(NodeUtil.isUserFolderNode(node)) {
} else if (NodeUtil.isSynonymFolderNode(node)) {
CubridNavigatorView view = CubridNavigatorView.findNavigationView();

if (view == null) {
return;
}

TreeViewer treeViewer = view.getViewer();
if (!treeViewer.getExpandedState(node)) {
treeViewer.expandToLevel(node, 1);
while (node.getChildren().size() == 0) {
ThreadUtil.sleep(500);
}
}
openSynonymsDetailInfoEditor(NodeUtil.getCubridDatabase(node));
} else if(NodeUtil.isUserFolderNode(node)) {
CubridNavigatorView view = CubridNavigatorView.findNavigationView();

if (view == null) {
Expand Down Expand Up @@ -352,6 +370,40 @@ public void openTriggersDetailInfoEditor(CubridDatabase database) {
}
}

/**
* open synonym detail info part
* @param database
*/
public void openSynonymsDetailInfoEditor(CubridDatabase database) {
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (null == window) {
return;
}

if (database == null) {
return;
}

/*Check it open same editor*/
IEditorPart editorPart = getOpenedEditorPart(database, SynonymDashboardEditorPart.ID);
if (editorPart == null) {
OpenSynonymDetailInfoPartProgress progress = new OpenSynonymDetailInfoPartProgress(database);
progress.loadSynonymInfoList();
if (progress.isSuccess()) {
SynonymDashboardInput input = new SynonymDashboardInput(database, progress.getSynonymList());
try {
window.getActivePage().openEditor(input, SynonymDashboardEditorPart.ID);
} catch (PartInitException e) {
LOGGER.error("Can not initialize the synonym view list UI.", e);
}
}
} else {
SynonymDashboardEditorPart synonymDetailInfoPart = (SynonymDashboardEditorPart)editorPart;
window.getActivePage().activate(synonymDetailInfoPart);
synonymDetailInfoPart.refresh();
}
}

/**
* open users detail info part
* @param database
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,8 @@ private boolean hasChildCount(ICubridNode parentNode) {
|| parentNode.getType().equals(NodeType.TABLE_FOLDER)
|| parentNode.getType().equals(NodeType.VIEW_FOLDER)
|| parentNode.getType().equals(NodeType.SERIAL_FOLDER)
|| parentNode.getType().equals(NodeType.TRIGGER_FOLDER));
|| parentNode.getType().equals(NodeType.TRIGGER_FOLDER)
|| parentNode.getType().equals(NodeType.SYNONYM_FOLDER));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ protected int category(ICubridNode node) {
|| NodeType.VIEW_FOLDER.equals(type)
|| NodeType.SERIAL_FOLDER.equals(type)
|| NodeType.TRIGGER_FOLDER.equals(type)
|| NodeType.SYNONYM_FOLDER.equals(type)
|| NodeType.STORED_PROCEDURE_FOLDER.equals(type)) {
return 1;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ public class ERXmlContainer {
//private final int CHILD_UPDATE_NONE = NONE_ACTION;
private final int PARENT_DELETE_RESTRICT = 10004;
private final int PARENT_DELETE_CASCADE = PARENT_DELETE_RESTRICT + 1;
//https://bookshelf.erwin.com/bookshelf/9.8.00/Bookshelf_Files/HTML/MM%20Ref/PROPERTY-Parent_Delete_Rule_Identifying.html
private final int PARENT_SET_NULL = PARENT_DELETE_CASCADE + 1;
private final int PARENT_DELETE_NOACTION = 9999;
//private final int PARENT_DELETE_NONE = NONE_ACTION;
//private final int CHILD_DELETE_RESTRICT = 10016;
Expand Down Expand Up @@ -346,7 +348,7 @@ private void createSchemaDDL() {
if (schemaInfo.getVirtual().equals(ClassType.VIEW.getText())) {
strDDL = createViewSchema(schemaInfo);
} else {
strDDL = ddl.getSchemaDDL(schemaInfo);
strDDL = ddl.getSchemaDDLforErwin(schemaInfo);
}

tableSchema.setSchemaInfo(strDDL);
Expand Down Expand Up @@ -879,6 +881,7 @@ private String text(int type) {
return "NO ACTION";

case NONE_ACTION:
case PARENT_SET_NULL:
return "SET NULL";

default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,8 @@ public void execute() { // FIXME logic code move to core module
deleteRule.setValue("9999");
} else if (tmp == "RESTRICT".hashCode()) {
deleteRule.setValue("10004");
} else if (tmp == "SET NULL".hashCode()) {
deleteRule.setValue("10006");
}
}
}
Expand Down
Loading

0 comments on commit 2381f2f

Please sign in to comment.