- Upgrades für ccm-sci-publications von 6.6.2 auf 6.6.3
- Kleinkram git-svn-id: https://svn.libreccm.org/ccm/trunk@1638 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
2a103a3564
commit
57e1df88be
|
|
@ -0,0 +1,4 @@
|
||||||
|
begin;
|
||||||
|
\i ddl/postgres/create.sql
|
||||||
|
\i ddl/postgres/deferred.sql
|
||||||
|
end;
|
||||||
|
|
@ -6,7 +6,32 @@
|
||||||
<script sql="ccm-sci-publications/upgrade/::database::-6.6.1-6.6.2.sql"/>
|
<script sql="ccm-sci-publications/upgrade/::database::-6.6.1-6.6.2.sql"/>
|
||||||
</version>
|
</version>
|
||||||
<version from="6.6.2" to="6.6.3">
|
<version from="6.6.2" to="6.6.3">
|
||||||
<script class="com.arsdigita.cms.contenttypes.PublicationAuthorAssocUpgrade"/>
|
<script class="com.arsdigita.cms.contenttypes.upgrades.JournalTypeUpgrade"/>
|
||||||
<script class="com.arsdigita.cms.contenttypes.PublicationOrgaunitAssocUpgrade"/>
|
<script class="com.arsdigita.cms.contenttypes.upgrades.ArticleInCollectedVolumeBundleUpgrade"/>
|
||||||
|
<script class="com.arsdigita.cms.contenttypes.upgrades.ArticleInJournalBundleUpgrade"/>
|
||||||
|
<script class="com.arsdigita.cms.contenttypes.upgrades.CollectedVolumeBundleUpgrade"/>
|
||||||
|
<script class="com.arsdigita.cms.contenttypes.upgrades.ExpertiseBundleUpgrade"/>
|
||||||
|
<script class="com.arsdigita.cms.contenttypes.upgrades.InProceedingsBundleUpgrade"/>
|
||||||
|
<script class="com.arsdigita.cms.contenttypes.upgrades.InternetArticleBundleUpgrade"/>
|
||||||
|
<script class="com.arsdigita.cms.contenttypes.upgrades.JournalBundleUpgrade"/>
|
||||||
|
<script class="com.arsdigita.cms.contenttypes.upgrades.ProceedingsBundleUpgrade"/>
|
||||||
|
<script class="com.arsdigita.cms.contenttypes.upgrades.PublicationBundleUpgrade"/>
|
||||||
|
<script class="com.arsdigita.cms.contenttypes.upgrades.PublicationWithPublisherBundleUpgrade"/>
|
||||||
|
<script class="com.arsdigita.cms.contenttypes.upgrades.PublisherBundleUpgrade"/>
|
||||||
|
<script class="com.arsdigita.cms.contenttypes.upgrades.SeriesBundleUpgrade"/>
|
||||||
|
<script class="com.arsdigita.cms.contenttypes.upgrades.UnPublishedBundleUpgrade"/>
|
||||||
|
<script class="com.arsdigita.cms.contenttypes.upgrades.CollectedVolumeArticlesAssocUpgrade"/>
|
||||||
|
<script class="com.arsdigita.cms.contenttypes.upgrades.ExpertiseOrdererAssocUpgrade"/>
|
||||||
|
<script class="com.arsdigita.cms.contenttypes.upgrades.ExpertiseOrganizationAssocUpgrade"/>
|
||||||
|
<script class="com.arsdigita.cms.contenttypes.upgrades.InternetArticleOrganizationAssocUpgrade"/>
|
||||||
|
<script class="com.arsdigita.cms.contenttypes.upgrades.JournalArticlesAssocUpgrade"/>
|
||||||
|
<script class="com.arsdigita.cms.contenttypes.upgrades.ProceedingsOrganizerAssocUpgrade"/>
|
||||||
|
<script class="com.arsdigita.cms.contenttypes.upgrades.ProceedingsPapersAssocUpgrade"/>
|
||||||
|
<script class="com.arsdigita.cms.contenttypes.upgrades.PublicationAuthorsAssocUpgrade"/>
|
||||||
|
<script class="com.arsdigita.cms.contenttypes.upgrades.PublicationOrgaunitAssocUpgrade"/>
|
||||||
|
<script class="com.arsdigita.cms.contenttypes.upgrades.PublicationWithPublisherAssocUpgrade"/>
|
||||||
|
<script class="com.arsdigita.cms.contenttypes.upgrades.SeriesEditorsAssocUpgrade"/>
|
||||||
|
<script class="com.arsdigita.cms.contenttypes.upgrades.SeriesPublicationsAssocUpgrade"/>
|
||||||
|
<script class="com.arsdigita.cms.contenttypes.upgrades.UnPublishedOrganizationAssocUpgrade"/>
|
||||||
</version>
|
</version>
|
||||||
</upgrade>
|
</upgrade>
|
||||||
|
|
@ -1,368 +0,0 @@
|
||||||
/*
|
|
||||||
* To change this template, choose Tools | Templates
|
|
||||||
* and open the template in the editor.
|
|
||||||
*/
|
|
||||||
package com.arsdigita.cms.contenttypes;
|
|
||||||
|
|
||||||
import com.arsdigita.util.cmd.Program;
|
|
||||||
import com.arsdigita.runtime.RuntimeConfig;
|
|
||||||
import com.arsdigita.util.jdbc.Connections;
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.sql.Connection;
|
|
||||||
import java.sql.ResultSet;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.sql.Statement;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import org.apache.commons.cli.CommandLine;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* * Upgrade for association between GenericPublication and GenericPerson
|
|
||||||
* (ccm-sci-publications 6.6.2 to 6.6.3)
|
|
||||||
*
|
|
||||||
* @author Jens Pelzetter
|
|
||||||
* @version $Id$
|
|
||||||
*/
|
|
||||||
public class PublicationOrgaunitAssocUpgrade extends Program {
|
|
||||||
|
|
||||||
public PublicationOrgaunitAssocUpgrade() {
|
|
||||||
super("PublicationOrgaunitAssocUpgrade", "1.0.0", "");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void main(final String[] args) {
|
|
||||||
new PublicationOrgaunitAssocUpgrade().run(args);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void doRun(final CommandLine cmdLine) {
|
|
||||||
System.out.println("Starting upgrade...");
|
|
||||||
List<AssocEntry> oldData = new ArrayList<AssocEntry>();
|
|
||||||
|
|
||||||
System.out.println("Trying to get JDBC connection...");
|
|
||||||
|
|
||||||
final Connection conn = Connections.acquire(RuntimeConfig.getConfig().
|
|
||||||
getJDBCURL());
|
|
||||||
try {
|
|
||||||
conn.setAutoCommit(false);
|
|
||||||
} catch (SQLException ex) {
|
|
||||||
System.err.println("Failed to configure JDBC connection.");
|
|
||||||
printStackTrace(ex);
|
|
||||||
close(conn);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
System.out.println("Retrieving old data...");
|
|
||||||
try {
|
|
||||||
final Statement stmt = conn.createStatement();
|
|
||||||
final ResultSet oldAssocResult = stmt.executeQuery(
|
|
||||||
"SELECT publication_id, orgaunit_id, publication_order"
|
|
||||||
+ "FROM cms_organizationalunits_publications_map "
|
|
||||||
+ "JOIN cms_items ON orgaunit_id = item_id "
|
|
||||||
+ "WHERE version = 'draft'");
|
|
||||||
|
|
||||||
while (oldAssocResult.next()) {
|
|
||||||
PublicationOrgaunitAssocUpgrade.AssocEntry entry =
|
|
||||||
new PublicationOrgaunitAssocUpgrade.AssocEntry();
|
|
||||||
|
|
||||||
entry.setPublicationDraftId(oldAssocResult.getBigDecimal(1));
|
|
||||||
entry.setPublicationBundleDraftId(getParentIdFor(
|
|
||||||
entry.getPublicationDraftId(), conn));
|
|
||||||
entry.setOrgaunitDraftId(oldAssocResult.getBigDecimal(2));
|
|
||||||
entry.setOrgaunitBundleDraftId(getParentIdFor(
|
|
||||||
entry.getOrgaunitDraftId(), conn));
|
|
||||||
|
|
||||||
entry.setPublicationLiveId(getPublicIdFor(
|
|
||||||
entry.getPublicationDraftId(), conn));
|
|
||||||
entry.setPublicationBundleLiveId(getPublicIdFor(
|
|
||||||
entry.getPublicationBundleDraftId(), conn));
|
|
||||||
entry.setOrgaunitLiveId(getPublicIdFor(
|
|
||||||
entry.getOrgaunitDraftId(), conn));
|
|
||||||
entry.setOrgaunitBundleLiveId(getPublicIdFor(
|
|
||||||
entry.getOrgaunitBundleDraftId(), conn));
|
|
||||||
|
|
||||||
entry.setOrder(oldAssocResult.getInt(3));
|
|
||||||
|
|
||||||
oldData.add(entry);
|
|
||||||
}
|
|
||||||
} catch (SQLException ex) {
|
|
||||||
System.err.println("Failed to retrieve old data.");
|
|
||||||
printStackTrace(ex);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
System.out.println("Droping old table...");
|
|
||||||
final Statement stmt = conn.createStatement();
|
|
||||||
stmt.execute("DROP TABLE cms_organizationalunits_publications_map");
|
|
||||||
} catch (SQLException ex) {
|
|
||||||
System.err.println("Failed to drop old table.");
|
|
||||||
printStackTrace(ex);
|
|
||||||
rollback(conn);
|
|
||||||
close(conn);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
System.out.println("Creating new tables...");
|
|
||||||
final Statement stmt = conn.createStatement();
|
|
||||||
|
|
||||||
stmt.addBatch(
|
|
||||||
"CREATE TABLE cms_organizationalunits_publications_map ( "
|
|
||||||
+ "orgaunit_id integer NOT NULL, "
|
|
||||||
+ "publication_id integer NOT NULL, "
|
|
||||||
+ "publication_order integer");
|
|
||||||
|
|
||||||
stmt.addBatch("ALTER TABLE ONLY cms_organizationalunits_publications_map "
|
|
||||||
+ "ADD CONSTRAINT cms_org_pub_map_org_id_p__dore "
|
|
||||||
+ "PRIMARY KEY (publication_id, orgaunit_id);");
|
|
||||||
|
|
||||||
stmt.addBatch(
|
|
||||||
"ALTER TABLE ONLY cms_organizationalunits_publications_map "
|
|
||||||
+ "ADD CONSTRAINT cms_org_pub_map_org_id_f_pe406 "
|
|
||||||
+ "FOREIGN KEY (orgaunit_id) "
|
|
||||||
+ "REFERENCES cms_orgaunit_bundles(bundle_id)");
|
|
||||||
|
|
||||||
stmt.addBatch(
|
|
||||||
"ALTER TABLE ONLY cms_organizationalunits_publications_map "
|
|
||||||
+ "ADD CONSTRAINT cms_org_pub_map_pub_id_f_6udi3 "
|
|
||||||
+ "FOREIGN KEY (publication_id) "
|
|
||||||
+ "REFERENCES ct_publication_bundles(bundle_id);");
|
|
||||||
|
|
||||||
stmt.executeBatch();
|
|
||||||
|
|
||||||
} catch (SQLException ex) {
|
|
||||||
System.err.println("Failed to create new table.");
|
|
||||||
printStackTrace(ex);
|
|
||||||
rollback(conn);
|
|
||||||
close(conn);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
System.out.println("Filling new tables with data...");
|
|
||||||
|
|
||||||
final Statement queryPublicationStmt = conn.createStatement();
|
|
||||||
final Statement stmt = conn.createStatement();
|
|
||||||
|
|
||||||
final List<String> processedEntries = new ArrayList<String>();
|
|
||||||
for (AssocEntry entry : oldData) {
|
|
||||||
if (processedEntries.contains(String.format(
|
|
||||||
"%s-%s",
|
|
||||||
entry.getPublicationBundleDraftId(),
|
|
||||||
entry.getOrgaunitBundleDraftId()))) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
stmt.addBatch(String.format(
|
|
||||||
"INSERT INTO cms_organizationalunits_publications_map ("
|
|
||||||
+ "publication_id,"
|
|
||||||
+ "orgaunit_id,"
|
|
||||||
+ "publication_order"
|
|
||||||
+ "VALUES (%s, %s, %s)",
|
|
||||||
entry.getPublicationBundleDraftId().toString(),
|
|
||||||
entry.getOrgaunitBundleDraftId().toString(),
|
|
||||||
entry.getOrder().toString()));
|
|
||||||
|
|
||||||
if ((entry.getPublicationBundleLiveId() != null)
|
|
||||||
&& (entry.getOrgaunitBundleLiveId() != null)) {
|
|
||||||
stmt.addBatch(String.format(
|
|
||||||
"INSERT INTO cms_organizationalunits_publications_map ("
|
|
||||||
+ "publication_id,"
|
|
||||||
+ "organunit_id,"
|
|
||||||
+ "publication_order) "
|
|
||||||
+ "VALUES (%s %s %s)",
|
|
||||||
entry.getPublicationBundleLiveId().toString(),
|
|
||||||
entry.getOrgaunitBundleLiveId().toString(),
|
|
||||||
entry.getOrder().toString()));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (entry.getPublicationBundleLiveId() != null) {
|
|
||||||
stmt.addBatch(String.format(
|
|
||||||
"DELETE FROM cms_published_links "
|
|
||||||
+ "WHERE pending = %s "
|
|
||||||
+ "AND draft_target = %s",
|
|
||||||
entry.getPublicationLiveId().toString(),
|
|
||||||
entry.getOrgaunitDraftId().toString()));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (entry.getOrgaunitBundleLiveId() != null) {
|
|
||||||
stmt.addBatch(String.format(
|
|
||||||
"DELETE FROM cms_published_links "
|
|
||||||
+ "WHERE pending = %s "
|
|
||||||
+ "AND draft_target = %s",
|
|
||||||
entry.getOrgaunitLiveId().toString(),
|
|
||||||
entry.getPublicationDraftId().toString()));
|
|
||||||
}
|
|
||||||
|
|
||||||
processedEntries.add(String.format(
|
|
||||||
"%s-%s",
|
|
||||||
entry.getPublicationBundleDraftId().toString(),
|
|
||||||
entry.getOrgaunitBundleDraftId().toString()));
|
|
||||||
}
|
|
||||||
|
|
||||||
stmt.executeBatch();
|
|
||||||
|
|
||||||
|
|
||||||
} catch (SQLException ex) {
|
|
||||||
System.err.println("Failed to create new table.");
|
|
||||||
printStackTrace(ex);
|
|
||||||
rollback(conn);
|
|
||||||
close(conn);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
conn.commit();
|
|
||||||
} catch (SQLException ex) {
|
|
||||||
System.err.println("Failed to commiting changes.");
|
|
||||||
printStackTrace(ex);
|
|
||||||
rollback(conn);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
close(conn);
|
|
||||||
}
|
|
||||||
|
|
||||||
private class AssocEntry {
|
|
||||||
|
|
||||||
private BigDecimal publicationDraftId;
|
|
||||||
private BigDecimal publicationLiveId;
|
|
||||||
private BigDecimal publicationBundleDraftId;
|
|
||||||
private BigDecimal publicationBundleLiveId;
|
|
||||||
private BigDecimal orgaunitDraftId;
|
|
||||||
private BigDecimal orgaunitLiveId;
|
|
||||||
private BigDecimal orgaunitBundleDraftId;
|
|
||||||
private BigDecimal orgaunitBundleLiveId;
|
|
||||||
private Integer order;
|
|
||||||
|
|
||||||
public Integer getOrder() {
|
|
||||||
return order;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOrder(Integer order) {
|
|
||||||
this.order = order;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BigDecimal getOrgaunitBundleDraftId() {
|
|
||||||
return orgaunitBundleDraftId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOrgaunitBundleDraftId(BigDecimal orgaunitBundleDraftId) {
|
|
||||||
this.orgaunitBundleDraftId = orgaunitBundleDraftId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BigDecimal getOrgaunitBundleLiveId() {
|
|
||||||
return orgaunitBundleLiveId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOrgaunitBundleLiveId(BigDecimal orgaunitBundleLiveId) {
|
|
||||||
this.orgaunitBundleLiveId = orgaunitBundleLiveId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BigDecimal getOrgaunitDraftId() {
|
|
||||||
return orgaunitDraftId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOrgaunitDraftId(BigDecimal orgaunitDraftId) {
|
|
||||||
this.orgaunitDraftId = orgaunitDraftId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BigDecimal getOrgaunitLiveId() {
|
|
||||||
return orgaunitLiveId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOrgaunitLiveId(BigDecimal orgaunitLiveId) {
|
|
||||||
this.orgaunitLiveId = orgaunitLiveId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BigDecimal getPublicationBundleDraftId() {
|
|
||||||
return publicationBundleDraftId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPublicationBundleDraftId(
|
|
||||||
BigDecimal publicationBundleDraftId) {
|
|
||||||
this.publicationBundleDraftId = publicationBundleDraftId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BigDecimal getPublicationBundleLiveId() {
|
|
||||||
return publicationBundleLiveId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPublicationBundleLiveId(
|
|
||||||
BigDecimal publicationBundleLiveId) {
|
|
||||||
this.publicationBundleLiveId = publicationBundleLiveId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BigDecimal getPublicationDraftId() {
|
|
||||||
return publicationDraftId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPublicationDraftId(BigDecimal publicationDraftId) {
|
|
||||||
this.publicationDraftId = publicationDraftId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BigDecimal getPublicationLiveId() {
|
|
||||||
return publicationLiveId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPublicationLiveId(BigDecimal publicationLiveId) {
|
|
||||||
this.publicationLiveId = publicationLiveId;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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",
|
|
||||||
id.toString()));
|
|
||||||
|
|
||||||
while (rs.next()) {
|
|
||||||
return rs.getBigDecimal(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void rollback(final Connection conn) {
|
|
||||||
try {
|
|
||||||
conn.rollback();
|
|
||||||
} catch (SQLException ex1) {
|
|
||||||
System.err.println("Rollback failed.");
|
|
||||||
ex1.printStackTrace(System.err);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void close(final Connection conn) {
|
|
||||||
try {
|
|
||||||
conn.close();
|
|
||||||
} catch (SQLException ex) {
|
|
||||||
System.err.println("Failed to close JDBC connection.");
|
|
||||||
printStackTrace(ex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void printStackTrace(final SQLException ex) {
|
|
||||||
ex.printStackTrace(System.err);
|
|
||||||
if (ex.getNextException() != null) {
|
|
||||||
printStackTrace(ex.getNextException());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -0,0 +1,68 @@
|
||||||
|
package com.arsdigita.cms.contenttypes.upgrades;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
public class CollectedVolumeArticlesAssocUpgrade extends AbstractAssocUpgrade {
|
||||||
|
|
||||||
|
public CollectedVolumeArticlesAssocUpgrade() {
|
||||||
|
super("CollectedVolumeArticlesAssocUpgrade", "1.0.0", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(final String[] args) {
|
||||||
|
new CollectedVolumeArticlesAssocUpgrade().run(args);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getTableName() {
|
||||||
|
return "ct_collected_volume_article_map";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getOwnerIdCol() {
|
||||||
|
return "collected_volume_id";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getMemberIdCol() {
|
||||||
|
return "article_id";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Map<String, String> getAttributes() {
|
||||||
|
final Map<String, String> attributes = new HashMap<String, String>();
|
||||||
|
attributes.put("article_order", "integer");
|
||||||
|
return attributes;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getPrimaryKeyConstraintName() {
|
||||||
|
return "ct_col_vol_art_map_art_p___0v4";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getOwnerConstraintName() {
|
||||||
|
return "ct_col_vol_art_map_col_f_x2knn";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getMemberConstraintName() {
|
||||||
|
return "ct_col_vol_art_map_art_f_j7m8p";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getOwnerTableName() {
|
||||||
|
return "ct_collected_volume_bundles";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getMemberTableName() {
|
||||||
|
return "ct_article_in_collected_volume_bundles";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,68 @@
|
||||||
|
package com.arsdigita.cms.contenttypes.upgrades;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
public class ExpertiseOrdererAssocUpgrade extends AbstractAssocUpgrade {
|
||||||
|
|
||||||
|
public ExpertiseOrdererAssocUpgrade() {
|
||||||
|
super("ExpertiseOrdererAssocUpgrade", "1.0.0", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(final String[] args) {
|
||||||
|
new ExpertiseOrdererAssocUpgrade().run(args);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getTableName() {
|
||||||
|
return "ct_expertise_orderer";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getOwnerIdCol() {
|
||||||
|
return "experise_id";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getMemberIdCol() {
|
||||||
|
return "orderer_id";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Map<String, String> getAttributes() {
|
||||||
|
final Map<String, String> attributes = new HashMap<String, String>();
|
||||||
|
attributes.put("orderer_order", "integer");
|
||||||
|
return attributes;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getPrimaryKeyConstraintName() {
|
||||||
|
return "ct_exp_ord_map_exp_id__p_dn4qh";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getOwnerConstraintName() {
|
||||||
|
return "ct_expe_ord_map_exp_id_f_e_q5f";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getMemberConstraintName() {
|
||||||
|
return "ct_expe_ord_map_ord_id_f_q51ie";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getOwnerTableName() {
|
||||||
|
return "ct_expertise_bundles";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getMemberTableName() {
|
||||||
|
return "ct_orgaunit_bundles";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,70 @@
|
||||||
|
package com.arsdigita.cms.contenttypes.upgrades;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
public class ExpertiseOrganizationAssocUpgrade extends AbstractAssocUpgrade {
|
||||||
|
|
||||||
|
public ExpertiseOrganizationAssocUpgrade() {
|
||||||
|
super("ExpertiseOrganizationAssocUpgrade", "1.0.0", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(final String[] args) {
|
||||||
|
new ExpertiseOrganizationAssocUpgrade().run(args);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getTableName() {
|
||||||
|
return "ct_expertise_organization_map";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getOwnerIdCol() {
|
||||||
|
return "experise_id";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getMemberIdCol() {
|
||||||
|
return "organization_id";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Map<String, String> getAttributes() {
|
||||||
|
final Map<String, String> attributes = new HashMap<String, String>();
|
||||||
|
attributes.put("orga_order", "integer");
|
||||||
|
return attributes;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getPrimaryKeyConstraintName() {
|
||||||
|
return "ct_exp_org_map_exp_id__p_4q5um";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getOwnerConstraintName() {
|
||||||
|
return "ct_exp_orga_map_exp_id_f_9uksn";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getMemberConstraintName() {
|
||||||
|
return "ct_exp_org_map_orga_id_f_d3msf";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getOwnerTableName() {
|
||||||
|
return "ct_expertise_bundles";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getMemberTableName() {
|
||||||
|
return "cms_orgaunit_bundles";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,67 @@
|
||||||
|
package com.arsdigita.cms.contenttypes.upgrades;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
public class InternetArticleOrganizationAssocUpgrade extends AbstractAssocUpgrade {
|
||||||
|
|
||||||
|
public InternetArticleOrganizationAssocUpgrade() {
|
||||||
|
super("InternetArticleOrganizationAssocUpgrade", "1.0.0", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(final String[] args) {
|
||||||
|
new InternetArticleOrganizationAssocUpgrade().run(args);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getTableName() {
|
||||||
|
return "ct_internet_article_organization_map";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getOwnerIdCol() {
|
||||||
|
return "internet_article_id";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getMemberIdCol() {
|
||||||
|
return "organization_id";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Map<String, String> getAttributes() {
|
||||||
|
final Map<String, String> attributes = new HashMap<String, String>();
|
||||||
|
attributes.put("orga_order", "integer");
|
||||||
|
return attributes;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getPrimaryKeyConstraintName() {
|
||||||
|
return "ct_int_art_org_map_int_p_vkmee";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getOwnerConstraintName() {
|
||||||
|
return "ct_int_art_org_map_int_f_5xso5";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getMemberConstraintName() {
|
||||||
|
return "ct_int_art_org_map_org_f_yp23x";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getOwnerTableName() {
|
||||||
|
return "ct_internet_article_bundles";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getMemberTableName() {
|
||||||
|
return "cms_orgaunit_bundles";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,68 @@
|
||||||
|
package com.arsdigita.cms.contenttypes.upgrades;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
public class JournalArticlesAssocUpgrade extends AbstractAssocUpgrade {
|
||||||
|
|
||||||
|
public JournalArticlesAssocUpgrade() {
|
||||||
|
super("JournalArticlesAssocUpgrade", "1.0.0", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(final String[] args) {
|
||||||
|
new JournalArticlesAssocUpgrade().run(args);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getTableName() {
|
||||||
|
return "ct_journal_article_map";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getOwnerIdCol() {
|
||||||
|
return "journal_id";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getMemberIdCol() {
|
||||||
|
return "article_in_journal_id";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Map<String, String> getAttributes() {
|
||||||
|
final Map<String, String> attributes = new HashMap<String, String>();
|
||||||
|
attributes.put("article_order", "integer");
|
||||||
|
return attributes;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getPrimaryKeyConstraintName() {
|
||||||
|
return "ct_jou_art_map_art_in__p_w1c45";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getOwnerConstraintName() {
|
||||||
|
return "ct_jou_art_map_jour_id_f_anw93";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getMemberConstraintName() {
|
||||||
|
return "ct_jou_art_map_art_in__f_gx_9q";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getOwnerTableName() {
|
||||||
|
return "ct_journal_bundles";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getMemberTableName() {
|
||||||
|
return "ct_article_in_journal_bundles";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,68 @@
|
||||||
|
package com.arsdigita.cms.contenttypes.upgrades;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
public class ProceedingsOrganizerAssocUpgrade extends AbstractAssocUpgrade {
|
||||||
|
|
||||||
|
public ProceedingsOrganizerAssocUpgrade() {
|
||||||
|
super("ProceedingsOrganizerAssocUpgrade", "1.0.0", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(final String[] args) {
|
||||||
|
new ProceedingsOrganizerAssocUpgrade().run(args);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getTableName() {
|
||||||
|
return "ct_proceedings_organizer_map";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getOwnerIdCol() {
|
||||||
|
return "proceeding_id";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getMemberIdCol() {
|
||||||
|
return "organizer_id";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Map<String, String> getAttributes() {
|
||||||
|
final Map<String, String> attributes = new HashMap<String, String>();
|
||||||
|
attributes.put("organizer_order", "integer");
|
||||||
|
return attributes;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getPrimaryKeyConstraintName() {
|
||||||
|
return "ct_pro_org_map_org_id__p_uhoc1";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getOwnerConstraintName() {
|
||||||
|
return "ct_proc_org_map_pro_id_f_jkgwf";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getMemberConstraintName() {
|
||||||
|
return "ct_proc_org_map_org_id_f_60x9n";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getOwnerTableName() {
|
||||||
|
return "ct_proceedings_bundles";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getMemberTableName() {
|
||||||
|
return "cms_orgaunit_bundles";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,68 @@
|
||||||
|
package com.arsdigita.cms.contenttypes.upgrades;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
public class ProceedingsPapersAssocUpgrade extends AbstractAssocUpgrade {
|
||||||
|
|
||||||
|
public ProceedingsPapersAssocUpgrade() {
|
||||||
|
super("ProceedingsPapersAssocUpgrade", "1.0.0", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(final String[] args) {
|
||||||
|
new ProceedingsPapersAssocUpgrade().run(args);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getTableName() {
|
||||||
|
return "ct_proceedings_papers_map";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getOwnerIdCol() {
|
||||||
|
return "proceedings_id";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getMemberIdCol() {
|
||||||
|
return "paper_id";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Map<String, String> getAttributes() {
|
||||||
|
final Map<String, String> attributes = new HashMap<String, String>();
|
||||||
|
attributes.put("paper_order", "integer");
|
||||||
|
return attributes;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getPrimaryKeyConstraintName() {
|
||||||
|
return "ct_pro_pap_map_pap_id__p_o1ws7";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getOwnerConstraintName() {
|
||||||
|
return "ct_pro_pap_map_proc_id_f_4jgfl";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getMemberConstraintName() {
|
||||||
|
return "ct_proc_pap_map_pap_id_f_k6cly";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getOwnerTableName() {
|
||||||
|
return "ct_proceedings_bundles";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getMemberTableName() {
|
||||||
|
return "ct_inproceedings_bundles";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,410 +0,0 @@
|
||||||
package com.arsdigita.cms.contenttypes.upgrades;
|
|
||||||
|
|
||||||
import com.arsdigita.util.cmd.Program;
|
|
||||||
import com.arsdigita.runtime.RuntimeConfig;
|
|
||||||
import com.arsdigita.util.jdbc.Connections;
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.sql.Connection;
|
|
||||||
import java.sql.ResultSet;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.sql.Statement;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import org.apache.commons.cli.CommandLine;
|
|
||||||
|
|
||||||
/**
|
|
||||||
|
|
||||||
* Upgrade for association between GenericPublication and GenericPerson
|
|
||||||
* (ccm-sci-publications 6.6.2 to 6.6.3)
|
|
||||||
*
|
|
||||||
* @author Jens Pelzetter
|
|
||||||
* @version $Id$
|
|
||||||
*/
|
|
||||||
public class PublicationAuthorAssocUpgrade extends Program {
|
|
||||||
|
|
||||||
public PublicationAuthorAssocUpgrade() {
|
|
||||||
super("PublicationAuthorAssocUpgrade", "1.0.0", "");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void main(final String[] args) {
|
|
||||||
new PublicationAuthorAssocUpgrade().run(args);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void doRun(final CommandLine cmdLine) {
|
|
||||||
System.out.println("Starting upgrade...");
|
|
||||||
List<AssocEntry> oldData = new ArrayList<AssocEntry>();
|
|
||||||
|
|
||||||
System.out.println("Trying to get JDBC connection...");
|
|
||||||
|
|
||||||
final Connection conn = Connections.acquire(RuntimeConfig.getConfig().
|
|
||||||
getJDBCURL());
|
|
||||||
try {
|
|
||||||
conn.setAutoCommit(false);
|
|
||||||
} catch (SQLException ex) {
|
|
||||||
System.err.println("Failed to configure JDBC connection.");
|
|
||||||
printStackTrace(ex);
|
|
||||||
close(conn);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
System.out.println("Retrieving old data...");
|
|
||||||
try {
|
|
||||||
final Statement stmt = conn.createStatement();
|
|
||||||
final ResultSet oldAssocResult = stmt.executeQuery(
|
|
||||||
"SELECT publication_id, person_id, editor, authorship_order"
|
|
||||||
+ "FROM ct_publications_authorship "
|
|
||||||
+ "JOIN cms_items ON publication_id = item_id "
|
|
||||||
+ "WHERE version = 'draft'");
|
|
||||||
|
|
||||||
while (oldAssocResult.next()) {
|
|
||||||
AssocEntry entry = new AssocEntry();
|
|
||||||
|
|
||||||
entry.setPublicationDraftId(oldAssocResult.getBigDecimal(1));
|
|
||||||
entry.setPublicationDraftBundleId(getParentIdFor(
|
|
||||||
entry.getPublicationDraftId(), conn));
|
|
||||||
entry.setAuthorDraftId(oldAssocResult.getBigDecimal(2));
|
|
||||||
entry.setAuthorBundleDraftId(getParentIdFor(
|
|
||||||
entry.getAuthorDraftId(), conn));
|
|
||||||
|
|
||||||
entry.setPublicationLiveId(getPublicIdFor(
|
|
||||||
entry.getPublicationDraftId(), conn));
|
|
||||||
entry.setPublicationLiveBundleId(getPublicIdFor(
|
|
||||||
entry.getPublicationDraftBundleId(), conn));
|
|
||||||
entry.setAuthorLiveId(getPublicIdFor(
|
|
||||||
entry.getAuthorDraftId(), conn));
|
|
||||||
entry.setAuthorBundleLiveId(getPublicIdFor(
|
|
||||||
entry.getAuthorBundleDraftId(), conn));
|
|
||||||
|
|
||||||
entry.setEditor(oldAssocResult.getBoolean(3));
|
|
||||||
entry.setAuthorOrder(oldAssocResult.getInt(4));
|
|
||||||
|
|
||||||
oldData.add(entry);
|
|
||||||
}
|
|
||||||
} catch (SQLException ex) {
|
|
||||||
System.err.println("Failed to retrieve old data.");
|
|
||||||
printStackTrace(ex);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
System.out.println("Droping old table...");
|
|
||||||
final Statement stmt = conn.createStatement();
|
|
||||||
stmt.execute("DROP TABLE ct_publications_authorship");
|
|
||||||
} catch (SQLException ex) {
|
|
||||||
System.err.println("Failed to drop old table.");
|
|
||||||
printStackTrace(ex);
|
|
||||||
rollback(conn);
|
|
||||||
close(conn);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
System.out.println("Creating new tables...");
|
|
||||||
final Statement stmt = conn.createStatement();
|
|
||||||
|
|
||||||
stmt.addBatch("CREATE TABLE ct_publication_bundles ("
|
|
||||||
+ "bundle_id integer NOT NULL)");
|
|
||||||
|
|
||||||
stmt.addBatch("CREATE TABLE ct_publications_authorship ("
|
|
||||||
+ "publication_id integer NOT NULL, "
|
|
||||||
+ "person_id integer NOT NULL, "
|
|
||||||
+ "editor boolean, "
|
|
||||||
+ "authorship_order integer");
|
|
||||||
|
|
||||||
stmt.addBatch("ALTER TABLE ONLY ct_publication_bundles "
|
|
||||||
+ "ADD CONSTRAINT ct_publica_bund_bun_id_p_ivy3p "
|
|
||||||
+ "PRIMARY KEY (bundle_id);");
|
|
||||||
|
|
||||||
stmt.addBatch("ALTER TABLE ONLY ct_publication_bundles "
|
|
||||||
+ "ADD CONSTRAINT ct_publica_bund_bun_id_f_bp022 "
|
|
||||||
+ "FOREIGN KEY(bundle_id) "
|
|
||||||
+ "REFERENCES cms_bundles (bundle_id)");
|
|
||||||
|
|
||||||
stmt.addBatch("ALTER TABLE ct_publications_authorship "
|
|
||||||
+ "ADD CONSTRAINT ct_pub_aut_per_id_pub__p_adskp "
|
|
||||||
+ "PRIMARY KEY (person_id, publication_id)");
|
|
||||||
|
|
||||||
stmt.addBatch("ALTER TABLE ONLY ct_publications_authorship "
|
|
||||||
+ "ADD CONSTRAINT ct_publi_auth_publi_id_f_6aw9g "
|
|
||||||
+ "FOREIGN KEY (publication_id) "
|
|
||||||
+ "REFERENCES ct_publication_bundles(bundle_id)");
|
|
||||||
|
|
||||||
stmt.addBatch("ALTER TABLE ONLY ct_publications_authorship "
|
|
||||||
+ "ADD CONSTRAINT ct_public_autho_per_id_f_ot1p6 "
|
|
||||||
+ "FOREIGN KEY (person_id) "
|
|
||||||
+ "REFERENCES cms_person_bundles(bundle_id)");
|
|
||||||
|
|
||||||
stmt.executeBatch();
|
|
||||||
|
|
||||||
} catch (SQLException ex) {
|
|
||||||
System.err.println("Failed to create new table.");
|
|
||||||
printStackTrace(ex);
|
|
||||||
rollback(conn);
|
|
||||||
close(conn);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
System.out.println("Filling new tables with data...");
|
|
||||||
|
|
||||||
final Statement queryPublicationStmt = conn.createStatement();
|
|
||||||
final Statement stmt = conn.createStatement();
|
|
||||||
|
|
||||||
final ResultSet publicationRs =
|
|
||||||
queryPublicationStmt.executeQuery(
|
|
||||||
"SELECT parent_id "
|
|
||||||
+ "FROM cms_items "
|
|
||||||
+ "JOIN cms_publications "
|
|
||||||
+ "WHERE cms_items.item_id = cms_publications.publication_id");
|
|
||||||
|
|
||||||
while (publicationRs.next()) {
|
|
||||||
stmt.addBatch(String.format("INSERT INTO cms_publication_bundles (bundle_id) "
|
|
||||||
+ "VALUES (%d)",
|
|
||||||
publicationRs.getInt(1)));
|
|
||||||
stmt.addBatch(String.format(
|
|
||||||
"UPDATE acs_objects "
|
|
||||||
+ "SET default_domain_class = 'com.arsdigita.cms.contenttypes.PublicationBundle', "
|
|
||||||
+ "object_type = 'com.arsdigita.cms.contenttypes.PublicationBundle' "
|
|
||||||
+ "WHERE object_id = %d",
|
|
||||||
publicationRs.getInt(1)));
|
|
||||||
}
|
|
||||||
|
|
||||||
final List<String> processedEntries = new ArrayList<String>();
|
|
||||||
for (AssocEntry entry : oldData) {
|
|
||||||
if (processedEntries.contains(String.format(
|
|
||||||
"%s-%s",
|
|
||||||
entry.getPublicationDraftBundleId().toString(),
|
|
||||||
entry.getAuthorBundleDraftId().toString()))) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
stmt.addBatch(String.format(
|
|
||||||
"INSERT INTO ct_publications_authorship ("
|
|
||||||
+ "publication_id, "
|
|
||||||
+ "person_id, "
|
|
||||||
+ "editor, "
|
|
||||||
+ "authorship_order) "
|
|
||||||
+ "VALUES (%s, %s, %s, %s)",
|
|
||||||
entry.getPublicationDraftBundleId().toString(),
|
|
||||||
entry.getAuthorBundleDraftId().toString(),
|
|
||||||
entry.getEditor().toString(),
|
|
||||||
entry.getAuthorOrder().toString()));
|
|
||||||
|
|
||||||
if ((entry.getPublicationLiveBundleId() != null)
|
|
||||||
&& (entry.getAuthorBundleLiveId() != null)) {
|
|
||||||
stmt.addBatch(String.format(
|
|
||||||
"INSERT INTO ct_publications_authorship ("
|
|
||||||
+ "publication_id, "
|
|
||||||
+ "person_id, "
|
|
||||||
+ "editor, "
|
|
||||||
+ "authorship_order) "
|
|
||||||
+ "VALUES (%s, %s, %s, %s)",
|
|
||||||
entry.getPublicationLiveBundleId().toString(),
|
|
||||||
entry.getAuthorBundleLiveId().toString(),
|
|
||||||
entry.getEditor().toString(),
|
|
||||||
entry.getAuthorOrder().toString()));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (entry.getPublicationLiveBundleId() != null) {
|
|
||||||
stmt.addBatch(String.format(
|
|
||||||
"DELETE FROM cms_published_links "
|
|
||||||
+ "WHERE pending = %s "
|
|
||||||
+ "AND draft_target = %s",
|
|
||||||
entry.getPublicationLiveId().toString(),
|
|
||||||
entry.getAuthorDraftId().toString()));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (entry.getAuthorBundleLiveId() != null) {
|
|
||||||
stmt.addBatch(String.format(
|
|
||||||
"DELETE FROM cms_published_links "
|
|
||||||
+ "WHERE pending = %s "
|
|
||||||
+ "AND draft_target = %s",
|
|
||||||
entry.getAuthorLiveId().toString(),
|
|
||||||
entry.getPublicationDraftId().toString()));
|
|
||||||
}
|
|
||||||
|
|
||||||
processedEntries.add(String.format(
|
|
||||||
"%s-%s",
|
|
||||||
entry.getPublicationDraftBundleId().toString(),
|
|
||||||
entry.getAuthorBundleDraftId().
|
|
||||||
toString()));
|
|
||||||
}
|
|
||||||
|
|
||||||
stmt.executeBatch();
|
|
||||||
|
|
||||||
} catch (SQLException ex) {
|
|
||||||
System.err.println("Failed to create new table.");
|
|
||||||
printStackTrace(ex);
|
|
||||||
rollback(conn);
|
|
||||||
close(conn);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
conn.commit();
|
|
||||||
} catch (SQLException ex) {
|
|
||||||
System.err.println("Failed to commiting changes.");
|
|
||||||
printStackTrace(ex);
|
|
||||||
rollback(conn);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
close(conn);
|
|
||||||
}
|
|
||||||
|
|
||||||
private class AssocEntry {
|
|
||||||
|
|
||||||
private BigDecimal publicationDraftId;
|
|
||||||
private BigDecimal authorDraftId;
|
|
||||||
private BigDecimal publicationLiveId;
|
|
||||||
private BigDecimal authorLiveId;
|
|
||||||
private BigDecimal publicationDraftBundleId;
|
|
||||||
private BigDecimal authorBundleDraftId;
|
|
||||||
private BigDecimal publicationLiveBundleId;
|
|
||||||
private BigDecimal authorBundleLiveId;
|
|
||||||
private Boolean editor;
|
|
||||||
private Integer authorOrder;
|
|
||||||
|
|
||||||
public AssocEntry() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public BigDecimal getAuthorBundleDraftId() {
|
|
||||||
return authorBundleDraftId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAuthorBundleDraftId(BigDecimal authorBundleDraftId) {
|
|
||||||
this.authorBundleDraftId = authorBundleDraftId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BigDecimal getAuthorBundleLiveId() {
|
|
||||||
return authorBundleLiveId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAuthorBundleLiveId(BigDecimal authorBundleLiveId) {
|
|
||||||
this.authorBundleLiveId = authorBundleLiveId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BigDecimal getAuthorDraftId() {
|
|
||||||
return authorDraftId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAuthorDraftId(BigDecimal authorDraftId) {
|
|
||||||
this.authorDraftId = authorDraftId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BigDecimal getAuthorLiveId() {
|
|
||||||
return authorLiveId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAuthorLiveId(BigDecimal authorLiveId) {
|
|
||||||
this.authorLiveId = authorLiveId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getAuthorOrder() {
|
|
||||||
return authorOrder;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAuthorOrder(Integer authorOrder) {
|
|
||||||
this.authorOrder = authorOrder;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Boolean getEditor() {
|
|
||||||
return editor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setEditor(Boolean editor) {
|
|
||||||
this.editor = editor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BigDecimal getPublicationDraftBundleId() {
|
|
||||||
return publicationDraftBundleId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPublicationDraftBundleId(
|
|
||||||
BigDecimal publicationDraftBundleId) {
|
|
||||||
this.publicationDraftBundleId = publicationDraftBundleId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BigDecimal getPublicationDraftId() {
|
|
||||||
return publicationDraftId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPublicationDraftId(BigDecimal publicationDraftId) {
|
|
||||||
this.publicationDraftId = publicationDraftId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BigDecimal getPublicationLiveBundleId() {
|
|
||||||
return publicationLiveBundleId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPublicationLiveBundleId(
|
|
||||||
BigDecimal publicationLiveBundleId) {
|
|
||||||
this.publicationLiveBundleId = publicationLiveBundleId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BigDecimal getPublicationLiveId() {
|
|
||||||
return publicationLiveId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPublicationLiveId(BigDecimal publicationLiveId) {
|
|
||||||
this.publicationLiveId = publicationLiveId;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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",
|
|
||||||
id.toString()));
|
|
||||||
|
|
||||||
while (rs.next()) {
|
|
||||||
return rs.getBigDecimal(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void rollback(final Connection conn) {
|
|
||||||
try {
|
|
||||||
conn.rollback();
|
|
||||||
} catch (SQLException ex1) {
|
|
||||||
System.err.println("Rollback failed.");
|
|
||||||
ex1.printStackTrace(System.err);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void close(final Connection conn) {
|
|
||||||
try {
|
|
||||||
conn.close();
|
|
||||||
} catch (SQLException ex) {
|
|
||||||
System.err.println("Failed to close JDBC connection.");
|
|
||||||
printStackTrace(ex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void printStackTrace(final SQLException ex) {
|
|
||||||
ex.printStackTrace(System.err);
|
|
||||||
if (ex.getNextException() != null) {
|
|
||||||
printStackTrace(ex.getNextException());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -0,0 +1,69 @@
|
||||||
|
package com.arsdigita.cms.contenttypes.upgrades;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
public class PublicationAuthorsAssocUpgrade extends AbstractAssocUpgrade {
|
||||||
|
|
||||||
|
public PublicationAuthorsAssocUpgrade() {
|
||||||
|
super("PublicationAuthorsAssocUpgrade", "1.0.0", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(final String[] args) {
|
||||||
|
new PublicationAuthorsAssocUpgrade().run(args);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getTableName() {
|
||||||
|
return "ct_publications_authorship";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getOwnerIdCol() {
|
||||||
|
return "publication_id";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getMemberIdCol() {
|
||||||
|
return "author_id";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Map<String, String> getAttributes() {
|
||||||
|
final Map<String, String> attributes = new HashMap<String, String>();
|
||||||
|
attributes.put("editor", "BIT");
|
||||||
|
attributes.put("authorship_order", "integer");
|
||||||
|
return attributes;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getPrimaryKeyConstraintName() {
|
||||||
|
return "ct_pub_aut_per_id_pub__p_adskp";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getOwnerConstraintName() {
|
||||||
|
return "ct_publi_auth_publi_id_f_6aw9g";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getMemberConstraintName() {
|
||||||
|
return "ct_public_autho_per_id_f_ot1p6";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getOwnerTableName() {
|
||||||
|
return "ct_publication_bundles";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getMemberTableName() {
|
||||||
|
return "cms_person_bundles";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,68 @@
|
||||||
|
package com.arsdigita.cms.contenttypes.upgrades;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
public class PublicationOrgaUnitAssocUpgrade extends AbstractAssocUpgrade {
|
||||||
|
|
||||||
|
public PublicationOrgaUnitAssocUpgrade() {
|
||||||
|
super("PublicationOrgaUnitAssocUpgrade", "1.0.0", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(final String[] args) {
|
||||||
|
new PublicationOrgaUnitAssocUpgrade().run(args);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getTableName() {
|
||||||
|
return "cms_organizationalunits_publications_map";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getOwnerIdCol() {
|
||||||
|
return "publication_id";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getMemberIdCol() {
|
||||||
|
return "orgaunit_id";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Map<String, String> getAttributes() {
|
||||||
|
final Map<String, String> attributes = new HashMap<String, String>();
|
||||||
|
attributes.put("authorship_order", "integer");
|
||||||
|
return attributes;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getPrimaryKeyConstraintName() {
|
||||||
|
return "cms_org_pub_map_org_id_p__dore";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getOwnerConstraintName() {
|
||||||
|
return "cms_org_pub_map_pub_id_f_6udi3";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getMemberConstraintName() {
|
||||||
|
return "cms_org_pub_map_org_id_f_pe406";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getOwnerTableName() {
|
||||||
|
return "ct_publication_bundles";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getMemberTableName() {
|
||||||
|
return "cms_orgaunit_bundles";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,68 @@
|
||||||
|
package com.arsdigita.cms.contenttypes.upgrades;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
public class PublicationWithPublisherPublisherAssocUpgrade extends AbstractAssocUpgrade {
|
||||||
|
|
||||||
|
public PublicationWithPublisherPublisherAssocUpgrade() {
|
||||||
|
super("PublicationWithPublisherPublisherAssocUpgrade", "1.0.0", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(final String[] args) {
|
||||||
|
new PublicationWithPublisherPublisherAssocUpgrade().run(args);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getTableName() {
|
||||||
|
return "ct_publication_with_publisher_publisher_map";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getOwnerIdCol() {
|
||||||
|
return "publication_id";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getMemberIdCol() {
|
||||||
|
return "publisher_id";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Map<String, String> getAttributes() {
|
||||||
|
final Map<String, String> attributes = new HashMap<String, String>();
|
||||||
|
attributes.put("publisher_order", "integer");
|
||||||
|
return attributes;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getPrimaryKeyConstraintName() {
|
||||||
|
return "ct_pub_wit_pub_pub_map_p_5zccy";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getOwnerConstraintName() {
|
||||||
|
return "ct_pub_wit_pub_pub_map_f_rcgl4";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getMemberConstraintName() {
|
||||||
|
return "ct_pub_wit_pub_pub_map_f_4nuuz";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getOwnerTableName() {
|
||||||
|
return "ct_publication_with_publisher_bundles";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getMemberTableName() {
|
||||||
|
return "ct_publisher_bundles";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,74 @@
|
||||||
|
package com.arsdigita.cms.contenttypes.upgrades;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
public class SeriesEditorsAssocUpgrade extends AbstractAssocUpgrade {
|
||||||
|
|
||||||
|
public SeriesEditorsAssocUpgrade() {
|
||||||
|
super("SeriesEditorsAssocUpgrade", "1.0.0", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(final String[] args) {
|
||||||
|
new SeriesEditorsAssocUpgrade().run(args);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getTableName() {
|
||||||
|
return "ct_series_editship";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getOwnerIdCol() {
|
||||||
|
return "series_id";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getMemberIdCol() {
|
||||||
|
return "person_id";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Map<String, String> getAttributes() {
|
||||||
|
final Map<String, String> attributes = new HashMap<String, String>();
|
||||||
|
attributes.put("date_from", "DATE");
|
||||||
|
attributes.put("date_from_skip_month", "boolean");
|
||||||
|
attributes.put("date_from_skip_day", "boolean");
|
||||||
|
attributes.put("date_to", "DATE");
|
||||||
|
attributes.put("date_to_skip_month", "boolean");
|
||||||
|
attributes.put("date_to_skip_day", "boolean");
|
||||||
|
attributes.put("editship_order", "integer");
|
||||||
|
return attributes;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getPrimaryKeyConstraintName() {
|
||||||
|
return "ct_ser_edi_per_id_ser__p_i1gdy";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getOwnerConstraintName() {
|
||||||
|
return "ct_seri_editsh_seri_id_f_6vmir";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getMemberConstraintName() {
|
||||||
|
return "ct_seri_editsh_pers_id_f_eje11";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getOwnerTableName() {
|
||||||
|
return "ct_series_bundles";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getMemberTableName() {
|
||||||
|
return "cms_person_bundles";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,68 @@
|
||||||
|
package com.arsdigita.cms.contenttypes.upgrades;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
public class SeriesPublicationsAssocUpgrade extends AbstractAssocUpgrade {
|
||||||
|
|
||||||
|
public SeriesPublicationsAssocUpgrade() {
|
||||||
|
super("SeriesPublicationsAssocUpgrade", "1.0.0", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(final String[] args) {
|
||||||
|
new SeriesPublicationsAssocUpgrade().run(args);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getTableName() {
|
||||||
|
return "ct_publications_volume_in_series";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getOwnerIdCol() {
|
||||||
|
return "series_id";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getMemberIdCol() {
|
||||||
|
return "publication_id";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Map<String, String> getAttributes() {
|
||||||
|
final Map<String, String> attributes = new HashMap<String, String>();
|
||||||
|
attributes.put("volumeOfSeries", "integer");
|
||||||
|
return attributes;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getPrimaryKeyConstraintName() {
|
||||||
|
return "ct_pub_vol_in_ser_pub__p_qsbkh";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getOwnerConstraintName() {
|
||||||
|
return "ct_pub_vol_in_ser_ser__f_q3jjk";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getMemberConstraintName() {
|
||||||
|
return "ct_pub_vol_in_ser_pub__f_gmhj2";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getOwnerTableName() {
|
||||||
|
return "ct_series_bundles";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getMemberTableName() {
|
||||||
|
return "ct_publication_bundles";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,70 @@
|
||||||
|
package com.arsdigita.cms.contenttypes.upgrades;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
public class UnPublishedOrganizationAssocUpgrade extends AbstractAssocUpgrade {
|
||||||
|
|
||||||
|
public UnPublishedOrganizationAssocUpgrade() {
|
||||||
|
super("UnPublishedOrganizationAssocUpgrade", "1.0.0", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(final String[] args) {
|
||||||
|
new UnPublishedOrganizationAssocUpgrade().run(args);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getTableName() {
|
||||||
|
return "ct_unpublished_organization_map";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getOwnerIdCol() {
|
||||||
|
return "unpublished_id";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getMemberIdCol() {
|
||||||
|
return "organization_id";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Map<String, String> getAttributes() {
|
||||||
|
final Map<String, String> attributes = new HashMap<String, String>();
|
||||||
|
attributes.put("orga_order", "integer");
|
||||||
|
return attributes;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getPrimaryKeyConstraintName() {
|
||||||
|
return "ct_unp_org_map_org_id__p__r4u5";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getOwnerConstraintName() {
|
||||||
|
return "ct_unp_orga_map_unp_id_f_uflh7";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getMemberConstraintName() {
|
||||||
|
return "ct_unp_org_map_orga_id_f_01qho";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getOwnerTableName() {
|
||||||
|
return "ct_unpublished_bundles";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getMemberTableName() {
|
||||||
|
return "cms_orgaunit_bundles";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue