Added some helper to InstallPathConfig. Added PlatformPathInfo to Template object.
authorkh5325.kim <kh5325.kim@samsung.com>
Tue, 27 Aug 2013 12:32:31 +0000 (21:32 +0900)
committerkh5325.kim <kh5325.kim@samsung.com>
Tue, 27 Aug 2013 12:32:31 +0000 (21:32 +0900)
org.tizen.common/src/org/tizen/common/core/application/InstallPathConfig.java
org.tizen.common/src/org/tizen/common/wizards/model/Template.java

index e9d6fb3..2e9d9fc 100755 (executable)
@@ -190,6 +190,26 @@ final public class InstallPathConfig {
     }
     
     /**
+     * Returns a list of PlatformPathInfo by flattening platform.
+     */
+    public static List<PlatformPathInfo> flattenPlatformPathInfos() {
+        return flattenPlatformPathInfos(getPlatformPathInfos());
+    }
+    
+    /**
+     * Returns a list of PlatformPathInfo by flattening platform.
+     */
+    public static List<PlatformPathInfo> flattenPlatformPathInfos(List<PlatformPathInfo> profileInfos) {
+        List<PlatformPathInfo> list = new ArrayList<PlatformPathInfo>();
+        for (PlatformPathInfo profileInfo : profileInfos) {
+            for (String version : profileInfo.getVersions()) {
+                list.add(new PlatformPathInfo(profileInfo.getProfile(), version, profileInfo.getPlatformPath(version)));
+            }
+        }
+        return list;
+    }
+    
+    /**
      * Returns a list of PlatformPathInfo including the given profile.<br>
      * Otherwise, returns null if the profile is null or cannot be found.
      */
index 9bcfa04..f3a5059 100644 (file)
@@ -33,6 +33,8 @@ import java.util.List;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.tizen.common.core.application.InstallPathConfig;
+import org.tizen.common.core.application.PlatformPathInfo;
 
 public class Template {
     protected Logger logger = LoggerFactory.getLogger( getClass() );
@@ -44,6 +46,7 @@ public class Template {
     private List<String> icons;
     private String category;
     private List<Template> templates;
+    private PlatformPathInfo platformInfo = InstallPathConfig.getLatestPlatformPathInfo();
  
     public Template(Category parent, String name, String descPath) {
         this(name, descPath, null);
@@ -105,6 +108,15 @@ public class Template {
         this.icons = icons;
     }
 
+    public PlatformPathInfo getPlatformInfo() {
+        return platformInfo;
+    }
+
+    public void setPlatformInfo(PlatformPathInfo platformInfo) {
+        if (platformInfo != null)
+            this.platformInfo = platformInfo;
+    }
+
     public void addTemplates(Object[] templates) {
         for (Object template : templates) {
             if (template instanceof Template) {
@@ -119,6 +131,6 @@ public class Template {
 
     @Override
     public String toString() {
-        return "Template [name=" + name + ", samplePath=" + samplePath + ", category=" + category + "]";
+        return "Template [name=" + name + ", samplePath=" + samplePath + ", category=" + category + ", platformInfo=" + platformInfo + "]";
     }
 }