1 40 package org.dspace.content; 41 42 55 public class DCPersonName 56 { 57 58 private String lastName; 59 60 61 private String firstNames; 62 63 64 public DCPersonName() 65 { 66 lastName = null; 67 firstNames = null; 68 } 69 70 76 public DCPersonName(String rawValue) 77 { 78 lastName = null; 80 firstNames = null; 81 82 if ((rawValue != null) && !rawValue.equals("")) 84 { 85 int commaIndex = rawValue.indexOf(','); 87 88 if (commaIndex == -1) 91 { 92 commaIndex = rawValue.length(); 93 } 94 95 lastName = rawValue.substring(0, commaIndex); 96 97 if (rawValue.length() > (commaIndex + 2)) 99 { 100 firstNames = rawValue.substring(commaIndex + 2); 101 } 102 else 103 { 104 firstNames = ""; 107 } 108 } 109 } 110 111 119 public DCPersonName(String lastNameIn, String firstNamesIn) 120 { 121 lastName = lastNameIn; 122 firstNames = firstNamesIn; 123 } 124 125 130 public String toString() 131 { 132 StringBuffer out = new StringBuffer (); 133 134 if (lastName != null) 135 { 136 out.append(lastName); 137 138 if ((firstNames != null) && !firstNames.equals("")) 139 { 140 out.append(", ").append(firstNames); 141 } 142 } 143 144 return (out.toString()); 145 } 146 147 152 public String getFirstNames() 153 { 154 return ((firstNames == null) ? "" : firstNames); 155 } 156 157 162 public String getLastName() 163 { 164 return ((lastName == null) ? "" : lastName); 165 } 166 } 167 | Popular Tags |