Permalink
Browse files

LPS-28437 Only update group when the name starts with classPK

  • Loading branch information...
1 parent 74f5e18 commit cd59b5f5c7c75e76fca81b082450a83e10192366 @jjangsam jjangsam committed with brianchandotcom Jul 9, 2012
Showing with 13 additions and 9 deletions.
  1. +13 −9 portal-impl/src/com/liferay/portal/verify/VerifyGroup.java
View
22 portal-impl/src/com/liferay/portal/verify/VerifyGroup.java
@@ -173,9 +173,10 @@ protected void verifyOrganizationNames() throws Exception {
try {
con = DataAccess.getUpgradeOptimizedConnection();
- StringBundler sb = new StringBundler(5);
+ StringBundler sb = new StringBundler(6);
- sb.append("select groupId, name from Group_ where name like '%");
+ sb.append("select classPK, groupId, name from Group_");
+ sb.append("where name like '%");
sb.append(GroupLocalServiceImpl.ORGANIZATION_NAME_SUFFIX);
sb.append("%' and name not like '% ");
sb.append(GroupLocalServiceImpl.ORGANIZATION_NAME_SUFFIX);
@@ -186,19 +187,22 @@ protected void verifyOrganizationNames() throws Exception {
rs = ps.executeQuery();
while (rs.next()) {
+ long classPK = rs.getLong("classPK");
long groupId = rs.getLong("groupId");
String name = rs.getString("name");
- int pos = name.indexOf(
- GroupLocalServiceImpl.ORGANIZATION_NAME_SUFFIX);
+ if (name.startsWith(String.valueOf(classPK))) {
+ int pos = name.indexOf(
+ GroupLocalServiceImpl.ORGANIZATION_NAME_SUFFIX);
- pos = name.indexOf(" ", pos + 1);
+ pos = name.indexOf(" ", pos + 1);
- String newName =
- name.substring(pos + 1) +
- GroupLocalServiceImpl.ORGANIZATION_NAME_SUFFIX;
+ String newName =
+ name.substring(pos + 1) +
+ GroupLocalServiceImpl.ORGANIZATION_NAME_SUFFIX;
- updateName(groupId, newName);
+ updateName(groupId, newName);
+ }
}
}
finally {

0 comments on commit cd59b5f

Please sign in to comment.