mirror of
https://github.com/sismics/docs.git
synced 2025-12-13 09:46:17 +00:00
#65: Add subject and identifier metadata
This commit is contained in:
@@ -89,7 +89,7 @@ public class DocumentDao {
|
||||
*/
|
||||
public DocumentDto getDocument(String id) {
|
||||
EntityManager em = ThreadLocalContext.get().getEntityManager();
|
||||
StringBuilder sb = new StringBuilder("select d.DOC_ID_C, d.DOC_TITLE_C, d.DOC_DESCRIPTION_C, d.DOC_CREATEDATE_D, d.DOC_LANGUAGE_C, ");
|
||||
StringBuilder sb = new StringBuilder("select d.DOC_ID_C, d.DOC_TITLE_C, d.DOC_DESCRIPTION_C, d.DOC_SUBJECT_C, d.DOC_IDENTIFIER_C, d.DOC_CREATEDATE_D, d.DOC_LANGUAGE_C, ");
|
||||
sb.append(" (select count(s.SHA_ID_C) from T_SHARE s, T_ACL ac where ac.ACL_SOURCEID_C = d.DOC_ID_C and ac.ACL_TARGETID_C = s.SHA_ID_C and ac.ACL_DELETEDATE_D is null and s.SHA_DELETEDATE_D is null), ");
|
||||
sb.append(" (select count(f.FIL_ID_C) from T_FILE f where f.FIL_DELETEDATE_D is null and f.FIL_IDDOC_C = d.DOC_ID_C), ");
|
||||
sb.append(" u.USE_USERNAME_C ");
|
||||
@@ -109,6 +109,8 @@ public class DocumentDao {
|
||||
documentDto.setId((String) o[i++]);
|
||||
documentDto.setTitle((String) o[i++]);
|
||||
documentDto.setDescription((String) o[i++]);
|
||||
documentDto.setSubject((String) o[i++]);
|
||||
documentDto.setIdentifier((String) o[i++]);
|
||||
documentDto.setCreateTimestamp(((Timestamp) o[i++]).getTime());
|
||||
documentDto.setLanguage((String) o[i++]);
|
||||
documentDto.setShared(((Number) o[i++]).intValue() > 0);
|
||||
@@ -296,6 +298,8 @@ public class DocumentDao {
|
||||
// Update the document
|
||||
documentFromDb.setTitle(document.getTitle());
|
||||
documentFromDb.setDescription(document.getDescription());
|
||||
documentFromDb.setSubject(document.getSubject());
|
||||
documentFromDb.setIdentifier(document.getIdentifier());
|
||||
documentFromDb.setCreateDate(document.getCreateDate());
|
||||
documentFromDb.setLanguage(document.getLanguage());
|
||||
|
||||
|
||||
@@ -24,6 +24,16 @@ public class DocumentDto {
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* Subject.
|
||||
*/
|
||||
private String subject;
|
||||
|
||||
/**
|
||||
* Identifier.
|
||||
*/
|
||||
private String identifier;
|
||||
|
||||
/**
|
||||
* Language.
|
||||
*/
|
||||
@@ -49,142 +59,82 @@ public class DocumentDto {
|
||||
*/
|
||||
private String creator;
|
||||
|
||||
/**
|
||||
* Getter de id.
|
||||
*
|
||||
* @return the id
|
||||
*/
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter de id.
|
||||
*
|
||||
* @param id id
|
||||
*/
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter de title.
|
||||
*
|
||||
* @return the title
|
||||
*/
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter de title.
|
||||
*
|
||||
* @param title title
|
||||
*/
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter de description.
|
||||
*
|
||||
* @return the description
|
||||
*/
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter de description.
|
||||
*
|
||||
* @param description description
|
||||
*/
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter de createTimestamp.
|
||||
*
|
||||
* @return the createTimestamp
|
||||
*/
|
||||
public String getSubject() {
|
||||
return subject;
|
||||
}
|
||||
|
||||
public void setSubject(String subject) {
|
||||
this.subject = subject;
|
||||
}
|
||||
|
||||
public String getIdentifier() {
|
||||
return identifier;
|
||||
}
|
||||
|
||||
public void setIdentifier(String identifier) {
|
||||
this.identifier = identifier;
|
||||
}
|
||||
|
||||
public Long getCreateTimestamp() {
|
||||
return createTimestamp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter of createTimestamp.
|
||||
*
|
||||
* @param createTimestamp createTimestamp
|
||||
*/
|
||||
public void setCreateTimestamp(Long createTimestamp) {
|
||||
this.createTimestamp = createTimestamp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter of shared.
|
||||
*
|
||||
* @return the shared
|
||||
*/
|
||||
public Boolean getShared() {
|
||||
return shared;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter of shared.
|
||||
*
|
||||
* @param shared shared
|
||||
*/
|
||||
public void setShared(Boolean shared) {
|
||||
this.shared = shared;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter of language.
|
||||
*
|
||||
* @return the language
|
||||
*/
|
||||
public String getLanguage() {
|
||||
return language;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter of language.
|
||||
*
|
||||
* @param language language
|
||||
*/
|
||||
public void setLanguage(String language) {
|
||||
this.language = language;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter of fileCount.
|
||||
* @return fileCount
|
||||
*/
|
||||
public Integer getFileCount() {
|
||||
return fileCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter of fileCount.
|
||||
* @param fileCount fileCount
|
||||
*/
|
||||
public void setFileCount(Integer fileCount) {
|
||||
this.fileCount = fileCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter of creator.
|
||||
* @return creator
|
||||
*/
|
||||
public String getCreator() {
|
||||
return creator;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter of creator.
|
||||
* @param creator creator
|
||||
*/
|
||||
public void setCreator(String creator) {
|
||||
this.creator = creator;
|
||||
}
|
||||
|
||||
@@ -159,6 +159,8 @@ public class LuceneDao {
|
||||
BooleanQuery query = new BooleanQuery();
|
||||
query.add(qpHelper.parse(searchQuery, "title"), Occur.SHOULD);
|
||||
query.add(qpHelper.parse(searchQuery, "description"), Occur.SHOULD);
|
||||
query.add(qpHelper.parse(searchQuery, "subject"), Occur.SHOULD);
|
||||
query.add(qpHelper.parse(searchQuery, "identifier"), Occur.SHOULD);
|
||||
query.add(qpHelper.parse(fullSearchQuery, "content"), Occur.SHOULD);
|
||||
|
||||
// Search
|
||||
@@ -198,12 +200,16 @@ public class LuceneDao {
|
||||
org.apache.lucene.document.Document luceneDocument = new org.apache.lucene.document.Document();
|
||||
luceneDocument.add(new StringField("id", document.getId(), Field.Store.YES));
|
||||
luceneDocument.add(new StringField("type", "document", Field.Store.YES));
|
||||
if (document.getTitle() != null) {
|
||||
luceneDocument.add(new TextField("title", document.getTitle(), Field.Store.NO));
|
||||
}
|
||||
luceneDocument.add(new TextField("title", document.getTitle(), Field.Store.NO));
|
||||
if (document.getDescription() != null) {
|
||||
luceneDocument.add(new TextField("description", document.getDescription(), Field.Store.NO));
|
||||
}
|
||||
if (document.getSubject() != null) {
|
||||
luceneDocument.add(new TextField("subject", document.getSubject(), Field.Store.NO));
|
||||
}
|
||||
if (document.getIdentifier() != null) {
|
||||
luceneDocument.add(new TextField("identifier", document.getIdentifier(), Field.Store.NO));
|
||||
}
|
||||
|
||||
return luceneDocument;
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ public class Document implements Loggable {
|
||||
/**
|
||||
* Title.
|
||||
*/
|
||||
@Column(name = "DOC_TITLE_C", length = 100)
|
||||
@Column(name = "DOC_TITLE_C", nullable = false, length = 100)
|
||||
private String title;
|
||||
|
||||
/**
|
||||
@@ -48,6 +48,18 @@ public class Document implements Loggable {
|
||||
@Column(name = "DOC_DESCRIPTION_C", length = 4000)
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* Subject.
|
||||
*/
|
||||
@Column(name = "DOC_SUBJECT_C", length = 500)
|
||||
private String subject;
|
||||
|
||||
/**
|
||||
* Identifer.
|
||||
*/
|
||||
@Column(name = "DOC_IDENTIFIER_C", length = 500)
|
||||
private String identifier;
|
||||
|
||||
/**
|
||||
* Creation date.
|
||||
*/
|
||||
@@ -60,129 +72,75 @@ public class Document implements Loggable {
|
||||
@Column(name = "DOC_DELETEDATE_D")
|
||||
private Date deleteDate;
|
||||
|
||||
/**
|
||||
* Getter of id.
|
||||
*
|
||||
* @return the id
|
||||
*/
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter of id.
|
||||
*
|
||||
* @param id id
|
||||
*/
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter of language.
|
||||
*
|
||||
* @return the language
|
||||
*/
|
||||
public String getLanguage() {
|
||||
return language;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter of language.
|
||||
*
|
||||
* @param language language
|
||||
*/
|
||||
public void setLanguage(String language) {
|
||||
this.language = language;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter of userId.
|
||||
*
|
||||
* @return the userId
|
||||
*/
|
||||
public String getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter of userId.
|
||||
*
|
||||
* @param userId userId
|
||||
*/
|
||||
public void setUserId(String userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter of title.
|
||||
*
|
||||
* @return the title
|
||||
*/
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter of title.
|
||||
*
|
||||
* @param title title
|
||||
*/
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter of description.
|
||||
*
|
||||
* @return the description
|
||||
*/
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter of description.
|
||||
*
|
||||
* @param description description
|
||||
*/
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getSubject() {
|
||||
return subject;
|
||||
}
|
||||
|
||||
public void setSubject(String subject) {
|
||||
this.subject = subject;
|
||||
}
|
||||
|
||||
public String getIdentifier() {
|
||||
return identifier;
|
||||
}
|
||||
|
||||
public void setIdentifier(String identifier) {
|
||||
this.identifier = identifier;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter of createDate.
|
||||
*
|
||||
* @return the createDate
|
||||
*/
|
||||
public Date getCreateDate() {
|
||||
return createDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter of createDate.
|
||||
*
|
||||
* @param createDate createDate
|
||||
*/
|
||||
public void setCreateDate(Date createDate) {
|
||||
this.createDate = createDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter of deleteDate.
|
||||
*
|
||||
* @return the deleteDate
|
||||
*/
|
||||
@Override
|
||||
public Date getDeleteDate() {
|
||||
return deleteDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter of deleteDate.
|
||||
*
|
||||
* @param deleteDate deleteDate
|
||||
*/
|
||||
public void setDeleteDate(Date deleteDate) {
|
||||
this.deleteDate = deleteDate;
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
db.version=5
|
||||
db.version=6
|
||||
@@ -0,0 +1,3 @@
|
||||
alter table T_DOCUMENT add column DOC_SUBJECT_C varchar(500);
|
||||
alter table T_DOCUMENT add column DOC_IDENTIFIER_C varchar(500);
|
||||
update T_CONFIG set CFG_VALUE_C = '6' where CFG_ID_C = 'DB_VERSION';
|
||||
Reference in New Issue
Block a user