|
|
@@ -11,6 +11,7 @@ import java.util.Set;
|
|
|
import javax.xml.transform.TransformerException;
|
|
|
|
|
|
import org.dom4j.DocumentException;
|
|
|
+import org.mongodb.morphia.query.Query;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
@@ -58,6 +59,7 @@ public class KanbanInstanceServiceImpl extends BaseService<KanbanInstance> imple
|
|
|
|
|
|
@Override
|
|
|
public KanbanInstance save(@NotEmpty("json") String json) {
|
|
|
+ // TODO 一个资源点只能为某个看板维护一个看板实例
|
|
|
KanbanInstance kanbanInstance = kanbanInstanceDao.parse(json);
|
|
|
checkParameters(kanbanInstance.getParameters());
|
|
|
Kanban kanban = checkKanban(kanbanInstance.getKanbanCode());
|
|
|
@@ -69,6 +71,7 @@ public class KanbanInstanceServiceImpl extends BaseService<KanbanInstance> imple
|
|
|
|
|
|
@Override
|
|
|
public int update(@NotEmpty("json") String json) throws IllegalArgumentException, OperationException {
|
|
|
+ // TODO 一个资源点只能为某个看板维护一个看板实例
|
|
|
KanbanInstance kanbanInstance = kanbanInstanceDao.parse(json);
|
|
|
checkParameters(kanbanInstance.getParameters());
|
|
|
checkKanban(kanbanInstance.getKanbanCode());
|
|
|
@@ -227,4 +230,13 @@ public class KanbanInstanceServiceImpl extends BaseService<KanbanInstance> imple
|
|
|
return content;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public KanbanInstance getByKanbanCode(@NotEmpty("kanbanCode") String kanbanCode) throws IllegalStateException {
|
|
|
+ Query<KanbanInstance> query = kanbanInstanceDao.createQuery().field("kanbanCode").equal(kanbanCode);
|
|
|
+ if (query.count() > 1) {
|
|
|
+ throw new IllegalStateException("找到多个看板实例");
|
|
|
+ }
|
|
|
+ return query.get();
|
|
|
+ }
|
|
|
+
|
|
|
}
|