Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reconcile enroll plugin source with what is running on the student site #3

Merged
merged 1 commit into from
Dec 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/plugins/plugin-enroll/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<dependency>
<groupId>fr.paris.lutece</groupId>
<artifactId>lutece-core</artifactId>
<version>6.1.0</version>
<version>6.2.0</version>
<type>lutece-core</type>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*
* License 1.0
*/
*/
package fr.paris.lutece.plugins.enroll.business;

import javax.validation.constraints.*;
Expand All @@ -39,25 +39,21 @@

/**
* This is the business class for the object Project
*/
*/
public class Project implements Serializable
{
private static final long serialVersionUID = 1L;

// Variables declarations
// Variables declarations
private int _nId;

@NotEmpty( message = "#i18n{enroll.validation.project.Name.notEmpty}" )
@Size( max = 50 , message = "#i18n{enroll.validation.project.Name.size}" )

private String _strName;

@NotEmpty( message = "#i18n{enroll.validation.project.Email.notEmpty}" )
@Size( max = 50 , message = "#i18n{enroll.validation.project.Email.size}" )
private String _strEmail;

@NotEmpty( message = "#i18n{enroll.validation.project.Phone.notEmpty}" )
@Size( max = 50 , message = "#i18n{enroll.validation.project.Phone.size}" )
private String _strPhone;

private int _size;

private int _currentsize;

private int _active;

/**
* Returns the Id
Expand All @@ -71,12 +67,12 @@ public int getId( )
/**
* Sets the Id
* @param nId The Id
*/
*/
public void setId( int nId )
{
_nId = nId;
}

/**
* Returns the Name
* @return The Name
Expand All @@ -89,45 +85,47 @@ public String getName( )
/**
* Sets the Name
* @param strName The Name
*/
*/
public void setName( String strName )
{
_strName = strName;
}

/**
* Returns the Email
* @return The Email
*/
public String getEmail( )

public int getSize( )
{
return _strEmail;
return _size;
}

/**
* Sets the Email
* @param strEmail The Email
*/
public void setEmail( String strEmail )
public void setSize( int size )
{
_strEmail = strEmail;
_size = size;
}

/**
* Returns the Phone
* @return The Phone
*/
public String getPhone( )

public int getActive( )
{
return _strPhone;
return _active;
}

/**
* Sets the Phone
* @param strPhone The Phone
*/
public void setPhone( String strPhone )
public void setActive( int act )
{
_active = act;
}

public void flipActive( )
{
_strPhone = strPhone;
if (_active == 0) {
_active = 1;
} else {
_active = 0;
}
}

public int getCurrentSize( )
{
return _currentsize;
}

public void setCurrentSize( int cs ) {
_currentsize = cs;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ public final class ProjectDAO implements IProjectDAO
{
// Constants
private static final String SQL_QUERY_NEW_PK = "SELECT max( id_project ) FROM enroll_project";
private static final String SQL_QUERY_SELECT = "SELECT id_project, name, email, phone FROM enroll_project WHERE id_project = ?";
private static final String SQL_QUERY_INSERT = "INSERT INTO enroll_project ( id_project, name, email, phone ) VALUES ( ?, ?, ?, ? ) ";
private static final String SQL_QUERY_SELECT = "SELECT id_project, name, size, currentsize, active FROM enroll_project WHERE id_project = ?";
private static final String SQL_QUERY_INSERT = "INSERT INTO enroll_project ( id_project, name, size, currentsize, active ) VALUES ( ?, ?, ?, ?, ?) ";
private static final String SQL_QUERY_DELETE = "DELETE FROM enroll_project WHERE id_project = ? ";
private static final String SQL_QUERY_UPDATE = "UPDATE enroll_project SET id_project = ?, name = ?, email = ?, phone = ? WHERE id_project = ?";
private static final String SQL_QUERY_SELECTALL = "SELECT id_project, name, email, phone FROM enroll_project";
private static final String SQL_QUERY_UPDATE = "UPDATE enroll_project SET id_project = ?, name = ?, size = ?, currentsize = ?, active = ? WHERE id_project = ?";
private static final String SQL_QUERY_SELECTALL = "SELECT id_project, name, size, currentsize, active FROM enroll_project";
private static final String SQL_QUERY_SELECTALL_ID = "SELECT id_project FROM enroll_project";

/**
Expand Down Expand Up @@ -83,12 +83,15 @@ public void insert( Project project, Plugin plugin )
{
DAOUtil daoUtil = new DAOUtil( SQL_QUERY_INSERT, plugin );
project.setId( newPrimaryKey( plugin ) );
project.setActive(1);
project.setCurrentSize(0);
int nIndex = 1;

daoUtil.setInt( nIndex++ , project.getId( ) );
daoUtil.setString( nIndex++ , project.getName( ) );
daoUtil.setString( nIndex++ , project.getEmail( ) );
daoUtil.setString( nIndex++ , project.getPhone( ) );
daoUtil.setInt( nIndex++ , project.getSize( ) );
daoUtil.setInt( nIndex++ , project.getCurrentSize( ) );
daoUtil.setInt( nIndex++ , project.getActive( ) );

daoUtil.executeUpdate( );
daoUtil.free( );
Expand All @@ -109,11 +112,12 @@ public Project load( int nKey, Plugin plugin )
{
project = new Project();
int nIndex = 1;

project.setId( daoUtil.getInt( nIndex++ ) );
project.setName( daoUtil.getString( nIndex++ ) );
project.setEmail( daoUtil.getString( nIndex++ ) );
project.setPhone( daoUtil.getString( nIndex++ ) );
project.setSize( daoUtil.getInt( nIndex++ ) );
project.setCurrentSize( daoUtil.getInt( nIndex++ ));
project.setActive( daoUtil.getInt( nIndex++ ) );
}

daoUtil.free( );
Expand All @@ -140,11 +144,12 @@ public void store( Project project, Plugin plugin )
{
DAOUtil daoUtil = new DAOUtil( SQL_QUERY_UPDATE, plugin );
int nIndex = 1;

daoUtil.setInt( nIndex++ , project.getId( ) );
daoUtil.setString( nIndex++ , project.getName( ) );
daoUtil.setString( nIndex++ , project.getEmail( ) );
daoUtil.setString( nIndex++ , project.getPhone( ) );
daoUtil.setInt( nIndex++ , project.getSize( ) );
daoUtil.setInt( nIndex++ , project.getCurrentSize() );
daoUtil.setInt( nIndex++ , project.getActive( ) );
daoUtil.setInt( nIndex , project.getId( ) );

daoUtil.executeUpdate( );
Expand All @@ -165,19 +170,20 @@ public List<Project> selectProjectsList( Plugin plugin )
{
Project project = new Project( );
int nIndex = 1;

project.setId( daoUtil.getInt( nIndex++ ) );
project.setName( daoUtil.getString( nIndex++ ) );
project.setEmail( daoUtil.getString( nIndex++ ) );
project.setPhone( daoUtil.getString( nIndex++ ) );
project.setSize( daoUtil.getInt( nIndex++ ) );
project.setCurrentSize ( daoUtil.getInt( nIndex++ ));
project.setActive( daoUtil.getInt( nIndex++ ) );

projectList.add( project );
}

daoUtil.free( );
return projectList;
}

/**
* {@inheritDoc }
*/
Expand All @@ -196,7 +202,7 @@ public List<Integer> selectIdProjectsList( Plugin plugin )
daoUtil.free( );
return projectList;
}

/**
* {@inheritDoc }
*/
Expand All @@ -215,4 +221,4 @@ public ReferenceList selectProjectsReferenceList( Plugin plugin )
daoUtil.free( );
return projectList;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,9 @@

public class Enrollment implements Serializable {
private int _nId;
private int _projectId;
private String _strEnrollment;
@NotEmpty( message = "#i18n{enroll.validation.enrollment.Name.notEmpty}" )
@Size( max = 50 , message = "#i18n{enroll.validation.enrollment.Name.size}" )
private String _strContactName;
@NotEmpty( message = "#i18n{enroll.validation.enrollment.Email.notEmpty}" )
@Size( max = 50 , message = "#i18n{enroll.validation.enrollment.Email.size}" )
private String _strContactEmail;
@NotEmpty( message = "#i18n{enroll.validation.enrollment.Phone.notEmpty}" )
@Size( max = 50 , message = "#i18n{enroll.validation.enrollment.Phone.size}" )
private String _strContactNumber;

public int getId() {
Expand All @@ -26,35 +19,35 @@ public void setId(int id) {
_nId = id;
}

public String getEnrollment() {
public String getProgram() {
return _strEnrollment;
}

public void setEnrollment(String enrollmentName) {
public void setProgram(String enrollmentName) {
_strEnrollment = enrollmentName;
}

public String getContactName() {
public String getName() {
return _strContactName;
}

public void setContactName(String name) {
public void setName(String name) {
_strContactName = name;
}

public String getContactEmail() {
public String getEmail() {
return _strContactEmail;
}

public void setContactEmail(String email) {
public void setEmail(String email) {
_strContactEmail = email;
}

public String getContactNumber() {
public String getPhone() {
return _strContactNumber;
}

public void setContactNumber(String number) {
public void setPhone(String number) {
_strContactNumber = number;
}
}
Loading