| 1 |
|
package org.kuali.student.lum.lu.ui.tools.server.gwt; |
| 2 |
|
|
| 3 |
|
import java.util.List; |
| 4 |
|
import java.util.Map; |
| 5 |
|
|
| 6 |
|
import org.apache.log4j.Logger; |
| 7 |
|
import org.kuali.student.common.assembly.data.AssemblyException; |
| 8 |
|
import org.kuali.student.common.assembly.data.Data; |
| 9 |
|
import org.kuali.student.common.assembly.data.Metadata; |
| 10 |
|
import org.kuali.student.common.assembly.dictionary.MetadataServiceImpl; |
| 11 |
|
import org.kuali.student.common.assembly.old.Assembler; |
| 12 |
|
import org.kuali.student.common.assembly.old.data.SaveResult; |
| 13 |
|
import org.kuali.student.common.assembly.transform.MetadataFilter; |
| 14 |
|
import org.kuali.student.common.assembly.transform.TransformFilter; |
| 15 |
|
import org.kuali.student.common.exceptions.DataValidationErrorException; |
| 16 |
|
import org.kuali.student.common.exceptions.DoesNotExistException; |
| 17 |
|
import org.kuali.student.common.exceptions.InvalidParameterException; |
| 18 |
|
import org.kuali.student.common.exceptions.MissingParameterException; |
| 19 |
|
import org.kuali.student.common.exceptions.OperationFailedException; |
| 20 |
|
import org.kuali.student.common.rice.authorization.PermissionType; |
| 21 |
|
import org.kuali.student.common.ui.client.service.DataSaveResult; |
| 22 |
|
import org.kuali.student.common.ui.server.gwt.DataService; |
| 23 |
|
import org.kuali.student.common.ui.shared.IdAttributes; |
| 24 |
|
import org.kuali.student.common.validation.dto.ValidationResultInfo; |
| 25 |
|
|
|
|
|
| 0% |
Uncovered Elements: 35 (35) |
Complexity: 14 |
Complexity Density: 0.64 |
|
| 26 |
|
public class CluSetDataService implements DataService{ |
| 27 |
|
|
| 28 |
|
final static Logger LOG = Logger.getLogger(CluSetDataService.class); |
| 29 |
|
private Assembler<Data, Void> assembler; |
| 30 |
|
private MetadataServiceImpl metadataService; |
| 31 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 32 |
0
|
public MetadataServiceImpl getMetadataService() {... |
| 33 |
0
|
return metadataService; |
| 34 |
|
} |
| 35 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 36 |
0
|
public void setMetadataService(MetadataServiceImpl metadataService) {... |
| 37 |
0
|
this.metadataService = metadataService; |
| 38 |
|
} |
| 39 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 40 |
0
|
public Assembler<Data, Void> getAssembler() {... |
| 41 |
0
|
return assembler; |
| 42 |
|
} |
| 43 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 44 |
0
|
public void setAssembler(Assembler<Data, Void> assembler) {... |
| 45 |
0
|
this.assembler = assembler; |
| 46 |
|
} |
| 47 |
|
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.4 |
|
| 48 |
0
|
@Override... |
| 49 |
|
public Data getData(String dataId) throws OperationFailedException, DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException { |
| 50 |
0
|
Data result = null; |
| 51 |
0
|
try { |
| 52 |
0
|
result = assembler.get(dataId); |
| 53 |
|
} catch (Exception e){ |
| 54 |
0
|
throw new OperationFailedException("Failed to retrieve data from id " + dataId, e); |
| 55 |
|
} |
| 56 |
0
|
return result; |
| 57 |
|
} |
| 58 |
|
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 59 |
0
|
@Override... |
| 60 |
|
public Metadata getMetadata(String id, Map<String,String> idAttributes) { |
| 61 |
0
|
Metadata metadata = metadataService.getMetadata(id); |
| 62 |
0
|
return metadata; |
| 63 |
|
} |
| 64 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 65 |
0
|
protected String getDefaultMetaDataType() {... |
| 66 |
0
|
return null; |
| 67 |
|
} |
| 68 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 69 |
0
|
protected String getDefaultMetaDataState() {... |
| 70 |
0
|
return null; |
| 71 |
|
} |
| 72 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 73 |
0
|
@Override... |
| 74 |
|
public Boolean isAuthorized(PermissionType type, Map<String, String> attributes) { |
| 75 |
0
|
return new Boolean(true); |
| 76 |
|
} |
| 77 |
|
|
|
|
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 3 |
Complexity Density: 0.43 |
|
| 78 |
0
|
@Override... |
| 79 |
|
public DataSaveResult saveData(Data data) throws OperationFailedException { |
| 80 |
0
|
try { |
| 81 |
0
|
SaveResult<Data> saveResult = assembler.save(data); |
| 82 |
0
|
if (saveResult != null) { |
| 83 |
0
|
return new DataSaveResult(saveResult.getValidationResults(), saveResult.getValue()); |
| 84 |
|
} |
| 85 |
|
} catch (Exception e) { |
| 86 |
0
|
LOG.error("Unable to save", e); |
| 87 |
0
|
throw new OperationFailedException("Unable to save"); |
| 88 |
|
} |
| 89 |
0
|
return null; |
| 90 |
|
} |
| 91 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 92 |
0
|
@Override... |
| 93 |
|
public List<ValidationResultInfo> validateData(Data data) |
| 94 |
|
throws OperationFailedException { |
| 95 |
0
|
return null; |
| 96 |
|
} |
| 97 |
|
} |