Преглед на файлове

preserve existing messages when upgrading AppMessage

tags/v0.17.0
Jonathan Cobb преди 4 години
родител
ревизия
3697481e1b
променени са 1 файла, в които са добавени 9 реда и са изтрити 0 реда
  1. +9
    -0
      bubble-server/src/main/java/bubble/model/app/AppMessage.java

+ 9
- 0
bubble-server/src/main/java/bubble/model/app/AppMessage.java Целия файл

@@ -5,6 +5,7 @@
package bubble.model.app;

import bubble.model.account.Account;
import bubble.server.BubbleConfiguration;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Getter;
import lombok.NoArgsConstructor;
@@ -22,6 +23,8 @@ import javax.persistence.Entity;
import javax.persistence.Transient;
import javax.validation.constraints.Size;

import java.util.Map;

import static bubble.ApiConstants.DB_JSON_MAPPER;
import static bubble.ApiConstants.EP_MESSAGES;
import static org.cobbzilla.util.daemon.ZillaRuntime.empty;
@@ -45,6 +48,12 @@ public class AppMessage extends IdentifiableBase implements AppTemplateEntity, H

@Override public Identifiable update(Identifiable other) { copy(this, other, UPDATE_FIELDS); return this; }

@Override public <T extends AppTemplateEntity> void upgrade(T sageObject, BubbleConfiguration configuration) {
final Map<String, String> map = NameAndValue.toMap(getMessages());
map.putAll(NameAndValue.toMap(((AppMessage) sageObject).getMessages()));
setMessagesJson(json(NameAndValue.map2list(map)));
}

@ECField(index=10)
@ECForeignKey(entity=Account.class)
@Column(nullable=false, updatable=false, length=UUID_MAXLEN)


Зареждане…
Отказ
Запис