dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #26050
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12925: removed all traces of FRED UI (will be re-implemented as app later), removed extra FRED services ...
------------------------------------------------------------
revno: 12925
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2013-11-12 10:04:21 +0100
message:
removed all traces of FRED UI (will be re-implemented as app later), removed extra FRED services (validation-service etc), added proper redirect from /api/-fred => /api-fred/v1/facilities, updated tests (but still disabled)
removed:
dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/webapi/v1/controller/FacilityServiceController.java
dhis-2/dhis-web/dhis-web-api-fred/src/main/webapp/WEB-INF/api-fred-velocity/
dhis-2/dhis-web/dhis-web-api-fred/src/main/webapp/WEB-INF/api-fred-velocity/v1/
dhis-2/dhis-web/dhis-web-api-fred/src/main/webapp/WEB-INF/api-fred-velocity/v1/facilities.vm
dhis-2/dhis-web/dhis-web-api-fred/src/main/webapp/WEB-INF/api-fred-velocity/v1/facility.vm
dhis-2/dhis-web/dhis-web-api-fred/src/main/webapp/WEB-INF/api-fred-velocity/v1/index.vm
dhis-2/dhis-web/dhis-web-api-fred/src/main/webapp/WEB-INF/api-fred-velocity/v1/layout.vm
dhis-2/dhis-web/dhis-web-api-fred/src/main/webapp/api-fred-resources/
dhis-2/dhis-web/dhis-web-api-fred/src/main/webapp/api-fred-resources/js/
dhis-2/dhis-web/dhis-web-api-fred/src/main/webapp/api-fred-resources/js/markerclusterer.min.js
modified:
dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/webapi/RedirectController.java
dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/webapi/v1/controller/FacilityController.java
dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/webapi/v1/controller/FredController.java
dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/webapi/v1/utils/OrganisationUnitToFacilityConverter.java
dhis-2/dhis-web/dhis-web-api-fred/src/main/resources/META-INF/dhis/webapi-fred.xml
dhis-2/dhis-web/dhis-web-api-fred/src/test/java/org/hisp/dhis/web/webapi/v1/controller/FacilityControllerTest.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-fred/src/main/java/org/hisp/dhis/web/webapi/RedirectController.java'
--- dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/webapi/RedirectController.java 2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/webapi/RedirectController.java 2013-11-12 09:04:21 +0000
@@ -31,6 +31,9 @@
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+
/**
* @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
*/
@@ -38,8 +41,8 @@
public class RedirectController
{
@RequestMapping(value = { "/api-fred", "/" })
- public String redirectToCurrentVersion()
+ public void redirectToCurrentVersion( HttpServletResponse response ) throws IOException
{
- return "redirect:/api-fred/v1";
+ response.sendRedirect( "/api-fred/v1" );
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/webapi/v1/controller/FacilityController.java'
--- dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/webapi/v1/controller/FacilityController.java 2013-11-01 13:59:33 +0000
+++ dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/webapi/v1/controller/FacilityController.java 2013-11-12 09:04:21 +0000
@@ -29,7 +29,6 @@
*/
import com.fasterxml.jackson.databind.ObjectMapper;
-import org.apache.commons.lang3.StringEscapeUtils;
import org.hisp.dhis.api.controller.organisationunit.OrganisationUnitLevelController;
import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
import org.hisp.dhis.dataset.DataSet;
@@ -48,7 +47,6 @@
import org.hisp.dhis.web.webapi.v1.exception.ETagVerificationException;
import org.hisp.dhis.web.webapi.v1.exception.FacilityNotFoundException;
import org.hisp.dhis.web.webapi.v1.exception.UuidFormatException;
-import org.hisp.dhis.web.webapi.v1.utils.ContextUtils;
import org.hisp.dhis.web.webapi.v1.utils.MessageUtils;
import org.hisp.dhis.web.webapi.v1.utils.ValidationUtils;
import org.hisp.dhis.web.webapi.v1.validation.group.Create;
@@ -61,7 +59,6 @@
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Controller;
-import org.springframework.ui.Model;
import org.springframework.util.DigestUtils;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
@@ -246,7 +243,7 @@
}
@RequestMapping( value = "", method = RequestMethod.GET )
- public String readFacilities( Model model,
+ public ResponseEntity<Facilities> readFacilities(
@RequestParam( value = "updatedSince", required = false ) Date lastUpdated,
@RequestParam( value = "allProperties", required = false, defaultValue = "true" ) Boolean allProperties,
@RequestParam( value = "fields", required = false ) String fields,
@@ -304,26 +301,7 @@
}
}
- setAccessRights( model );
-
- model.addAttribute( "esc", StringEscapeUtils.class );
- model.addAttribute( "entity", facilities );
- ContextUtils.populateContextPath( model, request );
- model.addAttribute( "baseUrl", linkTo( FredController.class ).toString() );
- model.addAttribute( "pageName", "facilities" );
- model.addAttribute( "page", FredController.PREFIX + "/facilities.vm" );
-
- if ( offset == 0 )
- {
- model.addAttribute( "prevDisabled", true );
- }
-
- if ( (offset + (limitValue == null ? 0 : limitValue) >= organisationUnitService.getNumberOfOrganisationUnits()) )
- {
- model.addAttribute( "nextDisabled", true );
- }
-
- return FredController.PREFIX + "/layout";
+ return new ResponseEntity<Facilities>( facilities, HttpStatus.OK );
}
private Integer getLimitValue( String limit, int defaultValue )
@@ -350,7 +328,7 @@
}
@RequestMapping( value = "/{id}", method = RequestMethod.GET )
- public String readFacility( Model model, @PathVariable String id,
+ public ResponseEntity<Facility> readFacility( @PathVariable String id,
@RequestParam( value = "allProperties", required = false, defaultValue = "true" ) Boolean allProperties,
@RequestParam( value = "fields", required = false ) String fields,
HttpServletRequest request ) throws FacilityNotFoundException
@@ -373,43 +351,7 @@
facility.setHref( facility.getHref() + ".json" );
}
- setAccessRights( model );
-
- model.addAttribute( "esc", StringEscapeUtils.class );
- model.addAttribute( "entity", facility );
-
- List<DataSet> dataSets = new ArrayList<DataSet>( dataSetService.getAllDataSets() );
- Collections.sort( dataSets, IdentifiableObjectNameComparator.INSTANCE );
- model.addAttribute( "dataSets", dataSets );
-
- ContextUtils.populateContextPath( model, request );
-
- model.addAttribute( "baseUrl", linkTo( FredController.class ).toString() );
- model.addAttribute( "pageName", "facility" );
- model.addAttribute( "page", FredController.PREFIX + "/facility.vm" );
-
- return FredController.PREFIX + "/layout";
- }
-
- private void setAccessRights( Model model )
- {
- // TODO fix this, a proper mock currentuserservice should be implemented
- if ( currentUserService != null && currentUserService.getCurrentUser() != null )
- {
- Set<String> authorities = currentUserService.getCurrentUser().getUserCredentials().getAllAuthorities();
-
- model.addAttribute( "canCreate", authorities.contains( "F_FRED_CREATE" ) || currentUserService.currentUserIsSuper() );
- model.addAttribute( "canRead", authorities.contains( "M-dhis-web-api-fred" ) || currentUserService.currentUserIsSuper() );
- model.addAttribute( "canUpdate", authorities.contains( "F_FRED_UPDATE" ) || currentUserService.currentUserIsSuper() );
- model.addAttribute( "canDelete", authorities.contains( "F_FRED_DELETE" ) || currentUserService.currentUserIsSuper() );
- }
- else
- {
- model.addAttribute( "canCreate", false );
- model.addAttribute( "canRead", false );
- model.addAttribute( "canUpdate", false );
- model.addAttribute( "canDelete", false );
- }
+ return new ResponseEntity<Facility>( facility, HttpStatus.OK );
}
private void addHierarchyPropertyToFacility( List<OrganisationUnitLevel> organisationUnitLevels, Facility facility )
=== removed file 'dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/webapi/v1/controller/FacilityServiceController.java'
--- dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/webapi/v1/controller/FacilityServiceController.java 2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/webapi/v1/controller/FacilityServiceController.java 1970-01-01 00:00:00 +0000
@@ -1,263 +0,0 @@
-package org.hisp.dhis.web.webapi.v1.controller;
-
-/*
- * Copyright (c) 2004-2013, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * Neither the name of the HISP project 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 OWNER 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.
- */
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-import org.geotools.filter.text.cql2.CQL;
-import org.geotools.filter.text.cql2.CQLException;
-import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.organisationunit.OrganisationUnitService;
-import org.hisp.dhis.web.webapi.v1.domain.Facility;
-import org.hisp.dhis.web.webapi.v1.exception.DuplicateCodeException;
-import org.hisp.dhis.web.webapi.v1.exception.DuplicateUidException;
-import org.hisp.dhis.web.webapi.v1.exception.DuplicateUuidException;
-import org.hisp.dhis.web.webapi.v1.exception.FacilityNotFoundException;
-import org.hisp.dhis.web.webapi.v1.utils.ValidationUtils;
-import org.hisp.dhis.web.webapi.v1.validation.group.Create;
-import org.hisp.dhis.web.webapi.v1.validation.group.Update;
-import org.opengis.feature.simple.SimpleFeature;
-import org.opengis.filter.Filter;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Qualifier;
-import org.springframework.core.convert.ConversionService;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.MediaType;
-import org.springframework.http.ResponseEntity;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-
-import javax.validation.ConstraintViolation;
-import javax.validation.Validator;
-import javax.validation.groups.Default;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
- */
-@Controller(value = "facility-service-controller-" + FredController.PREFIX)
-@RequestMapping(FacilityServiceController.RESOURCE_PATH)
-@PreAuthorize("hasRole('M_dhis-web-api-fred') or hasRole('ALL')")
-public class FacilityServiceController
-{
- public static final String RESOURCE_PATH = "/" + FredController.PREFIX + "/facility-service";
-
- @Autowired
- private OrganisationUnitService organisationUnitService;
-
- @Autowired
- private Validator validator;
-
- @Autowired
- private ConversionService conversionService;
-
- @Autowired
- @Qualifier("objectMapperFactoryBean")
- private ObjectMapper objectMapper;
-
- //--------------------------------------------------------------------------
- // EXTRA WEB METHODS
- //--------------------------------------------------------------------------
-
- @RequestMapping(value = "/{id}/activate", method = RequestMethod.POST)
- @PreAuthorize("hasRole('F_FRED_UPDATE') or hasRole('ALL')")
- public ResponseEntity<Void> activateFacility( @PathVariable String id ) throws FacilityNotFoundException
- {
- OrganisationUnit organisationUnit = getOrganisationUnit( id );
-
- if ( organisationUnit == null )
- {
- throw new FacilityNotFoundException();
- }
-
- organisationUnit.setActive( true );
- organisationUnitService.updateOrganisationUnit( organisationUnit );
-
- return new ResponseEntity<Void>( HttpStatus.OK );
- }
-
- @RequestMapping(value = "/{id}/deactivate", method = RequestMethod.POST)
- @PreAuthorize("hasRole('F_FRED_UPDATE') or hasRole('ALL')")
- public ResponseEntity<Void> deactivateFacility( @PathVariable String id ) throws FacilityNotFoundException
- {
- OrganisationUnit organisationUnit = getOrganisationUnit( id );
-
- if ( organisationUnit == null )
- {
- throw new FacilityNotFoundException();
- }
-
- organisationUnit.setActive( false );
- organisationUnitService.updateOrganisationUnit( organisationUnit );
-
- return new ResponseEntity<Void>( HttpStatus.OK );
- }
-
- @RequestMapping(value = "/validate", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
- public ResponseEntity<String> validateFacilityForCreate( @RequestBody Facility facility ) throws Exception
- {
- Set<ConstraintViolation<Facility>> constraintViolations = validator.validate( facility, Default.class, Create.class );
-
- String json = ValidationUtils.constraintViolationsToJson( constraintViolations );
-
- HttpHeaders headers = new HttpHeaders();
- headers.add( "Content-Type", MediaType.APPLICATION_JSON_VALUE );
-
- if ( constraintViolations.isEmpty() )
- {
- OrganisationUnit organisationUnit = conversionService.convert( facility, OrganisationUnit.class );
-
- if ( organisationUnitService.getOrganisationUnit( organisationUnit.getUuid() ) != null )
- {
- throw new DuplicateUuidException();
- }
- if ( organisationUnitService.getOrganisationUnit( organisationUnit.getUid() ) != null )
- {
- throw new DuplicateUidException();
- }
- else if ( organisationUnit.getCode() != null && organisationUnitService.getOrganisationUnitByCode( organisationUnit.getCode() ) != null )
- {
- throw new DuplicateCodeException();
- }
-
- return new ResponseEntity<String>( json, headers, HttpStatus.OK );
- }
- else
- {
- return new ResponseEntity<String>( json, headers, HttpStatus.UNPROCESSABLE_ENTITY );
- }
- }
-
- @RequestMapping(value = "/validate", method = RequestMethod.PUT, consumes = MediaType.APPLICATION_JSON_VALUE)
- public ResponseEntity<String> validateFacilityForUpdate( @RequestBody Facility facility ) throws Exception
- {
- Set<ConstraintViolation<Facility>> constraintViolations = validator.validate( facility, Default.class, Update.class );
-
- String json = ValidationUtils.constraintViolationsToJson( constraintViolations );
-
- HttpHeaders headers = new HttpHeaders();
- headers.add( "Content-Type", MediaType.APPLICATION_JSON_VALUE );
-
- if ( constraintViolations.isEmpty() )
- {
- OrganisationUnit organisationUnit = conversionService.convert( facility, OrganisationUnit.class );
- OrganisationUnit ou = organisationUnitService.getOrganisationUnit( facility.getUuid() );
-
- if ( ou == null )
- {
- throw new FacilityNotFoundException();
- }
- else if ( organisationUnit.getCode() != null )
- {
- OrganisationUnit ouByCode = organisationUnitService.getOrganisationUnitByCode( organisationUnit.getCode() );
-
- if ( ouByCode != null && !ou.getUid().equals( ouByCode.getUid() ) )
- {
- throw new DuplicateCodeException();
- }
- }
-
- return new ResponseEntity<String>( json, headers, HttpStatus.OK );
- }
- else
- {
- return new ResponseEntity<String>( json, headers, HttpStatus.UNPROCESSABLE_ENTITY );
- }
- }
-
- @RequestMapping(value = "/cql", method = RequestMethod.POST, consumes = MediaType.TEXT_PLAIN_VALUE)
- public ResponseEntity<String> cqlRequest( @RequestBody String cqlString ) throws IOException, CQLException
- {
- HttpHeaders headers = new HttpHeaders();
- headers.add( "Content-Type", MediaType.APPLICATION_JSON_VALUE );
-
- if ( cqlString == null || cqlString.isEmpty() )
- {
- return new ResponseEntity<String>( "{}", headers, HttpStatus.OK );
- }
-
- Filter filter = CQL.toFilter( cqlString );
-
- List<OrganisationUnit> allOrganisationUnits = new ArrayList<OrganisationUnit>( organisationUnitService.getAllOrganisationUnits() );
- List<Facility> facilities = new ArrayList<Facility>();
-
- for ( OrganisationUnit organisationUnit : allOrganisationUnits )
- {
- if ( organisationUnit.getFeatureType() != null
- && organisationUnit.getFeatureType().equals( OrganisationUnit.FEATURETYPE_POINT )
- && organisationUnit.getCoordinates() != null && !organisationUnit.getCoordinates().isEmpty() )
- {
- SimpleFeature feature = conversionService.convert( organisationUnit, SimpleFeature.class );
-
- if ( filter.evaluate( feature ) )
- {
- Facility facility = conversionService.convert( organisationUnit, Facility.class );
- facilities.add( facility );
- }
- }
- }
-
- Map<String, Object> resultSet = new HashMap<String, Object>();
- resultSet.put( "facilities", facilities );
-
- String json = objectMapper.writeValueAsString( resultSet );
-
- return new ResponseEntity<String>( json, headers, HttpStatus.OK );
- }
-
- //--------------------------------------------------------------------------
- // UTILS
- //--------------------------------------------------------------------------
-
- private OrganisationUnit getOrganisationUnit( String id )
- {
- OrganisationUnit organisationUnit;
-
- if ( id.length() == 11 )
- {
- organisationUnit = organisationUnitService.getOrganisationUnit( id );
- }
- else
- {
- organisationUnit = organisationUnitService.getOrganisationUnitByUuid( id );
- }
-
- return organisationUnit;
- }
-}
-
=== modified file 'dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/webapi/v1/controller/FredController.java'
--- dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/webapi/v1/controller/FredController.java 2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/webapi/v1/controller/FredController.java 2013-11-12 09:04:21 +0000
@@ -28,17 +28,12 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import org.hisp.dhis.web.webapi.v1.utils.ContextUtils;
-import org.springframework.http.MediaType;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Controller;
-import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-
-import javax.servlet.http.HttpServletRequest;
-
-import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo;
+
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
/**
* @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
@@ -50,15 +45,9 @@
{
public static final String PREFIX = "v1";
- @RequestMapping(value = "", method = RequestMethod.GET, produces = { MediaType.TEXT_HTML_VALUE, MediaType.TEXT_XML_VALUE })
- public String home( Model model, HttpServletRequest request )
+ @RequestMapping( value = "" )
+ public void redirectToV1( HttpServletResponse response ) throws IOException
{
- ContextUtils.populateContextPath( model, request );
-
- model.addAttribute( "baseUrl", linkTo( FredController.class ).toString() );
- model.addAttribute( "pageName", "home" );
- model.addAttribute( "page", FredController.PREFIX + "/index.vm" );
-
- return FredController.PREFIX + "/layout";
+ response.sendRedirect( "v1/facilities" );
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/webapi/v1/utils/OrganisationUnitToFacilityConverter.java'
--- dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/webapi/v1/utils/OrganisationUnitToFacilityConverter.java 2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/webapi/v1/utils/OrganisationUnitToFacilityConverter.java 2013-11-12 09:04:21 +0000
@@ -67,7 +67,7 @@
try
{
- facility.setHref( linkTo( FacilityController.class ).slash( organisationUnit.getUid() ).toString() );
+ facility.setHref( linkTo( FacilityController.class ).slash( organisationUnit.getUuid() ).toString() );
}
catch ( IllegalStateException ignored )
{
=== modified file 'dhis-2/dhis-web/dhis-web-api-fred/src/main/resources/META-INF/dhis/webapi-fred.xml'
--- dhis-2/dhis-web/dhis-web-api-fred/src/main/resources/META-INF/dhis/webapi-fred.xml 2013-07-16 12:07:31 +0000
+++ dhis-2/dhis-web/dhis-web-api-fred/src/main/resources/META-INF/dhis/webapi-fred.xml 2013-11-12 09:04:21 +0000
@@ -49,16 +49,11 @@
<mvc:annotation-driven conversion-service="conversionService" validator="validator" />
- <bean id="velocityConfig" class="org.springframework.web.servlet.view.velocity.VelocityConfigurer">
- <property name="resourceLoaderPath" value="/WEB-INF/api-fred-velocity/" />
- </bean>
-
<bean id="headerContentNegotiationStrategy" class="org.springframework.web.accept.HeaderContentNegotiationStrategy" />
<bean id="pathExtensionContentNegotiationStrategy" class="org.springframework.web.accept.PathExtensionContentNegotiationStrategy">
<constructor-arg name="mediaTypes">
<map>
- <entry key="html" value="text/*" />
<entry key="json" value="application/json" />
</map>
</constructor-arg>
@@ -76,17 +71,6 @@
<bean class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver">
<property name="contentNegotiationManager" ref="contentNegotiationManager" />
- <property name="viewResolvers">
- <list>
- <bean id="viewResolver" class="org.springframework.web.servlet.view.velocity.VelocityViewResolver">
- <property name="cache" value="true" />
- <property name="prefix" value="" />
- <property name="suffix" value=".vm" />
- <property name="contentType" value="text/html; charset=UTF-8" />
- </bean>
- </list>
- </property>
-
<property name="defaultViews">
<list>
<bean class="org.springframework.web.servlet.view.json.MappingJackson2JsonView">
=== removed directory 'dhis-2/dhis-web/dhis-web-api-fred/src/main/webapp/WEB-INF/api-fred-velocity'
=== removed directory 'dhis-2/dhis-web/dhis-web-api-fred/src/main/webapp/WEB-INF/api-fred-velocity/v1'
=== removed file 'dhis-2/dhis-web/dhis-web-api-fred/src/main/webapp/WEB-INF/api-fred-velocity/v1/facilities.vm'
--- dhis-2/dhis-web/dhis-web-api-fred/src/main/webapp/WEB-INF/api-fred-velocity/v1/facilities.vm 2013-03-08 09:47:01 +0000
+++ dhis-2/dhis-web/dhis-web-api-fred/src/main/webapp/WEB-INF/api-fred-velocity/v1/facilities.vm 1970-01-01 00:00:00 +0000
@@ -1,209 +0,0 @@
-
-<script>
- var markers = [];
- var infoWindow;
- var map;
-
- var facilities = [
- #foreach( $facility in $entity.facilities )
- {
- id: "$facility.uuid",
- href: "$facility.href",
- name: "$esc.escapeEcmaScript($facility.name)",
- coordinates: "$facility.coordinates"
- },
- #end
- ];
-
- function loadMapsScript() {
- if (!map) {
- $.getScript('//maps.googleapis.com/maps/api/js?sensor=false&callback=mapsLoaded');
- }
- }
-
- function mapsLoaded() {
- $.getScript('$baseUrl/../../api-fred-resources/js/markerclusterer.min.js').success(initialize);
- }
-
- function initialize()
- {
- markers = [];
- infoWindows = [];
-
- var lats = 0.0;
- var lngs = 0.0;
- var n = 0;
-
- $.each(facilities, function (idx, facility) {
- if (facility.coordinates !== undefined && JSON.parse(facility.coordinates).length > 0) {
- var coords = JSON.parse(facility.coordinates);
- var latlng = new google.maps.LatLng(coords[1], coords[0]);
- var name = facility.name;
- var id = facility.uuid;
- var href = facility.href;
-
- lats += coords[1];
- lngs += coords[0];
- n += 1;
-
- var marker = new google.maps.Marker({
- position: latlng,
- title: name
- });
-
- markers.push(marker);
-
- var infoWindow= new google.maps.InfoWindow({
- content: "<div>" + "<b>" + name + "</b><br/>Latitude " + coords[1] + "<br/> Longitude " + coords[0] +
- "<br/><br/><a href='" + href + "'>More information</a></div>"
- });
-
- infoWindows.push(infoWindow);
- }
- });
-
- lats = lats / n;
- lngs = lngs / n;
-
- var latlng = new google.maps.LatLng(lats, lngs);
-
- var options = {
- zoom: 8,
- center: latlng,
- disableDefaultUI: true,
- panControl: true,
- zoomControl: true,
- mapTypeControl: true,
- mapTypeId: google.maps.MapTypeId.ROADMAP,
- mapTypeControlOptions: {
- style: google.maps.MapTypeControlStyle.DROPDOWN_MENU
- }
- };
-
- map = new google.maps.Map(document.getElementById('mapTarget'), options);
-
- $.each(markers, function (idx, item) {
- google.maps.event.addListener(item, 'click', function() {
- if(!infoWindow)
- {
- infoWindow = new google.maps.InfoWindow();
- }
-
- infoWindow.setContent( infoWindows[idx].getContent());
- infoWindow.open(map, item);
- });
- });
-
- var markerCluster = new MarkerClusterer(map, markers);
- }
-
- $(function () {
- $('.activateButton').click(function () {
- if (confirm('Are you sure you want to activate this facility?')) {
- var id = $(this).parent().parent().parent().data('facility-id');
-
- $.ajax({
- url: 'facility-service/' + id + '/activate',
- type: 'POST',
- async: false
- }).complete(function () {
- window.location.reload();
- });
- }
- });
-
- $('.deactivateButton').click(function () {
- if (confirm('Are you sure you want to de-activate this facility?')) {
- var id = $(this).parent().parent().parent().data('facility-id');
-
- $.ajax({
- url: 'facility-service/' + id + '/deactivate',
- type: 'POST',
- async: false
- }).complete(function () {
- window.location.reload();
- });
- }
- });
-
- $('#mapLink').on('show', function () {
- loadMapsScript();
- });
- });
-</script>
-
-<div class='btn-group pull-right' style='margin-left: 10px;'>
- <a href='facilities.json' class='btn btn-small btn-info' style='margin-bottom: 5px;'>
- <span class='icon-white icon-download'> </span> JSON
- </a>
-</div>
-
-<div class='tabbable'>
- <ul class='nav nav-tabs'>
- <li class='active'><a id='listLink' href='#listTab' data-toggle='tab'><span class='icon-list-alt'> </span> List</a></li>
- <li><a id='mapLink' href='#mapTab' data-toggle='tab'><span class='icon-globe'> </span> Map</a></li>
- </ul>
-
- <div class='tab-content'>
-
- <div class='tab-pane active' id='listTab'>
- #listContent()
- </div>
-
- <div class='tab-pane' id='mapTab'>
- #mapContent()
- </div>
- </div>
-
-</div>
-
-#macro( listContent )
-<table class='table table-bordered table-striped table-condensed'>
- <thead>
- <tr>
- <th>Name</th>
- <th>Actions</th>
- </tr>
- </thead>
-
- <tbody>
- #foreach( $facility in $entity.facilities )
- <tr data-facility-id='$facility.uuid'>
- <td class='facility-name'><a href='$facility.href'>$esc.escapeHtml4($facility.name)</a></td>
-
- <td class='facility-actions' style='width: 1px;'>
- <div class='btn-group'>
- #if( $facility.active )
- <button #if(!$canUpdate)disabled#end style='width: 44px;' class='deactivateButton btn btn-mini btn-success' title='Deactivate Facility'>
- <span class='icon-white icon-ok-circle'> </span>
- </button>
- #else
- <button #if(!$canUpdate)disabled#end style='width: 44px;' class='activateButton btn btn-mini btn-inverse' title='Activate Facility'>
- <span class='icon-white icon-ban-circle'> </span>
- </button>
- #end
- <button #if(true)disabled#end disabled='disabled' style='width: 42px;' class='deleteButton btn btn-mini btn-danger' title='Delete Facility'>
- <span class='icon-white icon-trash'> </span>
- </button>
- </div>
- </td>
- </tr>
- #end
- </tbody>
-</table>
-
-<div class="pagination pagination-right">
- <ul>
- #set( $nextOffset = $entity.meta.offset + $entity.meta.limit)
- #set( $prevOffset = $entity.meta.offset - $entity.meta.limit)
- <li class="#if($prevDisabled)disabled#end"><a class="prev-button" href="facilities?offset=$prevOffset">Prev</a></li>
- <li class="#if($nextDisabled)disabled#end"><a class="next-button" href="facilities?offset=$nextOffset">Next</a></li>
- </ul>
-</div>
-#end
-
-#macro( mapContent )
-<div id="mapDiv" class='span12 well' style='padding: 4px;'>
- <div style='height: 680px;' id='mapTarget'></div>
-</div>
-#end
=== removed file 'dhis-2/dhis-web/dhis-web-api-fred/src/main/webapp/WEB-INF/api-fred-velocity/v1/facility.vm'
--- dhis-2/dhis-web/dhis-web-api-fred/src/main/webapp/WEB-INF/api-fred-velocity/v1/facility.vm 2013-03-08 15:09:56 +0000
+++ dhis-2/dhis-web/dhis-web-api-fred/src/main/webapp/WEB-INF/api-fred-velocity/v1/facility.vm 1970-01-01 00:00:00 +0000
@@ -1,187 +0,0 @@
-<script src="//maps.google.com/maps/api/js?sensor=false"></script>
-
-<script>
- function updateMap(coordinates) {
- if(!coordinates[0] || !coordinates[1])
- {
- noCoordinatesProvided();
- return;
- }
-
- var latlng = new google.maps.LatLng(coordinates[1], coordinates[0]);
-
- var options = {
- zoom: 12,
- center: latlng,
- disableDefaultUI: true,
- zoomControl: true,
- mapTypeControl: true,
- mapTypeId: google.maps.MapTypeId.ROADMAP,
- mapTypeControlOptions: {
- style: google.maps.MapTypeControlStyle.DROPDOWN_MENU
- }
- };
-
- var map = new google.maps.Map(document.getElementById('mapTarget'), options);
-
- var marker = new google.maps.Marker({
- position: latlng,
- map: map,
- title: '$esc.escapeEcmaScript($entity.name)'
- });
- }
-
- function noCoordinatesProvided() {
- $( '#mapTarget' ).html( '<div style="text-align: center;">No coordinates provided.</div>' )
- .parent().addClass( 'hidden-phone' );
- }
-
- $(function () {
- var coordinates = JSON.parse("$entity.coordinates");
-
- if (coordinates.length > 0) {
- $('#facilityLatitude').val(coordinates[1]);
- $('#facilityLongitude').val(coordinates[0]);
-
- updateMap(coordinates);
- } else {
- noCoordinatesProvided();
- }
-
- $('#facilityForm').submit(function (e) {
- e.preventDefault();
- $('#facilitySubmit').attr('disabled', true).text('Saving');
-
- $.get('$baseUrl/facilities/${entity.uuid}.json').success(function (data) {
- delete data.createdAt;
- delete data.updatedAt;
- delete data.href;
-
- data.name = $('#facilityName').val();
- data.active = JSON.parse($('#facilityActive').val());
-
- var lng = $('#facilityLongitude').val();
- var lat = $('#facilityLatitude').val();
-
- data.coordinates = [ lng, lat ];
-
- data.properties = {};
- data.properties.parent = $( '#facilityDhis2Parent' ).val();
-
- var dhis2Code = $( '#facilityDhis2Code' ).val();
-
- if ( dhis2Code.length > 0 ) {
- data.identifiers = [
- {
- 'agency': 'DHIS2',
- 'context': 'DHIS2_CODE',
- 'id': dhis2Code
- }
- ]
- }
-
- var facilityDhis2DataSets = $( '#facilityDhis2DataSets :selected' );
-
- if ( facilityDhis2DataSets.length > 0 ) {
- data.properties.dataSets = [];
-
- $.each( facilityDhis2DataSets, function ( idx, item ) {
- data.properties.dataSets.push( $( item ).val() );
- } );
- }
-
- $.ajax({
- url: '$baseUrl/facilities/${entity.uuid}',
- contentType: 'application/json; charset=UTF-8',
- type: 'PUT',
- data: JSON.stringify(data),
- dataType: 'json'
- }).success(function (data) {
- updateMap([lng, lat]);
-
- $('#facilitySubmit').removeAttr('disabled').text('Save');
- }).error(function (data) {
- $('#facilitySubmit').removeAttr('disabled').text('Save');
- });
- });
- });
- });
-</script>
-
-<div class="container-fluid">
- <div class="span5 well" style="padding: 4px;">
- <div style="height: 320px;" id="mapTarget"></div>
- </div>
-
- <div class="span6">
- <form id="facilityForm">
- #set( $inputSize = "span12")
-
- <fieldset>
- <legend>Facility</legend>
-
- <label for="facilityID">UUID</label>
- <input id="facilityID" disabled="disabled" type="text" class="$inputSize" value="$entity.uuid"/>
-
- <label for="facilityName">Name</label>
- <input #if(!$canUpdate)disabled#end id="facilityName" type="text" class="$inputSize" value="$esc.escapeHtml4($entity.name)"/>
-
- <label for="facilityActive">Active</label>
- <select id="facilityActive" #if(!$canUpdate)disabled#end class="$inputSize">
- <option value="true" #if($entity.active)selected#end>Yes</option>
- <option value="false" #if(!$entity.active)selected#end>No</option>
- </select>
-
- <label for="facilityLatitude">Latitude</label>
- <input #if(!$canUpdate)disabled#end id="facilityLatitude" type="text" class="$inputSize" value=""/>
-
- <label for="facilityLongitude">Longitude</label>
- <input #if(!$canUpdate)disabled#end id="facilityLongitude" type="text" class="$inputSize" value=""/>
-
- <fieldset>
- <legend>DHIS 2</legend>
-
- #foreach( $identifier in $entity.identifiers )
- #if( $identifier.context == "DHIS2_CODE" )
- #set( $dhis2Code = $identifier.id )
- #end
- #if( $identifier.context == "DHIS2_UID" )
- #set( $dhis2Uid = $identifier.id )
- #end
- #end
-
- <label for="facilityDhis2Uid">UID</label>
- <input disabled id="facilityDhis2Uid" type="text" class="$inputSize" value="$!esc.escapeHtml4($dhis2Uid)"/>
-
- <label for="facilityDhis2Code">Code</label>
- <input #if(!$canUpdate)disabled#end id="facilityDhis2Code" type="text" class="$inputSize" value="$!esc.escapeHtml4($dhis2Code)"/>
-
- #set( $dhis2Parent = $entity.properties.get('parent') )
-
- <label for="facilityDhis2Parent">Parent</label>
- <input #if(!$canUpdate)disabled#end id="facilityDhis2Parent" type="text" class="$inputSize" value="$!esc.escapeHtml4($dhis2Parent)"/>
-
- #set( $dhis2DataSets = $entity.properties.get('dataSets') )
-
- <label for="facilityDhis2DataSets">Data Sets</label>
- <select #if(!$canUpdate)disabled#end id="facilityDhis2DataSets" class="$inputSize" multiple="multiple">
- #foreach( $dataSet in $dataSets )
- <option value="$dataSet.uid" #if( $dhis2DataSets.contains( $dataSet.uid ))selected="selected"#end>$!esc.escapeHtml4($dataSet.displayName)</option>
- #end
- </select>
-
- </fieldset>
- </fieldset>
-
- <button #if(!$canUpdate)disabled#end type="submit" id="facilitySubmit" class="btn btn-info">Save</button>
- <a id="back-button" class="btn btn-inverse pull-right" href="../facilities">Back</a>
- </form>
- </div>
-
- <div class="span1">
- <button #if(true)disabled#end style="width: 42px;" class="deleteButton btn btn-mini btn-danger pull-right" title="Delete Facility">
- <span class="icon-white icon-trash"> </span>
- </button>
- </div>
-</div>
-
=== removed file 'dhis-2/dhis-web/dhis-web-api-fred/src/main/webapp/WEB-INF/api-fred-velocity/v1/index.vm'
--- dhis-2/dhis-web/dhis-web-api-fred/src/main/webapp/WEB-INF/api-fred-velocity/v1/index.vm 2013-03-08 07:08:05 +0000
+++ dhis-2/dhis-web/dhis-web-api-fred/src/main/webapp/WEB-INF/api-fred-velocity/v1/index.vm 1970-01-01 00:00:00 +0000
@@ -1,25 +0,0 @@
-<div class="offset1 span10">
- <div class="hero-unit">
- <h2>Facility Registry Expansion Development</h2>
-
- <p style="font-size: 0.8em;">The Open Facility Registry Service Project or FRED - "Facility Registry Expansion Development" will
- model the benefits of an NHIS Health Information Exchange (HIE) and provide a roadmap for implementation of the full range of
- NHIS components. The development and documentation of a Facility Registry Service (a master facilities list along with
- documented methods of interoperability) will provide a common and replicable solution for integrated e/mHealth systems. In
- collaboration with national entities,academia, solution providers, NGOs (NetHope members) and donors, we will develop a
- standards-based service that reflect national policies and regulation, using the subset of the Facility Registry Service to
- illustrate how the rest of the NHIS components can be similarly orchestrated. In a repeatable fashion, FRED will complete the
- design, development, and reference implementation of a Facility Registry Service and prepare for its interoperability with
- existing key e/mHealth tools in multiple countries during the next 9-12 months. FRED will provide an open source,
- standards-based, repeatable approach to the implementation of a Facility Registry Service; it will at the same time accommodate
- unique national requirements as well as allow for continuous and evolutionary improvements.
- </p>
-
- <p>
- <a style="font-size: 0.8em;" class="btn btn-primary btn-large"
- href="http://facilityregistry.org/">
- Read the specification »
- </a>
- </p>
- </div>
-</div>
=== removed file 'dhis-2/dhis-web/dhis-web-api-fred/src/main/webapp/WEB-INF/api-fred-velocity/v1/layout.vm'
--- dhis-2/dhis-web/dhis-web-api-fred/src/main/webapp/WEB-INF/api-fred-velocity/v1/layout.vm 2012-12-28 11:28:02 +0000
+++ dhis-2/dhis-web/dhis-web-api-fred/src/main/webapp/WEB-INF/api-fred-velocity/v1/layout.vm 1970-01-01 00:00:00 +0000
@@ -1,71 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-
-<head>
- <meta charset="utf-8">
- <title>FRED Facility API v1.0 (DHIS2)</title>
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
-
- <script src="$contextPath/dhis-web-commons/javascripts/jQuery/jquery.min.js?v=1.8.2"></script>
- <script src="$contextPath/dhis-web-commons/bootstrap/js/bootstrap.min.js?v=2.2.2"></script>
-
- <link href="$contextPath/dhis-web-commons/bootstrap/css/bootstrap.min.css?v2.2.2" rel="stylesheet">
-
- <style>
- body {
- padding-top : 60px;
- }
- </style>
-
- <link href="$contextPath/dhis-web-commons/bootstrap/css/bootstrap-responsive.min.css?v2.2.2" rel="stylesheet">
-
- <!--[if lt IE 9]>
- <script src="http://html5shim.googlecode.com/svn/trunk/html5.js" type="text/javascript"></script>
- <![endif]-->
-
- <style>
- #mapTarget img {
- max-width : none;
- }
-
- #mapTarget label {
- width : auto;
- display : inline;
- }
- </style>
-
-</head>
-
-<body>
-
-<div class="navbar navbar-inverse navbar-fixed-top">
- <div class="navbar-inner">
- <div class="container">
- <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
- <span class="icon-bar"></span>
- <span class="icon-bar"></span>
- <span class="icon-bar"></span>
- </a>
-
- <a class="brand" href="$baseUrl">FRED API v1.0</a>
-
- <div class="nav-collapse collapse">
- <ul class="nav">
- <li #if( $pageName == "home" )class="active"#end><a href="$baseUrl"><span class="icon-home"> </span> Home</a></li>
- <li #if( $pageName == "facilities" )class="active"#end><a href="$baseUrl/facilities"><span class="icon-list-alt"> </span> Facilities</a></li>
- </ul>
- </div>
- </div>
- </div>
-</div>
-
-<div class="container-fluid">
- <div class="row-fluid">
- <div class="span12">
- #parse( $page )
- </div>
- </div>
-</div>
-
-</body>
-</html>
=== removed directory 'dhis-2/dhis-web/dhis-web-api-fred/src/main/webapp/api-fred-resources'
=== removed directory 'dhis-2/dhis-web/dhis-web-api-fred/src/main/webapp/api-fred-resources/js'
=== removed file 'dhis-2/dhis-web/dhis-web-api-fred/src/main/webapp/api-fred-resources/js/markerclusterer.min.js'
--- dhis-2/dhis-web/dhis-web-api-fred/src/main/webapp/api-fred-resources/js/markerclusterer.min.js 2012-12-08 22:01:14 +0000
+++ dhis-2/dhis-web/dhis-web-api-fred/src/main/webapp/api-fred-resources/js/markerclusterer.min.js 1970-01-01 00:00:00 +0000
@@ -1,21 +0,0 @@
-(function(){var d=null;function e(a){return function(b){this[a]=b}}function h(a){return function(){return this[a]}}var j;
-function k(a,b,c){this.extend(k,google.maps.OverlayView);this.c=a;this.a=[];this.f=[];this.ca=[53,56,66,78,90];this.j=[];this.A=!1;c=c||{};this.g=c.gridSize||60;this.l=c.minimumClusterSize||2;this.J=c.maxZoom||d;this.j=c.styles||[];this.X=c.imagePath||this.Q;this.W=c.imageExtension||this.P;this.O=!0;if(c.zoomOnClick!=void 0)this.O=c.zoomOnClick;this.r=!1;if(c.averageCenter!=void 0)this.r=c.averageCenter;l(this);this.setMap(a);this.K=this.c.getZoom();var f=this;google.maps.event.addListener(this.c,
-"zoom_changed",function(){var a=f.c.getZoom();if(f.K!=a)f.K=a,f.m()});google.maps.event.addListener(this.c,"idle",function(){f.i()});b&&b.length&&this.C(b,!1)}j=k.prototype;j.Q="http://google-maps-utility-library-v3.googlecode.com/svn/trunk/markerclusterer/images/m";j.P="png";j.extend=function(a,b){return function(a){for(var b in a.prototype)this.prototype[b]=a.prototype[b];return this}.apply(a,[b])};j.onAdd=function(){if(!this.A)this.A=!0,n(this)};j.draw=function(){};
-function l(a){if(!a.j.length)for(var b=0,c;c=a.ca[b];b++)a.j.push({url:a.X+(b+1)+"."+a.W,height:c,width:c})}j.S=function(){for(var a=this.o(),b=new google.maps.LatLngBounds,c=0,f;f=a[c];c++)b.extend(f.getPosition());this.c.fitBounds(b)};j.z=h("j");j.o=h("a");j.V=function(){return this.a.length};j.ba=e("J");j.I=h("J");j.G=function(a,b){for(var c=0,f=a.length,g=f;g!==0;)g=parseInt(g/10,10),c++;c=Math.min(c,b);return{text:f,index:c}};j.$=e("G");j.H=h("G");
-j.C=function(a,b){for(var c=0,f;f=a[c];c++)q(this,f);b||this.i()};function q(a,b){b.s=!1;b.draggable&&google.maps.event.addListener(b,"dragend",function(){b.s=!1;a.L()});a.a.push(b)}j.q=function(a,b){q(this,a);b||this.i()};function r(a,b){var c=-1;if(a.a.indexOf)c=a.a.indexOf(b);else for(var f=0,g;g=a.a[f];f++)if(g==b){c=f;break}if(c==-1)return!1;b.setMap(d);a.a.splice(c,1);return!0}j.Y=function(a,b){var c=r(this,a);return!b&&c?(this.m(),this.i(),!0):!1};
-j.Z=function(a,b){for(var c=!1,f=0,g;g=a[f];f++)g=r(this,g),c=c||g;if(!b&&c)return this.m(),this.i(),!0};j.U=function(){return this.f.length};j.getMap=h("c");j.setMap=e("c");j.w=h("g");j.aa=e("g");
-j.v=function(a){var b=this.getProjection(),c=new google.maps.LatLng(a.getNorthEast().lat(),a.getNorthEast().lng()),f=new google.maps.LatLng(a.getSouthWest().lat(),a.getSouthWest().lng()),c=b.fromLatLngToDivPixel(c);c.x+=this.g;c.y-=this.g;f=b.fromLatLngToDivPixel(f);f.x-=this.g;f.y+=this.g;c=b.fromDivPixelToLatLng(c);b=b.fromDivPixelToLatLng(f);a.extend(c);a.extend(b);return a};j.R=function(){this.m(!0);this.a=[]};
-j.m=function(a){for(var b=0,c;c=this.f[b];b++)c.remove();for(b=0;c=this.a[b];b++)c.s=!1,a&&c.setMap(d);this.f=[]};j.L=function(){var a=this.f.slice();this.f.length=0;this.m();this.i();window.setTimeout(function(){for(var b=0,c;c=a[b];b++)c.remove()},0)};j.i=function(){n(this)};
-function n(a){if(a.A)for(var b=a.v(new google.maps.LatLngBounds(a.c.getBounds().getSouthWest(),a.c.getBounds().getNorthEast())),c=0,f;f=a.a[c];c++)if(!f.s&&b.contains(f.getPosition())){for(var g=a,u=4E4,o=d,v=0,m=void 0;m=g.f[v];v++){var i=m.getCenter();if(i){var p=f.getPosition();if(!i||!p)i=0;else var w=(p.lat()-i.lat())*Math.PI/180,x=(p.lng()-i.lng())*Math.PI/180,i=Math.sin(w/2)*Math.sin(w/2)+Math.cos(i.lat()*Math.PI/180)*Math.cos(p.lat()*Math.PI/180)*Math.sin(x/2)*Math.sin(x/2),i=6371*2*Math.atan2(Math.sqrt(i),
-Math.sqrt(1-i));i<u&&(u=i,o=m)}}o&&o.F.contains(f.getPosition())?o.q(f):(m=new s(g),m.q(f),g.f.push(m))}}function s(a){this.k=a;this.c=a.getMap();this.g=a.w();this.l=a.l;this.r=a.r;this.d=d;this.a=[];this.F=d;this.n=new t(this,a.z(),a.w())}j=s.prototype;
-j.q=function(a){var b;a:if(this.a.indexOf)b=this.a.indexOf(a)!=-1;else{b=0;for(var c;c=this.a[b];b++)if(c==a){b=!0;break a}b=!1}if(b)return!1;if(this.d){if(this.r)c=this.a.length+1,b=(this.d.lat()*(c-1)+a.getPosition().lat())/c,c=(this.d.lng()*(c-1)+a.getPosition().lng())/c,this.d=new google.maps.LatLng(b,c),y(this)}else this.d=a.getPosition(),y(this);a.s=!0;this.a.push(a);b=this.a.length;b<this.l&&a.getMap()!=this.c&&a.setMap(this.c);if(b==this.l)for(c=0;c<b;c++)this.a[c].setMap(d);b>=this.l&&a.setMap(d);
-a=this.c.getZoom();if((b=this.k.I())&&a>b)for(a=0;b=this.a[a];a++)b.setMap(this.c);else if(this.a.length<this.l)z(this.n);else{b=this.k.H()(this.a,this.k.z().length);this.n.setCenter(this.d);a=this.n;a.B=b;a.ga=b.text;a.ea=b.index;if(a.b)a.b.innerHTML=b.text;b=Math.max(0,a.B.index-1);b=Math.min(a.j.length-1,b);b=a.j[b];a.da=b.url;a.h=b.height;a.p=b.width;a.M=b.textColor;a.e=b.anchor;a.N=b.textSize;a.D=b.backgroundPosition;this.n.show()}return!0};
-j.getBounds=function(){for(var a=new google.maps.LatLngBounds(this.d,this.d),b=this.o(),c=0,f;f=b[c];c++)a.extend(f.getPosition());return a};j.remove=function(){this.n.remove();this.a.length=0;delete this.a};j.T=function(){return this.a.length};j.o=h("a");j.getCenter=h("d");function y(a){a.F=a.k.v(new google.maps.LatLngBounds(a.d,a.d))}j.getMap=h("c");
-function t(a,b,c){a.k.extend(t,google.maps.OverlayView);this.j=b;this.fa=c||0;this.u=a;this.d=d;this.c=a.getMap();this.B=this.b=d;this.t=!1;this.setMap(this.c)}j=t.prototype;
-j.onAdd=function(){this.b=document.createElement("DIV");if(this.t)this.b.style.cssText=A(this,B(this,this.d)),this.b.innerHTML=this.B.text;this.getPanes().overlayMouseTarget.appendChild(this.b);var a=this;google.maps.event.addDomListener(this.b,"click",function(){var b=a.u.k;google.maps.event.trigger(b,"clusterclick",a.u);b.O&&a.c.fitBounds(a.u.getBounds())})};function B(a,b){var c=a.getProjection().fromLatLngToDivPixel(b);c.x-=parseInt(a.p/2,10);c.y-=parseInt(a.h/2,10);return c}
-j.draw=function(){if(this.t){var a=B(this,this.d);this.b.style.top=a.y+"px";this.b.style.left=a.x+"px"}};function z(a){if(a.b)a.b.style.display="none";a.t=!1}j.show=function(){if(this.b)this.b.style.cssText=A(this,B(this,this.d)),this.b.style.display="";this.t=!0};j.remove=function(){this.setMap(d)};j.onRemove=function(){if(this.b&&this.b.parentNode)z(this),this.b.parentNode.removeChild(this.b),this.b=d};j.setCenter=e("d");
-function A(a,b){var c=[];c.push("background-image:url("+a.da+");");c.push("background-position:"+(a.D?a.D:"0 0")+";");typeof a.e==="object"?(typeof a.e[0]==="number"&&a.e[0]>0&&a.e[0]<a.h?c.push("height:"+(a.h-a.e[0])+"px; padding-top:"+a.e[0]+"px;"):c.push("height:"+a.h+"px; line-height:"+a.h+"px;"),typeof a.e[1]==="number"&&a.e[1]>0&&a.e[1]<a.p?c.push("width:"+(a.p-a.e[1])+"px; padding-left:"+a.e[1]+"px;"):c.push("width:"+a.p+"px; text-align:center;")):c.push("height:"+a.h+"px; line-height:"+a.h+
-"px; width:"+a.p+"px; text-align:center;");c.push("cursor:pointer; top:"+b.y+"px; left:"+b.x+"px; color:"+(a.M?a.M:"black")+"; position:absolute; font-size:"+(a.N?a.N:11)+"px; font-family:Arial,sans-serif; font-weight:bold");return c.join("")}window.MarkerClusterer=k;k.prototype.addMarker=k.prototype.q;k.prototype.addMarkers=k.prototype.C;k.prototype.clearMarkers=k.prototype.R;k.prototype.fitMapToMarkers=k.prototype.S;k.prototype.getCalculator=k.prototype.H;k.prototype.getGridSize=k.prototype.w;
-k.prototype.getExtendedBounds=k.prototype.v;k.prototype.getMap=k.prototype.getMap;k.prototype.getMarkers=k.prototype.o;k.prototype.getMaxZoom=k.prototype.I;k.prototype.getStyles=k.prototype.z;k.prototype.getTotalClusters=k.prototype.U;k.prototype.getTotalMarkers=k.prototype.V;k.prototype.redraw=k.prototype.i;k.prototype.removeMarker=k.prototype.Y;k.prototype.removeMarkers=k.prototype.Z;k.prototype.resetViewport=k.prototype.m;k.prototype.repaint=k.prototype.L;k.prototype.setCalculator=k.prototype.$;
-k.prototype.setGridSize=k.prototype.aa;k.prototype.setMaxZoom=k.prototype.ba;k.prototype.onAdd=k.prototype.onAdd;k.prototype.draw=k.prototype.draw;s.prototype.getCenter=s.prototype.getCenter;s.prototype.getSize=s.prototype.T;s.prototype.getMarkers=s.prototype.o;t.prototype.onAdd=t.prototype.onAdd;t.prototype.draw=t.prototype.draw;t.prototype.onRemove=t.prototype.onRemove;
-})();
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-api-fred/src/test/java/org/hisp/dhis/web/webapi/v1/controller/FacilityControllerTest.java'
--- dhis-2/dhis-web/dhis-web-api-fred/src/test/java/org/hisp/dhis/web/webapi/v1/controller/FacilityControllerTest.java 2013-10-08 07:49:23 +0000
+++ dhis-2/dhis-web/dhis-web-api-fred/src/test/java/org/hisp/dhis/web/webapi/v1/controller/FacilityControllerTest.java 2013-11-12 09:04:21 +0000
@@ -47,7 +47,7 @@
/**
* @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
*/
-@Ignore //TODO Enable as integration test
+@Ignore
public class FacilityControllerTest extends FredSpringWebTest
{
@Autowired
@@ -72,7 +72,7 @@
MockHttpSession session = getSession( "ALL" );
mvc.perform( get( "/v1/facilities" ).session( session ).accept( MediaType.APPLICATION_JSON ) )
- .andExpect( content().contentType( MediaType.APPLICATION_JSON ) )
+ .andExpect( content().contentTypeCompatibleWith( MediaType.APPLICATION_JSON ) )
.andExpect( jsonPath( "$.facilities" ).isArray() )
.andExpect( status().isOk() );
}
@@ -83,7 +83,7 @@
MockHttpSession session = getSession( "M_dhis-web-api-fred" );
mvc.perform( get( "/v1/facilities" ).session( session ).accept( MediaType.APPLICATION_JSON ) )
- .andExpect( content().contentType( MediaType.APPLICATION_JSON ) )
+ .andExpect( content().contentTypeCompatibleWith( MediaType.APPLICATION_JSON ) )
.andExpect( jsonPath( "$.facilities" ).isArray() )
.andExpect( status().isOk() );
}
@@ -106,7 +106,7 @@
MockHttpSession session = getSession( "ALL" );
mvc.perform( get( "/v1/facilities" ).session( session ).accept( MediaType.APPLICATION_JSON ) )
- .andExpect( content().contentType( MediaType.APPLICATION_JSON ) )
+ .andExpect( content().contentTypeCompatibleWith( MediaType.APPLICATION_JSON ) )
.andExpect( jsonPath( "$.facilities" ).isArray() )
.andExpect( jsonPath( "$.facilities[0].name" ).value( "OrgUnitA" ) )
.andExpect( status().isOk() );
@@ -118,7 +118,7 @@
MockHttpSession session = getSession( "ALL" );
mvc.perform( get( "/v1/facilities/abc123" ).session( session ).accept( MediaType.APPLICATION_JSON ) )
- .andExpect( content().contentType( MediaType.APPLICATION_JSON ) )
+ .andExpect( content().contentTypeCompatibleWith( MediaType.APPLICATION_JSON ) )
.andExpect( jsonPath( "$.code" ).value( HttpStatus.NOT_FOUND.toString() ) )
.andExpect( status().isNotFound() );
}
@@ -133,7 +133,7 @@
mvc.perform( get( "/v1/facilities/" + organisationUnit.getUid() ).session( session ).accept( MediaType.APPLICATION_JSON ) )
.andExpect( header().string( "ETag", Matchers.notNullValue() ) )
- .andExpect( content().contentType( MediaType.APPLICATION_JSON ) )
+ .andExpect( content().contentTypeCompatibleWith( MediaType.APPLICATION_JSON ) )
.andExpect( status().isOk() );
}
@@ -146,7 +146,7 @@
MockHttpSession session = getSession( "ALL" );
mvc.perform( get( "/v1/facilities/" + organisationUnit.getUid() ).session( session ).accept( MediaType.APPLICATION_JSON ) )
- .andExpect( content().contentType( MediaType.APPLICATION_JSON ) )
+ .andExpect( content().contentTypeCompatibleWith( MediaType.APPLICATION_JSON ) )
.andExpect( jsonPath( "$.uuid", Matchers.notNullValue() ) )
.andExpect( jsonPath( "$.name" ).value( "OrgUnitA" ) )
.andExpect( jsonPath( "$.active" ).value( true ) )
@@ -165,7 +165,7 @@
MockHttpSession session = getSession( "ALL" );
mvc.perform( get( "/v1/facilities/" + organisationUnit.getUuid() ).session( session ).accept( MediaType.APPLICATION_JSON ) )
- .andExpect( content().contentType( MediaType.APPLICATION_JSON ) )
+ .andExpect( content().contentTypeCompatibleWith( MediaType.APPLICATION_JSON ) )
.andExpect( jsonPath( "$.uuid", Matchers.notNullValue() ) )
.andExpect( jsonPath( "$.name" ).value( "OrgUnitA" ) )
.andExpect( jsonPath( "$.active" ).value( true ) )
@@ -185,7 +185,7 @@
MockHttpSession session = getSession( "ALL" );
mvc.perform( put( "/v1/facilities/INVALID_IDENTIFIER" ).content( "{}" ).session( session ).contentType( MediaType.APPLICATION_JSON ) )
- .andExpect( content().contentType( MediaType.APPLICATION_JSON ) )
+ .andExpect( content().contentTypeCompatibleWith( MediaType.APPLICATION_JSON ) )
.andExpect( jsonPath( "$.code" ).value( HttpStatus.NOT_FOUND.toString() ) )
.andExpect( status().isNotFound() );
}
@@ -256,7 +256,7 @@
mvc.perform( put( "/v1/facilities/" + organisationUnit.getUid() ).content( objectMapper.writeValueAsString( facility ) )
.session( session ).contentType( MediaType.APPLICATION_JSON ) )
- .andExpect( content().contentType( MediaType.APPLICATION_JSON ) )
+ .andExpect( content().contentTypeCompatibleWith( MediaType.APPLICATION_JSON ) )
.andExpect( jsonPath( "$.uuid", Matchers.notNullValue() ) )
.andExpect( jsonPath( "$.name" ).value( "FacilityB" ) )
.andExpect( jsonPath( "$.active" ).value( false ) )
@@ -280,7 +280,7 @@
mvc.perform( put( "/v1/facilities/" + organisationUnit.getUuid() ).content( objectMapper.writeValueAsString( facility ) )
.session( session ).contentType( MediaType.APPLICATION_JSON ) )
- .andExpect( content().contentType( MediaType.APPLICATION_JSON ) )
+ .andExpect( content().contentTypeCompatibleWith( MediaType.APPLICATION_JSON ) )
.andExpect( jsonPath( "$.uuid", Matchers.notNullValue() ) )
.andExpect( jsonPath( "$.name" ).value( "FacilityB" ) )
.andExpect( jsonPath( "$.active" ).value( false ) )
@@ -303,7 +303,7 @@
mvc.perform( put( "/v1/facilities/" + organisationUnit.getUuid() ).content( objectMapper.writeValueAsString( facility ) )
.session( session ).contentType( MediaType.APPLICATION_JSON ) )
- .andExpect( content().contentType( MediaType.APPLICATION_JSON ) )
+ .andExpect( content().contentTypeCompatibleWith( MediaType.APPLICATION_JSON ) )
.andExpect( status().isPreconditionFailed() );
}
@@ -336,7 +336,7 @@
mvc.perform( post( "/v1/facilities" ).content( "{}" )
.session( session ).contentType( MediaType.APPLICATION_JSON ) )
- .andExpect( content().contentType( MediaType.APPLICATION_JSON ) )
+ .andExpect( content().contentTypeCompatibleWith( MediaType.APPLICATION_JSON ) )
.andExpect( status().isUnprocessableEntity() );
}
@@ -350,7 +350,7 @@
mvc.perform( post( "/v1/facilities" ).content( objectMapper.writeValueAsString( facility ) )
.session( session ).contentType( MediaType.APPLICATION_JSON ) )
- .andExpect( content().contentType( MediaType.APPLICATION_JSON ) )
+ .andExpect( content().contentTypeCompatibleWith( MediaType.APPLICATION_JSON ) )
.andExpect( status().isPreconditionFailed() );
}
@@ -363,7 +363,7 @@
mvc.perform( post( "/v1/facilities" ).content( objectMapper.writeValueAsString( facility ) )
.session( session ).contentType( MediaType.APPLICATION_JSON ) )
- .andExpect( content().contentType( MediaType.APPLICATION_JSON ) )
+ .andExpect( content().contentTypeCompatibleWith( MediaType.APPLICATION_JSON ) )
.andExpect( jsonPath( "$.uuid", Matchers.notNullValue() ) )
.andExpect( jsonPath( "$.name" ).value( "FacilityA" ) )
.andExpect( jsonPath( "$.active" ).value( true ) )
@@ -383,7 +383,7 @@
mvc.perform( post( "/v1/facilities" ).content( objectMapper.writeValueAsString( facility ) )
.session( session ).contentType( MediaType.APPLICATION_JSON ) )
- .andExpect( content().contentType( MediaType.APPLICATION_JSON ) )
+ .andExpect( content().contentTypeCompatibleWith( MediaType.APPLICATION_JSON ) )
.andExpect( jsonPath( "$.uuid" ).value( "aabbccdd-aabb-aabb-aabb-aabbccddeeff" ) )
.andExpect( jsonPath( "$.name" ).value( "FacilityA" ) )
.andExpect( jsonPath( "$.active" ).value( true ) )
@@ -402,7 +402,7 @@
mvc.perform( post( "/v1/facilities" ).content( objectMapper.writeValueAsString( facility ) )
.session( session ).contentType( MediaType.APPLICATION_JSON ) )
- .andExpect( content().contentType( MediaType.APPLICATION_JSON ) )
+ .andExpect( content().contentTypeCompatibleWith( MediaType.APPLICATION_JSON ) )
.andExpect( jsonPath( "$.uuid", Matchers.notNullValue() ) )
.andExpect( jsonPath( "$.name" ).value( "FacilityA" ) )
.andExpect( jsonPath( "$.active" ).value( false ) )
@@ -421,7 +421,7 @@
mvc.perform( post( "/v1/facilities" ).content( objectMapper.writeValueAsString( facility ) )
.session( session ).contentType( MediaType.APPLICATION_JSON ) )
- .andExpect( content().contentType( MediaType.APPLICATION_JSON ) )
+ .andExpect( content().contentTypeCompatibleWith( MediaType.APPLICATION_JSON ) )
.andExpect( jsonPath( "$.uuid", Matchers.notNullValue() ) )
.andExpect( jsonPath( "$.name" ).value( "FacilityA" ) )
.andExpect( jsonPath( "$.active" ).value( true ) )
@@ -432,7 +432,7 @@
mvc.perform( post( "/v1/facilities" ).content( objectMapper.writeValueAsString( facility ) )
.session( session ).contentType( MediaType.APPLICATION_JSON ) )
- .andExpect( content().contentType( MediaType.APPLICATION_JSON ) )
+ .andExpect( content().contentTypeCompatibleWith( MediaType.APPLICATION_JSON ) )
.andExpect( jsonPath( "$.uuid", Matchers.notNullValue() ) )
.andExpect( jsonPath( "$.name" ).value( "FacilityA" ) )
.andExpect( jsonPath( "$.active" ).value( true ) )
@@ -461,7 +461,7 @@
MockHttpSession session = getSession( "ALL" );
mvc.perform( delete( "/v1/facilities/INVALID_IDENTIFIER" ).session( session ) )
- .andExpect( content().contentType( MediaType.APPLICATION_JSON ) )
+ .andExpect( content().contentTypeCompatibleWith( MediaType.APPLICATION_JSON ) )
.andExpect( jsonPath( "$.code" ).value( HttpStatus.NOT_FOUND.toString() ) )
.andExpect( status().isNotFound() );
}
@@ -475,7 +475,7 @@
MockHttpSession session = getSession( "ALL" );
mvc.perform( delete( "/v1/facilities/" + organisationUnit.getUid() ).session( session ) )
- .andExpect( content().contentType( MediaType.APPLICATION_JSON ) )
+ .andExpect( content().contentTypeCompatibleWith( MediaType.APPLICATION_JSON ) )
.andExpect( status().isOk() );
}
@@ -488,7 +488,7 @@
MockHttpSession session = getSession( "ALL" );
mvc.perform( delete( "/v1/facilities/" + organisationUnit.getUuid() ).session( session ) )
- .andExpect( content().contentType( MediaType.APPLICATION_JSON ) )
+ .andExpect( content().contentTypeCompatibleWith( MediaType.APPLICATION_JSON ) )
.andExpect( status().isOk() );
}