One, IBM cm create cm connection
Import com.ibm.mm.sdk.common.DKException;
Import Com.ibm.mm.sdk.common.DKServerDefICM;
Import com.ibm.mm.sdk.common.dkCollection;
Import Com.ibm.mm.sdk.common.dkIterator;
Import Com.ibm.mm.sdk.server.DKDatastoreICM;
public class Cmconnection {
/**
* IBM cm Connection
*
/public static void main (string[] args) throws Dkexception, E xception {
cmconnection ();
}
public static void Cmconnection () throws Dkexception, Exception {
dkdatastoreicm dsicm;
DSICM = new DKDATASTOREICM ();
System.out.println ("*************** Create cm Connection ***************");
Dsicm.connect ("Icmnlsdb", "Icmadmin", "Icmadmin", ""); "Icmnlsdb": cm connection profile cmbcmenv.properties,icmserver=; "xxxxxx": username, password
System.out.println ("*************** Disconnect cm Connection *************** ");
Dsicm.disconnect ();
Dsicm.destroy (); Destroy reference
}
}
Second, IBM CM single File upload download
Import com.ibm.mm.sdk.common.DKConstant;
Import com.ibm.mm.sdk.common.DKException;
Import Com.ibm.mm.sdk.common.DKResults;
Import Com.ibm.mm.sdk.common.DKRetrieveOptionsICM;
Import Com.ibm.mm.sdk.common.DKTextICM;
Import Com.ibm.mm.sdk.server.DKDatastoreICM; public class Cmdownload_bypid {public static void main (string[] args) throws Dkexception, Exception {cmdownload_bypid
();
}//Single file upload download public static void Cmdownload_bypid () throws Dkexception, Exception {DKDATASTOREICM dsicm = null;
DSICM = new DKDATASTOREICM ();
System.out.println ("*************** first step: Create cm Connection ***************");
Dsicm.connect ("Icmnlsdb", "Icmadmin", "Icmadmin", "");
Dkresults results = null;
System.out.println ("*************** Second step: Specify document item type, upload Document ***************");
DKTEXTICM Text = (DKTEXTICM) dsicm.createddo ("Test_item_type", Dkconstant.dk_cm_item);
Text.setmimetype ("Text/plain"); Text.add ("D:/text1.txt"); Save Content "D:/text1.txt" to cm System.out.println ("*************** step three: Download the document according to the PID * **************");
String textpidstring = Text.getpidobject (). pidstring ();
Text = (DKTEXTICM) dsicm.createddofrompid (textpidstring); DKRETRIEVEOPTIONSICM dkretrieveoptions = dkretrieveoptionsicm.createinstance (DSICM);//Set what data to get DKRETRIEVEOPTIONS.R
Esourcecontent (TRUE);
Text.retrieve ("D:/text2.txt", Dkretrieveoptions.dknvpair ());
SYSTEM.OUT.PRINTLN ("*************** Disconnect cm Connection ********");
Dsicm.disconnect ();
Dsicm.destroy (); }
}