@Override
public GetDocumentListResult execute(GetDocumentList action,
ExecutionContext context) throws ActionException {
identity.checkLoggedIn();
ProjectIterationId iterationId =
action.getWorkspaceId().getProjectIterationId();
List<DocumentInfo> docs = new ArrayList<DocumentInfo>();
List<HDocument> hDocs = getDocumentList(action);
for (HDocument hDoc : hDocs) {
HPerson person = hDoc.getLastModifiedBy();
String lastModifiedBy = "";
if (person != null) {
lastModifiedBy = person.getAccount().getUsername();
}
Map<String, String> downloadExtensions =
new HashMap<String, String>();
HProjectIteration projectIteration = hDoc.getProjectIteration();
ProjectType type = projectIteration.getProjectType();
if (type == null) {
type = projectIteration.getProject().getDefaultProjectType();
}
if (type == null) {
// no .po download link
} else if (type == ProjectType.Gettext || type == ProjectType.Podir) {
downloadExtensions.put(".po", "po?docId=" + hDoc.getDocId());
} else {
downloadExtensions.put("offline .po",
"offlinepo?docId=" + hDoc.getDocId());
}
GlobalDocumentId id =
new GlobalDocumentId(iterationId.getProjectSlug(),
iterationId.getIterationSlug(), hDoc.getDocId());
if (filePersistService.hasPersistedDocument(id)) {
String extension =
"."
+ translationFileServiceImpl.getFileExtension(
iterationId.getProjectSlug(),
iterationId.getIterationSlug(),
hDoc.getPath(), hDoc.getName());
downloadExtensions.put(extension,
"baked?docId=" + hDoc.getDocId());
}