Verschiedene zusätzliche AuthoringSteps (PersonPublications, PublisherPublications, PersonOrgaUnits, GenericOrganizationalUnitPublications) können jetzt per Konfiguration deaktiviert werden (Ticket #1505).
git-svn-id: https://svn.libreccm.org/ccm/trunk@2021 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
4cc6541072
commit
efd744be3e
|
|
@ -15,7 +15,6 @@
|
||||||
* License along with this library; if not, write to the Free Software
|
* License along with this library; if not, write to the Free Software
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.arsdigita.atoz.tools;
|
package com.arsdigita.atoz.tools;
|
||||||
|
|
||||||
import com.arsdigita.atoz.AtoZ;
|
import com.arsdigita.atoz.AtoZ;
|
||||||
|
|
@ -32,7 +31,6 @@ import com.arsdigita.web.Application;
|
||||||
import org.apache.commons.cli.CommandLine;
|
import org.apache.commons.cli.CommandLine;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Command line utility to create an application instance of AtoZ.
|
* Command line utility to create an application instance of AtoZ.
|
||||||
*
|
*
|
||||||
|
|
@ -53,14 +51,15 @@ public class AtoZCreator extends Program {
|
||||||
|
|
||||||
private void addAtoZ(String atozURL, String atozTitle) {
|
private void addAtoZ(String atozURL, String atozTitle) {
|
||||||
|
|
||||||
if (!Application.isInstalled(AtoZ.BASE_DATA_OBJECT_TYPE, "/"+atozURL+"/")) {
|
if (!Application.isInstalled(AtoZ.BASE_DATA_OBJECT_TYPE, "/" + atozURL + "/")) {
|
||||||
|
|
||||||
DomainObjectFactory.registerInstantiator(
|
DomainObjectFactory.registerInstantiator(
|
||||||
AtoZ.BASE_DATA_OBJECT_TYPE, new DomainObjectInstantiator() {
|
AtoZ.BASE_DATA_OBJECT_TYPE, new DomainObjectInstantiator() {
|
||||||
public DomainObject doNewInstance(DataObject dataObject) {
|
public DomainObject doNewInstance(DataObject dataObject) {
|
||||||
return new AtoZ(dataObject);
|
return new AtoZ(dataObject);
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
});
|
||||||
Application app = Application.createApplication(
|
Application app = Application.createApplication(
|
||||||
AtoZ.BASE_DATA_OBJECT_TYPE, atozURL, atozTitle, null);
|
AtoZ.BASE_DATA_OBJECT_TYPE, atozURL, atozTitle, null);
|
||||||
app.save();
|
app.save();
|
||||||
|
|
@ -68,7 +67,7 @@ public class AtoZCreator extends Program {
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
System.err.println(AtoZ.BASE_DATA_OBJECT_TYPE
|
System.err.println(AtoZ.BASE_DATA_OBJECT_TYPE
|
||||||
+ " already installed at " + atozURL);
|
+ " already installed at " + atozURL);
|
||||||
System.exit(1);
|
System.exit(1);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -86,7 +85,7 @@ public class AtoZCreator extends Program {
|
||||||
String atozURL = args[0];
|
String atozURL = args[0];
|
||||||
String atozTitle = args[1];
|
String atozTitle = args[1];
|
||||||
if (atozURL != null && atozURL.length() != 0
|
if (atozURL != null && atozURL.length() != 0
|
||||||
&& atozTitle != null && atozTitle.length() != 0) {
|
&& atozTitle != null && atozTitle.length() != 0) {
|
||||||
addAtoZ(atozURL, atozTitle);
|
addAtoZ(atozURL, atozTitle);
|
||||||
} else {
|
} else {
|
||||||
help(System.err);
|
help(System.err);
|
||||||
|
|
@ -97,8 +96,10 @@ public class AtoZCreator extends Program {
|
||||||
System.exit(1);
|
System.exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}.run();
|
}.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
}.run();
|
}.run();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,6 @@
|
||||||
* License along with this library; if not, write to the Free Software
|
* License along with this library; if not, write to the Free Software
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.arsdigita.atoz.ui.admin;
|
package com.arsdigita.atoz.ui.admin;
|
||||||
|
|
||||||
import com.arsdigita.atoz.ItemProvider;
|
import com.arsdigita.atoz.ItemProvider;
|
||||||
|
|
@ -63,12 +62,12 @@ public class ItemProviderForm extends ProviderForm {
|
||||||
super.addWidgets();
|
super.addWidgets();
|
||||||
|
|
||||||
m_loadPaths = new TextField(ItemProvider.LOAD_PATHS);
|
m_loadPaths = new TextField(ItemProvider.LOAD_PATHS);
|
||||||
((SimpleComponent)m_loadPaths).setMetaDataAttribute("label", "Attributes to retrieve");
|
((SimpleComponent) m_loadPaths).setMetaDataAttribute("label", "Attributes to retrieve");
|
||||||
add(m_loadPaths);
|
add(m_loadPaths);
|
||||||
m_loadPaths.addValidationListener(new StringInRangeValidationListener(0, 200));
|
m_loadPaths.addValidationListener(new StringInRangeValidationListener(0, 200));
|
||||||
m_picker = new AllCategoryPicker("rootCategory");
|
m_picker = new AllCategoryPicker("rootCategory");
|
||||||
((SimpleComponent)m_picker).setMetaDataAttribute("label", "Category filter");
|
((SimpleComponent) m_picker).setMetaDataAttribute("label", "Category filter");
|
||||||
((SingleSelect)m_picker).addValidationListener(new NotNullValidationListener());
|
((SingleSelect) m_picker).addValidationListener(new NotNullValidationListener());
|
||||||
add(m_picker);
|
add(m_picker);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -77,10 +76,10 @@ public class ItemProviderForm extends ProviderForm {
|
||||||
AtoZProvider provider) {
|
AtoZProvider provider) {
|
||||||
super.processWidgets(state, provider);
|
super.processWidgets(state, provider);
|
||||||
|
|
||||||
ItemProvider myprovider = (ItemProvider)provider;
|
ItemProvider myprovider = (ItemProvider) provider;
|
||||||
|
|
||||||
myprovider.setCategory(m_picker.getCategory(state));
|
myprovider.setCategory(m_picker.getCategory(state));
|
||||||
myprovider.setLoadPaths( (String) m_loadPaths.getValue(state));
|
myprovider.setLoadPaths((String) m_loadPaths.getValue(state));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -88,7 +87,7 @@ public class ItemProviderForm extends ProviderForm {
|
||||||
AtoZProvider provider) {
|
AtoZProvider provider) {
|
||||||
super.initWidgets(state, provider);
|
super.initWidgets(state, provider);
|
||||||
|
|
||||||
ItemProvider myprovider = (ItemProvider)provider;
|
ItemProvider myprovider = (ItemProvider) provider;
|
||||||
if (provider != null) {
|
if (provider != null) {
|
||||||
//m_compound.setValue(state, new Boolean(myprovider.isCompound()));
|
//m_compound.setValue(state, new Boolean(myprovider.isCompound()));
|
||||||
|
|
||||||
|
|
@ -107,26 +106,23 @@ public class ItemProviderForm extends ProviderForm {
|
||||||
SingleSelect target) {
|
SingleSelect target) {
|
||||||
target.addOption(new Option(null, "-- pick one --"));
|
target.addOption(new Option(null, "-- pick one --"));
|
||||||
|
|
||||||
DataCollection domains = SessionManager.getSession()
|
DataCollection domains = SessionManager.getSession().retrieve("com.arsdigita.london.terms.Domain");
|
||||||
.retrieve("com.arsdigita.london.terms.Domain");
|
|
||||||
domains.addPath("model.id");
|
domains.addPath("model.id");
|
||||||
domains.addPath("model.objectType");
|
domains.addPath("model.objectType");
|
||||||
domains.addOrder("title");
|
domains.addOrder("title");
|
||||||
while (domains.next()) {
|
while (domains.next()) {
|
||||||
Category rootCategory = (Category)
|
Category rootCategory = (Category) DomainObjectFactory.newInstance((DataObject) domains.get("model"));
|
||||||
DomainObjectFactory.newInstance( (DataObject) domains.get("model"));
|
|
||||||
categorySubtreePath(target, rootCategory, " > ");
|
categorySubtreePath(target, rootCategory, " > ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void categorySubtreePath(SingleSelect target, Category root, String join) {
|
private void categorySubtreePath(SingleSelect target, Category root, String join) {
|
||||||
DomainCollection cats = new DomainCollection(
|
DomainCollection cats = new DomainCollection(
|
||||||
SessionManager.getSession().retrieve(Category.BASE_DATA_OBJECT_TYPE)
|
SessionManager.getSession().retrieve(Category.BASE_DATA_OBJECT_TYPE));
|
||||||
);
|
|
||||||
cats.addFilter("defaultAncestors like :ancestors")
|
cats.addFilter("defaultAncestors like :ancestors")
|
||||||
.set("ancestors",
|
.set("ancestors",
|
||||||
((String)DomainServiceInterfaceExposer
|
((String) DomainServiceInterfaceExposer
|
||||||
.get(root, "defaultAncestors")) + "%");
|
.get(root, "defaultAncestors")) + "%");
|
||||||
cats.addEqualsFilter("parents.link.isDefault", Boolean.TRUE);
|
cats.addEqualsFilter("parents.link.isDefault", Boolean.TRUE);
|
||||||
cats.addOrder("defaultAncestors");
|
cats.addOrder("defaultAncestors");
|
||||||
cats.addPath("parents.id");
|
cats.addPath("parents.id");
|
||||||
|
|
@ -137,27 +133,27 @@ public class ItemProviderForm extends ProviderForm {
|
||||||
path2cat.put(root.getName(), root);
|
path2cat.put(root.getName(), root);
|
||||||
cat2path.put(root.getID(), root.getName());
|
cat2path.put(root.getID(), root.getName());
|
||||||
target.addOption(new Option(root.getOID().toString(),
|
target.addOption(new Option(root.getOID().toString(),
|
||||||
" +++++++++++++++++++++++++ "
|
" +++++++++++++++++++++++++ "
|
||||||
+ root.getName()
|
+ root.getName()
|
||||||
+ " +++++++++++++++++++++++++ "));
|
+ " +++++++++++++++++++++++++ "));
|
||||||
|
|
||||||
while (cats.next()) {
|
while (cats.next()) {
|
||||||
Category cat = (Category)cats.getDomainObject();
|
Category cat = (Category) cats.getDomainObject();
|
||||||
BigDecimal parent = (BigDecimal)cats.get("parents.id");
|
BigDecimal parent = (BigDecimal) cats.get("parents.id");
|
||||||
|
|
||||||
if (parent == null) {
|
if (parent == null) {
|
||||||
path2cat.put(cat.getName(), cat);
|
path2cat.put(cat.getName(), cat);
|
||||||
cat2path.put(cat.getID(), cat.getName());
|
cat2path.put(cat.getID(), cat.getName());
|
||||||
target.addOption(new Option(cat.getOID().toString(), cat.getName()));
|
target.addOption(new Option(cat.getOID().toString(), cat.getName()));
|
||||||
} else {
|
} else {
|
||||||
String parentPath = (String)cat2path.get(parent);
|
String parentPath = (String) cat2path.get(parent);
|
||||||
String path = parentPath + join + cat.getName();
|
String path = parentPath + join + cat.getName();
|
||||||
path2cat.put(path, cat);
|
path2cat.put(path, cat);
|
||||||
cat2path.put(cat.getID(), path);
|
cat2path.put(cat.getID(), path);
|
||||||
//
|
//
|
||||||
int breakPos = 0;
|
int breakPos = 0;
|
||||||
String prefix = "---";
|
String prefix = "---";
|
||||||
while ((breakPos = 1+parentPath.indexOf(join, breakPos)) > 0) {
|
while ((breakPos = 1 + parentPath.indexOf(join, breakPos)) > 0) {
|
||||||
prefix += "---";
|
prefix += "---";
|
||||||
}
|
}
|
||||||
target.addOption(new Option(cat.getOID().toString(), prefix + " " + cat.getName()));
|
target.addOption(new Option(cat.getOID().toString(), prefix + " " + cat.getName()));
|
||||||
|
|
@ -166,5 +162,4 @@ public class ItemProviderForm extends ProviderForm {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -83,6 +83,7 @@ public final class CMSConfig extends AbstractConfig {
|
||||||
|
|
||||||
return s_config;
|
return s_config;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Storage (map) for method getAssetStepsToSkip(ContentType type) to store
|
* Storage (map) for method getAssetStepsToSkip(ContentType type) to store
|
||||||
* mapping of steps that are deemed irrelevant for the passid in type.
|
* mapping of steps that are deemed irrelevant for the passid in type.
|
||||||
|
|
@ -550,7 +551,6 @@ public final class CMSConfig extends AbstractConfig {
|
||||||
"com.arsdigita.cms.item_search.flat_browse_pane.page_size",
|
"com.arsdigita.cms.item_search.flat_browse_pane.page_size",
|
||||||
Parameter.REQUIRED,
|
Parameter.REQUIRED,
|
||||||
20);
|
20);
|
||||||
|
|
||||||
/////////////////////////////////////////////
|
/////////////////////////////////////////////
|
||||||
// FolderBrowse
|
// FolderBrowse
|
||||||
/////////////////////////////////////////////
|
/////////////////////////////////////////////
|
||||||
|
|
@ -592,7 +592,6 @@ public final class CMSConfig extends AbstractConfig {
|
||||||
"cms.arsdigita.cms.lifecycle.threaded_publishing.notify_on_error.to",
|
"cms.arsdigita.cms.lifecycle.threaded_publishing.notify_on_error.to",
|
||||||
Parameter.REQUIRED,
|
Parameter.REQUIRED,
|
||||||
"");
|
"");
|
||||||
|
|
||||||
/////////////////////////////////////////////////
|
/////////////////////////////////////////////////
|
||||||
// ImageBrowser Parameter
|
// ImageBrowser Parameter
|
||||||
/////////////////////////////////////////////////
|
/////////////////////////////////////////////////
|
||||||
|
|
@ -604,7 +603,6 @@ public final class CMSConfig extends AbstractConfig {
|
||||||
"com.arsdigita.cms.image_browser.thumbnail_max_height",
|
"com.arsdigita.cms.image_browser.thumbnail_max_height",
|
||||||
Parameter.REQUIRED,
|
Parameter.REQUIRED,
|
||||||
50);
|
50);
|
||||||
|
|
||||||
/////////////////////////////////////////////////
|
/////////////////////////////////////////////////
|
||||||
// ImageCache Parameter
|
// ImageCache Parameter
|
||||||
/////////////////////////////////////////////////
|
/////////////////////////////////////////////////
|
||||||
|
|
@ -624,7 +622,10 @@ public final class CMSConfig extends AbstractConfig {
|
||||||
"com.arsdigita.cms.image_cache.max_age",
|
"com.arsdigita.cms.image_cache.max_age",
|
||||||
Parameter.REQUIRED,
|
Parameter.REQUIRED,
|
||||||
300);
|
300);
|
||||||
|
private final Parameter m_attachPersonOrgaUnitsStep = new BooleanParameter(
|
||||||
|
"com.arsdigita.cms.contenttypes.genericperson.attach_person_orgaunits_step",
|
||||||
|
Parameter.REQUIRED,
|
||||||
|
Boolean.TRUE);
|
||||||
|
|
||||||
// ///////////////////////////////////////////
|
// ///////////////////////////////////////////
|
||||||
// publishToFile package related parameter
|
// publishToFile package related parameter
|
||||||
|
|
@ -632,7 +633,6 @@ public final class CMSConfig extends AbstractConfig {
|
||||||
// Moved to publishToFile.PublishToFileConfig as of version 6.0.2
|
// Moved to publishToFile.PublishToFileConfig as of version 6.0.2
|
||||||
// private final Parameter m_disableItemPfs;
|
// private final Parameter m_disableItemPfs;
|
||||||
// private final Parameter m_publishToFileClass;
|
// private final Parameter m_publishToFileClass;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor, but do NOT instantiate this class directly.
|
* Constructor, but do NOT instantiate this class directly.
|
||||||
*
|
*
|
||||||
|
|
@ -733,6 +733,8 @@ public final class CMSConfig extends AbstractConfig {
|
||||||
// register(m_itemSearchFlatBrowsePaneEnable);
|
// register(m_itemSearchFlatBrowsePaneEnable);
|
||||||
register(m_itemSearchFlatBrowsePanePageSize);
|
register(m_itemSearchFlatBrowsePanePageSize);
|
||||||
|
|
||||||
|
register(m_attachPersonOrgaUnitsStep);
|
||||||
|
|
||||||
loadInfo();
|
loadInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -934,6 +936,7 @@ public final class CMSConfig extends AbstractConfig {
|
||||||
protected Object unmarshal(String value, ErrorList errors) {
|
protected Object unmarshal(String value, ErrorList errors) {
|
||||||
return DHTMLEditor.Config.valueOf(value);
|
return DHTMLEditor.Config.valueOf(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
protected static HashMap extraXMLGenerators = new HashMap();
|
protected static HashMap extraXMLGenerators = new HashMap();
|
||||||
|
|
||||||
|
|
@ -1200,9 +1203,12 @@ public final class CMSConfig extends AbstractConfig {
|
||||||
// public Boolean getItemSearchFlatBrowsePaneEnable() {
|
// public Boolean getItemSearchFlatBrowsePaneEnable() {
|
||||||
// return (Boolean) get(m_itemSearchFlatBrowsePaneEnable);
|
// return (Boolean) get(m_itemSearchFlatBrowsePaneEnable);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
public Integer getItemSearchFlatBrowsePanePageSize() {
|
public Integer getItemSearchFlatBrowsePanePageSize() {
|
||||||
return (Integer) get(m_itemSearchFlatBrowsePanePageSize);
|
return (Integer) get(m_itemSearchFlatBrowsePanePageSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean getAttachPersonOrgaUnitsStep() {
|
||||||
|
return (Boolean) get(m_attachPersonOrgaUnitsStep);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -314,3 +314,8 @@ com.arsdigita.cms.image_cache.max_age.title=Image cache max age
|
||||||
com.arsdigita.cms.image_cache.max_age.purpose=Max unused item age in seconds, keep this low to prevent filling you memory with unsused images
|
com.arsdigita.cms.image_cache.max_age.purpose=Max unused item age in seconds, keep this low to prevent filling you memory with unsused images
|
||||||
com.arsdigita.cms.image_cache.max_age.example=300
|
com.arsdigita.cms.image_cache.max_age.example=300
|
||||||
com.arsdigita.cms.image_cache.max_age.format=[integer]
|
com.arsdigita.cms.image_cache.max_age.format=[integer]
|
||||||
|
|
||||||
|
com.arsdigita.cms.contenttypes.genericperson.attach_person_orgaunits_step.title = Attach PersonOrgaUnits step
|
||||||
|
com.arsdigita.cms.contenttypes.genericperson.attach_person_orgaunits_step.purpose = Attaches an authoring step to GenericPerson which displays all GenericOrganizationalUnits to which the person is assigned to
|
||||||
|
com.arsdigita.cms.contenttypes.genericperson.attach_person_orgaunits_step.example = true
|
||||||
|
com.arsdigita.cms.contenttypes.genericperson.attach_person_orgaunits_step.foramt = [boolean]
|
||||||
|
|
@ -83,7 +83,6 @@ import com.arsdigita.xml.XML;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The main CMS initializer, executed recurringly at each system startup.
|
* The main CMS initializer, executed recurringly at each system startup.
|
||||||
*
|
*
|
||||||
|
|
@ -120,7 +119,6 @@ public class Initializer extends CompoundInitializer {
|
||||||
s_log.debug("CMS.Initializer.(Constructor) completed");
|
s_log.debug("CMS.Initializer.(Constructor) completed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes domain-coupling machinery, usually consisting of
|
* Initializes domain-coupling machinery, usually consisting of
|
||||||
* registering object instantiators and observers.
|
* registering object instantiators and observers.
|
||||||
|
|
@ -232,18 +230,18 @@ public class Initializer extends CompoundInitializer {
|
||||||
FileAsset.BASE_DATA_OBJECT_TYPE,
|
FileAsset.BASE_DATA_OBJECT_TYPE,
|
||||||
new AssetMetadataProvider());
|
new AssetMetadataProvider());
|
||||||
|
|
||||||
|
if (s_conf.getAttachPersonOrgaUnitsStep()) {
|
||||||
AuthoringKitWizard.registerAssetStep(
|
AuthoringKitWizard.registerAssetStep(
|
||||||
GenericPerson.BASE_DATA_OBJECT_TYPE,
|
GenericPerson.BASE_DATA_OBJECT_TYPE,
|
||||||
GenericPersonOrgaUnitsStep.class,
|
GenericPersonOrgaUnitsStep.class,
|
||||||
ContenttypesGlobalizationUtil.globalize("person.authoring.orgas.title"),
|
ContenttypesGlobalizationUtil.globalize("person.authoring.orgas.title"),
|
||||||
ContenttypesGlobalizationUtil.globalize("person.authoring.orgas.title"),
|
ContenttypesGlobalizationUtil.globalize("person.authoring.orgas.title"),
|
||||||
20);
|
20);
|
||||||
|
}
|
||||||
|
|
||||||
s_log.debug("CMS.Initializer.init(DomainInitEvent) completed");
|
s_log.debug("CMS.Initializer.init(DomainInitEvent) completed");
|
||||||
} // END init(DomainInitEvent e)
|
} // END init(DomainInitEvent e)
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper Method, registers stylesheet pattern generators
|
* Helper Method, registers stylesheet pattern generators
|
||||||
*/
|
*/
|
||||||
|
|
@ -257,7 +255,6 @@ public class Initializer extends CompoundInitializer {
|
||||||
new ItemDelegatedURLPatternGenerator());
|
new ItemDelegatedURLPatternGenerator());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Registers object instantiators
|
* Registers object instantiators
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,6 @@
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.arsdigita.cms.contenttypes;
|
package com.arsdigita.cms.contenttypes;
|
||||||
|
|
||||||
import com.arsdigita.cms.contenttypes.ui.GenericOrganizationalUnitPublicationsStep;
|
import com.arsdigita.cms.contenttypes.ui.GenericOrganizationalUnitPublicationsStep;
|
||||||
|
|
@ -94,19 +93,23 @@ public class PublicationInitializer extends ContentTypeInitializer {
|
||||||
10);
|
10);
|
||||||
}
|
}
|
||||||
|
|
||||||
AuthoringKitWizard.registerAssetStep(
|
if (config.getAttachPersonPublicationsStep()) {
|
||||||
GenericPerson.BASE_DATA_OBJECT_TYPE,
|
AuthoringKitWizard.registerAssetStep(
|
||||||
PersonPublicationsStep.class,
|
GenericPerson.BASE_DATA_OBJECT_TYPE,
|
||||||
PublicationGlobalizationUtil.globalize("person.ui.publications.title"),
|
PersonPublicationsStep.class,
|
||||||
PublicationGlobalizationUtil.globalize("person.ui.publications.description"),
|
PublicationGlobalizationUtil.globalize("person.ui.publications.title"),
|
||||||
10);
|
PublicationGlobalizationUtil.globalize("person.ui.publications.description"),
|
||||||
|
10);
|
||||||
|
}
|
||||||
|
|
||||||
AuthoringKitWizard.registerAssetStep(
|
if (config.getAttachOrganizationPublicationsStep()) {
|
||||||
GenericOrganizationalUnit.BASE_DATA_OBJECT_TYPE,
|
AuthoringKitWizard.registerAssetStep(
|
||||||
OrganizationPublicationsStep.class,
|
GenericOrganizationalUnit.BASE_DATA_OBJECT_TYPE,
|
||||||
PublicationGlobalizationUtil.globalize("organization.ui.publications.title"),
|
OrganizationPublicationsStep.class,
|
||||||
PublicationGlobalizationUtil.globalize("organization.ui.publications.description"),
|
PublicationGlobalizationUtil.globalize("organization.ui.publications.title"),
|
||||||
11);
|
PublicationGlobalizationUtil.globalize("organization.ui.publications.description"),
|
||||||
|
11);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -135,4 +138,5 @@ public class PublicationInitializer extends ContentTypeInitializer {
|
||||||
public String getTraversalXML() {
|
public String getTraversalXML() {
|
||||||
return "/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/Publication.xml";
|
return "/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/Publication.xml";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,10 @@ import com.arsdigita.util.parameter.StringParameter;
|
||||||
public class PublicationsConfig extends AbstractConfig {
|
public class PublicationsConfig extends AbstractConfig {
|
||||||
|
|
||||||
private final Parameter attachOrgaUnitsStep;
|
private final Parameter attachOrgaUnitsStep;
|
||||||
|
private final Parameter attachOrganizationPublicationsStep;
|
||||||
|
private final Parameter attachPersonPublicationsStep;
|
||||||
private final Parameter attachPublicationsStepTo;
|
private final Parameter attachPublicationsStepTo;
|
||||||
|
private final Parameter attachPublisherPublicationsStep;
|
||||||
private final Parameter defaultAuthorsFolder;
|
private final Parameter defaultAuthorsFolder;
|
||||||
private final Parameter defaultSeriesFolder;
|
private final Parameter defaultSeriesFolder;
|
||||||
private final Parameter defaultPublisherFolder;
|
private final Parameter defaultPublisherFolder;
|
||||||
|
|
@ -36,12 +39,30 @@ public class PublicationsConfig extends AbstractConfig {
|
||||||
Parameter.REQUIRED,
|
Parameter.REQUIRED,
|
||||||
Boolean.FALSE);
|
Boolean.FALSE);
|
||||||
|
|
||||||
|
attachOrganizationPublicationsStep =
|
||||||
|
new BooleanParameter(
|
||||||
|
"com.arsdigita.cms.contenttypes.publications.attach_organization_publications_step",
|
||||||
|
Parameter.REQUIRED,
|
||||||
|
Boolean.TRUE);
|
||||||
|
|
||||||
|
attachPersonPublicationsStep =
|
||||||
|
new BooleanParameter(
|
||||||
|
"com.arsdigita.cms.contenttypes.publications.attach_person_publications_step",
|
||||||
|
Parameter.REQUIRED,
|
||||||
|
Boolean.TRUE);
|
||||||
|
|
||||||
attachPublicationsStepTo =
|
attachPublicationsStepTo =
|
||||||
new StringParameter(
|
new StringParameter(
|
||||||
"com.arsdigita.cms.contenttypes.publications.attach_publications_step_to",
|
"com.arsdigita.cms.contenttypes.publications.attach_publications_step_to",
|
||||||
Parameter.REQUIRED,
|
Parameter.REQUIRED,
|
||||||
"");
|
"");
|
||||||
|
|
||||||
|
attachPublisherPublicationsStep =
|
||||||
|
new BooleanParameter(
|
||||||
|
"com.arsdigita.cms.contenttypes.publications.attach_publisher_publications_step",
|
||||||
|
Parameter.REQUIRED,
|
||||||
|
Boolean.TRUE);
|
||||||
|
|
||||||
defaultAuthorsFolder = new IntegerParameter(
|
defaultAuthorsFolder = new IntegerParameter(
|
||||||
"com.arsdigita.cms.contenttypes.publications.default_authors_folder",
|
"com.arsdigita.cms.contenttypes.publications.default_authors_folder",
|
||||||
Parameter.OPTIONAL,
|
Parameter.OPTIONAL,
|
||||||
|
|
@ -107,7 +128,10 @@ public class PublicationsConfig extends AbstractConfig {
|
||||||
PublisherBundle.BASE_DATA_OBJECT_TYPE);
|
PublisherBundle.BASE_DATA_OBJECT_TYPE);
|
||||||
|
|
||||||
register(attachOrgaUnitsStep);
|
register(attachOrgaUnitsStep);
|
||||||
|
register(attachOrganizationPublicationsStep);
|
||||||
|
register(attachPersonPublicationsStep);
|
||||||
register(attachPublicationsStepTo);
|
register(attachPublicationsStepTo);
|
||||||
|
register(attachPublisherPublicationsStep);
|
||||||
register(defaultAuthorsFolder);
|
register(defaultAuthorsFolder);
|
||||||
register(defaultSeriesFolder);
|
register(defaultSeriesFolder);
|
||||||
register(defaultPublisherFolder);
|
register(defaultPublisherFolder);
|
||||||
|
|
@ -129,10 +153,22 @@ public class PublicationsConfig extends AbstractConfig {
|
||||||
return (Boolean) get(attachOrgaUnitsStep);
|
return (Boolean) get(attachOrgaUnitsStep);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Boolean getAttachOrganizationPublicationsStep() {
|
||||||
|
return (Boolean) get(attachOrganizationPublicationsStep);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean getAttachPersonPublicationsStep() {
|
||||||
|
return (Boolean) get(attachPersonPublicationsStep);
|
||||||
|
}
|
||||||
|
|
||||||
public String getAttachPublicationsStepTo() {
|
public String getAttachPublicationsStepTo() {
|
||||||
return (String) get(attachPublicationsStepTo);
|
return (String) get(attachPublicationsStepTo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Boolean getPublisherPublicationsStep() {
|
||||||
|
return (Boolean) get(attachPublisherPublicationsStep);
|
||||||
|
}
|
||||||
|
|
||||||
public Integer getDefaultAuthorsFolder() {
|
public Integer getDefaultAuthorsFolder() {
|
||||||
if (get(defaultAuthorsFolder) == null) {
|
if (get(defaultAuthorsFolder) == null) {
|
||||||
return null;
|
return null;
|
||||||
|
|
@ -228,4 +264,5 @@ public class PublicationsConfig extends AbstractConfig {
|
||||||
public String getOrganizationBundleType() {
|
public String getOrganizationBundleType() {
|
||||||
return (String) get(orgaBundleType);
|
return (String) get(orgaBundleType);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,11 +3,26 @@ com.arsdigita.cms.contenttypes.publications.attach_orgaunits_step.purpose = Enab
|
||||||
com.arsdigita.cms.contenttypes.publications.attach_orgaunits_step.example = true
|
com.arsdigita.cms.contenttypes.publications.attach_orgaunits_step.example = true
|
||||||
com.arsdigita.cms.contenttypes.publications.attach_orgaunits_step.format = [Boolean]
|
com.arsdigita.cms.contenttypes.publications.attach_orgaunits_step.format = [Boolean]
|
||||||
|
|
||||||
|
com.arsdigita.cms.contenttypes.publications.attach_organization_publications_step.title = Enable OrganizationPublications step
|
||||||
|
com.arsdigita.cms.contenttypes.publications.attach_organization_publications_step.purpose = Attaches an authoring step to GenericOrganizationalUnit which displays all publications of the type UnPublished to which the organizational unit is assigned as publishing organization.
|
||||||
|
com.arsdigita.cms.contenttypes.publications.attach_organization_publications_step.example = true
|
||||||
|
com.arsdigita.cms.contenttypes.publications.attach_organization_publications_step.format = [Boolean]
|
||||||
|
|
||||||
|
com.arsdigita.cms.contenttypes.publications.attach_person_publications_step.title = Enable authoring which lists all publications of a person
|
||||||
|
com.arsdigita.cms.contenttypes.publications.attach_person_publications_step.purpose = Attaches an authoring step to GenericPerson which displays all publications to which the person is assigned as author.
|
||||||
|
com.arsdigita.cms.contenttypes.publications.attach_person_publications_step.example = true
|
||||||
|
com.arsdigita.cms.contenttypes.publications.attach_person_publications_step.format = [Boolean]
|
||||||
|
|
||||||
com.arsdigita.cms.contenttypes.publications.attach_publications_step_to.title = Attach the Publications authoring step
|
com.arsdigita.cms.contenttypes.publications.attach_publications_step_to.title = Attach the Publications authoring step
|
||||||
com.arsdigita.cms.contenttypes.publications.attach_publications_step_to.purpose = Attaches the authoring step for associating a publication to organizationalunit to the authoring steps of the content types in the string.
|
com.arsdigita.cms.contenttypes.publications.attach_publications_step_to.purpose = Attaches the authoring step for associating a publication to organizationalunit to the authoring steps of the content types in the string.
|
||||||
com.arsdigita.cms.contenttypes.publications.attach_publications_step_to.example = com.arsdigita.cms.contenttypes.SciInstitute;com.arsdigita.cms.contenttypes.SciDepartment;com.arsdigita.cms.contenttypes.SciProject
|
com.arsdigita.cms.contenttypes.publications.attach_publications_step_to.example = com.arsdigita.cms.contenttypes.SciInstitute;com.arsdigita.cms.contenttypes.SciDepartment;com.arsdigita.cms.contenttypes.SciProject
|
||||||
com.arsdigita.cms.contenttypes.publications.attach_publications_step_to.format = [String]
|
com.arsdigita.cms.contenttypes.publications.attach_publications_step_to.format = [String]
|
||||||
|
|
||||||
|
com.arsdigita.cms.contenttypes.publications.attach_publisher_publications_step.title = Attach PublisherPublications step
|
||||||
|
com.arsdigita.cms.contenttypes.publications.attach_publisher_publications_step.purpose = Attaches an authoring step to Publisher which displays all publications the publisher is assigned to
|
||||||
|
com.arsdigita.cms.contenttypes.publications.attach_publisher_publications_step.example = true
|
||||||
|
com.arsdigita.cms.contenttypes.publications.attach_publisher_publications_step.format = [Boolean]
|
||||||
|
|
||||||
com.arsdigita.cms.contenttypes.publications.default_authors_folder.title = ID of the default folder for items created using the create pane of the ItemSearchWidget
|
com.arsdigita.cms.contenttypes.publications.default_authors_folder.title = ID of the default folder for items created using the create pane of the ItemSearchWidget
|
||||||
com.arsdigita.cms.contenttypes.publications.default_authors_folder.purpose = Default folder for items created using the create pane of the ItemSearchWidget
|
com.arsdigita.cms.contenttypes.publications.default_authors_folder.purpose = Default folder for items created using the create pane of the ItemSearchWidget
|
||||||
com.arsdigita.cms.contenttypes.publications.default_authors_folder.example = 10002
|
com.arsdigita.cms.contenttypes.publications.default_authors_folder.example = 10002
|
||||||
|
|
|
||||||
|
|
@ -53,12 +53,16 @@ public class PublisherInitializer extends ContentTypeInitializer {
|
||||||
public void init(final DomainInitEvent event) {
|
public void init(final DomainInitEvent event) {
|
||||||
super.init(event);
|
super.init(event);
|
||||||
|
|
||||||
AuthoringKitWizard.registerAssetStep(
|
final PublicationsConfig config = Publication.getConfig();
|
||||||
Publisher.BASE_DATA_OBJECT_TYPE,
|
|
||||||
PublisherPublicationsStep.class,
|
if (config.getPublisherPublicationsStep()) {
|
||||||
PublicationGlobalizationUtil.globalize("publisher.ui.publications.title"),
|
AuthoringKitWizard.registerAssetStep(
|
||||||
PublicationGlobalizationUtil.globalize("publisher.ui.publications.description"),
|
Publisher.BASE_DATA_OBJECT_TYPE,
|
||||||
10);
|
PublisherPublicationsStep.class,
|
||||||
|
PublicationGlobalizationUtil.globalize("publisher.ui.publications.title"),
|
||||||
|
PublicationGlobalizationUtil.globalize("publisher.ui.publications.description"),
|
||||||
|
10);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -259,6 +259,10 @@ public enum RisField {
|
||||||
* to 255 characters long.
|
* to 255 characters long.
|
||||||
*/
|
*/
|
||||||
A3,
|
A3,
|
||||||
|
/**
|
||||||
|
* Used in GEN type
|
||||||
|
*/
|
||||||
|
A4,
|
||||||
/**
|
/**
|
||||||
* Abstract. This is a free text field and can contain alphanumeric
|
* Abstract. This is a free text field and can contain alphanumeric
|
||||||
* characters; there is no practical length limit to this field.
|
* characters; there is no practical length limit to this field.
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,11 @@
|
||||||
package com.arsdigita.cms.scipublications.importer.ris.converters;
|
package com.arsdigita.cms.scipublications.importer.ris.converters;
|
||||||
|
|
||||||
import com.arsdigita.cms.contenttypes.Monograph;
|
import com.arsdigita.cms.contenttypes.Monograph;
|
||||||
import com.arsdigita.cms.contenttypes.Publication;
|
|
||||||
import com.arsdigita.cms.scipublications.imexporter.ris.RisField;
|
import com.arsdigita.cms.scipublications.imexporter.ris.RisField;
|
||||||
import com.arsdigita.cms.scipublications.imexporter.ris.RisType;
|
import com.arsdigita.cms.scipublications.imexporter.ris.RisType;
|
||||||
import com.arsdigita.cms.scipublications.importer.report.AuthorImportReport;
|
|
||||||
import com.arsdigita.cms.scipublications.importer.report.FieldImportReport;
|
import com.arsdigita.cms.scipublications.importer.report.FieldImportReport;
|
||||||
import com.arsdigita.cms.scipublications.importer.report.PublicationImportReport;
|
import com.arsdigita.cms.scipublications.importer.report.PublicationImportReport;
|
||||||
import com.arsdigita.cms.scipublications.importer.ris.RisConverter;
|
|
||||||
import com.arsdigita.cms.scipublications.importer.ris.RisDataset;
|
import com.arsdigita.cms.scipublications.importer.ris.RisDataset;
|
||||||
import com.arsdigita.cms.scipublications.importer.util.AuthorData;
|
|
||||||
import com.arsdigita.cms.scipublications.importer.util.ImporterUtil;
|
import com.arsdigita.cms.scipublications.importer.util.ImporterUtil;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
@ -19,7 +15,7 @@ import java.util.List;
|
||||||
* @author Jens Pelzetter <jens@jp-digital.de>
|
* @author Jens Pelzetter <jens@jp-digital.de>
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
public class BookConverter implements RisConverter {
|
public class BookConverter extends AbstractRisConverter {
|
||||||
|
|
||||||
public PublicationImportReport convert(final RisDataset dataset,
|
public PublicationImportReport convert(final RisDataset dataset,
|
||||||
final ImporterUtil importerUtil,
|
final ImporterUtil importerUtil,
|
||||||
|
|
@ -33,50 +29,13 @@ public class BookConverter implements RisConverter {
|
||||||
monograph.setTitle(dataset.getValues().get(RisField.TI).get(0));
|
monograph.setTitle(dataset.getValues().get(RisField.TI).get(0));
|
||||||
report.setTitle(dataset.getValues().get(RisField.TI).get(0));
|
report.setTitle(dataset.getValues().get(RisField.TI).get(0));
|
||||||
|
|
||||||
final String yearStr = dataset.getValues().get(RisField.PY).get(0);
|
processYear(dataset, pretend, monograph, report);
|
||||||
try {
|
|
||||||
final int year = Integer.parseInt(yearStr);
|
|
||||||
monograph.setYearOfPublication(year);
|
|
||||||
report.addField(new FieldImportReport("year", yearStr));
|
|
||||||
} catch (NumberFormatException ex) {
|
|
||||||
report.addMessage(String.format("Failed to convert year of publication value '%s' from RIS to"
|
|
||||||
+ "integer value. Setting year of publication to 0"));
|
|
||||||
monograph.setYearOfPublication(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
final List<String> authors = dataset.getValues().get(RisField.AU);
|
processAuthors(dataset, RisField.AU, importerUtil, monograph, report, pretend);
|
||||||
if ((authors != null) && !authors.isEmpty()) {
|
|
||||||
for (String authorStr : authors) {
|
|
||||||
processAuthorStr(authorStr, false, importerUtil, monograph, report, pretend);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
final List<String> editors = dataset.getValues().get(RisField.A3);
|
processEditors(dataset, RisField.A3, importerUtil, monograph, report, pretend);
|
||||||
if ((editors != null) && !editors.isEmpty()) {
|
|
||||||
for (String editorStr : editors) {
|
|
||||||
processAuthorStr(editorStr, true, importerUtil, monograph, report, pretend);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
final List<String> publisherList = dataset.getValues().get(RisField.PB);
|
processPublisher(dataset, pretend, monograph, importerUtil, report);
|
||||||
final List<String> placeList = dataset.getValues().get(RisField.CY);
|
|
||||||
final String publisherName;
|
|
||||||
if ((publisherList == null) || publisherList.isEmpty()) {
|
|
||||||
publisherName = null;
|
|
||||||
} else {
|
|
||||||
publisherName = publisherList.get(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
final String place;
|
|
||||||
if ((placeList == null) || placeList.isEmpty()) {
|
|
||||||
place = null;
|
|
||||||
} else {
|
|
||||||
place = placeList.get(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (publisherName != null) {
|
|
||||||
report.setPublisher(importerUtil.processPublisher(monograph, place, publisherName, pretend));
|
|
||||||
}
|
|
||||||
|
|
||||||
final List<String> abstractList = dataset.getValues().get(RisField.AB);
|
final List<String> abstractList = dataset.getValues().get(RisField.AB);
|
||||||
if ((abstractList != null) && (!abstractList.isEmpty())) {
|
if ((abstractList != null) && (!abstractList.isEmpty())) {
|
||||||
|
|
@ -90,16 +49,7 @@ public class BookConverter implements RisConverter {
|
||||||
report.addField(new FieldImportReport("edition", edition.get(0)));
|
report.addField(new FieldImportReport("edition", edition.get(0)));
|
||||||
}
|
}
|
||||||
|
|
||||||
final List<String> numberOfVols = dataset.getValues().get(RisField.NV);
|
processNumberOfVolumes(dataset, pretend, monograph, report);
|
||||||
if ((numberOfVols != null) && !numberOfVols.isEmpty()) {
|
|
||||||
try {
|
|
||||||
final int value = Integer.parseInt(numberOfVols.get(0));
|
|
||||||
monograph.setNumberOfVolumes(value);
|
|
||||||
report.addField(new FieldImportReport("number of volumes", numberOfVols.get(0)));
|
|
||||||
} catch (NumberFormatException ex) {
|
|
||||||
report.addMessage("Failed to parse number of volumes.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
final List<String> isbn = dataset.getValues().get(RisField.SN);
|
final List<String> isbn = dataset.getValues().get(RisField.SN);
|
||||||
if ((isbn != null) && !isbn.isEmpty()) {
|
if ((isbn != null) && !isbn.isEmpty()) {
|
||||||
|
|
@ -107,27 +57,9 @@ public class BookConverter implements RisConverter {
|
||||||
report.addField(new FieldImportReport("isbn", isbn.get(0)));
|
report.addField(new FieldImportReport("isbn", isbn.get(0)));
|
||||||
}
|
}
|
||||||
|
|
||||||
final List<String> numberOfPages = dataset.getValues().get(RisField.SP);
|
processNumberOfPages(dataset, pretend, monograph, report);
|
||||||
if ((numberOfPages != null) && !numberOfPages.isEmpty()) {
|
|
||||||
try {
|
|
||||||
final int value = Integer.parseInt(numberOfPages.get(0));
|
|
||||||
monograph.setNumberOfPages(value);
|
|
||||||
report.addField(new FieldImportReport("number of pages", numberOfPages.get(0)));
|
|
||||||
} catch(NumberFormatException ex) {
|
|
||||||
report.addMessage("Failed to parse number of pages");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
final List<String> volume = dataset.getValues().get(RisField.VL);
|
processVolume(dataset, pretend, monograph, report);
|
||||||
if ((volume != null) && !volume.isEmpty()) {
|
|
||||||
try {
|
|
||||||
final int value = Integer.parseInt(volume.get(0));
|
|
||||||
monograph.setVolume(value);
|
|
||||||
report.addField(new FieldImportReport("volume", volume.get(0)));
|
|
||||||
} catch(NumberFormatException ex) {
|
|
||||||
report.addMessage("Failed to parse value of field 'volume'.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
final List<String> series = dataset.getValues().get(RisField.T2);
|
final List<String> series = dataset.getValues().get(RisField.T2);
|
||||||
if ((series != null) && !series.isEmpty()) {
|
if ((series != null) && !series.isEmpty()) {
|
||||||
|
|
@ -137,34 +69,6 @@ public class BookConverter implements RisConverter {
|
||||||
return report;
|
return report;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void processAuthorStr(final String authorStr,
|
|
||||||
final boolean editor,
|
|
||||||
final ImporterUtil importerUtil,
|
|
||||||
final Publication publication,
|
|
||||||
final PublicationImportReport importReport,
|
|
||||||
final boolean pretend) {
|
|
||||||
final AuthorData authorData = new AuthorData();
|
|
||||||
|
|
||||||
final String[] tokens = authorStr.split(",");
|
|
||||||
if (tokens.length == 0) {
|
|
||||||
importReport.addMessage(String.format("Failed to parse author string '%s'.", authorStr));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tokens.length >= 1) {
|
|
||||||
authorData.setSurname(tokens[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tokens.length >= 2) {
|
|
||||||
authorData.setGivenName(tokens[1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
authorData.setEditor(editor);
|
|
||||||
|
|
||||||
final AuthorImportReport authorReport = importerUtil.processAuthor(publication, authorData, pretend);
|
|
||||||
importReport.addAuthor(authorReport);
|
|
||||||
}
|
|
||||||
|
|
||||||
public RisType getRisType() {
|
public RisType getRisType() {
|
||||||
return RisType.BOOK;
|
return RisType.BOOK;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,11 @@
|
||||||
package com.arsdigita.cms.scipublications.importer.ris.converters;
|
package com.arsdigita.cms.scipublications.importer.ris.converters;
|
||||||
|
|
||||||
import com.arsdigita.cms.contenttypes.Monograph;
|
import com.arsdigita.cms.contenttypes.Monograph;
|
||||||
import com.arsdigita.cms.contenttypes.Publication;
|
|
||||||
import com.arsdigita.cms.scipublications.imexporter.ris.RisField;
|
import com.arsdigita.cms.scipublications.imexporter.ris.RisField;
|
||||||
import com.arsdigita.cms.scipublications.imexporter.ris.RisType;
|
import com.arsdigita.cms.scipublications.imexporter.ris.RisType;
|
||||||
import com.arsdigita.cms.scipublications.importer.report.AuthorImportReport;
|
|
||||||
import com.arsdigita.cms.scipublications.importer.report.FieldImportReport;
|
import com.arsdigita.cms.scipublications.importer.report.FieldImportReport;
|
||||||
import com.arsdigita.cms.scipublications.importer.report.PublicationImportReport;
|
import com.arsdigita.cms.scipublications.importer.report.PublicationImportReport;
|
||||||
import com.arsdigita.cms.scipublications.importer.ris.RisConverter;
|
|
||||||
import com.arsdigita.cms.scipublications.importer.ris.RisDataset;
|
import com.arsdigita.cms.scipublications.importer.ris.RisDataset;
|
||||||
import com.arsdigita.cms.scipublications.importer.util.AuthorData;
|
|
||||||
import com.arsdigita.cms.scipublications.importer.util.ImporterUtil;
|
import com.arsdigita.cms.scipublications.importer.util.ImporterUtil;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
@ -19,7 +15,7 @@ import java.util.List;
|
||||||
* @author Jens Pelzetter <jens@jp-digital.de>
|
* @author Jens Pelzetter <jens@jp-digital.de>
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
public class EbookConverter implements RisConverter {
|
public class EbookConverter extends AbstractRisConverter {
|
||||||
|
|
||||||
public PublicationImportReport convert(final RisDataset dataset,
|
public PublicationImportReport convert(final RisDataset dataset,
|
||||||
final ImporterUtil importerUtil,
|
final ImporterUtil importerUtil,
|
||||||
|
|
@ -33,50 +29,13 @@ public class EbookConverter implements RisConverter {
|
||||||
monograph.setTitle(dataset.getValues().get(RisField.TI).get(0));
|
monograph.setTitle(dataset.getValues().get(RisField.TI).get(0));
|
||||||
report.setTitle(dataset.getValues().get(RisField.TI).get(0));
|
report.setTitle(dataset.getValues().get(RisField.TI).get(0));
|
||||||
|
|
||||||
final String yearStr = dataset.getValues().get(RisField.PY).get(0);
|
processYear(dataset, pretend, monograph, report);
|
||||||
try {
|
|
||||||
final int year = Integer.parseInt(yearStr);
|
|
||||||
monograph.setYearOfPublication(year);
|
|
||||||
report.addField(new FieldImportReport("year", yearStr));
|
|
||||||
} catch (NumberFormatException ex) {
|
|
||||||
report.addMessage(String.format("Failed to convert year of publication value '%s' from RIS to"
|
|
||||||
+ "integer value. Setting year of publication to 0"));
|
|
||||||
monograph.setYearOfPublication(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
final List<String> authors = dataset.getValues().get(RisField.AU);
|
processAuthors(dataset, RisField.AU, importerUtil, monograph, report, pretend);
|
||||||
if ((authors != null) && !authors.isEmpty()) {
|
|
||||||
for (String authorStr : authors) {
|
|
||||||
processAuthorStr(authorStr, false, importerUtil, monograph, report, pretend);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
final List<String> editors = dataset.getValues().get(RisField.A3);
|
processEditors(dataset, RisField.A3, importerUtil, monograph, report, pretend);
|
||||||
if ((editors != null) && !editors.isEmpty()) {
|
|
||||||
for (String editorStr : editors) {
|
|
||||||
processAuthorStr(editorStr, true, importerUtil, monograph, report, pretend);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
final List<String> publisherList = dataset.getValues().get(RisField.PB);
|
processPublisher(dataset, pretend, monograph, importerUtil, report);
|
||||||
final List<String> placeList = dataset.getValues().get(RisField.CY);
|
|
||||||
final String publisherName;
|
|
||||||
if ((publisherList == null) || publisherList.isEmpty()) {
|
|
||||||
publisherName = null;
|
|
||||||
} else {
|
|
||||||
publisherName = publisherList.get(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
final String place;
|
|
||||||
if ((placeList == null) || placeList.isEmpty()) {
|
|
||||||
place = null;
|
|
||||||
} else {
|
|
||||||
place = placeList.get(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (publisherName != null) {
|
|
||||||
report.setPublisher(importerUtil.processPublisher(monograph, place, publisherName, pretend));
|
|
||||||
}
|
|
||||||
|
|
||||||
final List<String> abstractList = dataset.getValues().get(RisField.AB);
|
final List<String> abstractList = dataset.getValues().get(RisField.AB);
|
||||||
if ((abstractList != null) && (!abstractList.isEmpty())) {
|
if ((abstractList != null) && (!abstractList.isEmpty())) {
|
||||||
|
|
@ -96,27 +55,9 @@ public class EbookConverter implements RisConverter {
|
||||||
report.addField(new FieldImportReport("isbn", isbn.get(0)));
|
report.addField(new FieldImportReport("isbn", isbn.get(0)));
|
||||||
}
|
}
|
||||||
|
|
||||||
final List<String> numberOfPages = dataset.getValues().get(RisField.SP);
|
processNumberOfPages(dataset, pretend, monograph, report);
|
||||||
if ((numberOfPages != null) && !numberOfPages.isEmpty()) {
|
|
||||||
try {
|
|
||||||
final int value = Integer.parseInt(numberOfPages.get(0));
|
|
||||||
monograph.setNumberOfPages(value);
|
|
||||||
report.addField(new FieldImportReport("number of pages", numberOfPages.get(0)));
|
|
||||||
} catch(NumberFormatException ex) {
|
|
||||||
report.addMessage("Failed to parse number of pages");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
final List<String> volume = dataset.getValues().get(RisField.VL);
|
processVolume(dataset, pretend, monograph, report);
|
||||||
if ((volume != null) && !volume.isEmpty()) {
|
|
||||||
try {
|
|
||||||
final int value = Integer.parseInt(volume.get(0));
|
|
||||||
monograph.setVolume(value);
|
|
||||||
report.addField(new FieldImportReport("volume", volume.get(0)));
|
|
||||||
} catch(NumberFormatException ex) {
|
|
||||||
report.addMessage("Failed to parse value of field 'volume'.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
final List<String> series = dataset.getValues().get(RisField.T2);
|
final List<String> series = dataset.getValues().get(RisField.T2);
|
||||||
if ((series != null) && !series.isEmpty()) {
|
if ((series != null) && !series.isEmpty()) {
|
||||||
|
|
@ -126,34 +67,6 @@ public class EbookConverter implements RisConverter {
|
||||||
return report;
|
return report;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void processAuthorStr(final String authorStr,
|
|
||||||
final boolean editor,
|
|
||||||
final ImporterUtil importerUtil,
|
|
||||||
final Publication publication,
|
|
||||||
final PublicationImportReport importReport,
|
|
||||||
final boolean pretend) {
|
|
||||||
final AuthorData authorData = new AuthorData();
|
|
||||||
|
|
||||||
final String[] tokens = authorStr.split(",");
|
|
||||||
if (tokens.length == 0) {
|
|
||||||
importReport.addMessage(String.format("Failed to parse author string '%s'.", authorStr));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tokens.length >= 1) {
|
|
||||||
authorData.setSurname(tokens[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tokens.length >= 2) {
|
|
||||||
authorData.setGivenName(tokens[1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
authorData.setEditor(editor);
|
|
||||||
|
|
||||||
final AuthorImportReport authorReport = importerUtil.processAuthor(publication, authorData, pretend);
|
|
||||||
importReport.addAuthor(authorReport);
|
|
||||||
}
|
|
||||||
|
|
||||||
public RisType getRisType() {
|
public RisType getRisType() {
|
||||||
return RisType.EBOOK;
|
return RisType.EBOOK;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue