This commit is contained in:
Keiichi Watanabe 2017-08-13 06:28:50 +09:00
parent 3358e594df
commit 6c625b837a
3 changed files with 6 additions and 7 deletions

View file

@ -239,7 +239,7 @@ public class AdminSearchlistAction extends FessAdminAction {
getDoc(form).ifPresent(entity -> {
form.doc = fessConfig.convertToEditableDoc(entity);
form.id = (String) entity.remove(fessConfig.getIndexFieldId());
form.versionNo = (Long) entity.remove(fessConfig.getIndexFieldVersion());
form.version = (Long) entity.remove(fessConfig.getIndexFieldVersion());
}).orElse(() -> {
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, docId), () -> asListHtml());
});
@ -292,7 +292,7 @@ public class AdminSearchlistAction extends FessAdminAction {
String oldId = null;
if (newId.equals(form.id)) {
entity.put(fessConfig.getIndexFieldId(), form.id);
entity.put(fessConfig.getIndexFieldVersion(), form.versionNo);
entity.put(fessConfig.getIndexFieldVersion(), form.version);
} else {
oldId = form.id;
entity.put(fessConfig.getIndexFieldId(), newId);
@ -303,7 +303,7 @@ public class AdminSearchlistAction extends FessAdminAction {
final String type = fessConfig.getIndexDocumentType();
fessEsClient.store(index, type, entity);
if (oldId != null) {
fessEsClient.delete(index, type, oldId, form.versionNo);
fessEsClient.delete(index, type, oldId, form.version);
}
saveInfo(messages -> messages.addSuccessCrudUpdateCrudTable(GLOBAL));
} catch (final Exception e) {

View file

@ -31,8 +31,7 @@ public class EditForm extends CreateForm {
@Size(max = 1000)
public String docId;
@Required
@ValidateTypeFailure
public Long versionNo;
public Long version;
}

View file

@ -167,7 +167,7 @@ public class ApiAdminSearchlistAction extends FessApiAdminAction {
String oldId = null;
if (newId.equals(body.id)) {
entity.put(fessConfig.getIndexFieldId(), body.id);
entity.put(fessConfig.getIndexFieldVersion(), body.versionNo);
entity.put(fessConfig.getIndexFieldVersion(), body.version);
} else {
oldId = body.id;
entity.put(fessConfig.getIndexFieldId(), newId);
@ -178,7 +178,7 @@ public class ApiAdminSearchlistAction extends FessApiAdminAction {
final String type = fessConfig.getIndexDocumentType();
fessEsClient.store(index, type, entity);
if (oldId != null) {
fessEsClient.delete(index, type, oldId, body.versionNo);
fessEsClient.delete(index, type, oldId, body.version);
}
saveInfo(messages -> messages.addSuccessCrudUpdateCrudTable(GLOBAL));
} catch (final Exception e) {