Revision: 1787
Author: [email protected]
Date: Thu Dec 17 13:39:12 2009
Log: When importing contacts we need the email address to have a protocol  
in order for it to be a valid resource identifier
http://code.google.com/p/simal/source/detail?r=1787

Deleted:
   
/trunk/uk.ac.osswatch.simal.core/src/test/java/uk/ac/osswatch/simal/unitTest/model/io
Modified:
   
/trunk/uk.ac.osswatch.simal.core/src/main/java/uk/ac/osswatch/simal/importData/Pims.java
   
/trunk/uk.ac.osswatch.simal.core/src/test/java/uk/ac/osswatch/simal/importData/test/PimsTest.java

=======================================
---  
/trunk/uk.ac.osswatch.simal.core/src/main/java/uk/ac/osswatch/simal/importData/Pims.java
         
Fri Nov 27 04:06:05 2009
+++  
/trunk/uk.ac.osswatch.simal.core/src/main/java/uk/ac/osswatch/simal/importData/Pims.java
         
Thu Dec 17 13:39:12 2009
@@ -316,9 +316,16 @@

                // foaf:mbox
                String email = getNullSafeStringValue(row, 6);
-               elem = doc.createElementNS(Foaf.getURI(), "mbox");
-               elem.setAttributeNS(RDF.getURI(), "resource", email);
-               person.appendChild(elem);
+               if (email.contains("@")) {
+                 if (!email.startsWith("mailto:";)) {
+                         email = "mailto:"; + email;
+                 }
+                 elem = doc.createElementNS(Foaf.getURI(), "mbox");
+                 elem.setAttributeNS(RDF.getURI(), "resource", email);
+                 person.appendChild(elem);
+               } else {
+                 logger.info("Contact in PIMS import has a strange looking  
email: " + email);
+               }

                // TODO: record contact telephone detail
                //HSSFRichTextString tel =  
row.getCell(7).getRichStringCellValue();
@@ -383,6 +390,7 @@
         * @return
         */
        private static String getPersonURI(int id) {
+               logger.debug("Creating a person with id; " + id);
                return "http://jisc.ac.uk/person#"; + id;
        }

=======================================
---  
/trunk/uk.ac.osswatch.simal.core/src/test/java/uk/ac/osswatch/simal/importData/test/PimsTest.java
        
Sun Nov 15 17:05:04 2009
+++  
/trunk/uk.ac.osswatch.simal.core/src/test/java/uk/ac/osswatch/simal/importData/test/PimsTest.java
        
Thu Dec 17 13:39:12 2009
@@ -145,5 +145,12 @@
                Set<IDoapHomepage> pages = project.getHomepages();
                assertEquals("Project A has an incorrect number of homepages", 
1,  
pages.size());
        }
+
+       @Test
+       public void testProjectToXMLAfterImport() throws 
SimalRepositoryException  
{
+               IProject project =  
SimalRepositoryFactory.getProjectService().getProject("http://jisc.ac.uk/project#10";);
+               String xml = project.toXML();
+               assertTrue("There appears to be no project identifer in the 
returned  
XML", xml.contains("http://jisc.ac.uk/project#10";));
+       }

  }

--

You received this message because you are subscribed to the Google Groups 
"Simal Commits" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/simal-commits?hl=en.


Reply via email to