move DTOs for file storage to gwt.ui

This commit is contained in:
Fredrik Teschke
2015-01-23 21:03:40 +01:00
parent 01d9793e3c
commit bcc2512366
14 changed files with 72 additions and 83 deletions
-1
View File
@@ -2,7 +2,6 @@
<classpath>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="resources"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="output" path="bin"/>
</classpath>
@@ -6,7 +6,6 @@ Bundle-Version: 1.0.0.qualifier
Bundle-Vendor: SAP
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Export-Package: com.sap.sse.filestorage,
com.sap.sse.filestorage.dto,
com.sap.sse.filestorage.impl,
com.sap.sse.filestorage.testsupport
Import-Package: com.sap.sse.osgi,
@@ -1,5 +1,4 @@
source.. = src/,\
resources/
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.
@@ -1,5 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.4.0//EN" "http://google-web-toolkit.googlecode.com/svn/tags/2.4.0/distro-source/core/src/gwt-module.dtd">
<module>
<source path='dto'/>
</module>
@@ -1,20 +0,0 @@
package com.sap.sse.filestorage.dto;
import java.io.Serializable;
public class FileStorageServiceDTO implements Serializable {
private static final long serialVersionUID = 6101940297792100418L;
public String name;
public String description;
public PropertyDTO[] properties;
// for GWT
FileStorageServiceDTO() {
}
public FileStorageServiceDTO(String name, String description, PropertyDTO... properties) {
this.name = name;
this.description = description;
this.properties = properties;
}
}
@@ -1,22 +0,0 @@
package com.sap.sse.filestorage.dto;
import java.io.Serializable;
public class PropertyDTO implements Serializable {
private static final long serialVersionUID = -2721807793068803143L;
public boolean isRequired;
public String name;
public String value;
public String description;
// for GWT
PropertyDTO() {
}
public PropertyDTO(boolean isRequired, String name, String value, String description) {
this.isRequired = isRequired;
this.name = name;
this.value = value;
this.description = description;
}
}
@@ -1,19 +0,0 @@
package com.sap.sse.filestorage.dto;
import java.io.Serializable;
import java.util.Map;
public class PropertyErrors implements Serializable {
private static final long serialVersionUID = -7328897153875728802L;
public Map<PropertyDTO, String> perPropertyMessages;
public String message;
// for GWT
PropertyErrors() {
}
public PropertyErrors(String message, Map<PropertyDTO, String> perPropertyMessages) {
this.message = message;
this.perPropertyMessages = perPropertyMessages;
}
}
@@ -1,36 +0,0 @@
package com.sap.sse.filestorage.impl;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import com.sap.sse.filestorage.FileStorageService;
import com.sap.sse.filestorage.InvalidPropertiesException;
import com.sap.sse.filestorage.Property;
import com.sap.sse.filestorage.dto.FileStorageServiceDTO;
import com.sap.sse.filestorage.dto.PropertyDTO;
import com.sap.sse.filestorage.dto.PropertyErrors;
public class FileStorageServiceDTOUtils {
public static PropertyDTO convert(Property p) {
return new PropertyDTO(p.isRequired(), p.getName(), p.getValue(), p.getDescription());
}
public static PropertyErrors convert(InvalidPropertiesException e) {
Map<PropertyDTO, String> msgs = new HashMap<>();
for (Entry<Property, String> entry : e.getPerPropertyMessage().entrySet()) {
msgs.put(convert(entry.getKey()), entry.getValue());
}
return new PropertyErrors(e.getMessage(), msgs);
}
public static FileStorageServiceDTO convert(FileStorageService s) {
List<PropertyDTO> pDtos = new ArrayList<>();
for (Property p : s.getProperties()) {
pDtos.add(convert(p));
}
return new FileStorageServiceDTO(s.getName(), s.getDescription(), pDtos.toArray(new PropertyDTO[0]));
}
}