|
推定所要時間
|
||
|---|---|---|
|
ニーズに合わせて Creo Elements/Direct Model Manager のビジネスロジックをカスタマイズします。
この演習では、Creo Elements/Direct Model Manager クラスを拡張してカスタムビジネスロジックを追加し、ビジネスロジックを使用するために関連する XML クラスを構成します。
|
説明:
|
1 分
|
|
演習:
|
20 分
|
|
|
Java では任意のディレクトリ名を使用できますが、後でコードを見つけやすいように、Creo Elements/Direct は一貫したディレクトリ構造を使用することをお勧めします。このガイドでは、ディレクトリ構造として、最初に「com」を使用し、次に会社名、その次にクラスのタイプを示すディレクトリを使用します。この演習で拡張するクラスは dm\biz ディレクトリにあり、ここでビジネスロジックが保持されます。
|
![]() |
package com.acme.dm.biz;
import com.osm.biz.*;
import com.osm.exception.*;
import com.osm.dm.biz.DMModel3D;
public class AcmeModel3D extends DMModel3D {
public AcmeModel3D(WMSession theSession, int theHandle) throws WMException {
super(theSession, theHandle);
}
@Override
public void setName(String name) throws WMException {
if (name.indexOf('l') > -1) {
throw new WMException ("l not allowed in model name");
}
if (name.indexOf('o') > -1) {
throw new WMException ("o not allowed in model name");
}
if (name.indexOf('i') > -1) {
throw new WMException ("i not allowed in model name");
}
super.setName(name);
}
}
|
Java では任意のディレクトリ名を使用できますが、後でコードを見つけやすいように、Creo Elements/Direct は一貫したディレクトリ構造を使用することをお勧めします。このガイドでは、ディレクトリ構造として、最初に「com」を使用し、次に会社名、その次にクラスのタイプを示すディレクトリを使用します。この演習で拡張するクラスは dt\biz ディレクトリにあり、ここでビジネスロジックが保持されます。
|
![]() |
package com.acme.dt.biz;
import com.osm.biz.*;
import com.osm.exception.*;
import com.osm.dt.biz.DTModel;
public class AcmeDTModel extends DTModel {
public AcmeDTModel(WMSession theSession, int theHandle) throws WMException {
super(theSession, theHandle);
}
@Override
public void setModelNo(final String modelNo) throws WMException {
if (modelNo.indexOf('l') > -1) {
throw new WMException ("l not allowed in model name");
}
if (modelNo.indexOf('o') > -1) {
throw new WMException ("o not allowed in model name");
}
if (modelNo.indexOf('i') > -1) {
throw new WMException ("i not allowed in model name");
}
super.setModelNo(modelNo);
}
}
<Class extends="DMModel, DMReleaseProcess">
<Name catalog="awm_stda" msg_num="258">MODEL_3D</Name>
<BusinessObjectClass>com.acme.dm.biz.AcmeModel3D</BusinessObjectClass>
</Class>
<Class extends="DTModel, DTReleaseProcess">
<Name catalog="awm_stda" msg_num="10">me_model</Name>
<BusinessObjectClass>com.acme.dt.biz.AcmeDTModel</BusinessObjectClass>
</Class>

