dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #35933
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18402: compilation fix
------------------------------------------------------------
revno: 18402
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2015-02-25 13:32:18 +0700
message:
compilation fix
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/ChartController.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DashboardController.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/IdentifiableObjectController.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/ReportTableController.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/EventChartController.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/EventReportController.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/legend/LegendSetController.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/user/UserController.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-02-25 06:11:43 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/AbstractCrudController.java 2015-02-25 06:32:18 +0000
@@ -361,6 +361,8 @@
public void postXmlObject( ImportOptions importOptions, HttpServletRequest request, HttpServletResponse response )
throws Exception
{
+ System.err.println( "MERGE: " + importOptions.getMergeStrategy() );
+
if ( !aclService.canCreate( currentUserService.getCurrentUser(), getEntityClass() ) )
{
throw new CreateAccessDeniedException( "You don't have the proper permissions to create this object." );
=== 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-02-17 06:00:52 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/ChartController.java 2015-02-25 06:32:18 +0000
@@ -47,6 +47,7 @@
import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
import org.hisp.dhis.dataelement.DataElementCategoryService;
import org.hisp.dhis.dataelement.DataElementService;
+import org.hisp.dhis.dxf2.common.ImportOptions;
import org.hisp.dhis.dxf2.common.JacksonUtils;
import org.hisp.dhis.i18n.I18nFormat;
import org.hisp.dhis.i18n.I18nManager;
@@ -112,7 +113,7 @@
@Override
@RequestMapping( method = RequestMethod.POST, consumes = "application/json" )
- public void postJsonObject( HttpServletRequest request, HttpServletResponse response ) throws Exception
+ public void postJsonObject( ImportOptions importOptions, HttpServletRequest request, HttpServletResponse response ) throws Exception
{
Chart chart = JacksonUtils.fromJson( request.getInputStream(), Chart.class );
@@ -125,7 +126,7 @@
@Override
@RequestMapping( value = "/{uid}", method = RequestMethod.PUT, consumes = "application/json" )
- public void putJsonObject( @PathVariable( "uid" ) String uid, HttpServletRequest request, HttpServletResponse response ) throws Exception
+ public void putJsonObject( ImportOptions importOptions, @PathVariable( "uid" ) String uid, HttpServletRequest request, HttpServletResponse response ) throws Exception
{
Chart chart = chartService.getChart( uid );
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DashboardController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DashboardController.java 2015-02-17 06:00:52 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DashboardController.java 2015-02-25 06:32:18 +0000
@@ -33,6 +33,7 @@
import org.hisp.dhis.dashboard.DashboardItem;
import org.hisp.dhis.dashboard.DashboardSearchResult;
import org.hisp.dhis.dashboard.DashboardService;
+import org.hisp.dhis.dxf2.common.ImportOptions;
import org.hisp.dhis.dxf2.common.JacksonUtils;
import org.hisp.dhis.hibernate.exception.DeleteAccessDeniedException;
import org.hisp.dhis.schema.descriptors.DashboardItemSchemaDescriptor;
@@ -79,7 +80,7 @@
@Override
@RequestMapping( method = RequestMethod.POST, consumes = "application/json" )
- public void postJsonObject( HttpServletRequest request, HttpServletResponse response ) throws Exception
+ public void postJsonObject( ImportOptions importOptions, HttpServletRequest request, HttpServletResponse response ) throws Exception
{
Dashboard dashboard = JacksonUtils.fromJson( request.getInputStream(), Dashboard.class );
@@ -91,7 +92,7 @@
@Override
@RequestMapping( value = "/{uid}", method = RequestMethod.PUT, consumes = "application/json" )
- public void putJsonObject( @PathVariable( "uid" ) String uid, HttpServletRequest request, HttpServletResponse response ) throws Exception
+ public void putJsonObject( ImportOptions importOptions, @PathVariable( "uid" ) String uid, HttpServletRequest request, HttpServletResponse response ) throws Exception
{
Dashboard dashboard = dashboardService.getDashboard( uid );
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/IdentifiableObjectController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/IdentifiableObjectController.java 2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/IdentifiableObjectController.java 2015-02-25 06:32:18 +0000
@@ -31,6 +31,7 @@
import com.google.common.base.Optional;
import com.google.common.collect.Lists;
import org.hisp.dhis.common.IdentifiableObject;
+import org.hisp.dhis.dxf2.common.ImportOptions;
import org.hisp.dhis.webapi.webdomain.WebOptions;
import org.springframework.stereotype.Controller;
import org.springframework.web.HttpRequestMethodNotSupportedException;
@@ -66,19 +67,19 @@
}
@Override
- public void postXmlObject( HttpServletRequest request, HttpServletResponse response ) throws Exception
- {
- throw new HttpRequestMethodNotSupportedException( "POST" );
- }
-
- @Override
- public void postJsonObject( HttpServletRequest request, HttpServletResponse response ) throws Exception
- {
- throw new HttpRequestMethodNotSupportedException( "POST" );
- }
-
- @Override
- public void putJsonObject( @PathVariable( "uid" ) String pvUid, HttpServletRequest request, HttpServletResponse response ) throws Exception
+ public void postXmlObject( ImportOptions importOptions, HttpServletRequest request, HttpServletResponse response ) throws Exception
+ {
+ throw new HttpRequestMethodNotSupportedException( "POST" );
+ }
+
+ @Override
+ public void postJsonObject( ImportOptions importOptions, HttpServletRequest request, HttpServletResponse response ) throws Exception
+ {
+ throw new HttpRequestMethodNotSupportedException( "POST" );
+ }
+
+ @Override
+ public void putJsonObject( ImportOptions importOptions, @PathVariable( "uid" ) String pvUid, HttpServletRequest request, HttpServletResponse response ) throws Exception
{
throw new HttpRequestMethodNotSupportedException( "PUT" );
}
=== 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-02-20 09:14:02 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/MessageConversationController.java 2015-02-25 06:32:18 +0000
@@ -31,6 +31,7 @@
import com.google.common.collect.Lists;
import org.hisp.dhis.acl.AclService;
import org.hisp.dhis.common.Pager;
+import org.hisp.dhis.dxf2.common.ImportOptions;
import org.hisp.dhis.dxf2.common.TranslateOptions;
import org.hisp.dhis.dxf2.common.JacksonUtils;
import org.hisp.dhis.hibernate.exception.DeleteAccessDeniedException;
@@ -159,14 +160,14 @@
//--------------------------------------------------------------------------
@Override
- public void postXmlObject( HttpServletRequest request, HttpServletResponse response ) throws Exception
+ public void postXmlObject( ImportOptions importOptions, HttpServletRequest request, HttpServletResponse response ) throws Exception
{
MessageConversation messageConversation = JacksonUtils.fromXml( request.getInputStream(), MessageConversation.class );
postObject( response, request, messageConversation );
}
@Override
- public void postJsonObject( HttpServletRequest request, HttpServletResponse response ) throws Exception
+ public void postJsonObject( ImportOptions importOptions, HttpServletRequest request, HttpServletResponse response ) throws Exception
{
MessageConversation messageConversation = JacksonUtils.fromJson( request.getInputStream(), MessageConversation.class );
postObject( response, request, messageConversation );
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/ReportTableController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/ReportTableController.java 2015-02-24 13:16:58 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/ReportTableController.java 2015-02-25 06:32:18 +0000
@@ -41,6 +41,7 @@
import org.hisp.dhis.common.DimensionService;
import org.hisp.dhis.common.Grid;
import org.hisp.dhis.common.MergeStrategy;
+import org.hisp.dhis.dxf2.common.ImportOptions;
import org.hisp.dhis.dxf2.common.JacksonUtils;
import org.hisp.dhis.i18n.I18nFormat;
import org.hisp.dhis.i18n.I18nManager;
@@ -101,7 +102,7 @@
@Override
@RequestMapping( method = RequestMethod.POST, consumes = "application/json" )
- public void postJsonObject( HttpServletRequest request, HttpServletResponse response ) throws Exception
+ public void postJsonObject( ImportOptions importOptions, HttpServletRequest request, HttpServletResponse response ) throws Exception
{
ReportTable reportTable = JacksonUtils.fromJson( request.getInputStream(), ReportTable.class );
@@ -114,7 +115,7 @@
@Override
@RequestMapping( value = "/{uid}", method = RequestMethod.PUT, consumes = "application/json" )
- public void putJsonObject( @PathVariable String uid, HttpServletRequest request, HttpServletResponse response ) throws Exception
+ public void putJsonObject( ImportOptions importOptions, @PathVariable String uid, HttpServletRequest request, HttpServletResponse response ) throws Exception
{
ReportTable reportTable = reportTableService.getReportTable( uid );
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/EventChartController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/EventChartController.java 2015-02-18 17:33:23 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/EventChartController.java 2015-02-25 06:32:18 +0000
@@ -41,6 +41,7 @@
import org.hisp.dhis.chart.ChartService;
import org.hisp.dhis.common.DimensionService;
import org.hisp.dhis.common.MergeStrategy;
+import org.hisp.dhis.dxf2.common.ImportOptions;
import org.hisp.dhis.dxf2.common.JacksonUtils;
import org.hisp.dhis.eventchart.EventChart;
import org.hisp.dhis.eventchart.EventChartService;
@@ -104,7 +105,7 @@
@Override
@RequestMapping( method = RequestMethod.POST, consumes = "application/json" )
- public void postJsonObject( HttpServletRequest request, HttpServletResponse response ) throws Exception
+ public void postJsonObject( ImportOptions importOptions, HttpServletRequest request, HttpServletResponse response ) throws Exception
{
EventChart eventChart = JacksonUtils.fromJson( request.getInputStream(), EventChart.class );
@@ -117,7 +118,7 @@
@Override
@RequestMapping( value = "/{uid}", method = RequestMethod.PUT, consumes = "application/json" )
- public void putJsonObject( @PathVariable String uid, HttpServletRequest request, HttpServletResponse response ) throws Exception
+ public void putJsonObject( ImportOptions importOptions, @PathVariable String uid, HttpServletRequest request, HttpServletResponse response ) throws Exception
{
EventChart eventChart = eventChartService.getEventChart( uid );
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/EventReportController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/EventReportController.java 2015-02-18 17:33:23 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/EventReportController.java 2015-02-25 06:32:18 +0000
@@ -37,6 +37,7 @@
import org.hisp.dhis.common.DimensionService;
import org.hisp.dhis.common.MergeStrategy;
+import org.hisp.dhis.dxf2.common.ImportOptions;
import org.hisp.dhis.dxf2.common.JacksonUtils;
import org.hisp.dhis.eventreport.EventReport;
import org.hisp.dhis.eventreport.EventReportService;
@@ -84,7 +85,7 @@
@Override
@RequestMapping( method = RequestMethod.POST, consumes = "application/json" )
- public void postJsonObject( HttpServletRequest request, HttpServletResponse response ) throws Exception
+ public void postJsonObject( ImportOptions importOptions, HttpServletRequest request, HttpServletResponse response ) throws Exception
{
EventReport report = JacksonUtils.fromJson( request.getInputStream(), EventReport.class );
@@ -97,7 +98,7 @@
@Override
@RequestMapping( value = "/{uid}", method = RequestMethod.PUT, consumes = "application/json" )
- public void putJsonObject( @PathVariable String uid, HttpServletRequest request, HttpServletResponse response ) throws Exception
+ public void putJsonObject( ImportOptions importOptions, @PathVariable String uid, HttpServletRequest request, HttpServletResponse response ) throws Exception
{
EventReport report = eventReportService.getEventReport( uid );
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/legend/LegendSetController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/legend/LegendSetController.java 2015-02-24 20:43:31 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/legend/LegendSetController.java 2015-02-25 06:32:18 +0000
@@ -28,12 +28,8 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import java.util.Iterator;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
import org.hisp.dhis.common.MergeStrategy;
+import org.hisp.dhis.dxf2.common.ImportOptions;
import org.hisp.dhis.dxf2.common.JacksonUtils;
import org.hisp.dhis.legend.Legend;
import org.hisp.dhis.legend.LegendService;
@@ -48,6 +44,10 @@
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.util.Iterator;
+
/**
* @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
*/
@@ -62,7 +62,7 @@
@Override
@RequestMapping( method = RequestMethod.POST, consumes = "application/json" )
@PreAuthorize( "hasRole('F_GIS_ADMIN') or hasRole('ALL')" )
- public void postJsonObject( HttpServletRequest request, HttpServletResponse response ) throws Exception
+ public void postJsonObject( ImportOptions importOptions, HttpServletRequest request, HttpServletResponse response ) throws Exception
{
LegendSet legendSet = JacksonUtils.fromJson( request.getInputStream(), LegendSet.class );
@@ -79,7 +79,7 @@
@Override
@RequestMapping( value = "/{uid}", method = RequestMethod.PUT, consumes = "application/json" )
@PreAuthorize( "hasRole('F_GIS_ADMIN') or hasRole('ALL')" )
- public void putJsonObject( @PathVariable String uid, HttpServletRequest request, HttpServletResponse response ) throws Exception
+ public void putJsonObject( ImportOptions importOptions, @PathVariable String uid, HttpServletRequest request, HttpServletResponse response ) throws Exception
{
LegendSet legendSet = legendService.getLegendSet( uid );
=== 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-02-24 13:16:58 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/mapping/MapController.java 2015-02-25 06:32:18 +0000
@@ -41,6 +41,7 @@
import org.hisp.dhis.common.DimensionService;
import org.hisp.dhis.common.MergeStrategy;
+import org.hisp.dhis.dxf2.common.ImportOptions;
import org.hisp.dhis.dxf2.common.JacksonUtils;
import org.hisp.dhis.i18n.I18nFormat;
import org.hisp.dhis.i18n.I18nManager;
@@ -115,7 +116,7 @@
@Override
@RequestMapping( method = RequestMethod.POST, consumes = "application/json" )
- public void postJsonObject( HttpServletRequest request, HttpServletResponse response ) throws Exception
+ public void postJsonObject( ImportOptions importOptions, HttpServletRequest request, HttpServletResponse response ) throws Exception
{
Map map = JacksonUtils.fromJson( request.getInputStream(), Map.class );
@@ -135,7 +136,7 @@
@Override
@RequestMapping( value = "/{uid}", method = RequestMethod.PUT, consumes = "application/json" )
- public void putJsonObject( @PathVariable String uid, HttpServletRequest request, HttpServletResponse response ) throws Exception
+ public void putJsonObject( ImportOptions importOptions, @PathVariable String uid, HttpServletRequest request, HttpServletResponse response ) throws Exception
{
Map map = mappingService.getMap( uid );
=== 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-02-20 09:14:02 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/user/UserController.java 2015-02-25 06:32:18 +0000
@@ -28,21 +28,14 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-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 com.google.common.base.Optional;
+import com.google.common.collect.Lists;
import org.apache.commons.lang3.StringUtils;
import org.hisp.dhis.common.CodeGenerator;
import org.hisp.dhis.common.IdentifiableObjectUtils;
import org.hisp.dhis.common.MergeStrategy;
import org.hisp.dhis.common.Pager;
+import org.hisp.dhis.dxf2.common.ImportOptions;
import org.hisp.dhis.dxf2.importsummary.ImportStatus;
import org.hisp.dhis.dxf2.importsummary.ImportSummary;
import org.hisp.dhis.dxf2.metadata.ImportTypeSummary;
@@ -74,8 +67,14 @@
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
-import com.google.common.base.Optional;
-import com.google.common.collect.Lists;
+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;
/**
* @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
@@ -87,7 +86,7 @@
{
public static final String INVITE_PATH = "/invite";
public static final String BULK_INVITE_PATH = "/invites";
-
+
private static final String KEY_USERNAME = "username";
private static final String KEY_PASSWORD = "password";
@@ -173,7 +172,7 @@
@Override
@RequestMapping( method = RequestMethod.POST, consumes = { "application/xml", "text/xml" } )
- public void postXmlObject( HttpServletRequest request, HttpServletResponse response ) throws Exception
+ public void postXmlObject( ImportOptions importOptions, HttpServletRequest request, HttpServletResponse response ) throws Exception
{
User user = renderService.fromXml( request.getInputStream(), getEntityClass() );
@@ -187,7 +186,7 @@
@Override
@RequestMapping( method = RequestMethod.POST, consumes = "application/json" )
- public void postJsonObject( HttpServletRequest request, HttpServletResponse response ) throws Exception
+ public void postJsonObject( ImportOptions importOptions, HttpServletRequest request, HttpServletResponse response ) throws Exception
{
User user = renderService.fromJson( request.getInputStream(), getEntityClass() );
@@ -266,27 +265,27 @@
@SuppressWarnings( "unchecked" )
@PreAuthorize( "hasRole('ALL')" )
@RequestMapping( value = "/{uid}/replica", method = RequestMethod.POST )
- public void replicateUser( @PathVariable String uid,
+ public void replicateUser( @PathVariable String uid,
HttpServletRequest request, HttpServletResponse response ) throws IOException
{
User existingUser = userService.getUser( uid );
-
+
if ( existingUser == null || existingUser.getUserCredentials() == null )
{
ContextUtils.conflictResponse( response, "User not found: " + uid );
return;
}
-
+
if ( !validateCreateUser( existingUser, response ) )
{
return;
}
-
+
Map<String, String> auth = renderService.fromJson( request.getInputStream(), Map.class );
String username = StringUtils.trimToNull( auth != null ? auth.get( KEY_USERNAME ) : null );
String password = StringUtils.trimToNull( auth != null ? auth.get( KEY_PASSWORD ) : null );
-
+
if ( auth == null || username == null )
{
ContextUtils.conflictResponse( response, "Username must be specified" );
@@ -298,47 +297,47 @@
ContextUtils.conflictResponse( response, "Username already taken: " + username );
return;
}
-
+
if ( password == null )
{
ContextUtils.conflictResponse( response, "Password must be specified" );
- return;
+ return;
}
-
+
if ( !ValidationUtils.passwordIsValid( password ) )
{
ContextUtils.conflictResponse( response, "Password must have at least 8 characters, one digit, one uppercase" );
return;
}
-
+
User userReplica = new User();
userReplica.mergeWith( existingUser, MergeStrategy.MERGE_IF_NOT_NULL );
userReplica.setUid( CodeGenerator.generateCode() );
userReplica.setCreated( new Date() );
-
+
UserCredentials credentialsReplica = new UserCredentials();
credentialsReplica.mergeWith( existingUser.getUserCredentials(), MergeStrategy.MERGE_IF_NOT_NULL );
-
+
credentialsReplica.setUsername( username );
userService.encodeAndSetPassword( credentialsReplica, password );
-
+
userReplica.setUserCredentials( credentialsReplica );
credentialsReplica.setUser( userReplica );
-
+
userService.addUser( userReplica );
userService.addUserCredentials( credentialsReplica );
userGroupService.addUserToGroups( userReplica, IdentifiableObjectUtils.getUids( existingUser.getGroups() ) );
-
+
ContextUtils.createdResponse( response, "User replica created", UserSchemaDescriptor.API_ENDPOINT + "/" + userReplica.getUid() );
}
-
+
// -------------------------------------------------------------------------
// PUT
// -------------------------------------------------------------------------
@Override
@RequestMapping( value = "/{uid}", method = RequestMethod.PUT, consumes = { "application/xml", "text/xml" } )
- public void putXmlObject( @PathVariable( "uid" ) String pvUid, HttpServletRequest request, HttpServletResponse response ) throws Exception
+ public void putXmlObject( ImportOptions importOptions, @PathVariable( "uid" ) String pvUid, HttpServletRequest request, HttpServletResponse response ) throws Exception
{
List<User> users = getEntity( pvUid );
@@ -363,21 +362,22 @@
return;
}
- ImportTypeSummary summary = importService.importObject( currentUserService.getCurrentUser().getUid(), parsed, ImportStrategy.UPDATE );
+ ImportTypeSummary summary = importService.importObject( currentUserService.getCurrentUser().getUid(), parsed,
+ ImportStrategy.UPDATE, MergeStrategy.MERGE_IF_NOT_NULL );
if ( summary.isStatus( ImportStatus.SUCCESS ) && summary.getImportCount().getUpdated() == 1 )
{
User user = userService.getUser( pvUid );
-
- userGroupService.updateUserGroups( user, IdentifiableObjectUtils.getUids( parsed.getGroups() ));
+
+ userGroupService.updateUserGroups( user, IdentifiableObjectUtils.getUids( parsed.getGroups() ) );
}
-
+
renderService.toXml( response.getOutputStream(), summary );
}
@Override
@RequestMapping( value = "/{uid}", method = RequestMethod.PUT, consumes = "application/json" )
- public void putJsonObject( @PathVariable( "uid" ) String pvUid, HttpServletRequest request, HttpServletResponse response ) throws Exception
+ public void putJsonObject( ImportOptions importOptions, @PathVariable( "uid" ) String pvUid, HttpServletRequest request, HttpServletResponse response ) throws Exception
{
List<User> users = getEntity( pvUid );
@@ -402,15 +402,16 @@
return;
}
- ImportTypeSummary summary = importService.importObject( currentUserService.getCurrentUser().getUid(), parsed, ImportStrategy.UPDATE );
+ ImportTypeSummary summary = importService.importObject( currentUserService.getCurrentUser().getUid(), parsed,
+ ImportStrategy.UPDATE, MergeStrategy.MERGE_IF_NOT_NULL );
if ( summary.isStatus( ImportStatus.SUCCESS ) && summary.getImportCount().getUpdated() == 1 )
{
User user = userService.getUser( pvUid );
-
- userGroupService.updateUserGroups( user, IdentifiableObjectUtils.getUids( parsed.getGroups() ));
+
+ userGroupService.updateUserGroups( user, IdentifiableObjectUtils.getUids( parsed.getGroups() ) );
}
-
+
renderService.toJson( response.getOutputStream(), summary );
}
@@ -466,7 +467,8 @@
user.getUserCredentials().getCatDimensionConstraints().addAll(
currentUserService.getCurrentUser().getUserCredentials().getCatDimensionConstraints() );
- ImportTypeSummary summary = importService.importObject( currentUserService.getCurrentUser().getUid(), user, ImportStrategy.CREATE );
+ ImportTypeSummary summary = importService.importObject( currentUserService.getCurrentUser().getUid(), user,
+ ImportStrategy.CREATE, MergeStrategy.MERGE_IF_NOT_NULL );
if ( summary.isStatus( ImportStatus.SUCCESS ) && summary.getImportCount().getImported() == 1 )
{