- Validator für Erscheinungsjahr bei Publikationen deaktiviert

- Erster Teil des CLI-Tools zum korrigieren der fehlerhaften Sprachverknüpfungen beim ZeS
- Kleinigkeiten


git-svn-id: https://svn.libreccm.org/ccm/trunk@992 8810af33-2d31-482b-a856-94f89814c4df
master
jensp 2011-06-27 18:25:14 +00:00
parent 2b07ec4258
commit 2180838326
3 changed files with 299 additions and 18 deletions

View File

@ -53,7 +53,8 @@ public class ItemQueryComponent extends BaseQueryComponent {
private String m_context; private String m_context;
public ItemQueryComponent(String context, final boolean limitToContentSection) { public ItemQueryComponent(String context,
final boolean limitToContentSection) {
m_context = context; m_context = context;
if (Search.getConfig().isIntermediaEnabled()) { if (Search.getConfig().isIntermediaEnabled()) {
@ -72,18 +73,22 @@ public class ItemQueryComponent extends BaseQueryComponent {
@Override @Override
protected Category[] getRoots(PageState state) { protected Category[] getRoots(PageState state) {
Category[] roots; Category[] roots;
if (limitToContentSection == true && CMS.getContext().hasContentSection()) { if (limitToContentSection == true && CMS.getContext().
ContentSection section = CMS.getContext().getContentSection(); hasContentSection()) {
ContentSection section = CMS.getContext().
getContentSection();
roots = new Category[]{section.getRootCategory()}; roots = new Category[]{section.getRootCategory()};
} else { } else {
ContentSectionCollection sections = ContentSectionCollection sections =
ContentSection.getAllSections(); ContentSection.getAllSections();
List cats = new ArrayList(); List cats = new ArrayList();
while (sections.next()) { while (sections.next()) {
ContentSection section = sections.getContentSection(); ContentSection section =
sections.getContentSection();
cats.add(section.getRootCategory()); cats.add(section.getRootCategory());
} }
roots = (Category[]) cats.toArray(new Category[cats.size()]); roots =
(Category[]) cats.toArray(new Category[cats.size()]);
} }
return roots; return roots;
} }
@ -93,7 +98,8 @@ public class ItemQueryComponent extends BaseQueryComponent {
@Override @Override
protected ContentSection getContentSection() { protected ContentSection getContentSection() {
if (limitToContentSection == true && CMS.getContext().hasContentSection()) { if (limitToContentSection == true && CMS.getContext().
hasContentSection()) {
return CMS.getContext().getContentSection(); return CMS.getContext().getContentSection();
} else { } else {
return super.getContentSection(); return super.getContentSection();
@ -115,7 +121,8 @@ public class ItemQueryComponent extends BaseQueryComponent {
LastModifiedUserFilterType.KEY)); LastModifiedUserFilterType.KEY));
} }
Submit submit = new Submit(m_context + "_search", Submit submit =
new Submit(m_context + "_search",
ContentSectionPage.globalize("cms.ui.search")); ContentSectionPage.globalize("cms.ui.search"));
add(submit); add(submit);
} }

View File

@ -80,8 +80,8 @@ public class PublicationPropertyForm
Publication.YEAR_OF_PUBLICATION); Publication.YEAR_OF_PUBLICATION);
TextField yearOfPublication = new TextField(yearOfPublicationParam); TextField yearOfPublication = new TextField(yearOfPublicationParam);
yearOfPublication.setMaxLength(4); yearOfPublication.setMaxLength(4);
yearOfPublication.addValidationListener(new NotNullValidationListener()); //yearOfPublication.addValidationListener(new NotNullValidationListener());
yearOfPublication.addValidationListener(new NotEmptyValidationListener()); //yearOfPublication.addValidationListener(new NotEmptyValidationListener());
add(yearOfPublication); add(yearOfPublication);
add(new Label((String) PublicationGlobalizationUtil.globalize( add(new Label((String) PublicationGlobalizationUtil.globalize(

View File

@ -0,0 +1,274 @@
package com.arsdigita.cms.contenttypes;
import com.arsdigita.cms.ContentBundle;
import com.arsdigita.cms.ContentItem;
import com.arsdigita.cms.ContentPage;
import com.arsdigita.cms.ContentSection;
import com.arsdigita.cms.ContentSectionCollection;
import com.arsdigita.cms.Folder;
import com.arsdigita.cms.Folder.ItemCollection;
import com.arsdigita.domain.DomainObject;
import com.arsdigita.persistence.Session;
import com.arsdigita.persistence.SessionManager;
import com.arsdigita.persistence.TransactionContext;
/**
*
* @author Jens Pelzetter
*/
public class ZeSLanguageVersionFix {
public static void main(final String[] args) {
final com.arsdigita.runtime.Runtime runtime =
new com.arsdigita.runtime.Runtime();
runtime.startup();
final Session session = SessionManager.getSession();
final TransactionContext tctx = session.getTransactionContext();
tctx.beginTxn();
try {
System.out.println("Starting to fix associations...");
ContentSectionCollection contentSections = ContentSection.
getAllSections();
ContentSection sectionContent = null;
ContentSection sectionResearch = null;
while (contentSections.next()) {
ContentSection section = contentSections.getContentSection();
if ("content".equals(section.getName())) {
sectionContent = section;
} else if ("research".equals(section.getName())) {
sectionResearch = section;
}
}
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;
if (item instanceof ContentBundle) {
zesDe =
(SciOrganizationWithPublications) ((ContentBundle) item).
getPrimaryInstance();
} else {
zesDe = (SciOrganizationWithPublications) ((ContentPage) item).
getContentBundle().getPrimaryInstance();
}
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...");
System.out.println("Finished, commiting transaction...");
tctx.commitTxn();
} catch (Exception ex) {
System.err.println(
"Exeception ocurred during convert process. "
+ "Transaction rolled back, all changes will be lost.");
ex.printStackTrace(System.err);
} finally {
if (tctx.inTxn()) {
tctx.abortTxn();
}
}
}
}