ListからArrayListに変更, スタブを追加

This commit is contained in:
ろむねこ 2023-12-11 13:48:21 +09:00
parent 7d460a6069
commit 7d158bf3e2
No known key found for this signature in database
GPG Key ID: FA1F39A1BA37D168
3 changed files with 66 additions and 1 deletions

View File

@ -1,4 +1,20 @@
package one.nem.lacerta.data.impl;
public class DocumentsImpl {
import java.util.ArrayList;
import java.util.List;
import javax.inject.Inject;
import one.nem.lacerta.data.model.documents.DocumentMeta;
import one.nem.lacerta.data.repository.Documents;
public class DocumentsImpl implements Documents {
@Inject
public DocumentsImpl() {
}
public ArrayList<DocumentMeta> getRecentDocuments(int limit) {
return null; // TODO-rca:
}
}

View File

@ -0,0 +1,40 @@
package one.nem.lacerta.data.impl.stub;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import java.util.UUID;
import java.util.Date;
import javax.inject.Inject;
import one.nem.lacerta.data.model.documents.DocumentMeta;
import one.nem.lacerta.data.model.documents.enums.DocumentType;
import one.nem.lacerta.data.repository.Documents;
public class DocumentsImpl implements Documents {
@Inject
public DocumentsImpl() {
}
public ArrayList<DocumentMeta> getRecentDocuments(int limit) { // Generate dummy data
ArrayList<DocumentMeta> documentMetaList = new ArrayList<>();
for (int i = 0; i < limit; i++) {
DocumentMeta documentMeta = new DocumentMeta();
documentMeta.id = UUID.randomUUID().toString();
documentMeta.name = "Document " + i;
documentMeta.created = new Date();
documentMeta.type = new Random(i).nextInt()/2 == 0 ? DocumentType.OTHER : DocumentType.NOTEBOOK;
documentMeta.tags = new String[] {"tag1", "tag2", "tag3"};
documentMeta.categories = new String[] {"category1", "category2", "category3"};
documentMetaList.add(documentMeta);
}
return documentMetaList;
}
}

View File

@ -1,5 +1,14 @@
package one.nem.lacerta.data.repository;
import java.util.ArrayList;
import java.util.List;
import one.nem.lacerta.data.model.documents.DocumentDetail;
import one.nem.lacerta.data.model.documents.DocumentMeta;
public interface Documents {
ArrayList<DocumentMeta> getRecentDocuments(int limit);
}