1 /*
2  * Copyright (C) 2013 The Android Open Source Project
3  *
4  * Licensed under the Eclipse Public License, Version 1.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.eclipse.org/org/documents/epl-v10.php
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.ide.eclipse.adt.internal.wizards.exportgradle;
18 
19 import com.android.annotations.NonNull;
20 import com.android.annotations.Nullable;
21 import com.google.common.collect.ArrayListMultimap;
22 import com.google.common.collect.Multimap;
23 
24 import java.io.File;
25 
26 public class ExportStatus {
27 
28     public static enum FileStatus { OK, VCS_FAILURE, IO_FAILURE; }
29 
30     private String mMainError = null;
31     private final Multimap<FileStatus, File> mFileStatus = ArrayListMultimap.create();
32 
addFileStatus(@onNull FileStatus status, @NonNull File file)33     void addFileStatus(@NonNull FileStatus status, @NonNull File file) {
34         mFileStatus.put(status, file);
35     }
36 
hasError()37     boolean hasError() {
38         return mMainError != null ||
39                 !mFileStatus.get(FileStatus.VCS_FAILURE).isEmpty() ||
40                 !mFileStatus.get(FileStatus.IO_FAILURE).isEmpty();
41     }
42 
setErrorMessage(String error)43     public void setErrorMessage(String error) {
44         mMainError = error;
45     }
46 
47     @Nullable
getErrorMessage()48     public String getErrorMessage() {
49         return mMainError;
50     }
51 
52     @NonNull
getFileStatus()53     public Multimap<FileStatus, File> getFileStatus() {
54         return mFileStatus;
55     }
56 }
57