2 Use Case Diagram dan Sequence Diagram Rental Buku


Usecase  Diagram : Rental Buku


Sequence Diagram : Daftar Anggota 

Realisasi Sequence Diagram 

* Boundary

FUser

FPendaftaran

* Control

VeriUser

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import jhhs.persistence.ConnectionPostgre;

/**
 * Class yang mengatur Login User dari Boundary FUser ke Entity Penjaga
 * @author Jeffrey Hermanto Halimsetiawan
 */
public class VerifUser {
    private String user;
    private String pass;
    private ConnectionPostgre con;

    public VerifUser() {
        this.user = this.pass = "";
        this.con = new ConnectionPostgre();
    }

    public void setUserPass(String user, String pass){
        this.user = user;
        this.pass = pass;
    }

    public boolean checkDataUser(){
        boolean authorize = false;
        con.open();
        String sql = "SELECT * FROM Penjaga WHERE pj_user = '" + this.user +"'"+
                     " AND pj_pass = '" + this.pass + "'";
        ResultSet rs = con.executeReader(sql);

        try {
            while (rs.next()) {
                authorize = true;
            }
        } catch (SQLException ex) {
            Logger.getLogger(PencarianMgr.class.getName()).log(Level.SEVERE, null, ex);
        }
        con.close();
        return authorize;
    }
}
PendaftaranMgr

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import jhhs.persistence.ConnectionPostgre;

/**
 * Class yang mengatur Pendaftaran Anggota dari Boundary FPendaftaran
 * ke Entity Anggota
 * @author Jeffrey Hermanto Halimsetiawan
 */
public class PendaftaranMgr {
    private String nama, ktp, alamat, telp;
    private ConnectionPostgre con;

    public PendaftaranMgr() {
        this.con = new ConnectionPostgre();
    }

    public void setDataAnggotaBaru(String nama, String ktp, String alamat, String telp){
        this.nama = nama;
        this.ktp = ktp;
        this.alamat = alamat;
        this.telp = telp;
    }

    public boolean saveDataAnggotaBaru(){
        con.open();
        String id = "";
        String sql = "SELECT COUNT(*) + 1 AS JUMLAH FROM Anggota";
        ResultSet rs = con.executeReader(sql);

        try {
            while (rs.next()) {
                id = rs.getString("JUMLAH");
            }
        } catch (SQLException ex) {
            Logger.getLogger(PencarianMgr.class.getName()).log(Level.SEVERE, null, ex);
            return false;
        }
        sql = "INSERT INTO Anggota VALUES('" + id + "','" + nama + "','" + ktp + "','"
                     + alamat + "','" + telp + "')";
        rs = con.executeReader(sql);

        con.close();
        return true;
    }
}
* Entity

Penjaga

create table PENJAGA (
   PJ_ID                INT4                 not null,
   PJ_NAMA              VARCHAR(50)          not null,
   PJ_USER              VARCHAR(32)          not null,
   PJ_PASS              VARCHAR(32)          not null,
   constraint PK_PENJAGA primary key (PJ_ID)
);


Anggota

create table ANGGOTA (
   AG_ID                INT4                 not null,
   AG_NAMA              VARCHAR(50)          not null,
   AG_NOKTP             VARCHAR(50)          not null,
   AG_ALAMAT            VARCHAR(50)          not null,
   AG_TELP              VARCHAR(50)          not null,
   constraint PK_ANGGOTA primary key (AG_ID)
);

2 komentar:

DEDE SULAIMAN 123 mengatakan...

postingan yang sungguh bermanfaat, thanks gan

Home Improvement | Mr. Dede | Tutorial Komputer

Unknown mengatakan...

ok om ... sering2 berkunjung yah ,,,, :)

Posting Komentar