Hi All,
I am getting a Bad ID error in my implementation.The following is my javacode:
package com.documentum.custom.library;.
import com.documentum.fc.client.IDfCollection;
import com.documentum.fc.client.IDfGroup;
import com.documentum.fc.client.IDfSession;
import com.documentum.fc.common.DfException;
import com.documentum.fc.common.DfId;
import com.documentum.fc.common.DfList;
import com.documentum.fc.common.IDfList;
import com.documentum.web.common.AccessibilityService;
import com.documentum.web.common.ArgumentList;
import com.documentum.web.common.ErrorMessageService;
import com.documentum.web.common.WrapperRuntimeException;
import com.documentum.web.form.Control;
import com.documentum.web.form.Form;
import com.documentum.web.form.FormActionReturnListener;
import com.documentum.web.form.control.Checkbox;
import com.documentum.web.form.control.DropDownList;
import com.documentum.web.form.control.Label;
import com.documentum.web.form.control.Link;
import com.documentum.web.form.control.Panel;
import com.documentum.web.form.control.TextArea;
import com.documentum.web.form.control.databound.DataProvider;
import com.documentum.web.form.control.databound.Datagrid;
import com.documentum.web.form.control.validator.RegExpValidator;
import com.documentum.web.form.control.validator.RequiredFieldValidator;
import com.documentum.web.formext.component.Component;
import com.documentum.web.formext.docbase.ServerUtil;
import com.documentum.webcomponent.common.WebComponentErrorService;
import com.documentum.webcomponent.library.locator.LocatorItemResultSet;
import com.documentum.webcomponent.library.messages.MessageService;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import com.documentum.com.DfClientX;
import com.documentum.fc.client.IDfClient;
import com.documentum.fc.client.IDfCollection;
import com.documentum.fc.client.IDfSession;
import com.documentum.fc.client.IDfSessionManager;
import com.documentum.fc.client.IDfSysObject;
import com.documentum.fc.client.IDfTypedObject;
import com.documentum.fc.common.IDfId;
import com.documentum.fc.common.IDfLoginInfo;
import com.documentum.fc.client.IDfSession;
import com.documentum.fc.client.IDfSessionManager;
import com.documentum.fc.client.IDfSysObject;
import com.documentum.fc.common.IDfId;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.InputStreamReader;
public class DummyComponent extends Component
{
private HashMap m_docIdLookup;
private ArrayList m_users;
private HashMap m_userLookup;
private HashMap m_userTypeLookup;
private String m_recipientNameDelim;
private boolean m_bSelectingRecipients;
private boolean m_bSelectingDocuments;
private boolean m_bSupportSequential;
public static final String SELECTED_FILES_DATAGRID_CONTROL_NAME = "__SELECTED_FILES_DATAGRID_CONTROL_NAME";
public static final String INSTRUCTIONS_TEXTAREA_CONTROL_NAME = "__INSTRUCTIONS_TEXTAREA_CONTROL_NAME";
public static final String INSTRUCTIONS_VALIDATOR_CONTROL_NAME = "__INSTRUCTIONS_VALIDATOR_CONTROL_NAME";
public static final String PRIORITY_DROPDOWN_CONTROL_NAME = "__PRIORITY_DROPDOWN_CONTROL_NAME";
public static final String RECIPIENTS_LABEL_CONTROL_NAME = "__RECIPIENTS_LABEL_CONTROL_NAME";
public static final String RECIPIENTS_VALIDATOR = "__RECIPIENTS_VALIDATOR";
public static final String SEQUENTIAL_CHECKBOX_CONTROL_NAME = "__SEQUENTIAL_CHECKBOX_CONTROL_NAME";
public static final String REJECT_INITIATOR_CHECKBOX_CONTROL_NAME = "__REJECT_INITIATOR_CHECKBOX_CONTROL_NAME";
public static final String REJECT_PREVIOUS_CHECKBOX_CONTROL_NAME = "__REJECT_PREVIOUS_CHECKBOX_CONTROL_NAME";
public static final String NOTIFICATION_CHECKBOX_CONTROL_NAME = "__NOTIFICATION_CHECKBOX_CONTROL_NAME";
public static final String SIGNOFF_CHECKBOX_CONTROL_NAME = "__SIGNOFF_CHECKBOX_CONTROL_NAME";
public static final String SEQUENTIAL_PANEL_CONTROL_NAME = "__SEQUENTIAL_PANEL_CONTROL_NAME";
public static final String SIGNOFF_PANEL_CONTROL_NAME = "__SIGNOFF_PANEL_CONTROL_NAME";
public static final String PRIORITY_VALUE_HIGH = "10";
public static final String PRIORITY_VALUE_MEDIUM = "5";
public static final String PRIORITY_VALUE_LOW = "1";
private IDfSessionManager m_sessionManager;
private String reponame = "documentum";
private String objectString = "09de75d180002f02";
private String strObject;
public DummyComponent(){
this.m_docIdLookup = new HashMap();
this.m_users = new ArrayList();
this.m_userLookup = new HashMap();
this.m_userTypeLookup = new HashMap();
this.m_bSelectingRecipients = false;
this.m_bSelectingDocuments = false;
this.m_bSupportSequential = false;
createSessionManager();
strObject = getContent(m_sessionManager,reponame,objectString);
System.out.println("This is content " + strObject );
}
public void onInit(ArgumentList arg)
{
super.onInit(arg);
String[] vals = arg.getValues("objectId");
}
private Boolean createSessionManager() {
try {
System.out.println("This is inside createSessionManager");
// The only class we instantiate directly is DfClientX.
DfClientX clientx = new DfClientX();
// Most objects are created using factory methods in interfaces.
// Create a client based on the DfClientX object.
IDfClient client = clientx.getLocalClient();
System.out.println("This is inside createSessionManager 11");
// Create a session manager based on the local client.
m_sessionManager = client.newSessionManager();
// Set the user information in the login information variable.
System.out.println("This is inside createSessionManager 22");
IDfLoginInfo loginInfo = clientx.getLoginInfo();
loginInfo.setUser("MyUsername");
loginInfo.setPassword("Password");
System.out.println("This is inside createSessionManager33");
// Set the identity of the session manager object based on the repository
// name and login information.
m_sessionManager.setIdentity( "documentum",loginInfo);
System.out.println("This is prior to True");
return true;
}
catch (Exception ex)
{
ex.printStackTrace();
System.out.println("Failed to instantiate Session Manager.");
return false;
}
}
public String getContent(IDfSessionManager sessionManager,String repositoryName,String objectIdString)
{
IDfSession mySession = null;
StringBuffer sb = new StringBuffer("");
try
{
mySession = sessionManager.getSession(repositoryName);
// Get the object ID based on the object ID string.
System.out.println("Inside getContent 1");
IDfId idObj =mySession.getIdByQualification("dm_sysobject where r_object_id='" + objectIdString + "'");
System.out.println("Inside getContent 2");
// Instantiate an object from the ID.
IDfSysObject sysObj = (IDfSysObject) mySession.getObject(idObj);
System.out.println("Inside getContent 3");
if (sysObj.getContentType().equals("crtext") | sysObj.getContentType().equals("text"))
{
ByteArrayInputStream buf = sysObj.getContent();
System.out.println("Inside getContent 4");
int i = 0;
InputStreamReader readInput = new InputStreamReader(buf, "UTF8");
BufferedReader br = new BufferedReader(readInput);
while (br.ready())
{
System.out.println("Inside while of getContent ******** ");
sb.append(br.readLine());
sb.append("\n");
}
return sb.toString();
}
else
{
System.out.println("Inside getContent 5");
return "Use getContent to view text documents.";
}
}
//Handle any exceptions.
catch (Exception ex)
{
ex.printStackTrace();
return "Exception has been thrown: " + ex;
}
//Always, always, release the session in the "finally" clause.
finally
{
sessionManager.release(mySession);
}
}
}
I am hardcoding the value of objectString from my Database.This id is of a document. inside the table dm_sysobjects_s
But when the constructor calls the function to getContent, i am getting the following error.
DfException:: THREAD: http-8080-1; MSG: [DM_API_E_BADID]error: "Bad ID given: 0000000000000000"; ERRORCODE: 100; NEXT: null
at com.documentum.fc.common.DfException.newBadIdException(DfException.java:28)
at com.documentum.fc.client.impl.session.Session.getObjectManager(Session.java:773)
at com.documentum.fc.client.impl.session.Session.getObject(Session.java:834)
at com.documentum.fc.client.impl.session.SessionHandle.getObject(SessionHandle.java:580)
at com.documentum.custom.library.DummyComponent.getContent(DummyComponent.java:171)
at com.documentum.custom.library.DummyComponent.<init>(DummyComponent.java:108)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
at java.lang.Class.newInstance0(Class.java:350)
at java.lang.Class.newInstance(Class.java:303)
at com.documentum.web.form.JumpOperation.execute(JumpOperation.java:88)
at com.documentum.web.form.FormProcessor.openForm(FormProcessor.java:219)
at com.documentum.web.form.WebformTag.doStartTag(WebformTag.java:127)
at org.apache.jsp.custom.hello_005fworld.hello_005fworld_005fcontent_jsp._jspx_meth_dmf_005fwebform_005f0(hello_005fworld_005fcontent_jsp.java:108)
at org.apache.jsp.custom.hello_005fworld.hello_005fworld_005fcontent_jsp._jspService(hello_005fworld_005fcontent_jsp.java:71)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:630)
at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:535)
at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:472)
at com.documentum.web.form.FormProcessor.dispatchURL(FormProcessor.java:2194)
at com.documentum.web.formext.component.URLDispatchBridge.dispatch(URLDispatchBridge.java:107)
at com.documentum.web.formext.component.ComponentDispatcher.mapRequestToComponent(ComponentDispatcher.java:463)
at com.documentum.web.formext.component.ComponentDispatcher.doPost(ComponentDispatcher.java:339)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at com.documentum.web.formext.component.ComponentDispatcher.doService(ComponentDispatcher.java:300)
at com.documentum.web.formext.component.ComponentDispatcher.serviceAsNonController(ComponentDispatcher.java:138)
at com.documentum.web.formext.component.ComponentDispatcher.service(ComponentDispatcher.java:119)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:630)
at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:535)
at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:472)
at com.documentum.web.form.FormProcessor.dispatchURL(FormProcessor.java:2194)
at com.documentum.web.form.FormProcessor.doFreshInclude(FormProcessor.java:1082)
at com.documentum.web.form.FormProcessor.doFreshInclude(FormProcessor.java:1058)
at com.documentum.web.form.FormProcessor.redirect(FormProcessor.java:1010)
at com.documentum.web.form.FormProcessor.openForm(FormProcessor.java:257)
at com.documentum.web.form.WebformTag.doStartTag(WebformTag.java:127)
at org.apache.jsp.custom.classic.doclist.objectlist_jsp._jspx_meth_dmf_005fwebform_005f0(objectlist_jsp.java:1033)
at org.apache.jsp.custom.classic.doclist.objectlist_jsp._jspService(objectlist_jsp.java:77)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.documentum.web.servlet.ResponseHeaderControlFilter.doFilter(ResponseHeaderControlFilter.java:317)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.documentum.web.servlet.CompressionFilter.doFilter(CompressionFilter.java:84)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.documentum.web.env.WDKController.processRequest(WDKController.java:95)
at com.documentum.web.env.WDKController.doFilter(WDKController.java:83)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:595)
This is content Exception has been thrown: DfException:: THREAD: http-8080-1; MSG: [DM_API_E_BADID]error: "Bad ID given: 0000000000000000"; ERRORCODE: 100; NEXT: null
Please, any guidance to rectify this will be really helpful.
Thank You