Simple Small example learn Enterprise content management IBM CM API development

Source: Internet
Author: User
Tags file upload

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 (); }

}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.