forked from hawkular/hawkular-android-client
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update on hawkular#229 Added rebuild from chunks
- Loading branch information
Showing
6 changed files
with
339 additions
and
144 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
mobile/src/main/java/org/hawkular/client/android/backend/model/Data.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
|
||
package org.hawkular.client.android.backend.model; | ||
|
||
import android.os.Parcel; | ||
import android.os.Parcelable; | ||
|
||
public class Data implements Parcelable | ||
{ | ||
|
||
private Long timestamp; | ||
private String value; | ||
private Tags tags; | ||
public final static Creator<Data> CREATOR = new Creator<Data>() { | ||
|
||
|
||
@SuppressWarnings({ | ||
"unchecked" | ||
}) | ||
public Data createFromParcel(Parcel in) { | ||
Data instance = new Data(); | ||
instance.timestamp = ((Long) in.readValue((Integer.class.getClassLoader()))); | ||
instance.value = ((String) in.readValue((String.class.getClassLoader()))); | ||
instance.tags = ((Tags) in.readValue((Tags.class.getClassLoader()))); | ||
return instance; | ||
} | ||
|
||
public Data[] newArray(int size) { | ||
return (new Data[size]); | ||
} | ||
|
||
} | ||
; | ||
|
||
public Long getTimestamp() { | ||
return timestamp; | ||
} | ||
|
||
public void setTimestamp(Long timestamp) { | ||
this.timestamp = timestamp; | ||
} | ||
|
||
public String getValue() { | ||
return value; | ||
} | ||
|
||
public void setValue(String value) { | ||
this.value = value; | ||
} | ||
|
||
public Tags getTags() { | ||
return tags; | ||
} | ||
|
||
public void setTags(Tags tags) { | ||
this.tags = tags; | ||
} | ||
|
||
public void writeToParcel(Parcel dest, int flags) { | ||
dest.writeValue(timestamp); | ||
dest.writeValue(value); | ||
dest.writeValue(tags); | ||
} | ||
|
||
public int describeContents() { | ||
return 0; | ||
} | ||
|
||
} |
121 changes: 33 additions & 88 deletions
121
mobile/src/main/java/org/hawkular/client/android/backend/model/Resource.java
100644 → 100755
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,113 +1,58 @@ | ||
/* | ||
* Copyright 2015-2017 Red Hat, Inc. and/or its affiliates | ||
* and other contributors as indicated by the @author tags. | ||
* | ||
* 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. | ||
*/ | ||
package org.hawkular.client.android.backend.model; | ||
|
||
import com.google.gson.annotations.SerializedName; | ||
package org.hawkular.client.android.backend.model; | ||
|
||
import java.util.List; | ||
import android.os.Parcel; | ||
import android.os.Parcelable; | ||
import android.support.annotation.NonNull; | ||
import android.support.annotation.VisibleForTesting; | ||
|
||
public final class Resource implements Parcelable { | ||
@SerializedName("id") | ||
private String id; | ||
|
||
@SerializedName("name") | ||
private String name; | ||
public class Resource implements Parcelable | ||
{ | ||
|
||
@SerializedName("type") | ||
private ResourceType type; | ||
|
||
@SerializedName("path") | ||
private String path; | ||
private String id; | ||
private List<Data> data = null; | ||
public final static Creator<Resource> CREATOR = new Creator<Resource>() { | ||
|
||
|
||
@SuppressWarnings({ | ||
"unchecked" | ||
}) | ||
public Resource createFromParcel(Parcel in) { | ||
Resource instance = new Resource(); | ||
instance.id = ((String) in.readValue((String.class.getClassLoader()))); | ||
in.readList(instance.data, (Data.class.getClassLoader())); | ||
return instance; | ||
} | ||
|
||
@SerializedName("properties") | ||
private ResourceProperties properties; | ||
public Resource[] newArray(int size) { | ||
return (new Resource[size]); | ||
} | ||
|
||
@VisibleForTesting | ||
public Resource(@NonNull String id, @NonNull ResourceType type, @NonNull ResourceProperties properties) { | ||
this.id = id; | ||
this.type = type; | ||
this.properties = properties; | ||
} | ||
; | ||
|
||
public String getId() { | ||
return id; | ||
} | ||
|
||
public ResourceType getType() { | ||
return type; | ||
} | ||
|
||
public String getPath() { | ||
return path; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public String getFeed() { | ||
String[] temp = path.split("/"); | ||
for (String string : temp) { | ||
if (string.startsWith("f")) { | ||
return string.substring(2); | ||
} | ||
} | ||
return null; | ||
public void setId(String id) { | ||
this.id = id; | ||
} | ||
|
||
|
||
public ResourceProperties getProperties() { | ||
return properties; | ||
public List<Data> getData() { | ||
return data; | ||
} | ||
|
||
public static Creator<Resource> CREATOR = new Creator<Resource>() { | ||
@Override | ||
public Resource createFromParcel(Parcel parcel) { | ||
return new Resource(parcel); | ||
} | ||
|
||
@Override | ||
public Resource[] newArray(int size) { | ||
return new Resource[size]; | ||
} | ||
}; | ||
|
||
private Resource(Parcel parcel) { | ||
this.id = parcel.readString(); | ||
this.name = parcel.readString(); | ||
this.type = parcel.readParcelable(ResourceType.class.getClassLoader()); | ||
this.path = parcel.readString(); | ||
this.properties = parcel.readParcelable(ResourceProperties.class.getClassLoader()); | ||
public void setData(List<Data> data) { | ||
this.data = data; | ||
} | ||
|
||
@Override | ||
public void writeToParcel(Parcel parcel, int flags) { | ||
parcel.writeString(id); | ||
parcel.writeString(name); | ||
parcel.writeParcelable(type, flags); | ||
parcel.writeString(path); | ||
parcel.writeParcelable(properties, flags); | ||
public void writeToParcel(Parcel dest, int flags) { | ||
dest.writeValue(id); | ||
dest.writeList(data); | ||
} | ||
|
||
@Override | ||
public int describeContents() { | ||
return 0; | ||
return 0; | ||
} | ||
|
||
} |
58 changes: 58 additions & 0 deletions
58
mobile/src/main/java/org/hawkular/client/android/backend/model/Tags.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
|
||
package org.hawkular.client.android.backend.model; | ||
|
||
import android.os.Parcel; | ||
import android.os.Parcelable; | ||
import android.os.Parcelable.Creator; | ||
|
||
public class Tags implements Parcelable | ||
{ | ||
|
||
private String chunks; | ||
private String size; | ||
public final static Creator<Tags> CREATOR = new Creator<Tags>() { | ||
|
||
|
||
@SuppressWarnings({ | ||
"unchecked" | ||
}) | ||
public Tags createFromParcel(Parcel in) { | ||
Tags instance = new Tags(); | ||
instance.chunks = ((String) in.readValue((String.class.getClassLoader()))); | ||
instance.size = ((String) in.readValue((String.class.getClassLoader()))); | ||
return instance; | ||
} | ||
|
||
public Tags[] newArray(int size) { | ||
return (new Tags[size]); | ||
} | ||
|
||
} | ||
; | ||
|
||
public String getChunks() { | ||
return chunks; | ||
} | ||
|
||
public void setChunks(String chunks) { | ||
this.chunks = chunks; | ||
} | ||
|
||
public String getSize() { | ||
return size; | ||
} | ||
|
||
public void setSize(String size) { | ||
this.size = size; | ||
} | ||
|
||
public void writeToParcel(Parcel dest, int flags) { | ||
dest.writeValue(chunks); | ||
dest.writeValue(size); | ||
} | ||
|
||
public int describeContents() { | ||
return 0; | ||
} | ||
|
||
} |
Oops, something went wrong.