Verfeinerungen an den Upgrades
git-svn-id: https://svn.libreccm.org/ccm/trunk@1512 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
f459b079b9
commit
6232654cda
|
|
@ -26,14 +26,14 @@ public class PublicPersonalProfileOwnerAssocUpgrade extends Program {
|
|||
super("PublicPersonalProfileOwnerAssocUpgrade", "1.0.0", "");
|
||||
}
|
||||
|
||||
public static final void main(final String[] args) {
|
||||
public static void main(final String[] args) {
|
||||
new PublicPersonalProfileOwnerAssocUpgrade().run(args);
|
||||
}
|
||||
|
||||
public void doRun(final CommandLine cmdLine) {
|
||||
System.out.println("Starting upgrade...");
|
||||
|
||||
List<OldAssocEntry> oldData = new ArrayList<OldAssocEntry>();
|
||||
List<AssocEntry> oldData = new ArrayList<AssocEntry>();
|
||||
|
||||
final Connection conn = Connections.acquire(RuntimeConfig.getConfig().
|
||||
getJDBCURL());
|
||||
|
|
@ -52,12 +52,32 @@ public class PublicPersonalProfileOwnerAssocUpgrade extends Program {
|
|||
final Statement stmt = conn.createStatement();
|
||||
final ResultSet oldAssocResult = stmt.executeQuery(
|
||||
"SELECT profile_id, owner_id, owner_order "
|
||||
+ "FROM ct_public_personal_profile_owner_map");
|
||||
+ "FROM ct_public_personal_profile_owner_map "
|
||||
+ "JOIN cms_items on profile_id = item_id "
|
||||
+ "WHERE version = 'draft'");
|
||||
|
||||
while (oldAssocResult.next()) {
|
||||
oldData.add(new OldAssocEntry(oldAssocResult.getBigDecimal(1),
|
||||
oldAssocResult.getBigDecimal(2),
|
||||
oldAssocResult.getInt(3)));
|
||||
AssocEntry entry = new AssocEntry();
|
||||
|
||||
entry.setProfileDraftId(oldAssocResult.getBigDecimal(1));
|
||||
entry.setProfileBundleDraftId(getParentIdFor(
|
||||
entry.getProfileDraftId(), conn));
|
||||
entry.setOwnerDraftId(oldAssocResult.getBigDecimal(2));
|
||||
entry.setOwnerBundleDraftId(getParentIdFor(
|
||||
entry.getOwnerDraftId(), conn));
|
||||
|
||||
entry.setProfilePublicId(getPublicIdFor(
|
||||
entry.getProfileDraftId(), conn));
|
||||
entry.setProfileBundlePublicId(getPublicIdFor(
|
||||
entry.getProfileBundleDraftId(), conn));
|
||||
entry.setOwnerPublicId(getParentIdFor(
|
||||
entry.getOwnerDraftId(), conn));
|
||||
entry.setOwnerBundlePublicId(getParentIdFor(
|
||||
entry.getOwnerBundleDraftId(), conn));
|
||||
|
||||
entry.setOwnerOrder(oldAssocResult.getInt(3));
|
||||
|
||||
oldData.add(entry);
|
||||
}
|
||||
} catch (SQLException ex) {
|
||||
System.err.println("Failed to retrieve old data.");
|
||||
|
|
@ -148,17 +168,12 @@ public class PublicPersonalProfileOwnerAssocUpgrade extends Program {
|
|||
}
|
||||
|
||||
final List<String> processedEntries = new ArrayList<String>();
|
||||
for (OldAssocEntry entry : oldData) {
|
||||
BigDecimal profileBundleId;
|
||||
BigDecimal ownerBundleId;
|
||||
|
||||
profileBundleId = getParentIdFor(entry.getProfileId(), conn);
|
||||
ownerBundleId = getParentIdFor(entry.ownerId, conn);
|
||||
for (AssocEntry entry : oldData) {
|
||||
|
||||
if (processedEntries.contains(
|
||||
String.format("%s-%s",
|
||||
profileBundleId.toString(),
|
||||
ownerBundleId.toString()))) {
|
||||
entry.getProfileBundleDraftId().toString(),
|
||||
entry.getOwnerBundleDraftId().toString()))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -168,14 +183,57 @@ public class PublicPersonalProfileOwnerAssocUpgrade extends Program {
|
|||
+ "owner_id, "
|
||||
+ "owner_order) "
|
||||
+ "VALUES (%s, %s, %d)",
|
||||
profileBundleId.toString(),
|
||||
ownerBundleId.toString(),
|
||||
entry.getProfileBundleDraftId().toString(),
|
||||
entry.getOwnerBundleDraftId().toString(),
|
||||
entry.getOwnerOrder()));
|
||||
if ((entry.getProfileBundlePublicId() != null)
|
||||
&& (entry.getOwnerBundlePublicId() != null)) {
|
||||
stmt.addBatch(String.format(
|
||||
"INSERT INTO ct_public_personal_profile_owner_map ("
|
||||
+ "profile_id, "
|
||||
+ "owner_id, "
|
||||
+ "owner_order) "
|
||||
+ "VALUES (%s, %s, %d)",
|
||||
entry.getProfileBundlePublicId().toString(),
|
||||
entry.getOwnerBundlePublicId().toString(),
|
||||
entry.getOwnerOrder()));
|
||||
}
|
||||
|
||||
if (entry.getProfileBundlePublicId() != null) {
|
||||
stmt.addBatch(String.format(
|
||||
"UPDATE cms_published_links "
|
||||
+ "SET pending = %s, "
|
||||
+ "pending_source = %s, "
|
||||
+ "draft_target = %s "
|
||||
+ "WHERE pending = %s "
|
||||
+ "AND draft_target = %s",
|
||||
entry.getProfileBundlePublicId(),
|
||||
entry.getProfileBundlePublicId(),
|
||||
entry.getOwnerBundleDraftId(),
|
||||
entry.getProfilePublicId(),
|
||||
entry.getOwnerDraftId()));
|
||||
}
|
||||
|
||||
if (entry.getOwnerBundlePublicId() != null) {
|
||||
stmt.addBatch(String.format(
|
||||
"UPDATE cms_published_links "
|
||||
+ "SET pending = %s, "
|
||||
+ "pending_source = %s, "
|
||||
+ "draft_target = %s "
|
||||
+ "WHERE pending = %s "
|
||||
+ "AND draft_target = %s",
|
||||
entry.getOwnerBundlePublicId(),
|
||||
entry.getOwnerBundlePublicId(),
|
||||
entry.getProfileBundleDraftId(),
|
||||
entry.getOwnerPublicId(),
|
||||
entry.getProfileDraftId()));
|
||||
}
|
||||
|
||||
|
||||
processedEntries.add(String.format(
|
||||
"%s-%s",
|
||||
profileBundleId.toString(),
|
||||
ownerBundleId.toString()));
|
||||
entry.getProfileBundleDraftId().toString(),
|
||||
entry.getOwnerBundleDraftId().toString()));
|
||||
}
|
||||
|
||||
stmt.executeBatch();
|
||||
|
|
@ -200,26 +258,43 @@ public class PublicPersonalProfileOwnerAssocUpgrade extends Program {
|
|||
close(conn);
|
||||
}
|
||||
|
||||
private class OldAssocEntry {
|
||||
private class AssocEntry {
|
||||
|
||||
private BigDecimal profileId;
|
||||
private BigDecimal ownerId;
|
||||
private BigDecimal profileDraftId;
|
||||
private BigDecimal ownerDraftId;
|
||||
private BigDecimal profilePublicId;
|
||||
private BigDecimal ownerPublicId;
|
||||
private BigDecimal profileBundleDraftId;
|
||||
private BigDecimal ownerBundleDraftId;
|
||||
private BigDecimal profileBundlePublicId;
|
||||
private BigDecimal ownerBundlePublicId;
|
||||
private Integer ownerOrder;
|
||||
|
||||
public OldAssocEntry(final BigDecimal profileId,
|
||||
final BigDecimal ownerId,
|
||||
final Integer ownerOrder) {
|
||||
this.profileId = profileId;
|
||||
this.ownerId = ownerId;
|
||||
this.ownerOrder = ownerOrder;
|
||||
public AssocEntry() {
|
||||
}
|
||||
|
||||
public BigDecimal getOwnerId() {
|
||||
return ownerId;
|
||||
public BigDecimal getOwnerBundleDraftId() {
|
||||
return ownerBundleDraftId;
|
||||
}
|
||||
|
||||
public void setOwnerId(BigDecimal ownerId) {
|
||||
this.ownerId = ownerId;
|
||||
public void setOwnerBundleDraftId(BigDecimal ownerBundleDraftId) {
|
||||
this.ownerBundleDraftId = ownerBundleDraftId;
|
||||
}
|
||||
|
||||
public BigDecimal getOwnerBundlePublicId() {
|
||||
return ownerBundlePublicId;
|
||||
}
|
||||
|
||||
public void setOwnerBundlePublicId(BigDecimal ownerBundlePublicId) {
|
||||
this.ownerBundlePublicId = ownerBundlePublicId;
|
||||
}
|
||||
|
||||
public BigDecimal getOwnerDraftId() {
|
||||
return ownerDraftId;
|
||||
}
|
||||
|
||||
public void setOwnerDraftId(BigDecimal ownerDraftId) {
|
||||
this.ownerDraftId = ownerDraftId;
|
||||
}
|
||||
|
||||
public Integer getOwnerOrder() {
|
||||
|
|
@ -230,12 +305,44 @@ public class PublicPersonalProfileOwnerAssocUpgrade extends Program {
|
|||
this.ownerOrder = ownerOrder;
|
||||
}
|
||||
|
||||
public BigDecimal getProfileId() {
|
||||
return profileId;
|
||||
public BigDecimal getOwnerPublicId() {
|
||||
return ownerPublicId;
|
||||
}
|
||||
|
||||
public void setProfileId(BigDecimal profileId) {
|
||||
this.profileId = profileId;
|
||||
public void setOwnerPublicId(BigDecimal ownerPublicId) {
|
||||
this.ownerPublicId = ownerPublicId;
|
||||
}
|
||||
|
||||
public BigDecimal getProfileBundleDraftId() {
|
||||
return profileBundleDraftId;
|
||||
}
|
||||
|
||||
public void setProfileBundleDraftId(BigDecimal profileBundleDraftId) {
|
||||
this.profileBundleDraftId = profileBundleDraftId;
|
||||
}
|
||||
|
||||
public BigDecimal getProfileBundlePublicId() {
|
||||
return profileBundlePublicId;
|
||||
}
|
||||
|
||||
public void setProfileBundlePublicId(BigDecimal profileBundlePublicId) {
|
||||
this.profileBundlePublicId = profileBundlePublicId;
|
||||
}
|
||||
|
||||
public BigDecimal getProfileDraftId() {
|
||||
return profileDraftId;
|
||||
}
|
||||
|
||||
public void setProfileDraftId(BigDecimal profileDraftId) {
|
||||
this.profileDraftId = profileDraftId;
|
||||
}
|
||||
|
||||
public BigDecimal getProfilePublicId() {
|
||||
return profilePublicId;
|
||||
}
|
||||
|
||||
public void setProfilePublicId(BigDecimal profilePublicId) {
|
||||
this.profilePublicId = profilePublicId;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -243,7 +350,8 @@ public class PublicPersonalProfileOwnerAssocUpgrade extends Program {
|
|||
try {
|
||||
conn.rollback();
|
||||
} catch (SQLException ex1) {
|
||||
System.out.println("Rollback failed.");
|
||||
System.err.println("Rollback failed.");
|
||||
ex1.printStackTrace(System.err);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -263,13 +371,29 @@ public class PublicPersonalProfileOwnerAssocUpgrade extends Program {
|
|||
}
|
||||
}
|
||||
|
||||
private BigDecimal getPublicIdFor(final BigDecimal id,
|
||||
final Connection conn)
|
||||
throws SQLException {
|
||||
final Statement stmt = conn.createStatement();
|
||||
|
||||
final ResultSet rs = stmt.executeQuery(String.format(
|
||||
"SELECT item_id FROM cms_items WHERE master_id = %s",
|
||||
id.toString()));
|
||||
|
||||
while (rs.next()) {
|
||||
return rs.getBigDecimal(1);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private BigDecimal getParentIdFor(final BigDecimal id,
|
||||
final Connection conn)
|
||||
throws SQLException {
|
||||
final Statement stmt = conn.createStatement();
|
||||
|
||||
final ResultSet rs = stmt.executeQuery(String.format(
|
||||
"SELECT parent_id FROM cms_items where item_id = %s",
|
||||
"SELECT parent_id FROM cms_items WHERE item_id = %s",
|
||||
id.toString()));
|
||||
|
||||
while (rs.next()) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,34 @@
|
|||
--
|
||||
-- Copyright (C) 2012 Jens Pelzetter. All Rights Reserved.
|
||||
--
|
||||
-- This library is free software; you can redistribute it and/or
|
||||
-- modify it under the terms of the GNU Lesser General Public License
|
||||
-- as published by the Free Software Foundation; either version 2.1 of
|
||||
-- the License, or (at your option) any later version.
|
||||
--
|
||||
-- This library is distributed in the hope that it will be useful,
|
||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
-- Lesser General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU Lesser General Public
|
||||
-- License along with this library; if not, write to the Free Software
|
||||
-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
--
|
||||
-- $Id$
|
||||
|
||||
CREATE TABLE cms_orgaunit_bundles (bundle_id integer NOT NULL);
|
||||
|
||||
ALTER TABLE ONLY cms_orgaunit_bundles ADD CONSTRAINT cms_orgau_bund_bund_id_p_cfjhf PRIMARY KEY (bundle_id);
|
||||
|
||||
ALTER TABLE cms_organizationalunits_contact_map DROP CONSTRAINT cms_org_con_map_org_id_f_vdrnx;
|
||||
|
||||
ALTER TABLE ONLY cms_organizationalunits_contact_map ADD CONSTRAINT cms_org_con_map_org_id_f_vdrnx FOREIGN KEY (organizationalunit_id) REFERENCES cms_orgaunit_bundles(bundle_id);
|
||||
|
||||
ALTER TABLE ONLY cms_orgaunit_bundles ADD CONSTRAINT cms_orgau_bund_bund_id_f_b64mp FOREIGN KEY (bundle_id) REFERENCES cms_bundles(bundle_id);
|
||||
|
||||
ALTER TABLE cms_organizationalunits_person_map DROP CONSTRAINT cms_org_per_map_org_id_f_ducb2;
|
||||
ALTER TABLE cms_organizationalunits_person_map DROP CONSTRAINT cms_org_per_map_per_id_f_hrpzh;
|
||||
|
||||
ALTER TABLE ONLY cms_organizationalunits_person_map ADD CONSTRAINT cms_org_per_map_org_id_f_ducb2 FOREIGN KEY (organizationalunit_id) REFERENCES cms_bundles(bundle_id);
|
||||
ALTER TABLE ONLY cms_organizationalunits_person_map ADD CONSTRAINT cms_org_per_map_per_id_f_hrpzh FOREIGN KEY (person_id) REFERENCES cms_bundles(bundle_id);
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
--
|
||||
-- Copyright (C) 2011 Jens Pelzetter All Rights Reserved.
|
||||
--
|
||||
-- This library is free software; you can redistribute it and/or
|
||||
-- modify it under the terms of the GNU Lesser General Public License
|
||||
-- as published by the Free Software Foundation; either version 2.1 of
|
||||
-- the License, or (at your option) any later version.
|
||||
--
|
||||
-- This library is distributed in the hope that it will be useful,
|
||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
-- Lesser General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU Lesser General Public
|
||||
-- License along with this library; if not, write to the Free Software
|
||||
-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
--
|
||||
-- $Id$
|
||||
|
||||
\echo Red Hat Enterprise CMS 6.6.4 -> 6.6.5 Upgrade Script (PostgreSQL)
|
||||
|
||||
begin;
|
||||
|
||||
\i ../default/upgrade/6.6.4-6.6.5/create_orgaunit_bundle.sql
|
||||
|
||||
commit;
|
||||
|
|
@ -52,6 +52,7 @@
|
|||
</version>
|
||||
<version from="6.6.4" to="6.6.5">
|
||||
<script class="com.arsdigita.cms.contenttypes.GenericContactPersonAssocUpgrade"/>
|
||||
<script sql="ccm-cms/upgrade::database::-6.6.4-6.6.5.sql"/>
|
||||
</version>
|
||||
<version from="6.6.5" to="6.6.6">
|
||||
<!-- ContentSection now loaded as legacy free application -->
|
||||
|
|
|
|||
|
|
@ -26,13 +26,13 @@ public class GenericContactPersonAssocUpgrade extends Program {
|
|||
super("GenericContactPersonAssocUpgrade", "1.0.0", "");
|
||||
}
|
||||
|
||||
public static final void main(final String[] args) {
|
||||
public static void main(final String[] args) {
|
||||
new GenericContactPersonAssocUpgrade().run(args);
|
||||
}
|
||||
|
||||
public void doRun(final CommandLine cmdLine) {
|
||||
System.out.println("Starting upgrade...");
|
||||
List<OldAssocEntry> oldData = new ArrayList<OldAssocEntry>();
|
||||
List<AssocEntry> oldData = new ArrayList<AssocEntry>();
|
||||
|
||||
System.out.println("Trying to get JDBC connection...");
|
||||
|
||||
|
|
@ -52,13 +52,33 @@ public class GenericContactPersonAssocUpgrade extends Program {
|
|||
final Statement stmt = conn.createStatement();
|
||||
final ResultSet oldAssocResult = stmt.executeQuery(
|
||||
"SELECT person_id, contact_id, link_order, link_key "
|
||||
+ "FROM cms_person_contact_map");
|
||||
+ "FROM cms_person_contact_map "
|
||||
+ "JOIN cms_items on person_id = item_id "
|
||||
+ "WHERE version = 'draft' ");
|
||||
|
||||
while (oldAssocResult.next()) {
|
||||
oldData.add(new OldAssocEntry(oldAssocResult.getBigDecimal(1),
|
||||
oldAssocResult.getBigDecimal(2),
|
||||
oldAssocResult.getInt(3),
|
||||
oldAssocResult.getString(4)));
|
||||
AssocEntry entry = new AssocEntry();
|
||||
|
||||
entry.setPersonDraftId(oldAssocResult.getBigDecimal(1));
|
||||
entry.setPersonDraftBundleId(getParentIdFor(
|
||||
entry.getPersonDraftId(), conn));
|
||||
entry.setContactDraftId(oldAssocResult.getBigDecimal(2));
|
||||
entry.setContactDraftBundleId(getParentIdFor(
|
||||
entry.getContactDraftId(), conn));
|
||||
|
||||
entry.setPersonPublicId(getPublicIdFor(
|
||||
entry.getPersonDraftId(), conn));
|
||||
entry.setPersonPublicBundleId(getPublicIdFor(
|
||||
entry.getPersonDraftBundleId(), conn));
|
||||
entry.setContactPublicId(getPublicIdFor(
|
||||
entry.getContactDraftId(), conn));
|
||||
entry.setContactPublicBundleId(getPublicIdFor(
|
||||
entry.getContactDraftBundleId(), conn));
|
||||
|
||||
entry.setLinkOrder(oldAssocResult.getInt(3));
|
||||
entry.setLinkKey(oldAssocResult.getString(4));
|
||||
|
||||
oldData.add(entry);
|
||||
}
|
||||
} catch (SQLException ex) {
|
||||
System.err.println("Failed to retrieve old data.");
|
||||
|
|
@ -181,17 +201,11 @@ public class GenericContactPersonAssocUpgrade extends Program {
|
|||
|
||||
final List<String> processedEntries =
|
||||
new ArrayList<String>();
|
||||
for (OldAssocEntry entry : oldData) {
|
||||
BigDecimal personBundleId;
|
||||
BigDecimal contactBundleId;
|
||||
|
||||
personBundleId = getParentIdFor(entry.getPersonId(), conn);
|
||||
contactBundleId = getParentIdFor(entry.getContactId(), conn);
|
||||
|
||||
for (AssocEntry entry : oldData) {
|
||||
if (processedEntries.contains(
|
||||
String.format("%s-%s",
|
||||
personBundleId.toString(),
|
||||
contactBundleId.toString()))) {
|
||||
entry.getPersonDraftBundleId().toString(),
|
||||
entry.getContactDraftBundleId().toString()))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -202,14 +216,61 @@ public class GenericContactPersonAssocUpgrade extends Program {
|
|||
+ "link_order, "
|
||||
+ "link_key) "
|
||||
+ "VALUES (%s, %s, %d, '%s')",
|
||||
personBundleId.toString(),
|
||||
contactBundleId.toString(),
|
||||
entry.getPersonDraftBundleId().toString(),
|
||||
entry.getContactDraftBundleId().toString(),
|
||||
entry.getLinkOrder(),
|
||||
entry.getLinkKey()));
|
||||
|
||||
processedEntries.add(String.format("%s-%s",
|
||||
personBundleId.toString(),
|
||||
contactBundleId.toString()));
|
||||
if ((entry.getPersonPublicBundleId() != null)
|
||||
&& (entry.getContactPublicBundleId() != null)) {
|
||||
stmt.addBatch(String.format(
|
||||
"INSERT INTO cms_person_contact_map ("
|
||||
+ "person_id, "
|
||||
+ "contact_id, "
|
||||
+ "link_order, "
|
||||
+ "link_key) "
|
||||
+ "VALUES (%s, %s, %d, '%s')",
|
||||
entry.getPersonPublicBundleId().toString(),
|
||||
entry.getContactPublicBundleId().toString(),
|
||||
entry.getLinkOrder(),
|
||||
entry.getLinkKey()));
|
||||
}
|
||||
|
||||
if (entry.getPersonPublicBundleId() != null) {
|
||||
stmt.addBatch(String.format(
|
||||
"UPDATE cms_published_links "
|
||||
+ "SET pending = %s, "
|
||||
+ "pending_source = %s, "
|
||||
+ "draft_target = %s "
|
||||
+ "WHERE pending = %s "
|
||||
+ "AND draft_target = %s",
|
||||
entry.getPersonPublicBundleId().toString(),
|
||||
entry.getPersonPublicBundleId().toString(),
|
||||
entry.getContactDraftBundleId(),
|
||||
entry.getPersonPublicId(),
|
||||
entry.getContactDraftId()));
|
||||
}
|
||||
|
||||
if (entry.getContactPublicBundleId() != null) {
|
||||
stmt.addBatch(String.format(
|
||||
"UPDATE cms_published_links "
|
||||
+ "SET pending = %s, "
|
||||
+ "pending_source = %s, "
|
||||
+ "draft_target = %s "
|
||||
+ "WHERE pending = %s "
|
||||
+ "AND draft_target = %s",
|
||||
entry.getContactPublicBundleId().toString(),
|
||||
entry.getContactPublicBundleId().toString(),
|
||||
entry.getPersonDraftBundleId(),
|
||||
entry.getContactPublicId(),
|
||||
entry.getPersonDraftId()));
|
||||
}
|
||||
|
||||
processedEntries.add(String.format(
|
||||
"%s-%s",
|
||||
entry.getPersonDraftBundleId().
|
||||
toString(),
|
||||
entry.getContactDraftBundleId().toString()));
|
||||
}
|
||||
|
||||
stmt.executeBatch();
|
||||
|
|
@ -235,38 +296,117 @@ public class GenericContactPersonAssocUpgrade extends Program {
|
|||
close(conn);
|
||||
}
|
||||
|
||||
private class OldAssocEntry {
|
||||
private class AssocEntry {
|
||||
|
||||
private BigDecimal personId;
|
||||
private BigDecimal contactId;
|
||||
private BigDecimal personDraftId;
|
||||
private BigDecimal contactDraftId;
|
||||
private BigDecimal personPublicId;
|
||||
private BigDecimal contactPublicId;
|
||||
private BigDecimal personDraftBundleId;
|
||||
private BigDecimal contactDraftBundleId;
|
||||
private BigDecimal personPublicBundleId;
|
||||
private BigDecimal contactPublicBundleId;
|
||||
private Integer linkOrder;
|
||||
private String linkKey;
|
||||
|
||||
public OldAssocEntry(final BigDecimal personId,
|
||||
final BigDecimal contactId,
|
||||
final Integer linkOrder,
|
||||
final String linkKey) {
|
||||
this.personId = personId;
|
||||
this.contactId = contactId;
|
||||
this.linkOrder = linkOrder;
|
||||
this.linkKey = linkKey;
|
||||
public AssocEntry() {
|
||||
}
|
||||
|
||||
public BigDecimal getContactId() {
|
||||
return contactId;
|
||||
public BigDecimal getContactDraftBundleId() {
|
||||
return contactDraftBundleId;
|
||||
}
|
||||
|
||||
public void setContactDraftBundleId(BigDecimal contactDraftBundleId) {
|
||||
this.contactDraftBundleId = contactDraftBundleId;
|
||||
}
|
||||
|
||||
public BigDecimal getContactDraftId() {
|
||||
return contactDraftId;
|
||||
}
|
||||
|
||||
public void setContactDraftId(BigDecimal contactDraftId) {
|
||||
this.contactDraftId = contactDraftId;
|
||||
}
|
||||
|
||||
public BigDecimal getContactPublicBundleId() {
|
||||
return contactPublicBundleId;
|
||||
}
|
||||
|
||||
public void setContactPublicBundleId(BigDecimal contactPublicBundleId) {
|
||||
this.contactPublicBundleId = contactPublicBundleId;
|
||||
}
|
||||
|
||||
public BigDecimal getContactPublicId() {
|
||||
return contactPublicId;
|
||||
}
|
||||
|
||||
public void setContactPublicId(BigDecimal contactPublicId) {
|
||||
this.contactPublicId = contactPublicId;
|
||||
}
|
||||
|
||||
public String getLinkKey() {
|
||||
return linkKey;
|
||||
}
|
||||
|
||||
public void setLinkKey(String linkKey) {
|
||||
this.linkKey = linkKey;
|
||||
}
|
||||
|
||||
public Integer getLinkOrder() {
|
||||
return linkOrder;
|
||||
}
|
||||
|
||||
public BigDecimal getPersonId() {
|
||||
return personId;
|
||||
public void setLinkOrder(Integer linkOrder) {
|
||||
this.linkOrder = linkOrder;
|
||||
}
|
||||
|
||||
public BigDecimal getPersonDraftBundleId() {
|
||||
return personDraftBundleId;
|
||||
}
|
||||
|
||||
public void setPersonDraftBundleId(BigDecimal personDraftBundleId) {
|
||||
this.personDraftBundleId = personDraftBundleId;
|
||||
}
|
||||
|
||||
public BigDecimal getPersonDraftId() {
|
||||
return personDraftId;
|
||||
}
|
||||
|
||||
public void setPersonDraftId(BigDecimal personDraftId) {
|
||||
this.personDraftId = personDraftId;
|
||||
}
|
||||
|
||||
public BigDecimal getPersonPublicBundleId() {
|
||||
return personPublicBundleId;
|
||||
}
|
||||
|
||||
public void setPersonPublicBundleId(BigDecimal personPublicBundleId) {
|
||||
this.personPublicBundleId = personPublicBundleId;
|
||||
}
|
||||
|
||||
public BigDecimal getPersonPublicId() {
|
||||
return personPublicId;
|
||||
}
|
||||
|
||||
public void setPersonPublicId(BigDecimal personPublicId) {
|
||||
this.personPublicId = personPublicId;
|
||||
}
|
||||
}
|
||||
|
||||
private BigDecimal getPublicIdFor(final BigDecimal id,
|
||||
final Connection conn)
|
||||
throws SQLException {
|
||||
final Statement stmt = conn.createStatement();
|
||||
|
||||
final ResultSet rs = stmt.executeQuery(String.format(
|
||||
"SELECT item_id FROM cms_items WHERE master_id = %s",
|
||||
id.toString()));
|
||||
|
||||
while (rs.next()) {
|
||||
return rs.getBigDecimal(1);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private BigDecimal getParentIdFor(final BigDecimal id,
|
||||
|
|
@ -275,7 +415,7 @@ public class GenericContactPersonAssocUpgrade extends Program {
|
|||
final Statement stmt = conn.createStatement();
|
||||
|
||||
final ResultSet rs = stmt.executeQuery(String.format(
|
||||
"SELECT parent_id FROM cms_items where item_id = %s",
|
||||
"SELECT parent_id FROM cms_items WHERE item_id = %s",
|
||||
id.toString()));
|
||||
|
||||
while (rs.next()) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue