📄 rowcategorization.java
字号:
/**
*
*/
package pagecode.rowCategorization;
import pagecode.PageCodeBase;
import javax.faces.component.html.HtmlForm;
import javax.faces.component.html.HtmlDataTable;
import javax.faces.component.UIColumn;
import javax.faces.component.html.HtmlOutputText;
import java.util.List;
import com.ibm.websphere.sdo.access.connections.ConnectionManager;
import com.ibm.websphere.sdo.mediator.jdbc.ConnectionWrapperFactory;
import com.ibm.websphere.sdo.mediator.jdbc.ConnectionWrapper;
import com.ibm.websphere.sdo.mediator.JDBCMediator;
import com.ibm.websphere.sdo.mediator.exception.MediatorException;
import com.ibm.websphere.sdo.mediator.jdbc.JDBCMediatorFactory;
import commonj.sdo.DataObject;
import java.sql.Connection;
/**
* @author nan
*
*/
public class RowCategorization extends PageCodeBase {
protected HtmlForm form1;
protected HtmlDataTable table1;
protected UIColumn column7;
protected HtmlOutputText text15;
protected HtmlOutputText text1;
protected HtmlOutputText text5;
protected HtmlOutputText text7;
protected HtmlOutputText text9;
protected HtmlOutputText text11;
protected UIColumn column1;
protected HtmlOutputText text2;
protected UIColumn column3;
protected HtmlOutputText text6;
protected UIColumn column4;
protected HtmlOutputText text8;
protected UIColumn column5;
protected HtmlOutputText text10;
protected UIColumn column6;
protected HtmlOutputText text12;
private static final String SDOConnection_name = "JSFandSDO_Con";
private ConnectionWrapper SDOConnectionWrapper;
protected DataObject categorizationParameters;
protected JDBCMediator categorizationMediator;
private static final String categorization_metadataFileName = "/WEB-INF/wdo/categorization.xml";
protected static final String[] categorizationArgNames = {};
protected static final String[] categorizationArgValues = {};
private static final int categorizationTargetPageSize = -1;
protected List categorization;
protected HtmlForm getForm1() {
if (form1 == null) {
form1 = (HtmlForm) findComponentInRoot("form1");
}
return form1;
}
protected HtmlDataTable getTable1() {
if (table1 == null) {
table1 = (HtmlDataTable) findComponentInRoot("table1");
}
return table1;
}
protected UIColumn getColumn7() {
if (column7 == null) {
column7 = (UIColumn) findComponentInRoot("column7");
}
return column7;
}
protected HtmlOutputText getText15() {
if (text15 == null) {
text15 = (HtmlOutputText) findComponentInRoot("text15");
}
return text15;
}
protected HtmlOutputText getText1() {
if (text1 == null) {
text1 = (HtmlOutputText) findComponentInRoot("text1");
}
return text1;
}
protected HtmlOutputText getText5() {
if (text5 == null) {
text5 = (HtmlOutputText) findComponentInRoot("text5");
}
return text5;
}
protected HtmlOutputText getText7() {
if (text7 == null) {
text7 = (HtmlOutputText) findComponentInRoot("text7");
}
return text7;
}
protected HtmlOutputText getText9() {
if (text9 == null) {
text9 = (HtmlOutputText) findComponentInRoot("text9");
}
return text9;
}
protected HtmlOutputText getText11() {
if (text11 == null) {
text11 = (HtmlOutputText) findComponentInRoot("text11");
}
return text11;
}
protected UIColumn getColumn1() {
if (column1 == null) {
column1 = (UIColumn) findComponentInRoot("column1");
}
return column1;
}
protected HtmlOutputText getText2() {
if (text2 == null) {
text2 = (HtmlOutputText) findComponentInRoot("text2");
}
return text2;
}
protected UIColumn getColumn3() {
if (column3 == null) {
column3 = (UIColumn) findComponentInRoot("column3");
}
return column3;
}
protected HtmlOutputText getText6() {
if (text6 == null) {
text6 = (HtmlOutputText) findComponentInRoot("text6");
}
return text6;
}
protected UIColumn getColumn4() {
if (column4 == null) {
column4 = (UIColumn) findComponentInRoot("column4");
}
return column4;
}
protected HtmlOutputText getText8() {
if (text8 == null) {
text8 = (HtmlOutputText) findComponentInRoot("text8");
}
return text8;
}
protected UIColumn getColumn5() {
if (column5 == null) {
column5 = (UIColumn) findComponentInRoot("column5");
}
return column5;
}
protected HtmlOutputText getText10() {
if (text10 == null) {
text10 = (HtmlOutputText) findComponentInRoot("text10");
}
return text10;
}
protected UIColumn getColumn6() {
if (column6 == null) {
column6 = (UIColumn) findComponentInRoot("column6");
}
return column6;
}
protected HtmlOutputText getText12() {
if (text12 == null) {
text12 = (HtmlOutputText) findComponentInRoot("text12");
}
return text12;
}
protected ConnectionWrapper getSDOConnectionWrapper() {
if (SDOConnectionWrapper == null) {
try {
Connection con = ConnectionManager
.createJDBCConnection(SDOConnection_name);
SDOConnectionWrapper = ConnectionWrapperFactory.soleInstance
.createConnectionWrapper(con);
} catch (Throwable e) {
logException(e);
}
}
return SDOConnectionWrapper;
}
/**
* @action id=categorization
*/
public String doCategorizationUpdateAction() {
try {
getCategorizationMediator().applyChanges(
getRootDataObject(getCategorization()));
} catch (Throwable e) {
logException(e);
} finally {
try {
if (SDOConnectionWrapper != null) {
SDOConnectionWrapper.getConnection().close();
SDOConnectionWrapper = null;
}
} catch (Throwable e1) {
logException(e1);
}
if (categorizationMediator != null) {
categorizationMediator.setConnectionWrapper(null);
}
}
return "";
}
/**
* @paramBean id=categorization
*/
public DataObject getCategorizationParameters() {
if (categorizationParameters == null) {
try {
categorizationParameters = getCategorizationMediator()
.getParameterDataObject();
} catch (MediatorException e) {
logException(e);
}
}
return categorizationParameters;
}
protected JDBCMediator getCategorizationMediator() {
if (categorizationMediator == null) {
try {
categorizationMediator = JDBCMediatorFactory.soleInstance
.createMediator(
getResourceInputStream(categorization_metadataFileName),
getSDOConnectionWrapper());
initSchema(getRealPath(categorization_metadataFileName),
categorizationMediator.getSchema());
} catch (Throwable e) {
logException(e);
}
} else {
categorizationMediator
.setConnectionWrapper(getSDOConnectionWrapper());
}
return categorizationMediator;
}
/**
* @action id=categorization
*/
public String doCategorizationFetchAction() {
try {
resolveParams(getCategorizationParameters(),
categorizationArgNames, categorizationArgValues,
"categorization_params_cache");
DataObject graph = getCategorizationMediator().getGraph(
getCategorizationParameters());
categorization = graph.getList(0);
} catch (Throwable e) {
logException(e);
} finally {
try {
if (SDOConnectionWrapper != null) {
SDOConnectionWrapper.getConnection().close();
SDOConnectionWrapper = null;
}
} catch (Throwable e1) {
logException(e1);
}
if (categorizationMediator != null) {
categorizationMediator.setConnectionWrapper(null);
}
}
return "";
}
/**
* @mediatorFactory com.ibm.etools.sdo.rdb.datahandlers.RelationalDataFactory
* @mediatorProperties metadataFileName=/WEB-INF/wdo/categorization.xml
* @methodEntry id=categorization/paramBean=categorization/action=categorization
* @action FILL
*/
public List getCategorization() {
if (categorization == null) {
doCategorizationFetchAction();
}
return categorization;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -