svn commit: r14979 - branches/gsoc2008/work_criticsprofiles_maurelio1234/src/org/argouml/profile/UserDefinedProfile.java

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: maurelio1234
Date: 2008-06-17 04:55:15-0700
New Revision: 14979

Modified:
   branches/gsoc2008/work_criticsprofiles_maurelio1234/src/org/argouml/profile/UserDefinedProfile.java

Log:
allowing profile without module

Modified: branches/gsoc2008/work_criticsprofiles_maurelio1234/src/org/argouml/profile/UserDefinedProfile.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2008/work_criticsprofiles_maurelio1234/src/org/argouml/profile/UserDefinedProfile.java?view=diff&rev=14979&p1=branches/gsoc2008/work_criticsprofiles_maurelio1234/src/org/argouml/profile/UserDefinedProfile.java&p2=branches/gsoc2008/work_criticsprofiles_maurelio1234/src/org/argouml/profile/UserDefinedProfile.java&r1=14978&r2=14979
==============================================================================
--- branches/gsoc2008/work_criticsprofiles_maurelio1234/src/org/argouml/profile/UserDefinedProfile.java	(original)
+++ branches/gsoc2008/work_criticsprofiles_maurelio1234/src/org/argouml/profile/UserDefinedProfile.java	2008-06-17 04:55:15-0700
@@ -32,6 +32,7 @@
 import java.io.Reader;
 import java.net.MalformedURLException;
 import java.net.URL;
+import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.List;
@@ -173,18 +174,25 @@
     /**
      * A constructor that reads a file from an URL 
      * associated with some profiles
+     * @param entryName 
      * 
      * @param url the URL
      * @param critics the Critics defined by this profile
      * @throws ProfileException
      */
-    public UserDefinedProfile(URL url, Set<CrUML> critics) throws ProfileException {
+    public UserDefinedProfile(String entryName, URL url, Set<CrUML> critics)
+        throws ProfileException {
         LOG.info("load " + url);
-        
-        ProfileReference reference = null;
-        reference = new UserProfileReference(url.getPath(), url);
-        model = new URLModelLoader().loadModel(reference);
-        fromZargo = false;
+
+        displayName = entryName;
+        if (url != null) {
+            ProfileReference reference = null;
+            reference = new UserProfileReference(url.getPath(), url);
+            model = new URLModelLoader().loadModel(reference);
+            fromZargo = false;            
+        } else {
+            model = new ArrayList(0);
+        }
         this.critics = critics;
         
         finishLoading();
@@ -283,7 +291,7 @@
             for (Object comment : comments) {
                 if (Model.getExtensionMechanismsHelper().hasStereotype(comment,
                         "Critic")) {
-                    ret.add(comment);
+                    ret.add(generateCriticFromModel(comment));
                 }
             }
             
@@ -344,7 +352,8 @@
      */
     @Override
     public String toString() {
-        return super.toString() + " [" + getModelFile() + "]";
+        File str = getModelFile();
+        return super.toString() + (str !=null ? " [" +  str + "]" : "");
     }
 
     @Override
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.