]>
git.argeo.org Git - gpl/argeo-slc.git/blob - legacy/runtime/org.argeo.slc.support.castor/src/main/java/org/argeo/slc/castor/test/tree/StatusFieldHandler.java
a69eb87daeb0592c4abaf927f6cf6701cec0761c
2 * Copyright (C) 2007-2012 Mathieu Baudier
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package org
.argeo
.slc
.castor
.test
.tree
;
18 import org
.argeo
.slc
.core
.test
.SimpleResultPart
;
19 import org
.argeo
.slc
.core
.test
.SlcTestUtils
;
20 import org
.argeo
.slc
.test
.TestStatus
;
21 import org
.exolab
.castor
.mapping
.AbstractFieldHandler
;
23 public class StatusFieldHandler
extends AbstractFieldHandler
{
26 public Object
getValue(Object object
) throws IllegalStateException
{
27 SimpleResultPart part
= (SimpleResultPart
) object
;
28 return SlcTestUtils
.statusToString(part
.getStatus());
32 public Object
newInstance(Object parent
) throws IllegalStateException
{
37 public Object
newInstance(Object parent
, Object
[] args
)
38 throws IllegalStateException
{
43 public void resetValue(Object object
) throws IllegalStateException
,
44 IllegalArgumentException
{
45 SimpleResultPart part
= (SimpleResultPart
) object
;
46 // ERROR by default since it should be explicitely set
47 part
.setStatus(TestStatus
.ERROR
);
51 public void setValue(Object object
, Object value
)
52 throws IllegalStateException
, IllegalArgumentException
{
53 SimpleResultPart part
= (SimpleResultPart
) object
;
54 Integer status
= SlcTestUtils
.stringToStatus((String
) value
);
55 part
.setStatus(status
);