[Dhis2-devs] [Branch ~dhis2-devs-core/dhis2/trunk] Rev 21898: add field filtering for /api/dimensions/dataSet/ID endpoint

2016-02-07 Thread noreply

revno: 21898
committer: Morten Olav Hansen 
branch nick: dhis2
timestamp: Sun 2016-02-07 16:59:19 +0700
message:
  add field filtering for /api/dimensions/dataSet/ID endpoint
modified:
  
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DimensionController.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/DimensionController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DimensionController.java	2016-02-02 06:34:22 +
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DimensionController.java	2016-02-07 09:59:19 +
@@ -156,11 +156,12 @@
 }
 
 @RequestMapping( value = "/dataSet/{uid}", method = RequestMethod.GET )
-public String getDimensionsForDataSet( @PathVariable String uid,
+public @ResponseBody RootNode getDimensionsForDataSet( @PathVariable String uid,
 @RequestParam( value = "links", defaultValue = "true", required = false ) Boolean links,
 Model model, HttpServletResponse response ) throws WebMessageException
 {
 WebMetadata metadata = new WebMetadata();
+List fields = Lists.newArrayList( contextService.getParameterValues( "fields" ) );
 
 DataSet dataSet = identifiableObjectManager.get( DataSet.class, uid );
 
@@ -185,13 +186,14 @@
 metadata.getDimensions().add( dimensionService.getDimensionalObjectCopy( dim.getUid(), true ) );
 }
 
-model.addAttribute( "model", metadata );
-
 if ( links )
 {
 linkService.generateLinks( metadata, false );
 }
 
-return "dimensions";
+RootNode rootNode = NodeUtils.createMetadata();
+rootNode.addChild( fieldFilterService.filter( getEntityClass(), metadata.getDimensions(), fields ) );
+
+return rootNode;
 }
 }

___
Mailing list: https://launchpad.net/~dhis2-devs
Post to : dhis2-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs
More help   : https://help.launchpad.net/ListHelp


Re: [Dhis2-devs] [Android] Sdk method count

2016-02-07 Thread Ignacio Foche
Hi Nhan Cao,

in EyeSeeTea we're also integrating Crashlytics and the DHIS2 SDK in our
projects, and we've experimented that problem, so here I tell you how we
solved it.

1. Add to the dependencies of your project, in your gradle.build, the
multidex library

compile 'com.android.support:multidex:1.0.1'


2. Create, if your project doesn't have it now, an Application class that
extend from Dhis2Application

public class EyeSeeTeaApplication extends Dhis2Application  {
..
}
(after that, whenever you tell Crashlytics to integrate with your
problem, it will probably introduce its code inside the "onCreate()"
method)

4. Import MultiDex in your Application class (EyeSeeTeaApplication in
the example)
import android.support.multidex.MultiDex;

5. Override in your Application class the attachBaseContext() method
to make DBFlow work with MultiDex:
/**
 * Function used to make DBFlow compatible with multidex
 * @param base
 */
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}

5. Consequently, in your AndroidManifest.xml there would be something like...

...

this is...you have to declare your application in your AndroidManifest.xml.


And I think that I didn't forget anything. I hope this can help you
and anyone else with the same problems (enabling MultiDex in a project
with DBFlow)


Best regards



2016-02-06 13:09 GMT+01:00 Nhan Cao :

> Hi all,
>
> I have problems when I integrate fabric into my project. UNEXPECTED
> TOP-LEVEL EXCEPTION (the dex 65K method limit). I try to set multidex but
> it's not stable, some feature not found class rx occur. So I create new
> default app and include sdk for test method of sdk, it's bit number: 57894
> method. I think it's problem for anyone want to extend it. Who can provide
> me a proguard file to reduce it. I has include file method count of
> sdk-2.22-legacy.
>
>
>
>
> Yours sincerely,
> Nhan Cao
> nha...@yeskone.com
>
>
>
>
> ___
> Mailing list: https://launchpad.net/~dhis2-devs
> Post to : dhis2-devs@lists.launchpad.net
> Unsubscribe : https://launchpad.net/~dhis2-devs
> More help   : https://help.launchpad.net/ListHelp
>
>


-- 

