svn commit: r12952 - branches/gsoc2007/maurelio1234/argouml/org/argouml/persistence

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: maurelio1234
Date: 2007-07-01 10:44:53-0700
New Revision: 12952

Modified:
   branches/gsoc2007/maurelio1234/argouml/org/argouml/persistence/OldZargoFilePersister.java
   branches/gsoc2007/maurelio1234/argouml/org/argouml/persistence/ProfileConfigurationFilePersister.java

Log:
Uploading merged code

Modified: branches/gsoc2007/maurelio1234/argouml/org/argouml/persistence/OldZargoFilePersister.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2007/maurelio1234/argouml/org/argouml/persistence/OldZargoFilePersister.java?view=diff&rev=12952&p1=branches/gsoc2007/maurelio1234/argouml/org/argouml/persistence/OldZargoFilePersister.java&p2=branches/gsoc2007/maurelio1234/argouml/org/argouml/persistence/OldZargoFilePersister.java&r1=12951&r2=12952
==============================================================================
--- branches/gsoc2007/maurelio1234/argouml/org/argouml/persistence/OldZargoFilePersister.java	(original)
+++ branches/gsoc2007/maurelio1234/argouml/org/argouml/persistence/OldZargoFilePersister.java	2007-07-01 10:44:53-0700
@@ -71,14 +71,14 @@
     public OldZargoFilePersister() {
     }
 
-    /*
+    /**
      * @see org.argouml.persistence.AbstractFilePersister#getDesc()
      */
     protected String getDesc() {
         return Translator.localize("combobox.filefilter.zargo");
     }
     
-    /*
+    /**
      * @see org.argouml.persistence.AbstractFilePersister#isSaveEnabled()
      */
     public boolean isSaveEnabled() {

Modified: branches/gsoc2007/maurelio1234/argouml/org/argouml/persistence/ProfileConfigurationFilePersister.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2007/maurelio1234/argouml/org/argouml/persistence/ProfileConfigurationFilePersister.java?view=diff&rev=12952&p1=branches/gsoc2007/maurelio1234/argouml/org/argouml/persistence/ProfileConfigurationFilePersister.java&p2=branches/gsoc2007/maurelio1234/argouml/org/argouml/persistence/ProfileConfigurationFilePersister.java&r1=12951&r2=12952
==============================================================================
--- branches/gsoc2007/maurelio1234/argouml/org/argouml/persistence/ProfileConfigurationFilePersister.java	(original)
+++ branches/gsoc2007/maurelio1234/argouml/org/argouml/persistence/ProfileConfigurationFilePersister.java	2007-07-01 10:44:53-0700
@@ -28,9 +28,10 @@
 import java.io.File;

 import java.io.InputStream;

 import java.io.InputStreamReader;

+import java.io.OutputStream;

 import java.io.PrintWriter;

 import java.io.Writer;

-import java.util.StringTokenizer;

+import java.util.Iterator;

 import java.util.Vector;

 

 import org.argouml.kernel.Project;

@@ -40,14 +41,29 @@
 import org.argouml.uml.profile.ProfileManagerImpl;

 import org.argouml.uml.profile.UserDefinedProfile;

 

+/**

+ * Persister for Project's Profile Configuration

+ *

+ * @author maurelio1234

+ */

 public class ProfileConfigurationFilePersister extends MemberFilePersister {

 

-    @Override

+    /**

+     * @return the tag used to store this content on the uml file

+     * 

+     * @see org.argouml.persistence.MemberFilePersister#getMainTag()

+     */

     public String getMainTag() {

 	return "profile";

     }

 

-    @Override

+    /**

+     * @param project

+     * @param inputStream

+     * @throws OpenException

+     * 

+     * @see org.argouml.persistence.MemberFilePersister#load(org.argouml.kernel.Project, java.io.InputStream)

+     */

     public void load(Project project, InputStream inputStream)

 	    throws OpenException {

 	try {

@@ -57,7 +73,12 @@
 		    inputStream));

 

 	    String line = null;

-	    while (!(line = br.readLine().trim()).equals("<profile>"));

+	    while (true) {

+		line = br.readLine();

+		if (line.trim().equals("<profile>")) {

+		    break;

+		}

+	    }

 

 	    while (true) {

 		line = br.readLine().trim();

@@ -118,30 +139,59 @@
 	}

     }

 

-    @Override

-    public void save(ProjectMember member, Writer writer, boolean xmlFragment) throws SaveException {

+    /**

+     * @param member

+     * @param writer

+     * @param xmlFragment

+     * @throws SaveException

+     * @deprecated

+     * 

+     * @see org.argouml.persistence.MemberFilePersister#save(org.argouml.kernel.ProjectMember, java.io.Writer, boolean)

+     */

+    public void save(ProjectMember member, Writer writer, boolean xmlFragment)

+	    throws SaveException {

+	PrintWriter w = new PrintWriter(writer);

+	saveProjectMember(member, w);

+    }

+

+    /**

+     * @param member

+     * @param stream

+     * @throws SaveException

+     * 

+     * @see org.argouml.persistence.MemberFilePersister#save(org.argouml.kernel.ProjectMember, java.io.OutputStream)

+     */

+    public void save(ProjectMember member, OutputStream stream)

+	    throws SaveException {

+	PrintWriter w = new PrintWriter(stream);

+	saveProjectMember(member, w);

+    }

+

+    private void saveProjectMember(ProjectMember member, PrintWriter w)

+	    throws SaveException {

 	try {

 	    if (member instanceof ProfileConfiguration) {

 		ProfileConfiguration pc = (ProfileConfiguration) member;

-		PrintWriter w = new PrintWriter(writer);

 

 		w.println("<?xml version = \"1.0\" encoding = \"UTF-8\" ?>");

 		w.println("<!DOCTYPE profile SYSTEM \"profile.dtd\" >");

 		w.println("<profile>");

-		

-		for (Object p : pc.getProfiles()) {

-		    Profile profile = (Profile) p;

+

+		Iterator it = pc.getProfiles().iterator();

+		while (it.hasNext()) {

+		    Profile profile = (Profile) it.next();

 

 		    if (profile != pc.getDefaultProfile()) {

 			if (profile instanceof UserDefinedProfile) {

 			    w.println("\t\t<userDefined>");

-			    w.println("\t\t\t"+((UserDefinedProfile) profile)

-				    .getModelFile().getCanonicalPath());

+			    w.println("\t\t\t"

+				    + ((UserDefinedProfile) profile)

+					    .getModelFile().getCanonicalPath());

 			    w.println("\t\t</userDefined>");

 			} else {

 			    w.println("\t\t<plugin>");

-			    w.println("\t\t\t"+p.getClass().getName());

-			    w.println("\t\t</plugin>");			    

+			    w.println("\t\t\t" + profile.getClass().getName());

+			    w.println("\t\t</plugin>");

 			}

 		    }

 		}
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.