dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #39972
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20233: DefaultFileResourceContentStore, checking if config directory is set to avoid exception which bre...
------------------------------------------------------------
revno: 20233
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2015-09-18 19:50:30 +0200
message:
DefaultFileResourceContentStore, checking if config directory is set to avoid exception which breaks tests
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOptionCombo.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/fileresource/BaseJCloudsFileResourceContentStore.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/fileresource/DefaultFileResourceContentStore.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-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOptionCombo.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOptionCombo.java 2015-09-17 16:01:21 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOptionCombo.java 2015-09-18 17:50:30 +0000
@@ -28,13 +28,14 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonView;
-import com.fasterxml.jackson.databind.annotation.JsonSerialize;
-import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
-import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
-import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
import org.hisp.dhis.common.BaseIdentifiableObject;
import org.hisp.dhis.common.BaseNameableObject;
import org.hisp.dhis.common.DxfNamespaces;
@@ -44,12 +45,13 @@
import org.hisp.dhis.common.view.DetailedView;
import org.hisp.dhis.common.view.ExportView;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonView;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
/**
* @author Abyot Aselefew
@@ -287,6 +289,10 @@
return name != null && name.equals( DEFAULT_TOSTRING );
}
+ /**
+ * Gets the name. Orders the options after the order of the category in
+ * category combo for which it is part of.
+ */
@Override
public String getName()
{
@@ -294,7 +300,31 @@
{
return name;
}
-
+
+ StringBuilder builder = new StringBuilder();
+
+ List<DataElementCategory> categories = this.categoryCombo.getCategories();
+
+ for ( DataElementCategory category : categories )
+ {
+ builder.append( "(" );
+
+ List<DataElementCategoryOption> options = category.getCategoryOptions();
+
+ for ( DataElementCategoryOption option : this.categoryOptions )
+ {
+ if ( options.contains( option ) )
+ {
+ builder.append( option.getDisplayName() ).append( ", " );
+ }
+ }
+
+ builder.delete( Math.max( builder.length() - 2, 0 ), builder.length() ).append( ")" );
+ }
+
+ return builder.toString();
+
+ /*
StringBuilder name = new StringBuilder();
if ( categoryOptions != null && categoryOptions.size() > 0 )
@@ -322,6 +352,7 @@
}
return name.toString();
+ */
}
@Override
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/fileresource/BaseJCloudsFileResourceContentStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/fileresource/BaseJCloudsFileResourceContentStore.java 2015-09-18 16:29:32 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/fileresource/BaseJCloudsFileResourceContentStore.java 2015-09-18 17:50:30 +0000
@@ -81,7 +81,7 @@
protected abstract String getLocation();
// -------------------------------------------------------------------------
- // Lifecycle management
+ // Life cycle management
// -------------------------------------------------------------------------
public void init()
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/fileresource/DefaultFileResourceContentStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/fileresource/DefaultFileResourceContentStore.java 2015-09-18 16:41:31 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/fileresource/DefaultFileResourceContentStore.java 2015-09-18 17:50:30 +0000
@@ -118,7 +118,9 @@
public void init()
{
- filestoreConfiguration = configurationProvider.getConfiguration().getProperties()
+ Properties properties = configurationProvider.getConfiguration().getProperties();
+
+ filestoreConfiguration = properties
.entrySet().stream().filter(
p -> ( (String) p.getKey() ).startsWith( FILESTORE_CONFIG_NAMESPACE ) )
.collect( Collectors.toMap(
@@ -198,9 +200,17 @@
private void configureFilesystemProvider()
{
- overrides.setProperty( FilesystemConstants.PROPERTY_BASEDIR, locationManager.getExternalDirectoryPath() );
- credentials = super.getCredentials();
- log.info( "File system filestore provider configured." );
+ if ( locationManager.externalDirectorySet() )
+ {
+ overrides.setProperty( FilesystemConstants.PROPERTY_BASEDIR, locationManager.getExternalDirectoryPath() );
+ credentials = super.getCredentials();
+
+ log.info( "File system store provider configured" );
+ }
+ else
+ {
+ log.warn( "File system store could not be configured, external directory not set" );
+ }
}
private void configureAWSS3Provider()
@@ -211,7 +221,7 @@
if ( credentials.identity.isEmpty() || credentials.credential.isEmpty() )
{
- log.info( "AWS S3 configured with empty credentials. Authentication will fail" );
+ log.info( "AWS S3 store configured with empty credentials, authentication not possible" );
}
}
}