AM设置:
为了防止钝化,需要在Propertis属性中填加控制:
Name:RENETION_LEVEL Value:MANAGE_STATE
oracle.apps.Application.scheme.server 保存EO对象
oracle.apps.Application.webui 保存PG和CO对象
oracle.apps.Application.server 保存AM、VO、VL等对象
oracle.apps.Application.lov.server 保存Lov的AM和VO对象
oracle.apps.Application.lov.webui 保存Lov的PG和CO对象
oracle.apps.Application.poplist.server 保存Poplist的VO对象
Application一般指应用简称,例如:oracle.apps.sie.webui
http://sietest.chinasie.com:8017/OA_HTML/jsp/fnd/aoljtest.jsp
以下是登陆数据库
apps
apps
se12test
192.168.175.20
1538
复制保存为8017.dbc并用'#'号注释最长的那句(也就是连接数据库的语)
E:\oraceldeveloper\Jdev_R12_GENERIC\jdevbin\oaext\bin\import E:\oraceldeveloper\Jdev_R12_GENERIC\jdevhome\jdev\myprojects\oracle\apps\pos\onboard\webui -includeSubpackages -rootdir E:\oraceldeveloper\Jdev_R12_GENERIC\jdevhome\jdev\myprojects -mmddir E:\oraceldeveloper\Jdev_R12_GENERIC\jdevbin\oaext\config\mmd -username apps -password apps -dbconnection "(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.175.20)(PORT=1538)))(CONNECT_DATA=(SID=se12test)))" -jdk13
导出PG:
E:\oraceldeveloper\Jdev_R12_GENERIC\jdevbin\oaext\bin\export.bat /oracle/apps/pos/onboard/webui/FlexRegPSRequestRN -rootdir D:\export1 -username apps -password apps -dbconnection "(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.175.20)(PORT=1538))(CONNECT_DATA=(SID=se12test)))"
重启服务器:
telnet 192.168.175.20
applse5l
applse5l
cd $INST_TOP/admin/scripts
adapcctl.sh stop
adoacorectl.sh stop
adapcctl.sh start
adoacorectl.sh start
查看PG
SELECT path_name, path_docid, path_owner_docid, path_type
FROM jdr_paths
START WITH path_name = 'CsfDashBoardPG'
CONNECT BY PRIOR path_owner_docid = path_docid;
--查看二次开发的修改版本
select * from jdr_paths a where a.path_name='FlexRegAM';
--查看二次开发过的修改内容
BEGIN
jdr_utils.listcustomizations('/oracle/apps/pos/onboard/server/FlexRegAM');
END;
--删除二次开发过的修改内容
BEGIN
jdr_utils.deleteDocument('/oracle/apps/pos/onboard/server/customizations/site/0/FlexRegAM');
END;
String userContent =pageContext.getParameter("HelloName");
String
message = "Hello," + userContent + "!";
throw new OAException(message, OAException.INFORMATION);
try {
retStr = new String(str.getBytes("ISO-8859-1"), "gb2312");
} catch (UnsupportedEncodingException e) {
OAException.wrapperException(e);
}
7.3 String转换为Number注意要引进:
import oracle.jbo.domain.Number;
new Number(Integer.parseInt(String));
CSSStyle style = new CSSStyle();
style.setProperty("font-color", "#FFFFCC;");
webBean.findChildRecursive("DemandQty").setAttributeValue(INLINE_STYL E_ATTR, style);
AImageBean delAptitude = (OAImageBean)webBean.findChildRecursive("delAptitude");
String str =null;
String javaStr =null;
if(delAptitude!=null){
try {
str = new String("是否要删除该条认证信息?备注为:");
str = new String(str.getBytes("ISO-8859-1"), "gb2312");
} catch (UnsupportedEncodingException e) {}
//假设图标列控件的ID为:Y_REMARK 备注列控件的ID为:delAptitude
delAptitude.setOnClick("javascript.:var idStr = this.id;
var remarkidStr = idStr.replace('delAptitude','Y_REMARK');
var remarktext = document.getElementById(remarkidStr);
if(remarktext == undefined){remarkidStr = idStr.replace('delAptitude','N_REMARK'); remarktext = document.getElementById(remarkidStr);}
var str ='"+str+"';var str2=remarktext.innerText;
var str3=str.concat(str2);
if(!confirm(str3)){ return false ;}"); //注意在此处要返回flase
}
Serializable[] Parameters = {SearchLogonName,SearchUserName}; //创建变量数组
am.invokeMethod("UserQuery",Parameters); //调用AM方法UserQuery
public void initQuery(String SearchLogonName,String SearchUserName)
{
StringBuffer WhereCluse = new StringBuffer(); //新定义一个WHERE条件的对象
Vector Parameters = new Vector(2);
int CluseCount = 0;
int BindCount = 0;
this.setWhereClauseParams(null);//以上是给对象初始化
//保存LOGONNAME
if ((SearchLogonName != null) && (!("".equals(SearchLogonName.trim()))))
{
WhereCluse.append("LOGON_NAME = :"); //增加一个字符串
WhereCluse.append(++BindCount);
Parameters.addElement(SearchLogonName);// 给BindCount赋值 用于判断
CluseCount++;
}
//保存USER_NAME
if ((SearchUserName != null) && (!("".equals(SearchUserName.trim()))))
{
if (CluseCount > 0)
{
WhereCluse.append(" AND "); //拼SQL语句
}
WhereCluse.append("USER_NAME = :");
WhereCluse.append(++BindCount);
Parameters.addElement(SearchUserName);
CluseCount++;
}
this.setWhereClause(WhereCluse.toString());
if (BindCount>0)
{
Object[] Params = new Object[BindCount];
Parameters.copyInto(Params);
setWhereClauseParams(Params);//给WHERE条件赋值
}
}
String userid = pageContext.getParameter("userid");//获取UserId
HashMap params = new HashMap(1);//创建HashMap对象
params.put("userid",userid);//给参数赋值
//跳转到修改页面,同时传递参数过去
pageContext.setForwardURL("OA.jsp?page=/oracle/apps/sie/lesson/update/webui/UpdateUserPG",
null,
OAWebBeanConstants.KEEP_MENU_CONTEXT,
null,
params,
true, // Retain AM
OAWebBeanConstants.ADD_BREAD_CRUMB_YES,
OAWebBeanConstants.IGNORE_MESSAGES);
public void create(AttributeList attributeList)
{
super.create(attributeList);
//修改给UserId赋值,获取序列号
Number new_user_id = this.getOADBTransaction()
.getSequenceValue("OAF_EXM_USER_S");
setUserId(new_user_id);
}
------------------------版本一-----------------------------
public void deleteUser()
{
OAViewObjectImpl vo =getUserSummaryVO1();
UserSummaryVORowImpl row = null;
int fetchedRowCount = vo.getFetchedRowCount(); //可用getRowCount();
RowSetIterator deleteIter = null;
try
{
deleteIter = vo.createRowSetIterator("deleteIter");
if (fetchedRowCount > 0)
{
deleteIter.setRangeStart(0);
deleteIter.setRangeSize(fetchedRowCount);
while (deleteIter.hasNext())
{
row = (UserSummaryVORowImpl)deleteIter.next();
System.out.print(row.getSelectFlag());
if (“Y”. equals(row.getSelectFlag()))
{
row.remove();
}
}
getTransaction().commit();
}
}
finally
{
if (deleteIter!=null)
{
deleteIter.closeRowSetIterator();
}
}
}
---------------------版本二-----------------------------------
private void deleteComment(int article_id)
{
CommentVOImpl vo=(CommentVOImpl)getCommentVO1();
CommentVORowImpl row = null;
row=(CommentVORowImpl)vo.first();
while(row!=null){
Number primaryKey = row.getArticleId();
if (primaryKey.compareTo(article_id) == 0) {
row.remove();
getTransaction().commit();
}
if(vo.hasNext()) row=(CommentVORowImpl)vo.next();
else break;
}
}
――事务新建
TransactionUnitHelper.startTransactionUnit(pageContext, "createPlanTxn"); //开启事务
――事务关闭
if (TransactionUnitHelper.isTransactionUnitInProgress(pageContext, "createUserTxn", false)) //这里是用到一个令牌效果,如果执行了从新建页面回退到此页面,才执行如下操作。判断是否有令牌
{
am.invokeMethod("cancel"); //调用AM 的cancel方法
TransactionUnitHelper.endTransactionUnit(pageContext, " createUserTxn "); //撤消创建事务
}
--处理浏览器回退
//初始化加载页面,检查是否通过浏览器回退按钮进入本页面,如果是,则报警提示用户
if (!pageContext.isBackNavigationFired(false))
{
//正常进入创建用户页面,申明创建用户事务
TransactionUnitHelper.startTransactionUnit(pageContext, " createUserTxn ");
//注册一个“createUserTxn”事务
if (!pageContext.isFormSubmission())//判断是否提交
{
OAApplicationModule am = pageContext.getApplicationModule(webBean);
am.invokeMethod("newUser");//调用AM的“newUser”方法
}
}
else
{
//浏览器回退钮进入,报异常信息
if (!TransactionUnitHelper.isTransactionUnitInProgress(pageContext, " createUserTxn ", true))
{
OADialogPage dialogPage = new OADialogPage(NAVIGATION_ERROR);
pageContext.redirectToDialogPage(dialogPage); //显示错误信息
}
}
//数据库的回滚
public void cancel ()
{
Transaction Txn = getTransaction();//创建对象
if (Txn.isDirty())//检查是否脏数据
{
Txn.rollback();//执行回滚
}
}
//数据库提交
public void apply () {
this.getDBTransaction().commit();//执行提交操作
}
//创建新用户
public void createNewUser()
{
UserVOImpl vo = (UserVOImpl)getUserVO1();//获取VO
vo.setMaxFetchSize(0);
vo.executeQuery();//首先必须执行VO
Row row = vo.createRow();//创建一个新行
vo.insertRow(row);//将新创建的行加入到VO里
row.setNewRowState(Row.STATUS_INITIALIZED);//给创建的新行赋类型
}
String ctmCode = pageContext.getParameter("ctmcode");
String ctmName = pageContext.getParameter("ctmname");
String str=new String("是否确定要删除此客户信息(");
String str2=new String(")?");
try{
str=new String(str.getBytes("ISO-8859-1"),"gb2312");
str=str+ctmCode+" "+ctmName+new String(str2.getBytes("ISO-8859-1"),"gb2312");
}catch(Exception e){}
OAException mainMessage = new OAException(str);
OADialogPage dialogPage = new OADialogPage(OAException.WARNING, mainMessage, null, "", "");
String yes = pageContext.getMessage("AK", "FWK_TBX_T_YES", null);
String no = pageContext.getMessage("AK", "FWK_TBX_T_NO", null);
dialogPage.setOkButtonItemName("DeleteYesButton");
dialogPage.setOkButtonToPost(true);
dialogPage.setNoButtonToPost(true);
dialogPage.setPostToCallingPage(true);
dialogPage.setOkButtonLabel(yes);
dialogPage.setNoButtonLabel(no);
java.util.Hashtable formParams = new java.util.Hashtable(1);
formParams.put("id", id);
formParams.put("ctmcode", ctmCode);
formParams.put("ctmname", ctmName);
dialogPage.setFormParameters(formParams);
pageContext.redirectToDialogPage(dialogPage);
}
else if (pageContext.getParameter("DeleteYesButton") != null)
{
String id = pageContext.getParameter("id");
String ctmCode = pageContext.getParameter("ctmcode");
String ctmName = pageContext.getParameter("ctmname");
Serializable[] parameters = { id };
am.invokeMethod("DeleteCtmId",parameters);//调用AM方法删除
String str=new String("已删除客户信息(");
String str2=new String(")");
try{
str=new String(str.getBytes("ISO-8859-1"),"gb2312");
str=str+ctmCode+" "+ctmName+new String(str2.getBytes("ISO-8859-1"),"gb2312");
}catch(Exception e){}
OAException message = new OAException(str,OAException.WARNING);
pageContext.putDialogMessage(message);
}
int user_id = Integer.valueOf(pageContext.getParameter("user_id"));
int org_id = Integer.valueOf(pageContext.getParameter("org_id"));
int mfg_org_id = Integer.valueOf(pageContext.getParameter("mfg_org_id"));
int po_line_id = Integer.valueOf(pageContext.getParameter("po_line_id"));
int po_head_id = Integer.valueOf(pageContext.getParameter("po_head_id"));
int resp_Id = Integer.valueOf(pageContext.getParameter("resp_Id"));
int resp_appl_id = Integer.valueOf(pageContext.getParameter("resp_appl_id"));
System.out.println("--start----");
String result =null;
OAApplicationModule am = (OAApplicationModule)pageContext.getApplicationModule(webBean);
OADBTransaction transaction = null;
CallableStatement stm =null;
try{
transaction = am.getOADBTransaction();
String sql ="Begin oaf_receive_inv_pg.receive_inv( p_user_id => :1, "
+"org_id => :2 ,"
+"p_mfg_org_id=> :3,"
+"p_po_line_id=> :4,"
+"p_po_head_id=> :5,"
+"p_resp_Id=> :6,"
+"p_resp_appl_id=> :7,"
+"o_result =>:8 ); end;";
stm = transaction.createCallableStatement(sql,1);
stm.setInt(1,user_id);
stm.setInt(2,org_id);
stm.setInt(3,mfg_org_id);
stm.setInt(4,po_line_id);
stm.setInt(5,po_head_id);
stm.setInt(6,resp_Id);
stm.setInt(7,resp_appl_id);
stm.registerOutParameter(8, 12);
stm.execute();
result = stm.getString(8);
System.out.println("end:"+result);
}catch(Exception exception){
exception.printStackTrace();
} finally {
try {
if (stm != null) stm.close();
} catch (Exception exception) {
exception.printStackTrace();
}
}
}
OAMessageFileUploadBean ubean = (OAMessageFileUploadBean)webBean.findChildRecursive("N_ARRACH");
if(ubean != null){
OADataBoundValueViewObject kk = new OADataBoundValueViewObject(ubean,"AttachmentFilename");
ubean.setAttributeValue(DOWNLOAD_FILE_NAME,kk);
}
public String paseDate(String needByDate) {
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
String mDateTime ="";
if(!"".equals(needByDate.trim())){
mDateTime = formatter.format(new java.util.Date(needByDate));
}
return mDateTime;
}
9.1 VO的SQL找不到字段:
9.2 钝化(后退,新建)
9.3 返回时要验证


111.jpg