diff --git a/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchPage.java b/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchPage.java index 28cf8e4c7..1006c7bc1 100755 --- a/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchPage.java +++ b/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchPage.java @@ -56,7 +56,7 @@ public class ItemSearchPage extends CMSPage { private TabbedPane m_tabbedPane; private ItemSearchBrowsePane m_browse; private ItemSearchPopup m_search; - private ItemSearchCreateItemPane m_create; + //private ItemSearchCreateItemPane m_create; private BigDecimalParameter m_sectionId; private static final CMSConfig s_conf = CMSConfig.getInstance(); private static final boolean LIMIT_TO_CONTENT_SECTION = false; diff --git a/ccm-core/src/com/arsdigita/persistence/DataObjectImpl.java b/ccm-core/src/com/arsdigita/persistence/DataObjectImpl.java index 089a29d98..d03d46372 100755 --- a/ccm-core/src/com/arsdigita/persistence/DataObjectImpl.java +++ b/ccm-core/src/com/arsdigita/persistence/DataObjectImpl.java @@ -165,6 +165,7 @@ class DataObjectImpl implements DataObject { } private com.redhat.persistence.metadata.Property convert(String property) { + System.out.printf("\n!!!Converting property '%s'...\n", property); return C.prop(m_ssn.getRoot(), getObjectType().getProperty(property)); } diff --git a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ZeSLanguageVersionFix.java b/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ZeSLanguageVersionFix.java index c91080d52..02ce16048 100644 --- a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ZeSLanguageVersionFix.java +++ b/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ZeSLanguageVersionFix.java @@ -5,12 +5,17 @@ import com.arsdigita.cms.ContentItem; import com.arsdigita.cms.ContentPage; import com.arsdigita.cms.ContentSection; import com.arsdigita.cms.ContentSectionCollection; +import com.arsdigita.cms.ContentType; +import com.arsdigita.cms.ContentTypeLifecycleDefinition; +import com.arsdigita.cms.ContentTypeWorkflowTemplate; import com.arsdigita.cms.Folder; -import com.arsdigita.cms.Folder.ItemCollection; -import com.arsdigita.domain.DomainObject; +import com.arsdigita.cms.lifecycle.LifecycleDefinition; import com.arsdigita.persistence.Session; import com.arsdigita.persistence.SessionManager; import com.arsdigita.persistence.TransactionContext; +import com.arsdigita.workflow.simple.Workflow; +import com.arsdigita.workflow.simple.WorkflowTemplate; +import java.util.Date; /** * @@ -44,230 +49,30 @@ public class ZeSLanguageVersionFix { } } - System.out.println( - "First, the publications of the english variant of the ZeS..."); - Folder folder = sectionContent.getRootFolder(); - folder = (Folder) folder.getItem("das-zentrum", true); - ContentItem item = folder.getItem("zes", false); - - SciOrganizationWithPublications zesDe; - SciOrganizationWithPublications zesEn; - if (item instanceof ContentBundle) { - zesDe = - (SciOrganizationWithPublications) ((ContentBundle) item). - getPrimaryInstance(); - } else { - zesDe = (SciOrganizationWithPublications) ((ContentPage) item). - getContentBundle().getPrimaryInstance(); - } - zesEn = (SciOrganizationWithPublications) zesDe.getContentBundle().getInstance("en"); - SciOrganizationPublicationsCollection zesPublications = zesDe.getPublications(); - while(zesPublications.next()) { - Publication publicationDe = (Publication) zesPublications.getPublication().getContentBundle().getPrimaryInstance(); - if (publicationDe.getContentBundle().getInstance("en") == null) { - //craete en variant of publication... - } - Publication publicationEn = (Publication) publicationDe.getContentBundle().getInstance("en"); - zesEn.addPublication(publicationEn); - } - - System.out.printf("Got the ZeS: %s (%s)\n", zesDe.getName(), zesDe. - getLanguage()); - - System.out.println( - "Abteilung Theorie und Verfassung des Wohlfahrtsstaates..."); - folder = sectionContent.getRootFolder(); - folder = (Folder) folder.getItem("theorie-und-verfassung", true); - item = folder.getItem("theorie-und-verfassung-des-wohlfahrtsstaates", - false); - - final SciDepartmentWithPublications theorieDe; - if (item instanceof ContentBundle) { - theorieDe = - (SciDepartmentWithPublications) ((ContentBundle) item). - getPrimaryInstance(); - } else { - theorieDe = - (SciDepartmentWithPublications) ((ContentPage) item). - getContentBundle().getPrimaryInstance(); - } - - System.out.printf("Got '%s' (%s)\n", theorieDe.getName(), theorieDe. - getLanguage()); - - System.out.println( - "Abteilung Institutionen und Geschichte des Wohlfahrtsstaates..."); - folder = sectionContent.getRootFolder(); - folder = (Folder) folder.getItem("institutionen-und-geschichte", - true); - item = folder.getItem( - "institutionen-und-geschichte-des-wohlfahrtsstaates", false); - - final SciDepartmentWithPublications institutionenDe; - if (item instanceof ContentBundle) { - institutionenDe = - (SciDepartmentWithPublications) ((ContentBundle) item). - getPrimaryInstance(); - } else { - institutionenDe = - (SciDepartmentWithPublications) ((ContentPage) item). - getContentBundle().getPrimaryInstance(); - } - - System.out.printf("Got '%s' (%s)\n", theorieDe.getName(), theorieDe. - getLanguage()); - - System.out.println( - "Abteilung Wirtschaftswissenschaftliche Abteilung..."); - folder = sectionContent.getRootFolder(); - folder = (Folder) folder.getItem( - "wirtschaftswissenschaftliche-abteilung", - true); - item = - folder.getItem("wirtschaftswissenschaftliche-abteilung", false); - final SciDepartmentWithPublications wirtschaftDe; - if (item instanceof ContentBundle) { - wirtschaftDe = - (SciDepartmentWithPublications) ((ContentBundle) item). - getPrimaryInstance(); - } else { - wirtschaftDe = - (SciDepartmentWithPublications) ((ContentPage) item). - getContentBundle().getPrimaryInstance(); - } - - System.out.printf("Got '%s' (%s)\n", theorieDe.getName(), theorieDe. - getLanguage()); - - System.out.println("Abteilung Gesundheit..."); - folder = sectionContent.getRootFolder(); - folder = (Folder) folder.getItem( - "gesundheit", - true); - item = - folder.getItem( - "gesundheitsoekonomie-gesundheitspolitik-und-versorgungsforschung", - false); - final SciDepartmentWithPublications gesundheitDe; - if (item instanceof ContentBundle) { - gesundheitDe = - (SciDepartmentWithPublications) ((ContentBundle) item). - getPrimaryInstance(); - } else { - gesundheitDe = - (SciDepartmentWithPublications) ((ContentPage) item). - getContentBundle().getPrimaryInstance(); - } - - System.out.printf("Got '%s' (%s)\n", theorieDe.getName(), theorieDe. - getLanguage()); - - System.out.println("Arbeitsbereich 1..."); - folder = sectionContent.getRootFolder(); - folder = (Folder) folder.getItem( - "gesundheit", - true); - item = - folder.getItem("arbeitsbereich-1", false); - final SciDepartmentWithPublications arbeitsbereich1De; - if (item instanceof ContentBundle) { - arbeitsbereich1De = - (SciDepartmentWithPublications) ((ContentBundle) item). - getPrimaryInstance(); - } else { - arbeitsbereich1De = - (SciDepartmentWithPublications) ((ContentPage) item). - getContentBundle().getPrimaryInstance(); - } - - System.out.printf("Got '%s' (%s)\n", theorieDe.getName(), theorieDe. - getLanguage()); - - System.out.println("Arbeitsbereich 2..."); - folder = sectionContent.getRootFolder(); - folder = (Folder) folder.getItem( - "gesundheit", - true); - item = - folder.getItem("arbeitsbereich-2", false); - final SciDepartmentWithPublications arbeitsbereich2De; - if (item instanceof ContentBundle) { - arbeitsbereich2De = - (SciDepartmentWithPublications) ((ContentBundle) item). - getPrimaryInstance(); - } else { - arbeitsbereich2De = - (SciDepartmentWithPublications) ((ContentPage) item). - getContentBundle().getPrimaryInstance(); - } - - System.out.printf("Got '%s' (%s)\n", theorieDe.getName(), theorieDe. - getLanguage()); - - System.out.println("Arbeitsbereich 3..."); - folder = sectionContent.getRootFolder(); - folder = (Folder) folder.getItem( - "gesundheit", - true); - item = - folder.getItem("arbeitsbereich-3", false); - final SciDepartmentWithPublications arbeitsbereich3De; - if (item instanceof ContentBundle) { - arbeitsbereich3De = - (SciDepartmentWithPublications) ((ContentBundle) item). - getPrimaryInstance(); - } else { - arbeitsbereich3De = - (SciDepartmentWithPublications) ((ContentPage) item). - getContentBundle().getPrimaryInstance(); - } - - System.out.printf("Got '%s' (%s)\n", theorieDe.getName(), theorieDe. - getLanguage()); - - System.out.println("Arbeitsbereich 4..."); - folder = sectionContent.getRootFolder(); - folder = (Folder) folder.getItem( - "gesundheit", - true); - item = - folder.getItem("arbeitsbereich-4", false); - final SciDepartmentWithPublications arbeitsbereich4De; - if (item instanceof ContentBundle) { - arbeitsbereich4De = - (SciDepartmentWithPublications) ((ContentBundle) item). - getPrimaryInstance(); - } else { - arbeitsbereich4De = - (SciDepartmentWithPublications) ((ContentPage) item). - getContentBundle().getPrimaryInstance(); - } - - System.out.printf("Got '%s' (%s)\n", theorieDe.getName(), theorieDe. - getLanguage()); - System.out.println("Abteilung Geschlechterpolitik..."); - folder = sectionContent.getRootFolder(); - folder = (Folder) folder.getItem("geschlechterpolitik", - true); - item = - folder.getItem("geschlechterpolitik-im-wohlfahrtsstaat", false); - final SciDepartmentWithPublications geschlechterDe; - if (item instanceof ContentBundle) { - geschlechterDe = - (SciDepartmentWithPublications) ((ContentBundle) item). - getPrimaryInstance(); - } else { - geschlechterDe = - (SciDepartmentWithPublications) ((ContentPage) item). - getContentBundle().getPrimaryInstance(); - } - - System.out.printf("Got '%s' (%s)\n", theorieDe.getName(), theorieDe. - getLanguage()); - - - System.out.println("FileStorageItems for WorkingPapers..."); + fixZeS(session, sectionContent, sectionResearch); + fixTheorieUndVerfassung(session, sectionContent, sectionResearch); + fixInstitutionenUndGeschichte(session, + sectionContent, + sectionResearch); + fixWirtschaftswissenschaftliche(session, + sectionContent, + sectionResearch); + fixGesundheit(session, sectionContent, sectionResearch); + fixGesundheitArbeitsbereich1(session, + sectionContent, + sectionResearch); + fixGesundheitArbeitsbereich2(session, + sectionContent, + sectionResearch); + fixGesundheitArbeitsbereich3(session, + sectionContent, + sectionResearch); + fixGesundheitArbeitsbereich4(session, + sectionContent, + sectionResearch); + fixGeschlechterpolitik(session, sectionContent, sectionResearch); + fixFileStorageItems(session, sectionContent, sectionResearch); System.out.println("Finished, commiting transaction..."); tctx.commitTxn(); @@ -282,4 +87,425 @@ public class ZeSLanguageVersionFix { } } } + + public static void fixZeS(final Session session, + final ContentSection sectionContent, + final ContentSection sectionResearch) { + System.out.println( + "First, the publications of the english variant of the ZeS..."); + Folder folder = sectionContent.getRootFolder(); + folder = (Folder) folder.getItem("das-zentrum", true); + ContentItem item = folder.getItem("zes", false); + + SciOrganizationWithPublications zesDe; + SciOrganizationWithPublications zesEn; + if (item instanceof ContentBundle) { + zesDe = + (SciOrganizationWithPublications) ((ContentBundle) item). + getPrimaryInstance(); + } else { + zesDe = (SciOrganizationWithPublications) ((ContentPage) item). + getContentBundle().getPrimaryInstance(); + } + zesEn = (SciOrganizationWithPublications) zesDe.getContentBundle(). + getInstance("en"); + + System.out.printf("Got the ZeS: %s (%s)\n", zesDe.getName(), zesDe. + getLanguage()); + + SciOrganizationPublicationsCollection publicationsZeSde = zesDe. + getPublications(); + SciOrganizationPublicationsCollection publicationsZeSen = zesEn. + getPublications(); + + Publication publicationDe; + Publication publicationEn; + + //Delete all publication links from the english variant to german variants of publications + System.out.println( + "Deleting all assciations of the english ZeS item with german variants of publication items..."); + int i = 1; + long size = publicationsZeSen.size(); + while (publicationsZeSen.next()) { + publicationEn = publicationsZeSen.getPublication(); + System.out.printf("\tProcessing item %d of %d ('%s')...\n", + i, + size, + publicationEn.getName()); + if (!("de").equals(publicationEn.getLanguage())) { + zesEn.removePublication(publicationEn); + LifecycleDefinition lifecycleDef = + ContentTypeLifecycleDefinition. + getLifecycleDefinition( + publicationEn.getContentSection(), + publicationEn.getContentType()); + + System.out.println("\t\t\tPublishing new item..."); + publicationEn.publish(lifecycleDef, new Date()); + i++; + } + } + + publicationEn = null; + + publicationsZeSen = zesEn.getPublications(); + + i = 1; + size = publicationsZeSde.size(); + System.out.println( + "Processing publications and linking them to the english variant of the ZeS item..."); + while (publicationsZeSde.next()) { + publicationDe = publicationsZeSde.getPublication(); + publicationEn = (Publication) publicationDe.getContentBundle(). + getInstance("en"); + System.out.printf("\tProceesing item %d of %d ('%s')...", + i, + size, + publicationDe.getName()); + + System.out.println( + "\tCreating english versions of the publication items of associated with the ZeS item (if necessary)..."); + if (publicationEn == null) { + System.out.println( + "\t\tNo english version found, creating one..."); + publicationEn = + (Publication) createEnglishVersion(publicationDe, + sectionResearch); + } else { + System.out.println( + "\t\tEnglish version exists, no action necessary here."); + } + + System.out.println( + "\tChecking if english variant of the publication item is already associated with the english version of the ZeS item. "); + publicationsZeSen.addFilter(String.format("id = %s", publicationEn. + getID())); + if (publicationsZeSen.isEmpty()) { + System.out.println( + "\t\tAdding english version of publication item to english version of the ZeS item..."); + zesEn.addPublication(publicationEn); + LifecycleDefinition lifecycleDef = + ContentTypeLifecycleDefinition. + getLifecycleDefinition( + publicationEn.getContentSection(), + publicationEn.getContentType()); + System.out.println("\t\t\t(Re)publishing publication item..."); + if (publicationEn.isPublished()) { + publicationEn.republish(); + } else { + publicationEn.publish(lifecycleDef, new Date()); + } + } else { + System.out.println( + "\t\tAlready associated, no actions necessary."); + } + publicationsZeSen.reset(); + i++; + } + + System.out.println("\t\t\t(Re)publishing the english ZeS item..."); + if (zesEn.isPublished()) { + zesEn.republish(); + } else { + LifecycleDefinition lifcycleDef = + ContentTypeLifecycleDefinition. + getLifecycleDefinition(zesEn.getContentSection(), + zesEn.getContentType()); + zesEn.publish(lifcycleDef, new Date()); + } + } + + public static void fixTheorieUndVerfassung(final Session session, + final ContentSection sectionContent, + final ContentSection researchContent) { + Folder folder; + ContentItem item; + + System.out.println( + "Abteilung Theorie und Verfassung des Wohlfahrtsstaates..."); + folder = sectionContent.getRootFolder(); + folder = (Folder) folder.getItem("theorie-und-verfassung", true); + item = folder.getItem("theorie-und-verfassung-des-wohlfahrtsstaates", + false); + + final SciDepartmentWithPublications theorieDe; + if (item instanceof ContentBundle) { + theorieDe = + (SciDepartmentWithPublications) ((ContentBundle) item). + getPrimaryInstance(); + } else { + theorieDe = + (SciDepartmentWithPublications) ((ContentPage) item). + getContentBundle().getPrimaryInstance(); + } + + System.out.printf("Got '%s' (%s)\n", theorieDe.getName(), theorieDe. + getLanguage()); + } + + public static void fixInstitutionenUndGeschichte(final Session session, + final ContentSection sectionContent, + final ContentSection sectionResearch) { + Folder folder; + ContentItem item; + + System.out.println( + "Abteilung Institutionen und Geschichte des Wohlfahrtsstaates..."); + folder = sectionContent.getRootFolder(); + folder = (Folder) folder.getItem("institutionen-und-geschichte", + true); + item = folder.getItem( + "institutionen-und-geschichte-des-wohlfahrtsstaates", false); + + final SciDepartmentWithPublications institutionenDe; + if (item instanceof ContentBundle) { + institutionenDe = + (SciDepartmentWithPublications) ((ContentBundle) item). + getPrimaryInstance(); + } else { + institutionenDe = + (SciDepartmentWithPublications) ((ContentPage) item). + getContentBundle().getPrimaryInstance(); + } + + System.out.printf("Got '%s' (%s)\n", + institutionenDe.getName(), + institutionenDe.getLanguage()); + } + + public static void fixWirtschaftswissenschaftliche(final Session session, + final ContentSection sectionContent, + final ContentSection sectionResearch) { + Folder folder; + ContentItem item; + + System.out.println( + "Abteilung Wirtschaftswissenschaftliche Abteilung..."); + folder = sectionContent.getRootFolder(); + folder = (Folder) folder.getItem( + "wirtschaftswissenschaftliche-abteilung", + true); + item = + folder.getItem("wirtschaftswissenschaftliche-abteilung", false); + final SciDepartmentWithPublications wirtschaftDe; + if (item instanceof ContentBundle) { + wirtschaftDe = + (SciDepartmentWithPublications) ((ContentBundle) item). + getPrimaryInstance(); + } else { + wirtschaftDe = + (SciDepartmentWithPublications) ((ContentPage) item). + getContentBundle().getPrimaryInstance(); + } + + System.out.printf("Got '%s' (%s)\n", wirtschaftDe.getName(), + wirtschaftDe.getLanguage()); + } + + public static void fixGesundheit(final Session session, + final ContentSection sectionContent, + final ContentSection sectionResearch) { + Folder folder; + ContentItem item; + + System.out.println("Abteilung Gesundheit..."); + folder = sectionContent.getRootFolder(); + folder = (Folder) folder.getItem( + "gesundheit", + true); + item = + folder.getItem( + "gesundheitsoekonomie-gesundheitspolitik-und-versorgungsforschung", + false); + final SciDepartmentWithPublications gesundheitDe; + if (item instanceof ContentBundle) { + gesundheitDe = + (SciDepartmentWithPublications) ((ContentBundle) item). + getPrimaryInstance(); + } else { + gesundheitDe = + (SciDepartmentWithPublications) ((ContentPage) item). + getContentBundle().getPrimaryInstance(); + } + + System.out.printf("Got '%s' (%s)\n", gesundheitDe.getName(), + gesundheitDe.getLanguage()); + } + + public static void fixGesundheitArbeitsbereich1(final Session session, + final ContentSection sectionContent, + final ContentSection sectionResearch) { + Folder folder; + ContentItem item; + + System.out.println("Gesundheit/Arbeitsbereich 1..."); + folder = sectionContent.getRootFolder(); + folder = (Folder) folder.getItem( + "gesundheit", + true); + item = + folder.getItem("arbeitsbereich-1", false); + final SciDepartmentWithPublications arbeitsbereich1De; + if (item instanceof ContentBundle) { + arbeitsbereich1De = + (SciDepartmentWithPublications) ((ContentBundle) item). + getPrimaryInstance(); + } else { + arbeitsbereich1De = + (SciDepartmentWithPublications) ((ContentPage) item). + getContentBundle().getPrimaryInstance(); + } + + System.out.printf("Got '%s' (%s)\n", arbeitsbereich1De.getName(), + arbeitsbereich1De.getLanguage()); + } + + public static void fixGesundheitArbeitsbereich2(final Session session, + final ContentSection sectionContent, + final ContentSection sectionResearch) { + Folder folder; + ContentItem item; + + System.out.println("Arbeitsbereich 2..."); + folder = sectionContent.getRootFolder(); + folder = (Folder) folder.getItem( + "gesundheit", + true); + item = + folder.getItem("arbeitsbereich-2", false); + final SciDepartmentWithPublications arbeitsbereich2De; + if (item instanceof ContentBundle) { + arbeitsbereich2De = + (SciDepartmentWithPublications) ((ContentBundle) item). + getPrimaryInstance(); + } else { + arbeitsbereich2De = + (SciDepartmentWithPublications) ((ContentPage) item). + getContentBundle().getPrimaryInstance(); + } + + System.out.printf("Got '%s' (%s)\n", + arbeitsbereich2De.getName(), + arbeitsbereich2De.getLanguage()); + + } + + public static void fixGesundheitArbeitsbereich3(final Session session, + final ContentSection sectionContent, + final ContentSection sectionResearch) { + Folder folder; + ContentItem item; + + System.out.println("Arbeitsbereich 3..."); + folder = sectionContent.getRootFolder(); + folder = (Folder) folder.getItem( + "gesundheit", + true); + item = + folder.getItem("arbeitsbereich-3", false); + final SciDepartmentWithPublications arbeitsbereich3De; + if (item instanceof ContentBundle) { + arbeitsbereich3De = + (SciDepartmentWithPublications) ((ContentBundle) item). + getPrimaryInstance(); + } else { + arbeitsbereich3De = + (SciDepartmentWithPublications) ((ContentPage) item). + getContentBundle().getPrimaryInstance(); + } + + System.out.printf("Got '%s' (%s)\n", + arbeitsbereich3De.getName(), + arbeitsbereich3De.getLanguage()); + } + + public static void fixGesundheitArbeitsbereich4(final Session session, + final ContentSection sectionContent, + final ContentSection sectionResearch) { + Folder folder; + ContentItem item; + + System.out.println("Arbeitsbereich 4..."); + folder = sectionContent.getRootFolder(); + folder = (Folder) folder.getItem( + "gesundheit", + true); + item = + folder.getItem("arbeitsbereich-4", false); + final SciDepartmentWithPublications arbeitsbereich4De; + if (item instanceof ContentBundle) { + arbeitsbereich4De = + (SciDepartmentWithPublications) ((ContentBundle) item). + getPrimaryInstance(); + } else { + arbeitsbereich4De = + (SciDepartmentWithPublications) ((ContentPage) item). + getContentBundle().getPrimaryInstance(); + } + + System.out.printf("Got '%s' (%s)\n", + arbeitsbereich4De.getName(), + arbeitsbereich4De.getLanguage()); + } + + public static void fixGeschlechterpolitik(final Session session, + final ContentSection sectionContent, + final ContentSection sectionResearch) { + Folder folder; + ContentItem item; + + System.out.println("Abteilung Geschlechterpolitik..."); + folder = sectionContent.getRootFolder(); + folder = (Folder) folder.getItem("geschlechterpolitik", + true); + item = + folder.getItem("geschlechterpolitik-im-wohlfahrtsstaat", false); + final SciDepartmentWithPublications geschlechterDe; + if (item instanceof ContentBundle) { + geschlechterDe = + (SciDepartmentWithPublications) ((ContentBundle) item). + getPrimaryInstance(); + } else { + geschlechterDe = + (SciDepartmentWithPublications) ((ContentPage) item). + getContentBundle().getPrimaryInstance(); + } + + System.out.printf("Got '%s' (%s)\n", + geschlechterDe.getName(), + geschlechterDe.getLanguage()); + } + + public static void fixFileStorageItems(final Session session, + final ContentSection sectionContent, + final ContentSection sectionResearch) { + Folder folder; + ContentItem item; + + System.out.println("FileStorageItems for WorkingPapers..."); + } + + public static ContentPage createEnglishVersion(final ContentPage item, + final ContentSection section) { + ContentPage itemPrimary; + ContentPage itemEn; + + itemPrimary = (Publication) item.getContentBundle(). + getPrimaryInstance(); + + itemEn = (Publication) itemPrimary.copy("en"); + itemEn.setLanguage("en"); + itemEn.setName(item.getContentBundle().getName()); + + ContentType type = item.getContentType();; + WorkflowTemplate template = ContentTypeWorkflowTemplate. + getWorkflowTemplate(section, type); + if (template != null) { + Workflow workflow = template.instantiateNewWorkflow(); + workflow.setObjectID(itemEn.getID()); + workflow.save(); + } + + return itemEn; + } }