Rapid implementation of ArcSDE SDK Java 7

Source: Internet
Author: User
I. Version
· Add or delete a version

The following code creates a new sub-version based on the default version:

Seconnection conn = getconn ();

If (Conn! = NULL ){

Try {

Seversion v_1 = new seversion (Conn, seversion. se_qualified_default_version_name );

V_1.setname ("v_1 ");

V_1.create (true, v_1 );

} Catch (seexception e ){

E. printstacktrace ();

} Finally {

Try {

Conn. Close ();

} Catch (seexception e ){

E. printstacktrace ();

}

}

}

It is easier to delete a version:

Seconnection conn = getconn ();

If (Conn! = NULL ){

Try {

Seversion v_1 = new seversion (Conn, "v_1 ");

V_1.delete ();

} Catch (seexception e ){

E. printstacktrace ();

} Finally {

Try {

Conn. Close ();

} Catch (seexception e ){

E. printstacktrace ();

}

}

}

· Edit a version

The key to version editing is to manage the version status. The following code shows how to delete a record from a version Dataset:

Seconnection conn = getconn ();

If (Conn! = NULL ){

Try {

Seversion version = new seversion (Conn, "V1 ");

Seobjectid oldstateid = version. getstateid ();

Sestate oldstate = new sestate (Conn, oldstateid );

If (oldstate. isopen ()){

Try {

Oldstate. Close ();

} Catch (exception e ){

E. printstacktrace ();

}

}

Sestate newstate = new sestate (conn );

Newstate. Create (oldstateid );

Version. changestate (newstate. GETID ());

Sedelete delete = new sedelete (conn );

Delete. setstate (newstate. GETID (),

New seobjectid (sestate. se_null_state_id ),

Sestate. se_state_diff_nocheck );

Delete. fromtable ("test", "objectid = 3 ");

Delete. Close ();

} Catch (seexception e ){

E. printstacktrace ();

} Finally {

Try {

Conn. Close ();

} Catch (seexception e ){

E. printstacktrace ();

}

}

}

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.