Skip to content

Commit 71b3172

Browse files
author
Mark Robinson
committed
Allow the use of the dot character in workflow IDs
Closes #90
1 parent 5049b14 commit 71b3172

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
package org.commonwl.viewer;
21+
22+
import org.springframework.beans.factory.annotation.Autowired;
23+
import org.springframework.context.annotation.Bean;
24+
import org.springframework.context.annotation.Configuration;
25+
import org.springframework.data.mongodb.MongoDbFactory;
26+
import org.springframework.data.mongodb.core.convert.DbRefResolver;
27+
import org.springframework.data.mongodb.core.convert.DefaultDbRefResolver;
28+
import org.springframework.data.mongodb.core.convert.MappingMongoConverter;
29+
import org.springframework.data.mongodb.core.mapping.MongoMappingContext;
30+
31+
@Configuration
32+
public class MongoConfig {
33+
34+
@Autowired
35+
private MongoDbFactory mongoFactory;
36+
37+
@Autowired
38+
private MongoMappingContext mongoMappingContext;
39+
40+
/**
41+
* Override the default converter which just throws an error with special chars
42+
*/
43+
@Bean
44+
public MappingMongoConverter mongoConverter() throws Exception {
45+
DbRefResolver dbRefResolver = new DefaultDbRefResolver(mongoFactory);
46+
MappingMongoConverter mongoConverter = new MappingMongoConverter(dbRefResolver, mongoMappingContext);
47+
48+
// Replace dot with the unicode replacement character
49+
mongoConverter.setMapKeyDotReplacement("\uFFFD");
50+
51+
return mongoConverter;
52+
}
53+
}

0 commit comments

Comments
 (0)