| 1 |
|
package org.trails.record; |
| 2 |
|
|
| 3 |
|
|
| 4 |
|
import java.util.Collection; |
| 5 |
|
import java.util.Collections; |
| 6 |
|
import java.util.HashSet; |
| 7 |
|
import java.util.Set; |
| 8 |
|
|
| 9 |
|
import org.apache.hivemind.util.Defense; |
| 10 |
|
import org.apache.tapestry.engine.ServiceEncoding; |
| 11 |
|
import org.apache.tapestry.services.DataSqueezer; |
| 12 |
|
import org.apache.tapestry.web.WebRequest; |
| 13 |
|
|
| 14 |
0 |
public class ClientAsoPropertyPersistenceStrategy implements IClientAsoPropertyPersistenceStrategy |
| 15 |
|
{ |
| 16 |
|
|
| 17 |
0 |
private Set<String> propertiesNames = new HashSet<String>(); |
| 18 |
|
private DataSqueezer dataSqueezer; |
| 19 |
|
protected WebRequest request; |
| 20 |
|
|
| 21 |
|
public void initializeService() |
| 22 |
|
{ |
| 23 |
0 |
} |
| 24 |
|
|
| 25 |
|
public void store(String pageName, String idPath, String propertyName, Object newValue) |
| 26 |
|
{ |
| 27 |
0 |
} |
| 28 |
|
|
| 29 |
|
public Collection getStoredChanges(String pageName) |
| 30 |
|
{ |
| 31 |
0 |
return Collections.EMPTY_LIST; |
| 32 |
|
} |
| 33 |
|
|
| 34 |
|
public void discardStoredChanges(String pageName) |
| 35 |
|
{ |
| 36 |
0 |
} |
| 37 |
|
|
| 38 |
|
public void addParametersForPersistentProperties(ServiceEncoding encoding, boolean post) |
| 39 |
|
{ |
| 40 |
0 |
Defense.notNull(encoding, "encoding"); |
| 41 |
0 |
for (String propertyName : propertiesNames) |
| 42 |
|
{ |
| 43 |
0 |
encoding.setParameterValue(propertyName, dataSqueezer.squeeze(request.getAttribute(propertyName))); |
| 44 |
|
} |
| 45 |
0 |
} |
| 46 |
|
|
| 47 |
|
public void setRequest(WebRequest request) |
| 48 |
|
{ |
| 49 |
0 |
this.request = request; |
| 50 |
0 |
} |
| 51 |
|
|
| 52 |
|
public void setDataSqueezer(DataSqueezer dataSqueezer) |
| 53 |
|
{ |
| 54 |
0 |
this.dataSqueezer = dataSqueezer; |
| 55 |
0 |
} |
| 56 |
|
|
| 57 |
|
public void addPropertyName(String propertyName) |
| 58 |
|
{ |
| 59 |
0 |
propertiesNames.add(propertyName); |
| 60 |
0 |
} |
| 61 |
|
} |