CPD Results
The following document contains the results of PMD's CPD 6.13.0.
Duplications
File |
Line |
fr/paris/lutece/plugins/mydashboard/modules/myaccount/web/MyDashboardDemandComponent.java |
130 |
fr/paris/lutece/plugins/mydashboard/modules/myaccount/web/MyDashboardLastDemandComponent.java |
112 |
MyDemandService.getInstance().addInformations(request, crmUser, paginator.getPageItems( ), model);
HtmlTemplate template = AppTemplateService.getTemplate( TEMPLATE_DASHBOARD_COMPONENT,
LocaleService.getDefault( ), model );
return template.getHtml( );
}
return "";
}
@Override
public String getComponentId( )
{
return DASHBOARD_COMPONENT_ID;
}
@Override
public String getComponentDescription( Locale locale )
{
return I18nService.getLocalizedString( MESSAGE_DASHBOARD_COMPONENT_DESCRIPTION, locale );
}
/**
* Create a CRM account if the current user does not have one
*
* @param user
* the LuteceUser
*/
private void createOrUpdateCRMAccount( LuteceUser user )
{
if ( user != null )
{
CRMUser crmUser = CRMUserService.getService( ).findByUserGuid( user.getName( ) );
if ( crmUser == null )
{
crmUser = new CRMUser( );
crmUser.setUserGuid( user.getName( ) );
crmUser.setStatus( CRMUser.STATUS_ACTIVATED );
Map<String, String> userAttributes = new HashMap<String, String>( );
for ( String strUserAttributeKey : CRMUserAttributesService.getService( ).getUserAttributeKeys( ) )
{
userAttributes.put( strUserAttributeKey, user.getUserInfo( strUserAttributeKey ) );
}
crmUser.setUserAttributes( userAttributes );
CRMUserService.getService( ).create( crmUser );
}
else if ( crmUser.isMustBeUpdated( ) )
{
crmUser.setMustBeUpdated( false );
crmUser.setStatus( CRMUser.STATUS_ACTIVATED );
Map<String, String> userAttributes = new HashMap<String, String>( );
for ( String strUserAttributeKey : CRMUserAttributesService.getService( ).getUserAttributeKeys( ) )
{
userAttributes.put( strUserAttributeKey, user.getUserInfo( strUserAttributeKey ) );
}
crmUser.setUserAttributes( userAttributes );
CRMUserService.getService( ).update( crmUser );
}
}
}
} |
File |
Line |
fr/paris/lutece/plugins/mydashboard/modules/myaccount/web/MyDashboardDemandComponent.java |
132 |
fr/paris/lutece/plugins/mydashboard/modules/myaccount/web/MyDashboardFederationLinkComponent.java |
100 |
fr/paris/lutece/plugins/mydashboard/modules/myaccount/web/MyDashboardLastDemandComponent.java |
114 |
HtmlTemplate template = AppTemplateService.getTemplate( TEMPLATE_DASHBOARD_COMPONENT,
LocaleService.getDefault( ), model );
return template.getHtml( );
}
return "";
}
@Override
public String getComponentId( )
{
return DASHBOARD_COMPONENT_ID;
}
@Override
public String getComponentDescription( Locale locale )
{
return I18nService.getLocalizedString( MESSAGE_DASHBOARD_COMPONENT_DESCRIPTION, locale );
}
/**
* Create a CRM account if the current user does not have one
*
* @param user
* the LuteceUser
*/
private void createOrUpdateCRMAccount( LuteceUser user )
{
if ( user != null )
{
CRMUser crmUser = CRMUserService.getService( ).findByUserGuid( user.getName( ) );
if ( crmUser == null )
{
crmUser = new CRMUser( );
crmUser.setUserGuid( user.getName( ) );
crmUser.setStatus( CRMUser.STATUS_ACTIVATED );
Map<String, String> userAttributes = new HashMap<String, String>( );
for ( String strUserAttributeKey : CRMUserAttributesService.getService( ).getUserAttributeKeys( ) )
{
userAttributes.put( strUserAttributeKey, user.getUserInfo( strUserAttributeKey ) );
}
crmUser.setUserAttributes( userAttributes );
CRMUserService.getService( ).create( crmUser );
}
else if ( crmUser.isMustBeUpdated( ) )
{
crmUser.setMustBeUpdated( false );
crmUser.setStatus( CRMUser.STATUS_ACTIVATED );
Map<String, String> userAttributes = new HashMap<String, String>( );
for ( String strUserAttributeKey : CRMUserAttributesService.getService( ).getUserAttributeKeys( ) )
{
userAttributes.put( strUserAttributeKey, user.getUserInfo( strUserAttributeKey ) );
}
crmUser.setUserAttributes( userAttributes );
CRMUserService.getService( ).update( crmUser );
}
}
}
} |
File |
Line |
fr/paris/lutece/plugins/mydashboard/modules/myaccount/web/MyDashboardDemandComponent.java |
96 |
fr/paris/lutece/plugins/mydashboard/modules/myaccount/web/MyDashboardLastDemandComponent.java |
85 |
CRMUser crmUser = crmUserService.findByUserGuid( user.getName( ) );
if ( crmUser != null )
{
Map<String, Object> model = new HashMap<String, Object>( );
List<IDemandWraper> listDemandWraper = new ArrayList<IDemandWraper>( );
String categoryCode = request.getParameter( PARAMETER_CATEGORY_CODE );
if ( PARAMETER_ALL.equals( categoryCode ) )
{
listDemandWraper = MyDemandService.getInstance( ).getAllUserDemand( crmUser );
}
else if ( categoryCode != null && !categoryCode.trim( ).isEmpty( ) )
{
listDemandWraper = MyDemandService.getInstance( ).getUserDemandByCategory( crmUser, categoryCode );
}
//Sort demand
Collections.sort( listDemandWraper ); |