Commit 7151ef43 authored by Guillaume Lépine's avatar Guillaume Lépine
Browse files

mvn license & format

parent c1a5158e
/*
* Copyright (c) 2002-2021, City of Paris
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright notice
* and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice
* and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of 'Mairie de Paris' nor 'Lutece' nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* License 1.0
*/
package fr.paris.lutece.plugins.forms.service;
import java.util.List;
......@@ -18,9 +51,9 @@ public abstract class AbstractFormDisplayService implements IFormDisplayService
{
private static final String PROPERTY_ROOT_LEVEL_POSITION_LABEL = "forms.moveComposite.rootLevel.label";
private static final String PROPERTY_POSITION_LABEL = "forms.moveComposite.position.label";
private IFormDatabaseService _formDatabaseService = null;
@Override
public String getDisplayTitle( FormDisplay formDisplayToMove )
{
......@@ -45,7 +78,7 @@ public abstract class AbstractFormDisplayService implements IFormDisplayService
}
return strDisplayTitle;
}
@Override
public ReferenceList getTargetGroupDisplayListByStep( int nIdStep, FormDisplay formDisplayToMove, Locale locale )
{
......@@ -73,7 +106,7 @@ public abstract class AbstractFormDisplayService implements IFormDisplayService
return listGroupDisplay;
}
/**
* Return true if the provided FormDisplay identifier A is a descendant (a child, grandchild, great-grandchild, etc.) of the second FormDisplay parameter
*
......@@ -106,7 +139,7 @@ public abstract class AbstractFormDisplayService implements IFormDisplayService
}
return bIsChild;
}
@Override
public ReferenceList getlistAvailablePositionsInGroup( int nIdStep, int nIdDisplayGroup, boolean bAddPosition, Locale locale )
{
......@@ -125,7 +158,7 @@ public abstract class AbstractFormDisplayService implements IFormDisplayService
return listAvailablePositions;
}
@Override
public int getDisplayDepthFromParent( int parentGroup )
{
......@@ -140,7 +173,7 @@ public abstract class AbstractFormDisplayService implements IFormDisplayService
}
return nDisplayDepth;
}
@Override
public void setChildrenDisplayDepthAndStep( FormDisplay formDisplayParent, int nDepth, int nIdStep )
{
......@@ -149,7 +182,8 @@ public abstract class AbstractFormDisplayService implements IFormDisplayService
formDisplayParent.setStepId( nIdStep );
formDisplayParent.setDepth( nDepth );
getFormDatabaseService( ).updateFormDisplay( formDisplayParent );;
getFormDatabaseService( ).updateFormDisplay( formDisplayParent );
;
if ( CompositeDisplayType.QUESTION.getLabel( ).equalsIgnoreCase( strCompositeType ) )
{
......@@ -172,7 +206,7 @@ public abstract class AbstractFormDisplayService implements IFormDisplayService
setChildrenDisplayDepthAndStep( childDisplay, formDisplayParent.getDepth( ) + 1, nIdStep );
}
}
@Override
public void rebuildDisplayPositionSequence( List<FormDisplay> listDisplay )
{
......@@ -184,7 +218,7 @@ public abstract class AbstractFormDisplayService implements IFormDisplayService
getFormDatabaseService( ).updateFormDisplay( displayToUpdate );
}
}
/**
* Load the data of all the FormDisplay objects of type "Group" linked to a given FormStep and returns them as a referenceList
*
......@@ -193,7 +227,7 @@ public abstract class AbstractFormDisplayService implements IFormDisplayService
* @return the referenceList which contains the data of all the Display objects of group type
*/
protected abstract ReferenceList getGroupDisplayReferenceListByStep( int nIdStep );
/**
* Load the data of all the formDisplay that are direct children of a given parent and returns them as a list
*
......@@ -204,7 +238,7 @@ public abstract class AbstractFormDisplayService implements IFormDisplayService
* @return the list which contains the data of all the formDisplay objects by parent
*/
protected abstract List<FormDisplay> getFormDisplayListByParent( int nIdStep, int nIdParent );
protected IFormDatabaseService getFormDatabaseService( )
{
if ( _formDatabaseService == null )
......@@ -213,6 +247,6 @@ public abstract class AbstractFormDisplayService implements IFormDisplayService
}
return _formDatabaseService;
}
protected abstract IFormDatabaseService initFormDatabaseService( );
}
/*
* Copyright (c) 2002-2021, City of Paris
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright notice
* and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice
* and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of 'Mairie de Paris' nor 'Lutece' nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* License 1.0
*/
package fr.paris.lutece.plugins.forms.service;
import java.util.List;
......@@ -22,169 +55,169 @@ import fr.paris.lutece.plugins.genericattributes.business.ReferenceItemFieldHome
public class FormDatabaseService implements IFormDatabaseService
{
public static final String BEAN_NAME = "forms.formDatabaseService";
@Override
public void createEntry( Entry entry )
{
EntryHome.create( entry );
}
@Override
public void createField( Field field )
{
FieldHome.create( field );
}
@Override
public void createQuestion( Question question )
{
QuestionHome.create( question );
}
@Override
public void createGroup( Group group )
{
GroupHome.create( group );
}
@Override
public void updateGroup( Group group )
{
GroupHome.update( group );
}
@Override
public Group findGroupByPrimaryKey( int idGroup )
{
return GroupHome.findByPrimaryKey( idGroup );
}
@Override
public Step findStepByPrimaryKey( int idStep )
{
return StepHome.findByPrimaryKey( idStep );
}
@Override
public void updateEntry( Entry entry )
{
EntryHome.update( entry );
}
@Override
public void createFormDisplay( FormDisplay formDisplay )
{
FormDisplayHome.create( formDisplay );
}
@Override
public List<Question> getListQuestionByForm( int nIdForm )
{
return QuestionHome.getListQuestionByIdForm( nIdForm );
}
@Override
public Question findQuestionByPrimaryKey( int idQuestion )
{
return QuestionHome.findByPrimaryKey( idQuestion );
}
@Override
public Entry findEntryByPrimaryKey( int idEntry )
{
return EntryHome.findByPrimaryKey( idEntry );
}
@Override
public void updateField( Field field )
{
FieldHome.update( field );
}
@Override
public Field findFieldByPrimaryKey( int idField )
{
return FieldHome.findByPrimaryKey( idField );
}
@Override
public FormDisplay findDisplayByPrimaryKey( int idDisplay )
{
return FormDisplayHome.findByPrimaryKey( idDisplay );
}
@Override
public void updateQuestion( Question question )
{
QuestionHome.update( question );
}
@Override
public List<FormDisplay> getFormDisplayListByParent( int nIdStep, int nIdParent )
{
return FormDisplayHome.getFormDisplayListByParent( nIdStep, nIdParent );
}
@Override
public void updateFormDisplay( FormDisplay formDisplay )
{
FormDisplayHome.update( formDisplay );
}
@Override
public Entry copyEntry( Entry entry )
{
return EntryHome.copy( entry );
}
@Override
public List<Control> getControlByQuestion( int nIdQuestion )
{
return ControlHome.getControlByQuestion( nIdQuestion );
}
@Override
public FormDisplay getFormDisplayByFormStepAndComposite( int nIdForm, int nIdStep, int nIdComposite )
{
return FormDisplayHome.getFormDisplayByFormStepAndComposite( nIdForm, nIdStep, nIdComposite );
}
@Override
public void createControl( Control control )
{
ControlHome.create( control );
}
@Override
public List<Group> getGroupsListByIdStepList( List<Integer> idStepList )
{
return GroupHome.getGroupsListByIdStepList( idStepList );
}
@Override
public List<Question> getQuestionsListByStep( int nIdStep )
{
return QuestionHome.getQuestionsListByStep( nIdStep );
}
@Override
public Integer findIdReferenceItemByIdField( int idField )
{
return ReferenceItemFieldHome.findIdItemByIdField( idField );
}
@Override
public List<ControlMapping> getControlMappingListByIdControl( int nIdControl )
{
return ControlHome.getControlMappingListByIdControl( nIdControl );
}
@Override
public void createStep( Step step )
{
StepHome.create( step );
}
@Override
public void createMappingControl( int nIdcontrol, int nIdQuestion, String strValue )
{
......
......@@ -116,13 +116,13 @@ public class FormDisplayService extends AbstractFormDisplayService
{
return FormDisplayHome.getFormDisplayListByParent( nIdStep, nIdParent );
}
@Override
protected ReferenceList getGroupDisplayReferenceListByStep( int nIdStep )
{
return FormDisplayHome.getGroupDisplayReferenceListByStep( nIdStep );
}
@Override
protected IFormDatabaseService initFormDatabaseService( )
{
......
/*
* Copyright (c) 2002-2021, City of Paris
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright notice
* and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice
* and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of 'Mairie de Paris' nor 'Lutece' nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* License 1.0
*/
package fr.paris.lutece.plugins.forms.service;
import java.util.List;
......@@ -15,132 +48,152 @@ public interface IFormDatabaseService
{
/**
* Find a step by its id
*
* @param idStep
* @return
*/
Step findStepByPrimaryKey( int idStep );
/**
* Find a qusteion by its id
*
* @param idQuestion
* @return
*/
Question findQuestionByPrimaryKey( int idQuestion );
/**
* Find an entry by its id
*
* @param idEntry
* @return
*/
Entry findEntryByPrimaryKey( int idEntry );
/**
* Find a group by its id
*
* @param idGroup
* @return
*/
Group findGroupByPrimaryKey( int idGroup );
/**
* Find a field by its id
*
* @param idField
* @return
*/
Field findFieldByPrimaryKey( int idField );
/**
* Find a formdisplay by its id
*
* @param idDisplay
* @return
*/
FormDisplay findDisplayByPrimaryKey( int idDisplay );
/**
* copy an entry
*
* @param entry
* @return
*/
Entry copyEntry( Entry entry );
/**
* Create an entry
*
* @param entry
*/
void createEntry( Entry entry );
/**
* Create a formDisplay
*
* @param formDisplay
*/
void createFormDisplay( FormDisplay formDisplay );
/**
* Create a field
* Create a field
*
* @param field
*/
void createField( Field field );
/**
* Create a step
* Create a step
*
* @param step
*/
void createStep( Step step );
/**
* Create a question
*
* @param question
*/
void createQuestion( Question question );
/**
* Create a control
*
* @param control
*/
void createControl( Control control );
/**
* Create a group
*
* @param group
*/
void createGroup( Group group );
/**
* update a group
*
* @param group
*/
void updateGroup( Group group );
/**
* update an entry
*
* @param entry
*/
void updateEntry( Entry entry );
/**
* update a field
*
* @param field
*/
void updateField( Field field );
/**
* update a question
*
* @param question
*/
void updateQuestion( Question question );
/**
* update a FormDisplay
*
* @param formDisplay
*/
void updateFormDisplay( FormDisplay formDisplay );
/**
* Find all Questions by form
*
* @param nIdForm
* @return
*/
List<Question> getListQuestionByForm( int nIdForm );
/**
* Load the data of all the formDisplay that are direct children of a given parent and returns them as a list
*
......@@ -151,7 +204,7 @@ public interface IFormDatabaseService
* @return the list which contains the data of all the formDisplay objects by parent
*/
List<FormDisplay> getFormDisplayListByParent( int nIdStep, int nIdParent );
/**