if (configuration != null
&& type != null
&& type.equals(PortalManager.BUILDTYPE_VALUE_ID) == false) {
String storePrefix = (String)configuration.get(PortalConstants.CONF_PROFILE_CACHE);
if (storePrefix != null) {
Store store = this.getProfileStore();
Enumeration keys = store.keys();
String currentKey;
String deleteGlobal = null;
String deleteRole = null;
String deleteUser = null;
if (type.equals(PortalManager.BUILDTYPE_VALUE_BASIC) == true ||
type.equals(PortalManager.BUILDTYPE_VALUE_GLOBAL) == true) {
if (type.equals(PortalManager.BUILDTYPE_VALUE_BASIC) == true) {
deleteGlobal = this.getProfileID(PortalManager.BUILDTYPE_VALUE_GLOBAL, null, null, false).substring(1);
}
deleteRole = this.getProfileID(PortalManager.BUILDTYPE_VALUE_GLOBAL, null, null, false);
deleteRole = deleteRole.substring(1, deleteRole.lastIndexOf(':')+1) + PortalManager.BUILDTYPE_VALUE_ROLE;
deleteUser = this.getProfileID(PortalManager.BUILDTYPE_VALUE_GLOBAL, null, null, false);
deleteUser = deleteUser.substring(1, deleteUser.lastIndexOf(':')+1) + PortalManager.BUILDTYPE_VALUE_ID;
} else { // role
deleteGlobal = this.getProfileID(PortalManager.BUILDTYPE_VALUE_ROLE, role, null, false).substring(1);
deleteUser = this.getProfileID(PortalManager.BUILDTYPE_VALUE_ID, role, "a", false);
deleteUser = deleteUser.substring(1, deleteUser.length()-1);
}
while (keys.hasMoreElements() == true) {
currentKey = (String)keys.nextElement();
if (deleteGlobal != null && currentKey.equals(deleteGlobal) == true) {
store.remove(currentKey);
} else if (deleteRole != null && currentKey.startsWith(deleteRole) == true) {
store.remove(currentKey);
} else if (deleteUser != null && currentKey.startsWith(deleteUser) == true) {
store.remove(currentKey);
}
}
}
} else if (configuration != null && type == null) {
// clean whole cache
String storePrefix = (String)configuration.get(PortalConstants.CONF_PROFILE_CACHE);
if (storePrefix != null) {
Store store = this.getProfileStore();
Enumeration keys = store.keys();
String currentKey;
String delete;
delete = this.getProfileID(PortalManager.BUILDTYPE_VALUE_GLOBAL, null, null, false);
delete = delete.substring(1, delete.lastIndexOf(':') + 1);
while (keys.hasMoreElements() == true) {
currentKey = (String)keys.nextElement();
if (currentKey.startsWith(delete) == true) {
store.remove(currentKey);
}
}
}
}