Option   Explicit

ValidationMode   =   True

InteractiveMode =   im_Batch

Dim   mdl   '当前model

'获取当前活动model

Set   mdl   =   ActiveModel

If   (mdl   Is   Nothing)   Then

MsgBox   "There   is   no   current   Model "

ElseIf   Not   mdl.IsKindOf(PdCDM.cls_Model)   Then '如果是处理pdm,这里换成PdPDM.cls_Model

MsgBox   "The   current   model   is   not   an   Physical   Data   model. "

Else

ProcessFolder   mdl

End   If

Private   sub   ProcessFolder(folder)

Dim   item   '要处理的对象

'先处理每个实体或类的Name和Code,相当于每张表的表名

for   each   item   in  folder.Entities

if   not   item.isShortcut   then

Dim ecode

ecode = item.code

Dim i

i=2

Do While i < len(ecode)

If mid(ecode,i,1)=ucase(mid(ecode,i,1)) and mid(ecode,i-1,1)=lcase(mid(ecode,i-1,1)) and mid(ecode,i-1,1)<>"_" and mid(ecode,i,1)<>"_" Then '连续大写字母不用加_

ecode = left(ecode,i-1) + "_" + mid(ecode,i)

i =i+ 1

End If

i =i+ 1

Loop

item.code=ecode

item.name=ecode

dim col

'处理当前实体下的每个属性,相当于每张表的字段

for   each   col   in   item.Attributes

Dim acode

acode = col.code

Dim k

k=2

Do While k < len(acode)

If mid(acode,k,1)=ucase(mid(acode,k,1)) and mid(acode,k-1,1)=lcase(mid(acode,k-1,1)) and mid(acode,k-1,1)<>"_" and mid(acode,k,1)<>"_" Then '连续大写字母不用加_

acode = left(acode,k-1) + "_" + mid(acode,k)

k =k+ 1

End If

k =k+ 1

Loop

col.code=acode

col.name=acode

next

end  if

'再处理每个folder下的关系的名称

dim rel
    for each rel in folder.relationships
       if not rel.isshortcut then
         rel.name =rel.code
       end if
next

next

'递归遍历子文件夹

Dim   f   '子文件夹

For   Each   f   In   folder.Packages

if   not   f.IsShortcut   then

ProcessFolder   f

end   if

Next

end   sub

PowerDesigner的CDM模型将低驼峰命名法则的每个大写字母前加_符的更多相关文章

  1. PowerDesigner生成CDM模型

    一.新建概念数据模型  1)选择File-->New,弹出如图所示对话框,选择CDM模型(即概念数据模型)建立模型. 2)完成概念数据模型的创建.以下图示,对当前的工作空间进行简单介绍.(以后再 ...

  2. python-----重命名文件(在原文件名前加0)

    问题描述: 如果用循环给文件命名,则文件名就会是1,2,3...,10,11,12,13...,100,101...,但是遍历这些文件时,顺序就会变成1,10,100,101,...109,11,.. ...

  3. 【转】从PowerDesigner概念设计模型(CDM)中的3种实体关系说起

    PowerDesigner概念模型的relationship .inheritance. association 从PowerDesigner概念设计模型(CDM)中的3种实体关系说起

  4. 这次一定理清晰ThinkPHP之中的模型、数据库之间命名规范

    ServiceSiteModel.class.php 这个模型操控的数据库是service_site表: <?php namespace Admin\Model; use Think\Model ...

  5. PowerDesigner 业务处理模型( BPM )

    PowerDesigner 业务处理模型( BPM ) 说明 properties语言文档xmlvalidation数据库   目录(?)[+]   一.     BPM 简介 业务处理模型(Busi ...

  6. PowerDesigner新建CDM设置相同属性

    在 PowerDesigner设计逻辑模型CDM时,在一个包的一个域中,考虑到主外键名称可能冲突的问题,默认两个不同的实体中不能有相同的属性 但实际设计的时候,通常要在两个实体中使用相同的属性名, 比 ...

  7. PowerDesigner数据模型(CDM—PDM—SQL脚本的转换流程)

    原文地址:PowerDesigner数据模型(CDM-PDM-SQL脚本的转换流程)作者:zzenglish 有图片的参考http://blog.sina.com.cn/s/blog_64742675 ...

  8. js - 驼峰命名

    1. // 驼峰命名 console.log(hump('border-bottom-color')) function hump( str) { if (typeof str != 'string' ...

  9. java 驼峰命名

    jstl中前台jsp页面调用对象中的属性时, 用的是小驼峰命名法. 例如:${item.createTime} 1.小驼峰式命名法(lower camel case): 第一个单字以小写字母开始,第二 ...

随机推荐

  1. js替换字符串中的数字或非数字

    替换字符串中的数字 var text = "abc123"; text=text.replace(/[0-9]/ig,""); 此时得到的text为" ...

  2. 关于 Java正则表达式中的Possessive数量修饰词的理解

    关于 Java正则表达式中的Possessive数量修饰词的理解 正则表达式对于数量限定符如 ?, + , *, {n, m} 的匹配默认是贪婪模式,比如: a.*b   匹配 acbab 的结果是 ...

  3. YII2笔记之三

    activeform布局findAll等不能满足where, order by, limit,底层调用了findByConditioncol-md col-lg的使用 view的方法,前三个常用ren ...

  4. linux中动态链接库的创建与使用

    LINUX系统中动态链接库的创建与使用 http://www.cnblogs.com/ardar/articles/357321.html 正常C源文件编写,编译时-shared即可得到SO, gcc ...

  5. struts2常见配置解决错误There is no mapped for namespace[/] and action name

    我碰到这个错误的原因是我把配置文件名写成了Struts.xml,改成struts.xml就可以了. 在确定struts.xml本身并没有写错的情况下,那么发生错误有可能是路径,配置文件名. 如果实在找 ...

  6. java异常中的finally(一)

    finally是保证语句能一定执行的.不管程序是否会报错,我们把程序一定要执行的代码放在finally中. 比如说流的关闭,不管在读写的过程中是否报错,一定要关闭流,可以把流的关闭操作放在finall ...

  7. Windows Live Writer加载代码着色插件步骤

    博客园内置支持SyntaxHighlighter代码着色,代码着色语法:<pre class='brush:编程语言'>代码</pre>. 需要注意的是:如何你使用Syntax ...

  8. Oracle删除步骤

    1.Oracle卸载要求比较严格,不能简单的卸载就完事了:当然Oracle卸载也没有那么难,只是步骤比较多.Oracle10g还是Oracle11g卸载步骤都是一样的.下边详细介绍一下. 找到Orac ...

  9. iOS-使用ALAssetsLibrary获取相册图片视频

    用ALAssetsLibrary获取相册图片视频 ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init]; [library enumera ...

  10. LeetCode OJ:Minimum Path Sum(最小路径和)

    Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which ...