Author: ilgrosso
Date: Mon Sep 15 12:19:52 2014
New Revision: 1625012

URL: http://svn.apache.org/r1625012
Log:
Core upgrader: some enhancements + support for PostgreSQL

Added:
    syncope/branches/1_2_X/core-upgrader/src/main/resources/mysql-upgrade.sql
      - copied unchanged from r1624989, 
syncope/branches/1_2_X/core-upgrader/src/main/resources/syncope-1.1.X-1.2.X.sql
    
syncope/branches/1_2_X/core-upgrader/src/main/resources/postgresql-upgrade.sql  
 (with props)
Removed:
    
syncope/branches/1_2_X/core-upgrader/src/main/resources/syncope-1.1.X-1.2.X.sql
Modified:
    syncope/branches/1_2_X/   (props changed)
    
syncope/branches/1_2_X/core-upgrader/src/main/java/org/apache/syncope/upgrader/ContentUpgrader.java
    
syncope/branches/1_2_X/core/src/main/java/org/apache/syncope/core/persistence/beans/ConnInstance.java
    syncope/branches/1_2_X/src/site/xdoc/release-process.xml

Propchange: syncope/branches/1_2_X/
------------------------------------------------------------------------------
  Merged /syncope/branches/1_1_X:r1623345-1624961

Modified: 
syncope/branches/1_2_X/core-upgrader/src/main/java/org/apache/syncope/upgrader/ContentUpgrader.java
URL: 
http://svn.apache.org/viewvc/syncope/branches/1_2_X/core-upgrader/src/main/java/org/apache/syncope/upgrader/ContentUpgrader.java?rev=1625012&r1=1625011&r2=1625012&view=diff
==============================================================================
--- 
syncope/branches/1_2_X/core-upgrader/src/main/java/org/apache/syncope/upgrader/ContentUpgrader.java
 (original)
+++ 
syncope/branches/1_2_X/core-upgrader/src/main/java/org/apache/syncope/upgrader/ContentUpgrader.java
 Mon Sep 15 12:19:52 2014
