Author: fmui
Date: Tue Dec 23 11:48:30 2014
New Revision: 1647557

URL: http://svn.apache.org/r1647557
Log:
Server: don't add Browser Binding DateTime Format extension to repository info 
if it is already there

Modified:
    
chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/JSONConverter.java

Modified: 
chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/JSONConverter.java
URL: 
http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/JSONConverter.java?rev=1647557&r1=1647556&r2=1647557&view=diff
==============================================================================
--- 
chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/JSONConverter.java
 (original)
+++ 
chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/JSONConverter.java
 Tue Dec 23 11:48:30 2014
@@ -236,12 +236,24 @@ public final class JSONConverter {
 
         if (addExtendedDatetimeExtensionFeature) {
             JSONArray extendedFeatures = (JSONArray) 
result.get(JSON_REPINFO_EXTENDED_FEATURES);
+            boolean addFeature = true;
             if (extendedFeatures == null) {
                 extendedFeatures = new JSONArray();
                 result.put(JSON_REPINFO_EXTENDED_FEATURES, extendedFeatures);
+            } else {
+                for (Object ef : extendedFeatures) {
+                    if (ef instanceof ExtensionFeature) {
+                        if 
(ExtensionFeatures.EXTENDED_DATETIME_FORMAT.getId().equals(((ExtensionFeature) 
ef).getId())) {
+                            addFeature = false;
+                            break;
+                        }
+                    }
+                }
             }
 
-            
extendedFeatures.add(convert(ExtensionFeatures.EXTENDED_DATETIME_FORMAT));
+            if (addFeature) {
+                
extendedFeatures.add(convert(ExtensionFeatures.EXTENDED_DATETIME_FORMAT));
+            }
         }
 
         result.put(JSON_REPINFO_REPOSITORY_URL, repositoryUrl);


Reply via email to