Clave pública PGP:
http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8185416E
___
Mailing list: https://launchpad.net/~dhis2-devs
Post to : dhis2-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs
More help   : https://help.launchpad.net/ListHelp


Re: [Dhis2-devs] [Android] Sdk method count

2016-02-07 Thread Nhan Cao
Hi Ignacio Foche, 

Thanks for reply. So in my previous mail, I had said 
> I try to set multidex but it's not stable, some feature not found class rx 
> occur.

 I had done similar like you (a lot results on google or stackoverflow). You 
can read full docs at http://developer.android.com/tools/building/multidex.html 
 and noticed 
Multidex support for Android 5.0 and higher  and Avoiding the 65K Limit part. 

 With this you'll build success, but your apk higher, but if your project is 
injected some more lib using more annotation or not common declare (like 
reactiveX, dagger, retrolamda, ... ) it will not work stable, sometime will 
crash with no reference error. That why I'm not continue with that solution and 
try to review and do anything about reduce method.

Yours sincerely,
Nhan Cao
nha...@yeskone.com



> On Feb 7, 2016, at 5:20 PM, Ignacio Foche  wrote:
> 
> Hi Nhan Cao,
> 
> in EyeSeeTea we're also integrating Crashlytics and the DHIS2 SDK in our 
> projects, and we've experimented that problem, so here I tell you how we 
> solved it. 
> 
> 1. Add to the dependencies of your project, in your gradle.build, the 
> multidex library
> compile 'com.android.support:multidex:1.0.1'
> 
> 2. Create, if your project doesn't have it now, an Application class that 
> extend from Dhis2Application
> 
> public class EyeSeeTeaApplication extends Dhis2Application  {
> ..
> }
> (after that, whenever you tell Crashlytics to integrate with your problem, it 
> will probably introduce its code inside the "onCreate()" method)
> 
> 4. Import MultiDex in your Application class (EyeSeeTeaApplication in the 
> example) 
> import android.support.multidex.MultiDex;
> 5. Override in your Application class the attachBaseContext() method to make 
> DBFlow work with MultiDex:
> /**
>  * Function used to make DBFlow compatible with multidex
>  * @param base
>  */
> @Override
> protected void attachBaseContext(Context base) {
> super.attachBaseContext(base);
> MultiDex.install(this);
> }
> 
> 5. Consequently, in your AndroidManifest.xml there would be something like...
>  android:name=".EyeSeeTeaApplication"
> android:allowBackup="true"
> android:icon="@drawable/qualityapp_logo"
> android:label="@string/app_name"
> android:theme="@style/EyeSeeTheme"
> tools:replace="android:icon,android:theme" >
> ...
> 
> this is...you have to declare your application in your AndroidManifest.xml.
> 
> And I think that I didn't forget anything. I hope this can help you and 
> anyone else with the same problems (enabling MultiDex in a project with 
> DBFlow)
> 
> Best regards
> 
> 
> 2016-02-06 13:09 GMT+01:00 Nhan Cao  >:
> Hi all, 
> 
> I have problems when I integrate fabric into my project. UNEXPECTED TOP-LEVEL 
> EXCEPTION (the dex 65K method limit). I try to set multidex but it's not 
> stable, some feature not found class rx occur. So I create new default app 
> and include sdk for test method of sdk, it's bit number: 57894 method. I 
> think it's problem for anyone want to extend it. Who can provide me a 
> proguard file to reduce it. I has include file method count of 
> sdk-2.22-legacy.
> 
> 
> 
> 
> Yours sincerely,
> Nhan Cao
> nha...@yeskone.com 
> 
> 
> 
> 
> ___
> Mailing list: https://launchpad.net/~dhis2-devs 
> 
> Post to : dhis2-devs@lists.launchpad.net 
> 
> Unsubscribe : https://launchpad.net/~dhis2-devs 
> 
> More help   : https://help.launchpad.net/ListHelp 
> 
> 
> 
> 
> 
> -- 
> 
> Clave pública PGP:
> http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8185416E 
> 
___
Mailing list: https://launchpad.net/~dhis2-devs
Post to : dhis2-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs
More help   : https://help.launchpad.net/ListHelp


Re: [Dhis2-devs] DHIS2 - Issues with 2.22

