Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fix file mapping subparameters parsin
  • Loading branch information
viniciusam committed Aug 7, 2017
commit 5e3487bb5354a94a734b97f04a1a422626af38c6
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<dependency>
<groupId>org.utplsql</groupId>
<artifactId>java-api</artifactId>
<version>1.0-Alpha1</version>
<version>1.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
Expand Down
34 changes: 19 additions & 15 deletions src/main/java/org/utplsql/cli/RunCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -202,17 +202,24 @@ public List<ReporterOptions> getReporterOptionsList() {
public FileMapperOptions getMapperOptions(List<String> mappingParams, List<String> filePaths) {
FileMapperOptions mapperOptions = new FileMapperOptions(filePaths);

final String OPT_OWNER="-owner=";
final String OPT_REGEX="-regex_expression=";
final String OPT_TYPE_MAPPING="-type_mapping=";
final String OPT_OWNER_SUBEX="-owner_subexpression=";
final String OPT_NAME_SUBEX="-name_subexpression=";
final String OPT_TYPE_SUBEX="-type_subexpression=";

for (String p : mappingParams) {
if (p.startsWith("-object_owner=")) {
mapperOptions.setObjectOwner(p.substring("-object_owner=".length()));
if (p.startsWith(OPT_OWNER)) {
mapperOptions.setObjectOwner(p.substring(OPT_OWNER.length()));
}
else
if (p.startsWith("-regex_pattern=")) {
mapperOptions.setRegexPattern(p.substring("-regex_pattern=".length()));
if (p.startsWith(OPT_REGEX)) {
mapperOptions.setRegexPattern(p.substring(OPT_REGEX.length()));
}
else
if (p.startsWith("-type_mapping=")) {
String typeMappingsParam = p.substring("-type_mapping=".length());
if (p.startsWith(OPT_TYPE_MAPPING)) {
String typeMappingsParam = p.substring(OPT_TYPE_MAPPING.length());

List<KeyValuePair> typeMappings = new ArrayList<>();
for (String mapping : typeMappingsParam.split("/")) {
Expand All @@ -223,23 +230,20 @@ public FileMapperOptions getMapperOptions(List<String> mappingParams, List<Strin
mapperOptions.setTypeMappings(typeMappings);
}
else
if (p.startsWith("-owner_subexpression=")) {
mapperOptions.setOwnerSubExpression(Integer.parseInt(p.substring("-owner_subexpression=".length())));
if (p.startsWith(OPT_OWNER_SUBEX)) {
mapperOptions.setOwnerSubExpression(Integer.parseInt(p.substring(OPT_OWNER_SUBEX.length())));
}
else
if (p.startsWith("-name_subexpression=")) {
mapperOptions.setNameSubExpression(Integer.parseInt(p.substring("-name_subexpression=".length())));
if (p.startsWith(OPT_NAME_SUBEX)) {
mapperOptions.setNameSubExpression(Integer.parseInt(p.substring(OPT_NAME_SUBEX.length())));
}
else
if (p.startsWith("-type_subexpression=")) {
if (p.startsWith(OPT_TYPE_SUBEX)) {
mapperOptions.setTypeSubExpression(Integer.parseInt(p.substring("-type_subexpression=".length())));
}
}

if (mapperOptions.getRegexPattern() == null || mapperOptions.getRegexPattern().isEmpty())
return null;
else
return mapperOptions;
return mapperOptions;
}

}