forked from support-project/knowledge
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[wip] Adding draft API(support-project#1115)
- Loading branch information
1 parent
8c222d7
commit b4608be
Showing
3 changed files
with
181 additions
and
0 deletions.
There are no files selected for viewing
55 changes: 55 additions & 0 deletions
55
src/main/java/org/support/project/knowledge/control/api/DraftsControl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package org.support.project.knowledge.control.api; | ||
|
||
import net.arnx.jsonic.JSONException; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import org.support.project.common.log.Log; | ||
import org.support.project.common.log.LogFactory; | ||
import org.support.project.common.util.PropertyUtil; | ||
import org.support.project.di.DI; | ||
import org.support.project.di.Instance; | ||
import org.support.project.knowledge.dao.DraftKnowledgesDao; | ||
import org.support.project.knowledge.entity.DraftKnowledgesEntity; | ||
import org.support.project.knowledge.vo.api.Draft; | ||
import org.support.project.web.bean.ApiParams; | ||
import org.support.project.web.boundary.Boundary; | ||
import org.support.project.web.common.HttpStatus; | ||
import org.support.project.web.control.GetApiControl; | ||
import org.support.project.web.control.service.Delete; | ||
import org.support.project.web.control.service.Get; | ||
import org.support.project.web.control.service.Post; | ||
import org.support.project.web.control.service.Put; | ||
import org.support.project.web.exception.InvalidParamException; | ||
import org.support.project.web.filter.ControlManagerFilter; | ||
|
||
@DI(instance = Instance.Prototype) | ||
public class DraftsControl extends GetApiControl { | ||
private static Log LOG = LogFactory.getLog(ControlManagerFilter.class); | ||
|
||
@Get(path="api/drafts", publishToken="") | ||
public Boundary index() { | ||
return get(); | ||
} | ||
|
||
@Override | ||
public Boundary getList(ApiParams params) { | ||
List<DraftKnowledgesEntity> draftsEntity = DraftKnowledgesDao.get().selectOnUser(super.getLoginUserId()); | ||
List<Draft> results = new ArrayList<>(); | ||
|
||
for (DraftKnowledgesEntity draftEntity : draftsEntity) { | ||
Draft draft = new Draft(); | ||
PropertyUtil.copyPropertyValue(draftEntity, draft); | ||
results.add(draft); | ||
} | ||
|
||
return send(HttpStatus.SC_200_OK, results); | ||
} | ||
|
||
@Override | ||
public Boundary getSingle(String id) { | ||
// TODO Auto-generated method stub | ||
return null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
120 changes: 120 additions & 0 deletions
120
src/main/java/org/support/project/knowledge/vo/api/Draft.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
package org.support.project.knowledge.vo.api; | ||
|
||
import java.sql.Timestamp; | ||
|
||
public class Draft { | ||
/** 下書きID */ | ||
private Long draftId; | ||
/** ナレッジID */ | ||
private Long knowledgeId; | ||
/** タイトル */ | ||
private String title; | ||
/** 内容 */ | ||
private String content; | ||
/** 公開区分 */ | ||
private Integer publicFlag; | ||
/** 公開対象 */ | ||
private String accesses; | ||
/** 共同編集対象 */ | ||
private String editors; | ||
/** タグ名称一覧 */ | ||
private String tagNames; | ||
/** テンプレートの種類ID */ | ||
private Integer typeId; | ||
/** 登録ユーザ */ | ||
private Integer insertUser; | ||
/** 登録日時 */ | ||
private Timestamp insertDatetime; | ||
/** 更新ユーザ */ | ||
private Integer updateUser; | ||
/** 更新日時 */ | ||
private Timestamp updateDatetime; | ||
/** 削除フラグ */ | ||
private Integer deleteFlag; | ||
|
||
public Long getDraftId() { | ||
return draftId; | ||
} | ||
public void setDraftId(Long draftId) { | ||
this.draftId = draftId; | ||
} | ||
public Long getKnowledgeId() { | ||
return knowledgeId; | ||
} | ||
public void setKnowledgeId(Long knowledgeId) { | ||
this.knowledgeId = knowledgeId; | ||
} | ||
public String getTitle() { | ||
return title; | ||
} | ||
public void setTitle(String title) { | ||
this.title = title; | ||
} | ||
public String getContent() { | ||
return content; | ||
} | ||
public void setContent(String content) { | ||
this.content = content; | ||
} | ||
public Integer getPublicFlag() { | ||
return publicFlag; | ||
} | ||
public void setPublicFlag(Integer publicFlag) { | ||
this.publicFlag = publicFlag; | ||
} | ||
public String getAccesses() { | ||
return accesses; | ||
} | ||
public void setAccesses(String accesses) { | ||
this.accesses = accesses; | ||
} | ||
public String getEditors() { | ||
return editors; | ||
} | ||
public void setEditors(String editors) { | ||
this.editors = editors; | ||
} | ||
public String getTagNames() { | ||
return tagNames; | ||
} | ||
public void setTagNames(String tagNames) { | ||
this.tagNames = tagNames; | ||
} | ||
public Integer getTypeId() { | ||
return typeId; | ||
} | ||
public void setTypeId(Integer typeId) { | ||
this.typeId = typeId; | ||
} | ||
public Integer getInsertUser() { | ||
return insertUser; | ||
} | ||
public void setInsertUser(Integer insertUser) { | ||
this.insertUser = insertUser; | ||
} | ||
public Timestamp getInsertDatetime() { | ||
return insertDatetime; | ||
} | ||
public void setInsertDatetime(Timestamp insertDatetime) { | ||
this.insertDatetime = insertDatetime; | ||
} | ||
public Integer getUpdateUser() { | ||
return updateUser; | ||
} | ||
public void setUpdateUser(Integer updateUser) { | ||
this.updateUser = updateUser; | ||
} | ||
public Timestamp getUpdateDatetime() { | ||
return updateDatetime; | ||
} | ||
public void setUpdateDatetime(Timestamp updateDatetime) { | ||
this.updateDatetime = updateDatetime; | ||
} | ||
public Integer getDeleteFlag() { | ||
return deleteFlag; | ||
} | ||
public void setDeleteFlag(Integer deleteFlag) { | ||
this.deleteFlag = deleteFlag; | ||
} | ||
} | ||
|