Author: ndkhoiits
Date: 2011-02-11 06:33:14 -0500 (Fri, 11 Feb 2011)
New Revision: 5869
Modified:
portal/branches/branch-GTNPORTAL-1790/component/application-registry/src/main/java/org/exoplatform/application/registry/impl/ApplicationRegistryServiceImpl.java
Log:
GTNPORTAL-1781 Some portlet are duplicated after imported applications
Modified:
portal/branches/branch-GTNPORTAL-1790/component/application-registry/src/main/java/org/exoplatform/application/registry/impl/ApplicationRegistryServiceImpl.java
===================================================================
---
portal/branches/branch-GTNPORTAL-1790/component/application-registry/src/main/java/org/exoplatform/application/registry/impl/ApplicationRegistryServiceImpl.java 2011-02-10
09:49:40 UTC (rev 5868)
+++
portal/branches/branch-GTNPORTAL-1790/component/application-registry/src/main/java/org/exoplatform/application/registry/impl/ApplicationRegistryServiceImpl.java 2011-02-11
11:33:14 UTC (rev 5869)
@@ -524,11 +524,25 @@
contentId = info.getApplicationName() + "/" +
info.getName();
}
- //
- app = category.createContent(portletName, contentType, contentId);
- app.setDisplayName(displayName);
- app.setDescription(getLocalizedStringValue(descriptionLS, portletName));
- app.setAccessPermissions(permissions);
+ // Check if the portlet has already existed in this category
+ List<Application> applications = load(category).getApplications();
+ boolean isExist = false;
+ for (Application application : applications)
+ {
+ if (application.getContentId().equals(contentId))
+ {
+ isExist = true;
+ break;
+ }
+ }
+
+ if (!isExist)
+ {
+ app = category.createContent(portletName, contentType, contentId);
+ app.setDisplayName(displayName);
+ app.setDescription(getLocalizedStringValue(descriptionLS,
portletName));
+ app.setAccessPermissions(permissions);
+ }
}
}
}
Show replies by date