dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #39731
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20141: Web api, cleanup
------------------------------------------------------------
revno: 20141
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2015-09-14 19:57:00 +0200
message:
Web api, cleanup
modified:
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/AbstractCrudController.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/AccountController.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/AggregationQueryController.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/AppController.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/ChartController.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/CompleteDataSetRegistrationController.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/ConfigurationController.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DataSetController.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/InterpretationController.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/MessageConversationController.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/PdfFormController.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/SmsConfigurationController.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/SvgConversionController.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/SystemController.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/dataelement/DataElementController.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/mapping/MapController.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/organisationunit/OrganisationUnitController.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/user/CurrentUserController.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/user/UserController.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/utils/FormUtils.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/utils/PdfDataEntryFormImportUtil.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/view/ClassPathUriResolver.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/view/JacksonJsonView.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/view/JacksonXmlView.java
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/AbstractCrudController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/AbstractCrudController.java 2015-09-14 09:13:10 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/AbstractCrudController.java 2015-09-14 17:57:00 +0000
@@ -28,13 +28,19 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.dataformat.xml.XmlMapper;
-import com.google.common.base.Enums;
-import com.google.common.base.Joiner;
-import com.google.common.base.Optional;
-import com.google.common.collect.Lists;
+import java.io.IOException;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.nio.charset.Charset;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
import org.hisp.dhis.common.BaseIdentifiableObject;
import org.hisp.dhis.common.IdentifiableObject;
import org.hisp.dhis.common.IdentifiableObjectManager;
@@ -44,14 +50,13 @@
import org.hisp.dhis.dxf2.common.ImportOptions;
import org.hisp.dhis.dxf2.common.OrderOptions;
import org.hisp.dhis.dxf2.common.TranslateParams;
-import org.hisp.dhis.fieldfilter.FieldFilterService;
import org.hisp.dhis.dxf2.importsummary.ImportStatus;
import org.hisp.dhis.dxf2.metadata.ImportService;
import org.hisp.dhis.dxf2.metadata.ImportTypeSummary;
-import org.hisp.dhis.objectfilter.ObjectFilterService;
import org.hisp.dhis.dxf2.render.DefaultRenderService;
import org.hisp.dhis.dxf2.render.RenderService;
import org.hisp.dhis.dxf2.webmessage.WebMessageException;
+import org.hisp.dhis.fieldfilter.FieldFilterService;
import org.hisp.dhis.hibernate.exception.CreateAccessDeniedException;
import org.hisp.dhis.hibernate.exception.DeleteAccessDeniedException;
import org.hisp.dhis.hibernate.exception.ReadAccessDeniedException;
@@ -65,6 +70,7 @@
import org.hisp.dhis.node.types.ComplexNode;
import org.hisp.dhis.node.types.RootNode;
import org.hisp.dhis.node.types.SimpleNode;
+import org.hisp.dhis.objectfilter.ObjectFilterService;
import org.hisp.dhis.query.Order;
import org.hisp.dhis.query.Query;
import org.hisp.dhis.query.QueryService;
@@ -90,17 +96,13 @@
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.lang.reflect.ParameterizedType;
-import java.lang.reflect.Type;
-import java.nio.charset.Charset;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.dataformat.xml.XmlMapper;
+import com.google.common.base.Enums;
+import com.google.common.base.Joiner;
+import com.google.common.base.Optional;
+import com.google.common.collect.Lists;
/**
* @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
@@ -823,7 +825,6 @@
* Override to process entities after it has been retrieved from
* storage and before it is returned to the view. Entities is null-safe.
*/
-
protected void postProcessEntities( List<T> entityList, WebOptions options, Map<String, String> parameters )
{
}
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/AccountController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/AccountController.java 2015-08-25 13:54:00 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/AccountController.java 2015-09-14 17:57:00 +0000
@@ -88,6 +88,7 @@
private static final String TRUE = "true";
private static final String SPLIT = "\n";
private static final int MAX_LENGTH = 80;
+ private static final int MAX_PHONE_NO_LENGTH = 30;
@Autowired
private RestTemplate restTemplate;
@@ -298,7 +299,7 @@
throw new WebMessageException( WebMessageUtils.badRequest( "Email is not specified or invalid" ) );
}
- if ( phoneNumber == null || phoneNumber.trim().length() > 30 )
+ if ( phoneNumber == null || phoneNumber.trim().length() > MAX_PHONE_NO_LENGTH )
{
throw new WebMessageException( WebMessageUtils.badRequest( "Phone number is not specified or invalid" ) );
}
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/AggregationQueryController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/AggregationQueryController.java 2015-02-09 22:18:20 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/AggregationQueryController.java 2015-09-14 17:57:00 +0000
@@ -55,7 +55,7 @@
@RequestMapping( value = AggregationQueryController.RESOURCE_PATH )
public class AggregationQueryController
{
- private final static Log log = LogFactory.getLog( AggregationQueryController.class );
+ private static final Log log = LogFactory.getLog( AggregationQueryController.class );
public static final String RESOURCE_PATH = "/aggregationQueries";
@@ -133,16 +133,16 @@
private String convertDataElementExpression( String expression )
{
- String UID_PATTERN = "[A-Za-z0-9]+";
- String UID_TOKEN_PATTERN = "(#\\{(" + UID_PATTERN + ")})";
+ String uidPattern = "[A-Za-z0-9]+";
+ String uidTokenPattern = "(#\\{(" + uidPattern + ")})";
StringBuffer replacedExpressionBuffer = new StringBuffer();
Pattern dePattern = Pattern.compile( "(?<=\\[" + CaseAggregationCondition.OBJECT_PROGRAM_STAGE_DATAELEMENT
+ CaseAggregationCondition.SEPARATOR_OBJECT + ")"
- + UID_TOKEN_PATTERN + CaseAggregationCondition.SEPARATOR_ID
- + UID_TOKEN_PATTERN + CaseAggregationCondition.SEPARATOR_ID
- + UID_TOKEN_PATTERN
+ + uidTokenPattern + CaseAggregationCondition.SEPARATOR_ID
+ + uidTokenPattern + CaseAggregationCondition.SEPARATOR_ID
+ + uidTokenPattern
+ "(?=\\])" );
Matcher matcher = dePattern.matcher( expression );
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/AppController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/AppController.java 2015-09-03 03:11:47 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/AppController.java 2015-09-14 17:57:00 +0000
@@ -87,7 +87,7 @@
@Autowired
private LocationManager locationManager;
- private ResourceLoader resourceLoader = new DefaultResourceLoader();
+ private final ResourceLoader resourceLoader = new DefaultResourceLoader();
@RequestMapping( method = RequestMethod.GET, produces = ContextUtils.CONTENT_TYPE_JSON )
public void getApps( @RequestParam(required=false) String key, HttpServletResponse response )
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/ChartController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/ChartController.java 2015-08-04 12:59:15 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/ChartController.java 2015-09-14 17:57:00 +0000
@@ -40,6 +40,7 @@
import org.hisp.dhis.chart.Chart;
import org.hisp.dhis.chart.ChartService;
import org.hisp.dhis.common.DimensionService;
+import org.hisp.dhis.common.cache.CacheStrategy;
import org.hisp.dhis.commons.util.CodecUtils;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
@@ -57,9 +58,7 @@
import org.hisp.dhis.period.Period;
import org.hisp.dhis.period.PeriodType;
import org.hisp.dhis.schema.descriptors.ChartSchemaDescriptor;
-import org.hisp.dhis.user.CurrentUserService;
import org.hisp.dhis.webapi.utils.ContextUtils;
-import org.hisp.dhis.common.cache.CacheStrategy;
import org.hisp.dhis.webapi.utils.WebMessageUtils;
import org.jfree.chart.ChartUtilities;
import org.jfree.chart.JFreeChart;
@@ -97,9 +96,6 @@
private DimensionService dimensionService;
@Autowired
- private CurrentUserService currentUserService;
-
- @Autowired
private I18nManager i18nManager;
@Autowired
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/CompleteDataSetRegistrationController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/CompleteDataSetRegistrationController.java 2015-07-13 08:40:46 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/CompleteDataSetRegistrationController.java 2015-09-14 17:57:00 +0000
@@ -332,7 +332,9 @@
orgUnit, attributeOptionCombo, storedBy, completionDate );
if ( completeDataSetRegistration != null )
+ {
registrations.add( completeDataSetRegistration );
+ }
}
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/ConfigurationController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/ConfigurationController.java 2015-09-10 10:27:32 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/ConfigurationController.java 2015-09-14 17:57:00 +0000
@@ -72,13 +72,13 @@
@PreAuthorize( "hasRole('ALL') or hasRole('F_SYSTEM_SETTING')" )
@ResponseStatus( value = HttpStatus.OK )
@RequestMapping( value = "/systemId", method = RequestMethod.GET )
- private String getSystemId( Model model, HttpServletRequest request )
+ public String getSystemId( Model model, HttpServletRequest request )
{
return setModel( model, configurationService.getConfiguration().getSystemId() );
}
@RequestMapping( value = "/feedbackRecipients", method = RequestMethod.GET )
- private String getFeedbackRecipients( Model model, HttpServletRequest request )
+ public String getFeedbackRecipients( Model model, HttpServletRequest request )
{
return setModel( model, configurationService.getConfiguration().getFeedbackRecipients() );
}
@@ -86,7 +86,7 @@
@PreAuthorize( "hasRole('ALL') or hasRole('F_SYSTEM_SETTING')" )
@ResponseStatus( value = HttpStatus.OK )
@RequestMapping( value = "/feedbackRecipients/{uid}", method = RequestMethod.POST )
- private void setFeedbackRecipients( @PathVariable( "uid" ) String uid )
+ public void setFeedbackRecipients( @PathVariable( "uid" ) String uid )
throws NotFoundException
{
UserGroup group = identifiableObjectManager.get( UserGroup.class, uid );
@@ -104,7 +104,7 @@
}
@RequestMapping( value = "/offlineOrganisationUnitLevel", method = RequestMethod.GET )
- private String getOfflineOrganisationUnitLevel( Model model, HttpServletRequest request )
+ public String getOfflineOrganisationUnitLevel( Model model, HttpServletRequest request )
{
return setModel( model, configurationService.getConfiguration().getOfflineOrganisationUnitLevel() );
}
@@ -112,7 +112,7 @@
@PreAuthorize( "hasRole('ALL') or hasRole('F_SYSTEM_SETTING')" )
@ResponseStatus( value = HttpStatus.OK )
@RequestMapping( value = "/offlineOrganisationUnitLevel/{uid}", method = RequestMethod.POST )
- private void setOfflineOrganisationUnitLevels( @PathVariable( "uid" ) String uid )
+ public void setOfflineOrganisationUnitLevels( @PathVariable( "uid" ) String uid )
throws NotFoundException
{
OrganisationUnitLevel organisationUnitLevel = identifiableObjectManager.get( OrganisationUnitLevel.class, uid );
@@ -130,7 +130,7 @@
}
@RequestMapping( value = "/infrastructuralIndicators", method = RequestMethod.GET )
- private String getInfrastructuralIndicators( Model model, HttpServletRequest request )
+ public String getInfrastructuralIndicators( Model model, HttpServletRequest request )
{
return setModel( model, configurationService.getConfiguration().getInfrastructuralIndicators() );
}
@@ -138,7 +138,7 @@
@PreAuthorize( "hasRole('ALL') or hasRole('F_SYSTEM_SETTING')" )
@ResponseStatus( value = HttpStatus.OK )
@RequestMapping( value = "/infrastructuralIndicators/{uid}", method = RequestMethod.POST )
- private void setInfrastructuralIndicators( @PathVariable( "uid" ) String uid )
+ public void setInfrastructuralIndicators( @PathVariable( "uid" ) String uid )
throws NotFoundException
{
IndicatorGroup group = identifiableObjectManager.get( IndicatorGroup.class, uid );
@@ -156,7 +156,7 @@
}
@RequestMapping( value = "/infrastructuralDataElements", method = RequestMethod.GET )
- private String getInfrastructuralDataElements( Model model, HttpServletRequest request )
+ public String getInfrastructuralDataElements( Model model, HttpServletRequest request )
{
return setModel( model, configurationService.getConfiguration().getInfrastructuralDataElements() );
}
@@ -164,7 +164,7 @@
@PreAuthorize( "hasRole('ALL') or hasRole('F_SYSTEM_SETTING')" )
@ResponseStatus( value = HttpStatus.OK )
@RequestMapping( value = "/infrastructuralDataElements/{uid}", method = RequestMethod.POST )
- private void setInfrastructuralDataElements( @PathVariable("uid") String uid )
+ public void setInfrastructuralDataElements( @PathVariable("uid") String uid )
throws NotFoundException
{
DataElementGroup group = identifiableObjectManager.get( DataElementGroup.class, uid );
@@ -182,7 +182,7 @@
}
@RequestMapping( value = "/infrastructuralPeriodType", method = RequestMethod.GET )
- private String getInfrastructuralPeriodType( Model model, HttpServletRequest request )
+ public String getInfrastructuralPeriodType( Model model, HttpServletRequest request )
{
String name = configurationService.getConfiguration().getInfrastructuralPeriodTypeDefaultIfNull().getName();
BaseIdentifiableObject entity = new BaseIdentifiableObject( name, name, name );
@@ -193,7 +193,7 @@
@PreAuthorize( "hasRole('ALL') or hasRole('F_SYSTEM_SETTING')" )
@ResponseStatus( value = HttpStatus.OK )
@RequestMapping( value = "/infrastructuralPeriodType/{name}", method = RequestMethod.POST )
- private void setInfrastructuralPeriodType( @PathVariable( "name" ) String name )
+ public void setInfrastructuralPeriodType( @PathVariable( "name" ) String name )
throws NotFoundException
{
PeriodType periodType = PeriodType.getPeriodTypeByName( name );
@@ -213,7 +213,7 @@
}
@RequestMapping( value = "/selfRegistrationRole", method = RequestMethod.GET )
- private String getSelfRegistrationRole( Model model, HttpServletRequest request )
+ public String getSelfRegistrationRole( Model model, HttpServletRequest request )
{
return setModel( model, configurationService.getConfiguration().getSelfRegistrationRole() );
}
@@ -221,7 +221,7 @@
@PreAuthorize( "hasRole('ALL') or hasRole('F_SYSTEM_SETTING')" )
@ResponseStatus( value = HttpStatus.OK )
@RequestMapping( value = "/selfRegistrationRole/{uid}", method = RequestMethod.POST )
- private void setSelfRegistrationRole( @PathVariable( "uid" ) String uid )
+ public void setSelfRegistrationRole( @PathVariable( "uid" ) String uid )
throws NotFoundException
{
UserAuthorityGroup userGroup = identifiableObjectManager.get( UserAuthorityGroup.class, uid );
@@ -240,14 +240,14 @@
@ResponseStatus( value = HttpStatus.OK )
@RequestMapping( value = "/selfRegistrationOrgUnit", method = RequestMethod.GET )
- private String getSelfRegistrationOrgUnit( Model model, HttpServletRequest request )
+ public String getSelfRegistrationOrgUnit( Model model, HttpServletRequest request )
{
return setModel( model, configurationService.getConfiguration().getSelfRegistrationOrgUnit() );
}
@PreAuthorize( "hasRole('ALL') or hasRole('F_SYSTEM_SETTING')" )
@RequestMapping( value = "/selfRegistrationOrgUnit/{uid}", method = RequestMethod.POST )
- private void setSelfRegistrationOrgUnit( @PathVariable( "uid" ) String uid )
+ public void setSelfRegistrationOrgUnit( @PathVariable( "uid" ) String uid )
throws NotFoundException
{
OrganisationUnit orgunit = identifiableObjectManager.get( OrganisationUnit.class, uid );
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DataSetController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DataSetController.java 2015-09-14 17:35:36 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DataSetController.java 2015-09-14 17:57:00 +0000
@@ -28,6 +28,20 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
import org.hisp.dhis.common.view.ExportView;
import org.hisp.dhis.dataentryform.DataEntryForm;
import org.hisp.dhis.dataentryform.DataEntryFormService;
@@ -40,7 +54,6 @@
import org.hisp.dhis.dxf2.metadata.ExportService;
import org.hisp.dhis.dxf2.metadata.MetaData;
import org.hisp.dhis.dxf2.webmessage.WebMessageException;
-import org.hisp.dhis.i18n.I18nService;
import org.hisp.dhis.node.types.RootNode;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.period.Period;
@@ -63,19 +76,6 @@
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
-import javax.servlet.http.HttpServletResponse;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.stream.StreamResult;
-import javax.xml.transform.stream.StreamSource;
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
/**
* @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
*/
@@ -108,9 +108,6 @@
@Autowired
private PeriodService periodService;
- @Autowired
- private I18nService i18nService;
-
// -------------------------------------------------------------------------
// Controller
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/InterpretationController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/InterpretationController.java 2015-07-09 07:25:02 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/InterpretationController.java 2015-09-14 17:57:00 +0000
@@ -28,7 +28,13 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import com.google.common.collect.Lists;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
import org.hisp.dhis.chart.Chart;
import org.hisp.dhis.chart.ChartService;
import org.hisp.dhis.common.Pager;
@@ -48,7 +54,6 @@
import org.hisp.dhis.reporttable.ReportTable;
import org.hisp.dhis.reporttable.ReportTableService;
import org.hisp.dhis.schema.descriptors.InterpretationSchemaDescriptor;
-import org.hisp.dhis.user.CurrentUserService;
import org.hisp.dhis.user.User;
import org.hisp.dhis.webapi.utils.WebMessageUtils;
import org.hisp.dhis.webapi.webdomain.WebMetaData;
@@ -62,11 +67,7 @@
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
+import com.google.common.collect.Lists;
/**
* @author Lars Helge Overland
@@ -94,9 +95,6 @@
@Autowired
private MappingService mappingService;
- @Autowired
- private CurrentUserService currentUserService;
-
@Override
protected List<Interpretation> getEntityList( WebMetaData metaData, WebOptions options, List<String> filters, List<Order> orders )
{
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/MessageConversationController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/MessageConversationController.java 2015-07-13 09:52:25 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/MessageConversationController.java 2015-09-14 17:57:00 +0000
@@ -28,7 +28,14 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import com.google.common.collect.Lists;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
import org.hisp.dhis.common.Pager;
import org.hisp.dhis.dxf2.common.ImportOptions;
import org.hisp.dhis.dxf2.common.JacksonUtils;
@@ -44,7 +51,6 @@
import org.hisp.dhis.organisationunit.OrganisationUnitService;
import org.hisp.dhis.query.Order;
import org.hisp.dhis.schema.descriptors.MessageConversationSchemaDescriptor;
-import org.hisp.dhis.user.CurrentUserService;
import org.hisp.dhis.user.User;
import org.hisp.dhis.user.UserGroup;
import org.hisp.dhis.user.UserGroupService;
@@ -66,12 +72,7 @@
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
+import com.google.common.collect.Lists;
/**
* @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
@@ -93,9 +94,6 @@
@Autowired
private UserGroupService userGroupService;
- @Autowired
- private CurrentUserService currentUserService;
-
@Override
public void postProcessEntity( org.hisp.dhis.message.MessageConversation entity, WebOptions options, Map<String, String> parameters ) throws Exception
{
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/PdfFormController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/PdfFormController.java 2015-08-30 17:07:42 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/PdfFormController.java 2015-09-14 17:57:00 +0000
@@ -194,7 +194,7 @@
PdfDataEntryFormImportUtil pdfDataEntryFormImportUtil = new PdfDataEntryFormImportUtil();
- pdfDataEntryFormImportUtil.ImportProgramStage( in, i18nManager.getI18nFormat() );
+ pdfDataEntryFormImportUtil.importProgramStage( in, i18nManager.getI18nFormat() );
webMessageService.send( WebMessageUtils.ok( "Import successful." ), response, request );
}
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/SmsConfigurationController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/SmsConfigurationController.java 2015-09-03 03:11:47 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/SmsConfigurationController.java 2015-09-14 17:57:00 +0000
@@ -99,7 +99,7 @@
{
if ( smsConfiguration == null )
{
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException( "SMS configuration not set" );
}
smsConfigurationManager.updateSmsConfiguration( smsConfiguration );
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/SvgConversionController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/SvgConversionController.java 2015-07-15 15:49:39 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/SvgConversionController.java 2015-09-14 17:57:00 +0000
@@ -88,15 +88,15 @@
{
svg = replaceUnsafeSvgText( svg );
- PNGTranscoder t = new PNGTranscoder();
+ PNGTranscoder transcoder = new PNGTranscoder();
- t.addTranscodingHint( ImageTranscoder.KEY_BACKGROUND_COLOR, Color.WHITE );
+ transcoder.addTranscodingHint( ImageTranscoder.KEY_BACKGROUND_COLOR, Color.WHITE );
TranscoderInput input = new TranscoderInput( new StringReader( svg ) );
TranscoderOutput output = new TranscoderOutput( out );
- t.transcode( input, output );
+ transcoder.transcode( input, output );
}
private void convertToPdf( String svg, OutputStream out )
@@ -104,12 +104,12 @@
{
svg = replaceUnsafeSvgText( svg );
- PDFTranscoder t = new PDFTranscoder();
+ PDFTranscoder transcoder = new PDFTranscoder();
TranscoderInput input = new TranscoderInput( new StringReader( svg ) );
TranscoderOutput output = new TranscoderOutput( out );
- t.transcode( input, output );
+ transcoder.transcode( input, output );
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/SystemController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/SystemController.java 2015-06-10 11:00:04 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/SystemController.java 2015-09-14 17:57:00 +0000
@@ -88,10 +88,7 @@
public @ResponseBody RootNode getUid( @RequestParam( required = false, defaultValue = "1" ) Integer n, HttpServletResponse response )
throws IOException, InvalidTypeException
{
- if ( n > 10000 )
- {
- n = 10000;
- }
+ n = Math.min( n, 10000 );
RootNode rootNode = new RootNode( "codes" );
CollectionNode collectionNode = rootNode.addChild( new CollectionNode( "codes" ) );
@@ -109,10 +106,7 @@
public @ResponseBody RootNode getUuid( @RequestParam( required = false, defaultValue = "1" ) Integer n, HttpServletResponse response )
throws IOException, InvalidTypeException
{
- if ( n > 10000 )
- {
- n = 10000;
- }
+ n = Math.min( n, 10000 );
RootNode rootNode = new RootNode( "codes" );
CollectionNode collectionNode = rootNode.addChild( new CollectionNode( "codes" ) );
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/dataelement/DataElementController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/dataelement/DataElementController.java 2015-07-08 08:17:04 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/dataelement/DataElementController.java 2015-09-14 17:57:00 +0000
@@ -61,16 +61,16 @@
{
List<DataElement> entityList;
- String KEY_DOMAIN_TYPE = "domainType";
+ String keyDomainType = "domainType";
if ( options.getOptions().containsKey( "query" ) )
{
entityList = Lists.newArrayList( manager.filter( getEntityClass(), options.getOptions().get( "query" ) ) );
}
- else if ( DataElementDomain.AGGREGATE.equals( options.getOptions().get( KEY_DOMAIN_TYPE ) )
- || DataElementDomain.TRACKER.equals( options.getOptions().get( KEY_DOMAIN_TYPE ) ) )
+ else if ( DataElementDomain.AGGREGATE.equals( options.getOptions().get( keyDomainType ) )
+ || DataElementDomain.TRACKER.equals( options.getOptions().get( keyDomainType ) ) )
{
- String domainType = options.getOptions().get( KEY_DOMAIN_TYPE );
+ String domainType = options.getOptions().get( keyDomainType );
if ( options.hasPaging() )
{
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/mapping/MapController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/mapping/MapController.java 2015-07-15 15:49:39 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/mapping/MapController.java 2015-09-14 17:57:00 +0000
@@ -28,7 +28,17 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import java.awt.image.BufferedImage;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.Set;
+
+import javax.imageio.ImageIO;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
import org.hisp.dhis.common.DimensionService;
+import org.hisp.dhis.common.cache.CacheStrategy;
import org.hisp.dhis.dxf2.common.ImportOptions;
import org.hisp.dhis.dxf2.common.JacksonUtils;
import org.hisp.dhis.dxf2.webmessage.WebMessageException;
@@ -44,11 +54,9 @@
import org.hisp.dhis.organisationunit.OrganisationUnitService;
import org.hisp.dhis.period.Period;
import org.hisp.dhis.schema.descriptors.MapSchemaDescriptor;
-import org.hisp.dhis.user.CurrentUserService;
import org.hisp.dhis.user.UserService;
import org.hisp.dhis.webapi.controller.AbstractCrudController;
import org.hisp.dhis.webapi.utils.ContextUtils;
-import org.hisp.dhis.common.cache.CacheStrategy;
import org.hisp.dhis.webapi.utils.WebMessageUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
@@ -57,14 +65,6 @@
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
-import javax.imageio.ImageIO;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.awt.image.BufferedImage;
-import java.util.Date;
-import java.util.Iterator;
-import java.util.Set;
-
/**
* @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
* @author Lars Helge Overland
@@ -90,9 +90,6 @@
private OrganisationUnitGroupService organisationUnitGroupService;
@Autowired
- private CurrentUserService currentUserService;
-
- @Autowired
private I18nManager i18nManager;
@Autowired
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/organisationunit/OrganisationUnitController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/organisationunit/OrganisationUnitController.java 2015-09-03 03:11:47 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/organisationunit/OrganisationUnitController.java 2015-09-14 17:57:00 +0000
@@ -28,9 +28,16 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import com.fasterxml.jackson.core.JsonFactory;
-import com.fasterxml.jackson.core.JsonGenerator;
-import com.google.common.collect.Lists;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
import org.hisp.dhis.common.Pager;
import org.hisp.dhis.dxf2.common.TranslateParams;
import org.hisp.dhis.organisationunit.OrganisationUnit;
@@ -39,7 +46,6 @@
import org.hisp.dhis.query.Order;
import org.hisp.dhis.query.Query;
import org.hisp.dhis.schema.descriptors.OrganisationUnitSchemaDescriptor;
-import org.hisp.dhis.user.CurrentUserService;
import org.hisp.dhis.user.User;
import org.hisp.dhis.version.VersionService;
import org.hisp.dhis.webapi.controller.AbstractCrudController;
@@ -53,14 +59,9 @@
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
+import com.fasterxml.jackson.core.JsonFactory;
+import com.fasterxml.jackson.core.JsonGenerator;
+import com.google.common.collect.Lists;
/**
* @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
@@ -76,9 +77,6 @@
@Autowired
private VersionService versionService;
- @Autowired
- private CurrentUserService currentUserService;
-
@Override
@SuppressWarnings( "unchecked" )
protected List<OrganisationUnit> getEntityList( WebMetaData metaData, WebOptions options, List<String> filters, List<Order> orders )
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/user/CurrentUserController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/user/CurrentUserController.java 2015-09-14 09:13:10 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/user/CurrentUserController.java 2015-09-14 17:57:00 +0000
@@ -112,7 +112,7 @@
private static final int MAX_OBJECTS = 50;
- private static SimpleDateFormat simpleDateFormat = new SimpleDateFormat( "yyyy-MM-dd" );
+ private static SimpleDateFormat SIMPLE_DATE_FORMAT = new SimpleDateFormat( "yyyy-MM-dd" );
@Autowired
private CurrentUserService currentUserService;
@@ -349,7 +349,7 @@
if ( currentUser.getBirthday() != null )
{
- userAccount.setBirthday( simpleDateFormat.format( currentUser.getBirthday() ) );
+ userAccount.setBirthday( SIMPLE_DATE_FORMAT.format( currentUser.getBirthday() ) );
}
userAccount.setNationality( currentUser.getNationality() );
@@ -390,7 +390,7 @@
if ( userAccount.getBirthday() != null && !userAccount.getBirthday().isEmpty() )
{
- currentUser.setBirthday( simpleDateFormat.parse( userAccount.getBirthday() ) );
+ currentUser.setBirthday( SIMPLE_DATE_FORMAT.parse( userAccount.getBirthday() ) );
}
currentUser.setNationality( userAccount.getNationality() );
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/user/UserController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/user/UserController.java 2015-07-10 02:55:10 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/user/UserController.java 2015-09-14 17:57:00 +0000
@@ -28,8 +28,16 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import com.google.common.base.Optional;
-import com.google.common.collect.Lists;
+import static org.hisp.dhis.common.IdentifiableObjectUtils.getUids;
+
+import java.io.IOException;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
import org.apache.commons.lang3.StringUtils;
import org.hisp.dhis.common.CodeGenerator;
import org.hisp.dhis.common.IdentifiableObjectUtils;
@@ -49,7 +57,6 @@
import org.hisp.dhis.security.RestoreOptions;
import org.hisp.dhis.security.SecurityService;
import org.hisp.dhis.system.util.ValidationUtils;
-import org.hisp.dhis.user.CurrentUserService;
import org.hisp.dhis.user.User;
import org.hisp.dhis.user.UserAuthorityGroup;
import org.hisp.dhis.user.UserCredentials;
@@ -70,14 +77,8 @@
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-
-import static org.hisp.dhis.common.IdentifiableObjectUtils.getUids;
+import com.google.common.base.Optional;
+import com.google.common.collect.Lists;
/**
* @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
@@ -100,9 +101,6 @@
private UserGroupService userGroupService;
@Autowired
- private CurrentUserService currentUserService;
-
- @Autowired
private SecurityService securityService;
@Autowired
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/utils/FormUtils.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/utils/FormUtils.java 2015-09-11 11:54:53 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/utils/FormUtils.java 2015-09-14 17:57:00 +0000
@@ -161,7 +161,7 @@
{
if ( program.isWithoutRegistration() )
{
- throw new NullPointerException();
+ throw new IllegalStateException( "Program is without registration" );
}
else
{
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/utils/PdfDataEntryFormImportUtil.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/utils/PdfDataEntryFormImportUtil.java 2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/utils/PdfDataEntryFormImportUtil.java 2015-09-14 17:57:00 +0000
@@ -30,6 +30,8 @@
import com.lowagie.text.pdf.AcroFields;
import com.lowagie.text.pdf.PdfReader;
+
+import org.apache.commons.lang3.StringUtils;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementService;
import org.hisp.dhis.dxf2.pdfform.PdfDataEntryFormUtil;
@@ -87,7 +89,7 @@
// -------------------------------------------------------------------------
@SuppressWarnings( "unchecked" )
- public void ImportProgramStage( InputStream in, I18nFormat format )
+ public void importProgramStage( InputStream in, I18nFormat format )
throws Exception
{
int programStageInstanceId;
@@ -115,8 +117,7 @@
// Create Organized data
for ( String fldName : fldNames )
{
- // If the value in the textfield is not empty, proceed to add
- // it.
+ // If the value in the text field is not empty, proceed to add it.
if ( !form.getField( fldName ).trim().equals( "" ) )
{
if ( fldName.startsWith( PdfDataEntryFormUtil.LABELCODE_DATADATETEXTFIELD ) )
@@ -142,8 +143,7 @@
}
}
- // For each row, add new programStageInstance and add data elements
- // to it.
+ // For each row, add new programStageInstance and add data elements to it.
for ( Map.Entry<Integer, ProgramStageInstanceStorage> entry : programStageInstanceDataManager
.getProgramStageInstanceData().entrySet() )
{
@@ -209,10 +209,7 @@
TrackedEntityDataValue dataValue = dataValueService.getTrackedEntityDataValue( programStageInstance,
dataElement );
- if ( value != null && value.trim().length() == 0 )
- {
- value = null;
- }
+ value = StringUtils.trimToNull( value );
// ---------------------------------------------------------------------
// Save value
@@ -245,31 +242,24 @@
}
else if ( dataValue != null )
{
- // LOG.debug( "Updating TrackedEntityDataValue, value added/changed" );
-
dataValue.setValue( value );
dataValue.setTimestamp( new Date() );
- // dataValue.setProvidedElsewhere( providedElsewhere );
dataValue.setStoredBy( storedBy );
dataValueService.updateTrackedEntityDataValue( dataValue );
}
-
}
- // -----------------------------------------------------------------------------
- // ------------ Helper Classes [START] ------------
-
- class ProgramStageInstanceDataManager
+ private class ProgramStageInstanceDataManager
{
- Map<Integer, ProgramStageInstanceStorage> programStageInstanceData;
+ private Map<Integer, ProgramStageInstanceStorage> programStageInstanceData;
- public Map<Integer, ProgramStageInstanceStorage> getProgramStageInstanceData()
+ private Map<Integer, ProgramStageInstanceStorage> getProgramStageInstanceData()
{
return programStageInstanceData;
}
- public ProgramStageInstanceDataManager()
+ private ProgramStageInstanceDataManager()
{
programStageInstanceData = new HashMap<>();
}
@@ -317,11 +307,11 @@
}
}
- class ProgramStageInstanceStorage
+ private class ProgramStageInstanceStorage
{
- int date;
+ private int date;
- Map<Integer, String> dataElementsValue;
+ private Map<Integer, String> dataElementsValue;
// -------------------------------------------------------------------------
// GET/SET
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/view/ClassPathUriResolver.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/view/ClassPathUriResolver.java 2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/view/ClassPathUriResolver.java 2015-09-14 17:57:00 +0000
@@ -70,7 +70,7 @@
if ( !classPathResource.exists() )
{
- throw (new TransformerException( "Resource " + url + " does not exist in classpath." ));
+ throw new TransformerException( "Resource does not exist in classpath: " + url );
}
Source source = null;
@@ -81,7 +81,7 @@
}
catch ( IOException e )
{
- throw (new TransformerException( "IOException while reading " + url + "." ));
+ throw new TransformerException( "IOException while reading URL: " + url );
}
return source;
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/view/JacksonJsonView.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/view/JacksonJsonView.java 2015-02-17 06:00:52 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/view/JacksonJsonView.java 2015-09-14 17:57:00 +0000
@@ -28,31 +28,29 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import com.fasterxml.jackson.databind.util.JSONPObject;
-import org.hisp.dhis.webapi.utils.ContextUtils;
-import org.hisp.dhis.dxf2.common.JacksonUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.servlet.view.AbstractView;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
import java.io.OutputStream;
import java.util.Map;
import java.util.zip.GZIPOutputStream;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.hisp.dhis.dxf2.common.JacksonUtils;
+import org.hisp.dhis.webapi.utils.ContextUtils;
+import org.springframework.web.servlet.view.AbstractView;
+
+import com.fasterxml.jackson.databind.util.JSONPObject;
+
/**
* @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
*/
public class JacksonJsonView
extends AbstractView
{
- private static String CONTENT_TYPE_APPLICATION_JSON = "application/json";
-
- private static String CONTENT_TYPE_APPLICATION_JSON_GZIP = "application/json+gzip";
-
- private static String CONTENT_TYPE_APPLICATION_JAVASCRIPT = "application/javascript";
-
- private static String CONTENT_TYPE_APPLICATION_JAVASCRIPT_GZIP = "application/javascript+gzip";
+ private static final String CONTENT_TYPE_APPLICATION_JSON = "application/json";
+ private static final String CONTENT_TYPE_APPLICATION_JSON_GZIP = "application/json+gzip";
+ private static final String CONTENT_TYPE_APPLICATION_JAVASCRIPT = "application/javascript";
+ private static final String CONTENT_TYPE_APPLICATION_JAVASCRIPT_GZIP = "application/javascript+gzip";
private boolean withPadding = false;
@@ -62,9 +60,6 @@
private String paddingFunction = "callback";
- @Autowired
- private ContextUtils contextUtils;
-
public JacksonJsonView()
{
setContentType( CONTENT_TYPE_APPLICATION_JSON );
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/view/JacksonXmlView.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/view/JacksonXmlView.java 2015-02-17 06:00:52 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/view/JacksonXmlView.java 2015-09-14 17:57:00 +0000
@@ -29,32 +29,28 @@
*/
-import org.hisp.dhis.webapi.utils.ContextUtils;
-import org.hisp.dhis.dxf2.common.JacksonUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.servlet.view.AbstractView;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
import java.io.OutputStream;
import java.util.Map;
import java.util.zip.GZIPOutputStream;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.hisp.dhis.dxf2.common.JacksonUtils;
+import org.hisp.dhis.webapi.utils.ContextUtils;
+import org.springframework.web.servlet.view.AbstractView;
+
/**
* @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
*/
public class JacksonXmlView
extends AbstractView
{
- private static String CONTENT_TYPE_APPLICATION_XML = "application/xml";
-
- private static String CONTENT_TYPE_APPLICATION_XML_GZIP = "application/xml+gzip";
+ private static final String CONTENT_TYPE_APPLICATION_XML = "application/xml";
+ private static final String CONTENT_TYPE_APPLICATION_XML_GZIP = "application/xml+gzip";
private boolean withCompression = false;
- @Autowired
- private ContextUtils contextUtils;
-
public JacksonXmlView()
{
setContentType( CONTENT_TYPE_APPLICATION_XML );