Skip to content

Commit 73ed775

Browse files
author
mgeipel
committed
Merge branch 'master' of ssh://[email protected]/culturegraph/metafacture-core.git
2 parents 9d4ac07 + c2f5b2e commit 73ed775

File tree

11 files changed

+397
-213
lines changed

11 files changed

+397
-213
lines changed

.travis.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,4 @@ env:
1010

1111

1212
after_success:
13-
- python travis-ci/configure-mvn.py
14-
- mvn clean deploy --settings ~/.m2/mySettings.xml -Dgpg.skip=true -Psonatype-oss-release
13+
- "[[ $TRAVIS_BRANCH == \"master\" ]] && { python travis-ci/configure-mvn.py ; mvn clean deploy --settings ~/.m2/mySettings.xml -Dgpg.skip=true -Psonatype-oss-release ; }"

src/main/java/org/culturegraph/mf/framework/StreamReceiver.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
* ENTITY_OR_LITERAL = ENTITY | literal
2626
* ENTITY = startEntity, ENTITY_OR_LITERAL*, endEntity)
2727
*
28-
* The {@link WellFormednessChecker} can be used to check if a stream conforms
28+
* The {@link WellformednessChecker} can be used to check if a stream conforms
2929
* to these rules.
3030
*
3131
* @see DefaultStreamReceiver

src/main/java/org/culturegraph/mf/stream/converter/MapToStream.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,32 +24,32 @@
2424

2525
/**
2626
* Creates a literal for each entry in a map.
27-
*
27+
*
2828
* @author Christoph Böhme
2929
*/
3030
public final class MapToStream extends
3131
DefaultObjectPipe<Map<?, ?>, StreamReceiver> {
3232

33-
33+
3434
private Object idKey = StreamConstants.ID;
35-
35+
3636
public Object getIdKey() {
3737
return idKey;
3838
}
39-
39+
4040
public void setIdKey(final Object idKey) {
4141
this.idKey = idKey;
4242
}
43-
43+
4444
@Override
4545
public void process(final Map<?, ?> map) {
4646
final Object id = map.get(idKey);
4747
if (id == null) {
48-
getReceiver().startRecord(null);
48+
getReceiver().startRecord("");
4949
} else {
5050
getReceiver().startRecord(id.toString());
5151
}
52-
for (Map.Entry<?, ?> entry: map.entrySet()) {
52+
for (final Map.Entry<?, ?> entry: map.entrySet()) {
5353
getReceiver().literal(entry.getKey().toString(), entry.getValue().toString());
5454
}
5555
getReceiver().endRecord();

src/main/java/org/culturegraph/mf/stream/converter/xml/CGXmlHandler.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@
2626

2727
/**
2828
* Reads CG-XML files.
29-
*
29+
*
3030
* @author Christoph Böhme
31-
*
31+
*
3232
*/
3333
@Description("Reads CG-XML files")
3434
@In(XmlReceiver.class)
@@ -46,7 +46,12 @@ public final class CGXmlHandler extends DefaultXmlPipe<StreamReceiver> {
4646
public void startElement(final String uri, final String localName,
4747
final String qName, final Attributes attributes) {
4848
if (RECORD_TAG.equals(localName)) {
49-
getReceiver().startRecord(attributes.getValue("", ID_ATTR));
49+
final String recordId = attributes.getValue("", ID_ATTR);
50+
if (recordId == null) {
51+
getReceiver().startRecord("");
52+
} else {
53+
getReceiver().startRecord(recordId);
54+
}
5055
} else if (ENTITY_TAG.equals(localName)) {
5156
getReceiver().startEntity(attributes.getValue("", NAME_ATTR));
5257
} else if (LITERAL_TAG.equals(localName)) {

0 commit comments

Comments
 (0)