All pastes #224974 Raw Edit

Unnamed

public java v1 · immutable
#224974 ·published 2006-10-27 17:49 UTC
rendered paste body
    public ArrayList resetActivationCode(ActivationIdType activationIdType)    {        ArrayList activations = new ArrayList();        if (activationIdType.isSchoolId())        {            /**             * Parse through each family in the school and generate an actiavtion code for             * each family that does not already have one generated.  Retrieve all the             * families from the school in an array or array-type object, and check against             * the array, rather than making 1000 queries.             *              * The only queries that will need to be looped are UPDATE queries, when updating             * the table with the new "activationCode" and "lastReset" fields.             */            String schoolId = activationIdType.getId().toString();            System.out.println("RESET ACTIVATION CODE SCHOOL ID: " + schoolId);            /**             * Retrieve all families in the school based on the current graduation year.             *              * TODO: Access global variables to retrieve the current graduation year.  For now,             *       graduation year is defaulted to 07.             */            FamilyId[] families = familyData.getFamiliesBySchoolId(schoolId, "07");            System.out.println("FAMILIES LENGTH: " + families.length);         } }package org.weber.controls.db; import com.bea.control.*;import java.sql.SQLException;import org.weber.controls.custom.family.FamilyId;import org.weber.controls.custom.family.FamilyInfo;import org.weber.controls.custom.family.FamilyStudents;import org.weber.controls.custom.students.Student; /**  * Defines a new database control.  *  * The @jc:connection tag indicates which WebLogic data source will be used by  * this database control. Please change this to suit your needs. You can see a  * list of available data sources by going to the WebLogic console in a browser  * (typically http://localhost:7001/console) and clicking Services, JDBC,  * Data Sources.  *  * @jc:connection data-source-jndi-name="as400DataSource"  */ public interface FamilyData extends DatabaseControl, com.bea.control.ControlExtension{     // Sample database function.  Uncomment to use     // static public class Customer     // {     //   public int id;     //   public String name;     // }     //     // /**     //  * @jc:sql statement="SELECT ID, NAME FROM CUSTOMERS WHERE ID = {id}"     //  */     // Customer findCustomer(int id);    // Add "throws SQLException" to request that SQLExeptions be thrown on errors.    static final long serialVersionUID = 1L;    /**     * @jc:sql statement::     * select trim(famgs1) guardLastName, trim(famgf1) guardFirstName,     * trim(famgm1) guardMidName, trim(famgs2) spouseLastName, trim(famgf2) spouseFirstName,     * trim(famgm2) spouseMidName, trim(famstr) residenceAddress, trim(famadr) mailingAddress,     * trim(famcty) cityName, famst stateCode, famzip zipCode,     * trim(famfwk) guardEmployer, trim(fammwk) spouseEmployer, famfpa guardAreaCode,     * famfpp guardPhone, fammpa spouseAreaCode, fammpp spousePhone,     * famfpe guardExt, fammpe spouseExt, famara familyAreacode, famphn familyPhone     * from sms#.pstu301     * inner join sms#.pstu350 on stupha = famara and stuphn = famphn     * where stuid = {studentId}::     */    FamilyInfo getRecords(int studentId);    /**     * @jc:sql statement::     * select trim(stusnm) stuLastName, trim(stufnm) stuFirstName, trim(stumin) stuMiddleInit,     * stuccl stuCurrentClass, stucsn stuCurrentSchool, stusex stuGender,     * stubdt stuBirthDate, stuid studentId     * from sms#.pstu301     * where stupha = {familyArea} and stuphn = {familyPhone}::     */    FamilyStudents[] getFamilyStudents(int familyArea, int familyPhone);    /**     * ALL CONTROLS RETRIEVING STUDENTS SHOULD USE THE STUDENT CLASS     * (org.weber.controls.custom.students.Student)     *      * This method retrieves all the students in the family, but uses the Student class.     * Still need to integrate the familyId, rather than area code + phone number.     *      * @jc:sql statement::     * select STUID studentId, STUSEX sex, STUPHA areaCode, STUPHN phoneNumber,     *  STUSNM lastName, STUFNM firstName, STUMNM middleName, STUMIN middleInit,     *  STUSOC ssn, STUBDT birthDate, STU01 gradYear, STUCCL grade, STUCSN schoolNum,     *  STUCCE creditEarned, STUCGP cumGpa     * from sms#.pstu301     * where stupha = {familyArea} and stuphn = {familyPhone}::     */    Student[] getStudentsByFamily(int familyArea, int familyPhone);    /**     * @jc:sql statement::     * SELECT DISTINCT STUPHA areaCode, STUPHN phoneNumber     * FROM SMS#.PSTU301     * WHERE STUCSN = {schoolId} AND STU01 >= {gradYear}::     */    FamilyId[] getFamiliesBySchoolId(String schoolId, String gradYear);}package org.weber.controls.custom.family; import java.io.Serializable;public class FamilyId implements Serializable{    int areaCode;    int phoneNumber;    public FamilyId()    {        this.setAreaCode(0);        this.setPhoneNumber(0);    }    public FamilyId(int areaCode, int phoneNumber)    {        this.setAreaCode(areaCode);        this.setPhoneNumber(phoneNumber);    }    public int getAreaCode()    {        return this.areaCode;    }            public int getPhoneNumber()    {        return this.phoneNumber;    }            public void setAreaCode(int areaCode)    {        this.areaCode = areaCode;        return;    }    public void setPhoneNumber(int phoneNumber)    {        this.phoneNumber = phoneNumber;        return;    }}