这是我的MongoDb结构,
db.user.find();
Run Code Online (Sandbox Code Playgroud)
用户:
{
"name" : "KSK",
"claim" : [objectId("52ffc4a5d85242602e000000"),objectId("52ffc4a5d85242602e000001")]
}
Run Code Online (Sandbox Code Playgroud)
要求:
[
{
"_id" : "52ffc4a5d85242602e000001",
"claimName" :"XXXX"
},
{
"_id" : "52ffc4a5d85242602e000000",
"claimName" :"YYY"
}
]
Run Code Online (Sandbox Code Playgroud)
我的实体类是:
@Document(collection="user")
public class User{
@Id
private String id;
private String name;
@DBRef
private List<Claim> claim;
// setter and getter
}
Run Code Online (Sandbox Code Playgroud)
索赔等级:
@Document(collection="Claim")
public class Claim{
@Id
private String id;
private String claimName;
}
Run Code Online (Sandbox Code Playgroud)
我有一个方法来获取用户名,如下所示,
public User findByName(String name);
Run Code Online (Sandbox Code Playgroud)
如果我试图点击这个方法我得到一个错误,
没有找到能够从类型org.bson.types.ObjectId转换为类型java.lang.String的转换器
所以我改变了我的User实体类,如下所示,
而不是 private List<Claim> claim;
改为Private List<ObjectId> claim; …
我dojo.gridx用来显示我的价值观.有时用户可以创建新行.这样我在单击newRow按钮时添加了一个新按钮,将调用onclick方法.
在该方法中创建了新的行代码.我的代码如下.
addRow:
function() {
var that = this;
var gridIdLocal = dijit.byId('GridId');
that.lastIndex+=1; ( last index count I get externally)
var newRow = {
Id : '',
ClassDES:'',
createdDate: that.getTodayDate(),
activatedDate:that.getTodayDate(),
deactivedDate:'',
activeStatus:'Y',
id : lastIndex
};
gridIdLocal.store.newItem(newRow);
gridIdLocal.store.save();
},
Run Code Online (Sandbox Code Playgroud)
通过这段代码,我可以创建一个新行,但我想将鼠标光标指向新添加的行的第二列(ClassDES).
我该如何实现此功能dojo.gridx?
我想通过按钮ID删除CSS.我尝试了这段代码,但它没有用.有人可以帮我怎么做吗?
<button id="QF_1_Y" class="Class1" value="Y" style="display: inline-block;">YES</button>
<button id="QF_1_N" class="Class2" value="N" style="display: inline-block;">NO</button>
<button id="QF_1_NA" class="Class1 Class3 " value="NA" style="display: inline-block;">NA</button>
Run Code Online (Sandbox Code Playgroud)
代码:
var id1="#QF"+1+"Y";
var id2="#QF"+1+"N";
var id3="#QF"+1+"NA";
$(id1).removeClass('Class1');
$(id2).removeClass('Class2');
$(id3).removeClass('Class1 Class3');
Run Code Online (Sandbox Code Playgroud)
提前致谢,
这是我的方法,当我尝试通过sonarQube分析我的代码时出现此错误:
异常处理程序应保留原始异常:记录或重新抛出此异常.
如果我没有像我的方法那样捕获异常,为什么会出现此错误?
我的方法:
for (String QT : Q_T) {
try {
// some logic
}
} catch (JsonParseException e) {
LOG.log(Level.SEVERE, e.toString());
} catch (JsonMappingException e) {
LOG.log(Level.SEVERE, e.toString());
} catch (IOException e) {
LOG.log(Level.SEVERE, e.toString());
}
catch (Exception e) {
LOG.log(Level.SEVERE, e.toString());
}
}
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用Spring Boot实现AOP概念.但是在注释不起作用之前.这是我的代码,
的pom.xml
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.3.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
Run Code Online (Sandbox Code Playgroud)
Application.properties
server.port=6500
spring.aop.proxy-target-class=true
Run Code Online (Sandbox Code Playgroud)
主要:
包com.techno.theater;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import com.techno.theater.services.SampleService;
@SpringBootApplication
public class DigitalTheaterApplication {
private static Logger logger=LoggerFactory.getLogger(DigitalTheaterApplication.class);
public static void main(String[] args) {
SpringApplication.run(DigitalTheaterApplication.class, args);
new SampleService().sample();
}
}
Run Code Online (Sandbox Code Playgroud)
样品服务:
package com.techno.theater.services;
import org.springframework.stereotype.Service;
@Service
public class SampleService …Run Code Online (Sandbox Code Playgroud) 当鼠标悬停在角度时,我想在我的网址上添加一个锚符号.这是我的代码,
<a ng-click="download(File)"><img src="images/filePic.png"/>{{filename}}</a>
Run Code Online (Sandbox Code Playgroud)
java ×3
css ×2
anchor ×1
angularjs ×1
css3 ×1
dojo ×1
dojo.gridx ×1
dojox.grid ×1
gridx ×1
javascript ×1
jquery ×1
jquery-ui ×1
mongodb ×1
sonar-runner ×1
sonarqube ×1
sonarqube5.1 ×1
spring ×1
spring-aop ×1
spring-boot ×1
spring-mongo ×1