package com.thinkbiganalytics.feedmgr.rest.model; /*- * #%L * thinkbig-feed-manager-rest-model * %% * Copyright (C) 2017 ThinkBig Analytics * %% * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * #L% */ import com.fasterxml.jackson.annotation.JsonIgnore; import org.joda.time.DateTime; import java.util.UUID; public class UploadProgressMessage { private String messageKey; private String message; private DateTime dateTime; private boolean complete; private boolean success; public UploadProgressMessage() { this.messageKey = UUID.randomUUID().toString(); } public UploadProgressMessage(String message) { this(); this.message = message; this.dateTime = DateTime.now(); } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } public DateTime getDateTime() { return dateTime; } public void setDateTime(DateTime dateTime) { this.dateTime = dateTime; } public String getMessageKey() { return messageKey; } public void setMessageKey(String messageKey) { this.messageKey = messageKey; } public boolean isComplete() { return complete; } public void setComplete(boolean complete) { this.complete = complete; } public boolean isSuccess() { return success; } public void setSuccess(boolean success) { this.success = success; } public void update(String message, boolean success){ update(message); complete(success); } public void update(String message){ setMessage(message); setDateTime(DateTime.now()); } @JsonIgnore public void complete(boolean success){ setComplete(true); setSuccess(success); } }