-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
344 additions
and
46 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
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
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
77 changes: 77 additions & 0 deletions
77
src/main/java/com/github/davidepastore/liferay/model/DDMDocumentAndMedia.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,77 @@ | ||
package com.github.davidepastore.liferay.model; | ||
|
||
/** | ||
* @author Christian Palombella | ||
* | ||
*/ | ||
public class DDMDocumentAndMedia { | ||
|
||
private String classPK; | ||
private String groupId; | ||
private String title; | ||
private String type; | ||
private String uuid; | ||
|
||
public DDMDocumentAndMedia() { | ||
super(); | ||
} | ||
|
||
public String getClassPK() { | ||
return classPK; | ||
} | ||
|
||
public void setClassPK(String classPK) { | ||
this.classPK = classPK; | ||
} | ||
|
||
public String getGroupId() { | ||
return groupId; | ||
} | ||
|
||
public void setGroupId(String groupId) { | ||
this.groupId = groupId; | ||
} | ||
|
||
public String getTitle() { | ||
return title; | ||
} | ||
|
||
public void setTitle(String title) { | ||
this.title = title; | ||
} | ||
|
||
public String getType() { | ||
return type; | ||
} | ||
|
||
public void setType(String type) { | ||
this.type = type; | ||
} | ||
|
||
public String getUuid() { | ||
return uuid; | ||
} | ||
|
||
public void setUuid(String uuid) { | ||
this.uuid = uuid; | ||
} | ||
|
||
/** | ||
* Check if the object are equals. | ||
*/ | ||
@Override | ||
public boolean equals(Object obj) { | ||
return obj instanceof DDMDocumentAndMedia | ||
&& groupId.equals(((DDMDocumentAndMedia) obj) | ||
.getGroupId()) | ||
&& classPK.equals(((DDMDocumentAndMedia) obj) | ||
.getClassPK()) | ||
&& uuid.equals(((DDMDocumentAndMedia) obj) | ||
.getUuid()) | ||
&& type.equals(((DDMDocumentAndMedia) obj) | ||
.getType()) | ||
&& title.equals(((DDMDocumentAndMedia) obj) | ||
.getTitle()); | ||
} | ||
|
||
} |
25 changes: 25 additions & 0 deletions
25
src/main/java/com/github/davidepastore/liferay/model/DDMGeolocation.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,25 @@ | ||
package com.github.davidepastore.liferay.model; | ||
|
||
/** | ||
* | ||
* @author Christian Palombella | ||
* | ||
*/ | ||
public class DDMGeolocation { | ||
|
||
private Double latitude; | ||
private Double longitude; | ||
|
||
public DDMGeolocation() { | ||
super(); | ||
} | ||
|
||
public Double getLatitude() { | ||
return latitude; | ||
} | ||
|
||
public Double getLongitude() { | ||
return longitude; | ||
} | ||
|
||
} |
59 changes: 59 additions & 0 deletions
59
src/main/java/com/github/davidepastore/liferay/model/DDMImage.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,59 @@ | ||
package com.github.davidepastore.liferay.model; | ||
|
||
/** | ||
* @author Christian Palombella | ||
* | ||
*/ | ||
public class DDMImage { | ||
|
||
private String classPK; | ||
private String groupId; | ||
private String name; | ||
private String alt; | ||
private String title; | ||
private String type; | ||
private String uuid; | ||
private String fileEntryId; | ||
private String resourcePrimKey; | ||
|
||
public DDMImage() { | ||
super(); | ||
} | ||
|
||
public String getClassPK() { | ||
return classPK; | ||
} | ||
|
||
public String getGroupId() { | ||
return groupId; | ||
} | ||
|
||
public String getTitle() { | ||
return title; | ||
} | ||
|
||
public String getType() { | ||
return type; | ||
} | ||
|
||
public String getUuid() { | ||
return uuid; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public String getAlt() { | ||
return alt; | ||
} | ||
|
||
public String getFileEntryId() { | ||
return fileEntryId; | ||
} | ||
|
||
public String getResourcePrimKey() { | ||
return resourcePrimKey; | ||
} | ||
|
||
} |
66 changes: 66 additions & 0 deletions
66
src/main/java/com/github/davidepastore/liferay/util/JsonUtil.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,66 @@ | ||
package com.github.davidepastore.liferay.util; | ||
|
||
import com.github.davidepastore.liferay.model.DDMDocumentAndMedia; | ||
import com.github.davidepastore.liferay.model.DDMGeolocation; | ||
import com.github.davidepastore.liferay.model.DDMImage; | ||
import com.google.gson.Gson; | ||
import com.google.gson.GsonBuilder; | ||
import com.google.gson.JsonIOException; | ||
import com.google.gson.JsonParseException; | ||
import com.google.gson.JsonSyntaxException; | ||
import com.google.gson.reflect.TypeToken; | ||
|
||
/** | ||
* @author Christian Palombella | ||
* | ||
*/ | ||
public class JsonUtil { | ||
|
||
/** | ||
* | ||
* @param ddmGeolocationString | ||
* @return | ||
* @throws JsonSyntaxException | ||
* @throws JsonIOException | ||
* @throws FileNotFoundException | ||
*/ | ||
public static DDMGeolocation getDDMGeolocation(String ddmGeolocationString) throws JsonSyntaxException, JsonIOException, JsonParseException { | ||
|
||
Gson gson = new GsonBuilder().create(); | ||
DDMGeolocation ddmGeolocation = gson.fromJson(ddmGeolocationString, new TypeToken<DDMGeolocation>(){}.getType()); | ||
|
||
return ddmGeolocation; | ||
} | ||
|
||
/** | ||
* | ||
* @param ddmImageString | ||
* @return | ||
* @throws JsonSyntaxException | ||
* @throws JsonIOException | ||
* @throws FileNotFoundException | ||
*/ | ||
public static DDMImage getDDMImage(String ddmImageString) throws JsonSyntaxException, JsonIOException, JsonParseException { | ||
|
||
Gson gson = new GsonBuilder().create(); | ||
DDMImage ddmImage = gson.fromJson(ddmImageString, new TypeToken<DDMImage>(){}.getType()); | ||
|
||
return ddmImage; | ||
} | ||
|
||
/** | ||
* | ||
* @param ddmDocumentAndMediaString | ||
* @return | ||
* @throws JsonSyntaxException | ||
* @throws JsonIOException | ||
* @throws FileNotFoundException | ||
*/ | ||
public static DDMDocumentAndMedia getDDMDocumentAndMedia(String ddmDocumentAndMediaString) throws JsonSyntaxException, JsonIOException, JsonParseException { | ||
|
||
Gson gson = new GsonBuilder().create(); | ||
DDMDocumentAndMedia ddmDocumentAndMedia = gson.fromJson(ddmDocumentAndMediaString, new TypeToken<DDMDocumentAndMedia>(){}.getType()); | ||
|
||
return ddmDocumentAndMedia; | ||
} | ||
} |
Oops, something went wrong.