@@ -593,7 +593,6 @@ public class ContentUpgrader implements 
             jdbcTemplate.update("ALTER TABLE RAttr DROP COLUMN schema_name;");
             jdbcTemplate.update("ALTER TABLE RDerAttr DROP COLUMN 
DERIVEDSCHEMA_NAME;");
             jdbcTemplate.update("ALTER TABLE RVirAttr DROP COLUMN 
VIRTUALSCHEMA_NAME;");
-
         } catch (DataAccessException ex) {
             LOG.error("Error accessing RAttr or RAttrTemplate table", ex);
         }
@@ -671,6 +670,7 @@ public class ContentUpgrader implements 
                 // add template to normal attributes
                 for (Long attrId : jdbcTemplate.queryForList("SELECT id FROM 
MAttr WHERE OWNER_ID = ?", Long.class,
                         membership.getId())) {
+                    
                     final MAttr mAttr = attrDAO.find(attrId, MAttr.class);
 
                     LOG.info("Adding template to membership normal attribute 
{}", mAttr);
@@ -685,6 +685,7 @@ public class ContentUpgrader implements 
                 // add template to derived attributes
                 for (Long attrId : jdbcTemplate.queryForList("SELECT id FROM 
MDerAttr WHERE OWNER_ID = ?", Long.class,
                         membership.getId())) {
+                    
                     final MDerAttr mDerAttr = derAttrDAO.find(attrId, 
MDerAttr.class);
 
                     LOG.info("Adding template to membership derived attribute 
{}", mDerAttr);
@@ -699,6 +700,7 @@ public class ContentUpgrader implements 
                 // add template to virtual attributes
                 for (Long attrId : jdbcTemplate.queryForList("SELECT id FROM 
MVirAttr WHERE OWNER_ID = ?", Long.class,
                         membership.getId())) {
+                    
                     final MVirAttr mVirAttr = virAttrDAO.find(attrId, 
MVirAttr.class);
 
                     LOG.info("Adding template to membership virtual attribute 
{}", mVirAttr);
@@ -725,12 +727,14 @@ public class ContentUpgrader implements 
 
     private <T extends AbstractAttrTemplate<K>, K extends AbstractSchema> T 
getTemplate(final Object obj,
             final String schemaName, final Class<T> reference) {
+
         T attrTemplate = null;
         for (Number number : attrTemplateDAO.findBySchemaName(schemaName, 
reference)) {
             final T attrTemplateTemp = attrTemplateDAO.find((Long) number, 
reference);
 
-            if (attrTemplateTemp.getOwner().equals(obj instanceof SyncopeRole 
? (SyncopeRole) obj : ((Membership) obj).
-                    getSyncopeRole())) {
+            if (attrTemplateTemp.getOwner().equals(obj instanceof SyncopeRole
+                    ? (SyncopeRole) obj : ((Membership) 
obj).getSyncopeRole())) {
+
                 attrTemplate = attrTemplateTemp;
             }
         }

Added: 
syncope/branches/1_2_X/core-upgrader/src/main/resources/postgresql-upgrade.sql
URL: 
http://svn.apache.org/viewvc/syncope/branches/1_2_X/core-upgrader/src/main/resources/postgresql-upgrade.sql?rev=1625012&view=auto
==============================================================================
--- 
syncope/branches/1_2_X/core-upgrader/src/main/resources/postgresql-upgrade.sql 
(added)
+++ 
syncope/branches/1_2_X/core-upgrader/src/main/resources/postgresql-upgrade.sql 
Mon Sep 15 12:19:52 2014
@@ -0,0 +1,101 @@
+-- Licensed to the Apache Software Foundation (ASF) under one
+-- or more contributor license agreements.  See the NOTICE file
+-- distributed with this work for additional information
+-- regarding copyright ownership.  The ASF licenses this file
+-- to you under the Apache License, Version 2.0 (the
+-- "License"); you may not use this file except in compliance
+-- with the License.  You may obtain a copy of the License at
+
+--  http://www.apache.org/licenses/LICENSE-2.0
+
+-- Unless required by applicable law or agreed to in writing,
+-- software distributed under the License is distributed on an
+-- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+-- KIND, either express or implied.  See the License for the
+-- specific language governing permissions and limitations
+-- under the License.
+
+-- delete views and indexes, they will be recreated by ContentInitializer
+
+DROP VIEW user_search;
+DROP VIEW user_search_attr;
+DROP VIEW user_search_membership;
+DROP VIEW user_search_resource;
+DROP VIEW user_search_null_attr;
+DROP VIEW user_search_role_resource;
+DROP VIEW user_search_unique_attr;
+DROP VIEW role_search;
+DROP VIEW role_search_attr;
+DROP VIEW role_search_entitlements;
+DROP VIEW role_search_null_attr;
+DROP VIEW role_search_resource;
+DROP VIEW role_search_unique_attr;
+
+DROP INDEX UAttrValue_stringvalueIndex;
+DROP INDEX UAttrValue_datevalueIndex; 
+DROP INDEX UAttrValue_longvalueIndex;
+DROP INDEX UAttrValue_doublevalueIndex;
+DROP INDEX UAttrValue_booleanvalueIndex;
+DROP INDEX MAttrValue_stringvalueIndex;
+DROP INDEX MAttrValue_datevalueIndex;
+DROP INDEX MAttrValue_longvalueIndex;
+DROP INDEX MAttrValue_doublevalueIndex;
+DROP INDEX MAttrValue_booleanvalueIndex;
+DROP INDEX RAttrValue_stringvalueIndex;
+DROP INDEX RAttrValue_datevalueIndex;
+DROP INDEX RAttrValue_longvalueIndex;
+DROP INDEX RAttrValue_doublevalueIndex;
+DROP INDEX RAttrValue_booleanvalueIndex;
+DROP INDEX Task_executedIndex;
+DROP INDEX ACT_RU_TASK_PARENT_TASK_ID_;
+
+--SYNCOPE-451 upgrade table definitions to comply with new Apache OpenJpa 
2.3.0 version
+ALTER TABLE ConnInstance_capabilities ALTER COLUMN capabilities TYPE 
VARCHAR(20);
+ALTER TABLE ExternalResource ALTER COLUMN createTraceLevel TYPE VARCHAR(20);
+ALTER TABLE ExternalResource ALTER COLUMN deleteTraceLevel TYPE VARCHAR(20);
+ALTER TABLE ExternalResource ALTER COLUMN syncTraceLevel TYPE VARCHAR(20);
+ALTER TABLE ExternalResource ALTER COLUMN propagationMode TYPE VARCHAR(20);
+ALTER TABLE ExternalResource ALTER COLUMN updateTraceLevel TYPE VARCHAR(20);
+ALTER TABLE MSchema ALTER COLUMN type TYPE VARCHAR(20);
+ALTER TABLE RMappingItem ALTER COLUMN intMappingType TYPE VARCHAR(23);
+ALTER TABLE RMappingItem ALTER COLUMN purpose TYPE VARCHAR(20);
+ALTER TABLE RSchema ALTER COLUMN type TYPE VARCHAR(20);
+ALTER TABLE SyncopeLogger ALTER COLUMN logLevel TYPE VARCHAR(20);
+ALTER TABLE SyncopeLogger ALTER COLUMN logType TYPE VARCHAR(20);
+ALTER TABLE SyncopeUser ALTER COLUMN cipherAlgorithm TYPE VARCHAR(20);
+ALTER TABLE UMappingItem ALTER COLUMN intMappingType TYPE VARCHAR(23);
+ALTER TABLE UMappingItem ALTER COLUMN purpose TYPE VARCHAR(20);
+ALTER TABLE USchema ALTER COLUMN type TYPE VARCHAR(20);
+ALTER TABLE SyncopeUser ALTER COLUMN password TYPE VARCHAR(255);
+
+-- SYNCOPE5-524
+ALTER TABLE ExternalResource RENAME COLUMN xmlConfiguration TO jsonConf;
+ALTER TABLE ConnInstance RENAME COLUMN xmlConfiguration TO jsonConf;
+
+-- preliminary steps for upgrade of (refactored) role and membership attributes
+ALTER TABLE RAttr DROP CONSTRAINT rattr_schema_name_fkey;
+ALTER TABLE RDerAttr DROP CONSTRAINT rderattr_derivedschema_name_fkey;
+ALTER TABLE RVirAttr DROP CONSTRAINT rvirattr_virtualschema_name_fkey;
+
+ALTER TABLE MAttr DROP CONSTRAINT mattr_schema_name_fkey;
+ALTER TABLE MDerAttr DROP CONSTRAINT mderattr_derivedschema_name_fkey;
+ALTER TABLE MVirAttr DROP CONSTRAINT mvirattr_virtualschema_name_fkey;
+
+ALTER TABLE UDerAttr DROP CONSTRAINT uderattr_derivedschema_name_fkey;
+ALTER TABLE UDerAttr RENAME DERIVEDSCHEMA_NAME TO DERSCHEMA_NAME;
+ALTER TABLE UDerAttr ADD CONSTRAINT uderattr_derschema_name_fkey FOREIGN KEY 
(DERSCHEMA_NAME) REFERENCES UDerSchema (name);  
+
+ALTER TABLE UVirAttr DROP CONSTRAINT uvirattr_virtualschema_name_fkey;
+ALTER TABLE UVirAttr RENAME VIRTUALSCHEMA_NAME TO VIRSCHEMA_NAME;
+ALTER TABLE UVirAttr ADD CONSTRAINT uvirattr_virschema_name_fkey FOREIGN KEY 
(VIRSCHEMA_NAME) REFERENCES UVirSchema (name);  
+
+-- SYNCOPE-444, SYNCOPE-409, SYNCOPE-445
+ALTER TABLE Notification DROP COLUMN xmlAbout;
+ALTER TABLE Notification DROP COLUMN xmlRecipients;
+
+-- create a backup of SyncopeConf table into new SyncopeConf_temp table
+create table SyncopeConf_temp (confKey varchar(255) primary key, confValue 
varchar(255));
+insert into SyncopeConf_temp (confKey,confValue) select confKey,confValue from 
SyncopeConf;
+
+-- delete SyncopeConf table, it will be created and initilized respectively by 
OpenJpa and ContentInitializer
+DROP TABLE SyncopeConf;

Propchange: 
syncope/branches/1_2_X/core-upgrader/src/main/resources/postgresql-upgrade.sql
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
syncope/branches/1_2_X/core-upgrader/src/main/resources/postgresql-upgrade.sql
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: 
syncope/branches/1_2_X/core-upgrader/src/main/resources/postgresql-upgrade.sql
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: 
syncope/branches/1_2_X/core/src/main/java/org/apache/syncope/core/persistence/beans/ConnInstance.java
URL: 
http://svn.apache.org/viewvc/syncope/branches/1_2_X/core/src/main/java/org/apache/syncope/core/persistence/beans/ConnInstance.java?rev=1625012&r1=1625011&r2=1625012&view=diff
==============================================================================
--- 
syncope/branches/1_2_X/core/src/main/java/org/apache/syncope/core/persistence/beans/ConnInstance.java
 (original)
+++ 
syncope/branches/1_2_X/core/src/main/java/org/apache/syncope/core/persistence/beans/ConnInstance.java
 Mon Sep 15 12:19:52 2014
@@ -34,6 +34,7 @@ import javax.persistence.FetchType;
 import javax.persistence.Id;
 import javax.persistence.Lob;
 import javax.persistence.OneToMany;
+import org.apache.commons.lang3.ArrayUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.syncope.common.types.ConnConfProperty;
 import org.apache.syncope.common.types.ConnectorCapability;
@@ -155,10 +156,15 @@ public class ConnInstance extends Abstra
     }
 
     public Set<ConnConfProperty> getConfiguration() {
-        return StringUtils.isBlank(jsonConf)
-                ? Collections.<ConnConfProperty>emptySet()
-                : new HashSet<ConnConfProperty>(
-                        Arrays.asList(POJOHelper.deserialize(jsonConf, 
ConnConfProperty[].class)));
+        Set<ConnConfProperty> configuration = 
Collections.<ConnConfProperty>emptySet();
+        if (!StringUtils.isBlank(jsonConf)) {
+            ConnConfProperty[] deserialized = POJOHelper.deserialize(jsonConf, 
ConnConfProperty[].class);
+            if (ArrayUtils.isNotEmpty(deserialized)) {
+                configuration = new 
HashSet<ConnConfProperty>(Arrays.asList(deserialized));
+            }
+        }
+
+        return configuration;
     }
 
     public void setConfiguration(final Set<ConnConfProperty> configuration) {

Modified: syncope/branches/1_2_X/src/site/xdoc/release-process.xml
URL: 
http://svn.apache.org/viewvc/syncope/branches/1_2_X/src/site/xdoc/release-process.xml?rev=1625012&r1=1625011&r2=1625012&view=diff
==============================================================================
--- syncope/branches/1_2_X/src/site/xdoc/release-process.xml (original)
+++ syncope/branches/1_2_X/src/site/xdoc/release-process.xml Mon Sep 15 
12:19:52 2014
@@ -469,8 +469,6 @@ svn mv -m "Moving the voted release arti
 https://dist.apache.org/repos/dist/dev/syncope/<version>
 https://dist.apache.org/repos/dist/release/syncope/<version>
 
-svn rm -m "Cleaning up older releases" 
https://dist.apache.org/repos/dist/dev/syncope/<version>
-
 svn co https://dist.apache.org/repos/dist/release/syncope syncope-dist-release
 cd syncope-dist-release
 svn rm <any older release artifact (if present)>


Reply via email to