private void doInsertOrUpdate(Profile profile, int operation, Connection connection)
throws Exception
{
JetspeedGroupProfile groupProfile = new JetspeedGroupProfile();
DatabasePsmlManager service = (DatabasePsmlManager)PsmlManager.getService();
groupProfile.setGroupName(profile.getGroup().getName());
groupProfile.setMediaType(profile.getMediaType());
String language = profile.getLanguage();
if(language != null && (!language.equals("-1")))
{
groupProfile.setLanguage(language);
}
else
{
groupProfile.setLanguage(null);
}
String country = profile.getCountry();
if(country != null && (!country.equals("-1")))
{
groupProfile.setCountry(country);
}
else
{
groupProfile.setCountry(null);
}
String name = profile.getName();
if (name == null || name.equals(""))
{
profile.setName(Profiler.FULL_DEFAULT_PROFILE);
}
else if (!name.endsWith(Profiler.DEFAULT_EXTENSION))
{
profile.setName(name + Profiler.DEFAULT_EXTENSION);
}
groupProfile.setPage(profile.getName());
groupProfile.setProfile(DBUtils.portletsToBytes(
profile.getDocument().getPortlets(), service.getMapping()));
if (operation == INSERT)
{
super.doInsert(groupProfile, connection);
}