31 lines
1.0 KiB
Java
31 lines
1.0 KiB
Java
package io.dataease.dto.datasource;
|
|
|
|
import lombok.Getter;
|
|
import lombok.Setter;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
@Getter
|
|
@Setter
|
|
public class MongodbConfiguration extends JdbcConfiguration {
|
|
|
|
private String driver = "mongodb.jdbc.MongoDriver";
|
|
private String connectionType;
|
|
private String extraParams = "rebuildschema=true";
|
|
|
|
public String getJdbc() {
|
|
if(StringUtils.isEmpty(extraParams.trim())){
|
|
return "jdbc:mongodb://HOSTNAME:PORT/DATABASE"
|
|
.replace("HOSTNAME", getHost().trim())
|
|
.replace("PORT", getPort().toString().trim())
|
|
.replace("DATABASE", getDataBase().trim());
|
|
}else {
|
|
return "jdbc:mongodb://HOSTNAME:PORT/DATABASE?EXTRA_PARAMS"
|
|
.replace("HOSTNAME", getHost().trim())
|
|
.replace("PORT", getPort().toString().trim())
|
|
.replace("DATABASE", getDataBase().trim())
|
|
.replace("EXTRA_PARAMS", getExtraParams().trim());
|
|
}
|
|
|
|
}
|
|
}
|