geoportal-data-viewer-app/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/cms/project/ProjectUtil.java

61 lines
1.5 KiB
Java
Raw Normal View History

2022-10-25 11:35:03 +02:00
package org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.project;
import java.util.Map.Entry;
import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV;
public class ProjectUtil {
public static <T extends DocumentDV> String toHMLCode(T document, String projectID) {
String htmlCode = "";
2022-10-25 14:53:56 +02:00
if (document == null)
return htmlCode;
2022-10-25 11:35:03 +02:00
Entry<String, Object> firstEntrySet = document.getFirstEntryOfMap();
if (firstEntrySet != null) {
htmlCode += firstEntrySet.getKey() + ": <b>" + firstEntrySet.getValue() + "</b>";
}
if (projectID != null) {
2022-11-04 17:16:37 +01:00
htmlCode += " (id: " + projectID + ")";
2022-10-25 11:35:03 +02:00
}
return htmlCode;
}
public static <T extends DocumentDV> String toHMLCode(boolean showkey, T document, String projectID) {
String htmlCode = "";
if (document == null)
return htmlCode;
Entry<String, Object> firstEntrySet = document.getFirstEntryOfMap();
if (firstEntrySet != null) {
htmlCode += showkey ? firstEntrySet.getKey() + ": <b>" + firstEntrySet.getValue() + "</b>"
: firstEntrySet.getValue();
}
if (projectID != null) {
htmlCode += " (id: " + projectID + ")";
}
return htmlCode;
}
2022-10-25 14:53:56 +02:00
public static <T extends DocumentDV> String toHMLCode(T document) {
String htmlCode = "";
if (document == null)
return htmlCode;
Entry<String, Object> firstEntrySet = document.getFirstEntryOfMap();
if (firstEntrySet != null) {
htmlCode += firstEntrySet.getKey() + ": <b>" + firstEntrySet.getValue() + "</b>";
}
return htmlCode;
}
2022-10-25 11:35:03 +02:00
}