minor fixes

This commit is contained in:
kstamatis
2013-10-17 23:35:51 +03:00
parent 1d5fa8c9ce
commit ff1c20c8b2
5 changed files with 20 additions and 47 deletions

View File

@@ -133,22 +133,22 @@ public class DSpaceWorkspaceItemOutputGenerator implements OutputGenerator {
|| addedMetadata.contains(metadata)) {
addedMetadata.add(metadata);
String[] md = splitMetadata(metadata);
if (isValidMetadata(formName, md)) {
if (isRepeatableMetadata(formName, md)) {
for (Value value : itemLookup.getValues(field)) {
String[] splitValue = splitValue(value.getAsString());
if (splitValue[3] != null) {
item.addMetadata(md[0], md[1], md[2], md[3],
splitValue[0], splitValue[1],
Integer.parseInt(splitValue[2]));
} else {
item.addMetadata(md[0], md[1], md[2], md[3],
value.getAsString());
if (isValidMetadata(formName, md)) { //if in extra metadata or in the spefific form
List<Value> values = itemLookup.getValues(field);
if (values != null && values.size()>0){
if (isRepeatableMetadata(formName, md)) { //if metadata is repeatable in form
for (Value value : values) {
String[] splitValue = splitValue(value.getAsString());
if (splitValue[3] != null) {
item.addMetadata(md[0], md[1], md[2], md[3],
splitValue[0], splitValue[1],
Integer.parseInt(splitValue[2]));
} else {
item.addMetadata(md[0], md[1], md[2], md[3],
value.getAsString());
}
}
}
} else {
List<Value> values = itemLookup.getValues(field);
if (values != null && values.size()>0){
} else {
String value = values.iterator().next().getAsString();
String[] splitValue = splitValue(value);
if (splitValue[3] != null) {
@@ -220,6 +220,7 @@ public class DSpaceWorkspaceItemOutputGenerator implements OutputGenerator {
}
}
//KSTA:ToDo: Make this a modifier
if (md != null && md.contains("|")) {
String[] cond = md.trim().split("\\|");
for (int idx = 1; idx < cond.length; idx++) {

View File

@@ -1,19 +0,0 @@
/**
* The contents of this file are subject to the license and copyright
* detailed in the LICENSE and NOTICE files at the root of the source
* tree and available online at
*
* http://www.dspace.org/license/
*/
package org.dspace.submit.lookup;
import java.util.List;
import org.dspace.submit.util.SubmissionLookupPublication;
public interface EnhancerSubmissionLookup {
List<String> getValues(
SubmissionLookupPublication publication);
}

View File

@@ -68,7 +68,7 @@ public class MultipleSubmissionLookupDataLoader implements DataLoader {
List<String> foundDOIs = new ArrayList<String>();
for (Record publication : recordSet.getRecords()) {
String providerName = publication.getValues(SubmissionLookupService.PROVIDER_NAME_FIELD).get(0).getAsString();
String providerName = SubmissionLookupService.getFirstValue(publication, SubmissionLookupService.PROVIDER_NAME_FIELD);
String doi = null;

View File

@@ -38,8 +38,6 @@ public class SubmissionLookupService {
public static final String SEPARATOR_VALUE_REGEX = SEPARATOR_VALUE;
private Map<String, EnhancerSubmissionLookup> enhancedMetadata;
private List<SubmissionLookupProvider> providers;
private Map<String, List<SubmissionLookupProvider>> idents2provs;
@@ -48,15 +46,7 @@ public class SubmissionLookupService {
private TransformationEngine phase1TransformationEngine;
private TransformationEngine phase2TransformationEngine;
public void setEnhancedMetadata(
Map<String, EnhancerSubmissionLookup> enhancedMetadata) {
this.enhancedMetadata = enhancedMetadata;
}
public Map<String, EnhancerSubmissionLookup> getEnhancedMetadata() {
return enhancedMetadata;
}
public void setPhase2TransformationEngine(TransformationEngine phase2TransformationEngine) {
this.phase2TransformationEngine = phase2TransformationEngine;

View File

@@ -7,6 +7,7 @@
*/
package org.dspace.submit.util;
import gr.ekt.bte.core.MutableRecord;
import gr.ekt.bte.core.Record;
import gr.ekt.bte.core.Value;
@@ -62,7 +63,7 @@ public class ItemSubmissionLookupDTO implements Serializable {
}
else
{
SubmissionLookupPublication pub = new SubmissionLookupPublication(MERGED_PUBLICATION_PROVIDER);
MutableRecord pub = new SubmissionLookupPublication(MERGED_PUBLICATION_PROVIDER);
for (SubmissionLookupProvider prov : providers)
{
for (Record p : publications)
@@ -80,7 +81,7 @@ public class ItemSubmissionLookupDTO implements Serializable {
{
for (Value v : values)
{
pub.add(field, v.getAsString());
pub.addValue(field, v);
}
}
}