2016-02-07 Thread Morten Olav Hansen
Hi Aamer

Regarding pt 3, can you get the UID of that data element.. and see (either
in web-api or through the database) if the categorycombo column is null? it
should have been attached to the default category combo.. but it seems you
have a data element with a category combo set to null

@Lars: would there be any side effects to simply doing a null check in
 DefaultDataElementService.getDataElementCategoryCombos ? line 274

--
Morten

On Sat, Feb 6, 2016 at 6:22 PM, Lars Helge Øverland  wrote:

> Hi Aamer,
>
> re issue 1. This was a regression bug which has been fixed now in trunk
> and 2.22.
>
> regards,
>
> Lars
>
> On Thu, Feb 4, 2016 at 8:53 AM, Aamer Mohammed 
> wrote:
>
>> Hi
>>
>> I am using two instances of DHIS on 2.22 version and facing the below
>> issues currently.
>>
>> *Issue 1:*
>> *Unable to sync data between the two instances.* I have setup the
>> synchronization as per
>> http://dhis2.github.io/dhis2-docs/2.21/en/user/html/ch22s16.html
>> and trying to save the data. I have cleared the cache but still no values
>> appear on the other instance. The log says "Server available,
>> authentication successful and sync successful"
>>
>> *Issue 2:*
>> *Unable to do metadata import of users.* When I try importing metadata
>> without users, the import is successful.
>> I see this issue is already being tracked through Bug#1538443
>>
>> *Issue 3:*
>> Adding newly created data elements to existing data set is throwing
>> exception.
>>
>> *Issue 4:*
>> When a dashboard is shared with user group giving view-only access, the
>> users of that group are able to edit it as well. The changes are also
>> reflected across all users.
>>
>> *Issue 5:*
>> A dashboard which is shared with a user group in one instance is not
>> visible to that user group after metadata import. It is visible to admin
>> only.
>>
>> Could you please suggest on these?
>>
>>
>> Thanks
>> Aamer.
>>
>> ___
>> Mailing list: https://launchpad.net/~dhis2-devs
>> Post to : dhis2-devs@lists.launchpad.net
>> Unsubscribe : https://launchpad.net/~dhis2-devs
>> More help   : https://help.launchpad.net/ListHelp
>>
>>
>
>
> --
> Lars Helge Øverland
> Lead developer, DHIS 2
> University of Oslo
> Skype: larshelgeoverland
> http://www.dhis2.org 
>
>
___
Mailing list: https://launchpad.net/~dhis2-devs
Post to : dhis2-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs
More help   : https://help.launchpad.net/ListHelp


[Dhis2-devs] [Branch ~dhis2-devs-core/dhis2/trunk] Rev 21899: Regex pattern validation in program rules

2016-02-07 Thread noreply

revno: 21899
committer: Markus Bekken 
branch nick: dhis2
timestamp: Mon 2016-02-08 08:08:15 +0100
message:
  Regex pattern validation in program rules
modified:
  
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.services.js


--
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-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.services.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.services.js	2016-02-04 10:43:43 +
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.services.js	2016-02-08 07:08:15 +
@@ -1300,6 +1300,7 @@
 {name:"d2:round",parameters:1},
 {name:"d2:hasValue",parameters:1},
 {name:"d2:lastEventDate",parameters:1},
+{name:"d2:validatePattern",parameters:2},
 {name:"d2:addControlDigits",parameters:1},
 {name:"d2:checkControlDigits",parameters:1}];
 var continueLooping = true;
@@ -1573,6 +1574,21 @@
 expression = expression.replace(callToThisFunction, valueFound);
 successfulExecution = true;
 }
+else if(dhisFunction.name === "d2:validatePattern") {
+var inputToValidate = parameters[0].toString();
+var pattern = parameters[1];
+var regEx = new RegExp(pattern,'g');
+var match = inputToValidate.match(regEx);
+
+var matchFound = false;
+if(match !== null && inputToValidate === match[0]) {
+matchFound = true;
+}
+
+//Replace the end evaluation of the dhis function:
+expression = expression.replace(callToThisFunction, matchFound);
+successfulExecution = true;
+}
 else if(dhisFunction.name === "d2:addControlDigits") {
 
 var baseNumber = parameters[0];

___
Mailing list: https://launchpad.net/~dhis2-devs
Post to : dhis2-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs
More help   : https://help.launchpad.net/ListHelp


[Dhis2-devs] [Branch ~dhis2-devs-core/dhis2/trunk] Rev 21900: minor object bundle fixes

2016-02-07 Thread noreply

revno: 21900
committer: Morten Olav Hansen 
branch nick: dhis2
timestamp: Mon 2016-02-08 14:21:53 +0700
message:
  minor object bundle fixes
added:
  
dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata2/objectbundle/ObjectBundleException.java
  dhis-2/dhis-services/dhis-service-dxf2/src/test/resources/dxf2/degAUidRef.json
modified:
  
dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata2/objectbundle/DefaultObjectBundleService.java
  
dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata2/objectbundle/ObjectBundle.java
  
dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata2/objectbundle/ObjectBundleParams.java
  
dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata2/objectbundle/ObjectBundleService.java
  
dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/metadata2/objectbundle/ObjectBundleServiceTest.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-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata2/objectbundle/DefaultObjectBundleService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata2/objectbundle/DefaultObjectBundleService.java	2016-02-04 08:01:30 +
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata2/objectbundle/DefaultObjectBundleService.java	2016-02-08 07:21:53 +
@@ -44,6 +44,12 @@
 }
 
 @Override
+public void validate( ObjectBundle bundle )
+{
+
+}
+
+@Override
 public void commit( ObjectBundle bundle )
 {
 

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata2/objectbundle/ObjectBundle.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata2/objectbundle/ObjectBundle.java	2016-02-04 08:01:30 +
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata2/objectbundle/ObjectBundle.java	2016-02-08 07:21:53 +
@@ -28,9 +28,91 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import org.hisp.dhis.common.IdentifiableObject;
+import org.hisp.dhis.preheat.Preheat;
+import org.hisp.dhis.preheat.PreheatIdentifier;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
 /**
  * @author Morten Olav Hansen 
  */
 public class ObjectBundle
 {
+private ObjectBundleMode objectBundleMode = ObjectBundleMode.COMMIT;
+
+private PreheatIdentifier preheatIdentifier = PreheatIdentifier.UID;
+
+private Preheat preheat = new Preheat();
+
+private Map, List> objects = new HashMap<>();
+
+public ObjectBundle()
+{
+}
+
+public ObjectBundleMode getObjectBundleMode()
+{
+return objectBundleMode;
+}
+
+public void setObjectBundleMode( ObjectBundleMode objectBundleMode )
+{
+this.objectBundleMode = objectBundleMode;
+}
+
+public PreheatIdentifier getPreheatIdentifier()
+{
+return preheatIdentifier;
+}
+
+public void setPreheatIdentifier( PreheatIdentifier preheatIdentifier )
+{
+this.preheatIdentifier = preheatIdentifier;
+}
+
+public Preheat getPreheat()
+{
+return preheat;
+}
+
+public void setPreheat( Preheat preheat )
+{
+this.preheat = preheat;
+}
+
+@SuppressWarnings( "unchecked" )
+public  void addObject( T object )
+{
+if ( object == null )
+{
+return;
+}
+
+if ( !objects.containsKey( object.getClass() ) )
+{
+objects.put( object.getClass(), new ArrayList<>() );
+}
+
+objects.get( object.getClass() ).add( object );
+preheat.put( preheatIdentifier, object );
+}
+
+public  void addObjects( List objects )
+{
+objects.forEach( this::addObject );
+}
+
+public Map, List> getObjects()
+{
+return objects;
+}
+
+public void setObjects( Map, List> objects )
+{
+this.objects = objects;
+}
 }

=== added file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata2/objectbundle/ObjectBundleException.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata2/objectbundle/ObjectBundleException.java	1970-01-01 00:00:00 +
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata2/objectbundle/ObjectBundleException.java	2016-02-08 07:21:53 +
@@ -0,0 +1,41 @@
+package org.hisp.dhis.dxf2.metadata2.objectbundle;
+
+/*
+ * Copyright (c) 2004-2016, University of Oslo
+ * Al