Changes to Spring security rules.
Code refactoring.
This commit is contained in:
parent
c168affc7c
commit
6b6179e750
16 changed files with 162 additions and 230 deletions
|
|
@ -3,7 +3,7 @@ Subcontractor work description
|
|||
|
||||
It is possible to keep this field empty.
|
||||
|
||||
But if you do, you could get errors in communication functionality when multiple emtpy fields exist.
|
||||
But if you do, you could get errors in communication functionality when multiple empty fields exist.
|
||||
|
||||
We recommend to always use a unique work description.
|
||||
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ public abstract class OrderElement extends IntegrationEntity implements ICriteri
|
|||
protected OrderLineGroup parent;
|
||||
|
||||
protected CriterionRequirementOrderElementHandler criterionRequirementHandler =
|
||||
CriterionRequirementOrderElementHandler.getInstance();
|
||||
CriterionRequirementOrderElementHandler.getInstance();
|
||||
|
||||
/**
|
||||
* This field is transient.
|
||||
|
|
@ -355,7 +355,7 @@ public abstract class OrderElement extends IntegrationEntity implements ICriteri
|
|||
private boolean wasASchedulingPoint() {
|
||||
TaskSource currentTaskSource = getTaskSource();
|
||||
// Check if the existing TaskSource is inconsistent with the current scheduling state
|
||||
if (currentTaskSource != null &&
|
||||
if (currentTaskSource != null && currentTaskSource.getTask() != null &&
|
||||
currentTaskSource.getTask().isLeaf() &&
|
||||
getSchedulingStateType() != Type.SCHEDULING_POINT) {
|
||||
|
||||
|
|
@ -535,10 +535,6 @@ public abstract class OrderElement extends IntegrationEntity implements ICriteri
|
|||
this.getInfoComponent().setName(name);
|
||||
}
|
||||
|
||||
public abstract boolean isLeaf();
|
||||
|
||||
public abstract List<OrderElement> getChildren();
|
||||
|
||||
public Date getInitDate() {
|
||||
return initDate;
|
||||
}
|
||||
|
|
@ -654,9 +650,8 @@ public abstract class OrderElement extends IntegrationEntity implements ICriteri
|
|||
Validate.notNull(label);
|
||||
|
||||
if (!checkAncestorsNoOtherLabelRepeated(label)) {
|
||||
throw new IllegalArgumentException(
|
||||
"An ancestor has the same label assigned, " +
|
||||
"so this element is already inheriting this label");
|
||||
throw new IllegalArgumentException("An ancestor has the same label assigned, " +
|
||||
"so this element is already inheriting this label");
|
||||
}
|
||||
|
||||
removeLabelOnChildren(label);
|
||||
|
|
@ -856,10 +851,9 @@ public abstract class OrderElement extends IntegrationEntity implements ICriteri
|
|||
return Collections.unmodifiableSet(criterionRequirements);
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* Operations to manage the criterion requirements of a orderElement
|
||||
* (remove, adding, update of the criterion requirement of the orderElement
|
||||
* such as the descendant's criterion requirement)
|
||||
* (remove, adding, update of the criterion requirement of the orderElement such as the descendant's criterion requirement)
|
||||
*/
|
||||
|
||||
public void setValidCriterionRequirement(IndirectCriterionRequirement requirement,boolean valid) {
|
||||
|
|
|
|||
|
|
@ -199,7 +199,7 @@ public class OrderLine extends OrderElement {
|
|||
}
|
||||
|
||||
/**
|
||||
* Operations for manipulating {@link HoursGroup}
|
||||
* Operations for manipulating {@link HoursGroup}.
|
||||
*/
|
||||
|
||||
public void setWorkHours(Integer workHours) throws IllegalArgumentException {
|
||||
|
|
@ -349,8 +349,7 @@ public class OrderLine extends OrderElement {
|
|||
}
|
||||
|
||||
@Override
|
||||
public DirectAdvanceAssignment calculateFakeDirectAdvanceAssignment(
|
||||
IndirectAdvanceAssignment indirectAdvanceAssignment) {
|
||||
public DirectAdvanceAssignment calculateFakeDirectAdvanceAssignment(IndirectAdvanceAssignment indirectAdvanceAssignment) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -37,58 +37,50 @@ import org.libreplan.business.util.deepcopy.Strategy;
|
|||
|
||||
public class CalculatedConsolidation extends Consolidation {
|
||||
|
||||
private SortedSet<CalculatedConsolidatedValue> consolidatedValues = new TreeSet<CalculatedConsolidatedValue>(
|
||||
new ConsolidatedValueComparator());
|
||||
|
||||
@AfterCopy
|
||||
private void instantiateConsolidatedValuesWithComparator() {
|
||||
SortedSet<CalculatedConsolidatedValue> previous = consolidatedValues;
|
||||
consolidatedValues = new TreeSet<CalculatedConsolidatedValue>(
|
||||
new ConsolidatedValueComparator());
|
||||
consolidatedValues.addAll(previous);
|
||||
}
|
||||
private SortedSet<CalculatedConsolidatedValue> consolidatedValues = new TreeSet<>(new ConsolidatedValueComparator());
|
||||
|
||||
@OnCopy(Strategy.SHARE)
|
||||
private IndirectAdvanceAssignment indirectAdvanceAssignment;
|
||||
|
||||
public static CalculatedConsolidation create(Task task,
|
||||
IndirectAdvanceAssignment indirectAdvanceAssignment) {
|
||||
return create(new CalculatedConsolidation(task,
|
||||
indirectAdvanceAssignment));
|
||||
}
|
||||
|
||||
public static CalculatedConsolidation create(Task task,
|
||||
IndirectAdvanceAssignment indirectAdvanceAssignment,
|
||||
SortedSet<CalculatedConsolidatedValue> consolidatedValues) {
|
||||
return create(new CalculatedConsolidation(task,
|
||||
indirectAdvanceAssignment,
|
||||
consolidatedValues));
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for {@link DeepCopy}. DO NOT USE!
|
||||
*/
|
||||
public CalculatedConsolidation() {
|
||||
|
||||
}
|
||||
|
||||
protected CalculatedConsolidation(Task task,
|
||||
IndirectAdvanceAssignment indirectAdvanceAssignment,
|
||||
SortedSet<CalculatedConsolidatedValue> consolidatedValues) {
|
||||
this(task, indirectAdvanceAssignment);
|
||||
this.setConsolidatedValues(consolidatedValues);
|
||||
}
|
||||
|
||||
public CalculatedConsolidation(Task task,
|
||||
IndirectAdvanceAssignment indirectAdvanceAssignment) {
|
||||
public CalculatedConsolidation(Task task, IndirectAdvanceAssignment indirectAdvanceAssignment) {
|
||||
super(task);
|
||||
this.indirectAdvanceAssignment = indirectAdvanceAssignment;
|
||||
}
|
||||
|
||||
protected CalculatedConsolidation(Task task, IndirectAdvanceAssignment indirectAdvanceAssignment,
|
||||
SortedSet<CalculatedConsolidatedValue> consolidatedValues) {
|
||||
|
||||
this(task, indirectAdvanceAssignment);
|
||||
this.setConsolidatedValues(consolidatedValues);
|
||||
}
|
||||
|
||||
@AfterCopy
|
||||
private void instantiateConsolidatedValuesWithComparator() {
|
||||
SortedSet<CalculatedConsolidatedValue> previous = consolidatedValues;
|
||||
consolidatedValues = new TreeSet<>(new ConsolidatedValueComparator());
|
||||
consolidatedValues.addAll(previous);
|
||||
}
|
||||
|
||||
public static CalculatedConsolidation create(Task task, IndirectAdvanceAssignment indirectAdvanceAssignment) {
|
||||
return create(new CalculatedConsolidation(task, indirectAdvanceAssignment));
|
||||
}
|
||||
|
||||
public static CalculatedConsolidation create(Task task, IndirectAdvanceAssignment indirectAdvanceAssignment,
|
||||
SortedSet<CalculatedConsolidatedValue> consolidatedValues) {
|
||||
|
||||
return create(new CalculatedConsolidation(task, indirectAdvanceAssignment, consolidatedValues));
|
||||
}
|
||||
|
||||
@Override
|
||||
public SortedSet<ConsolidatedValue> getConsolidatedValues() {
|
||||
SortedSet<ConsolidatedValue> result = new TreeSet<ConsolidatedValue>(
|
||||
new ConsolidatedValueComparator());
|
||||
SortedSet<ConsolidatedValue> result;
|
||||
result = new TreeSet<>(new ConsolidatedValueComparator());
|
||||
result.addAll(consolidatedValues);
|
||||
return result;
|
||||
}
|
||||
|
|
@ -97,13 +89,11 @@ public class CalculatedConsolidation extends Consolidation {
|
|||
return consolidatedValues;
|
||||
}
|
||||
|
||||
public void setConsolidatedValues(
|
||||
SortedSet<CalculatedConsolidatedValue> consolidatedValues) {
|
||||
public void setConsolidatedValues(SortedSet<CalculatedConsolidatedValue> consolidatedValues) {
|
||||
this.consolidatedValues = consolidatedValues;
|
||||
}
|
||||
|
||||
public void setIndirectAdvanceAssignment(
|
||||
IndirectAdvanceAssignment indirectAdvanceAssignment) {
|
||||
public void setIndirectAdvanceAssignment(IndirectAdvanceAssignment indirectAdvanceAssignment) {
|
||||
this.indirectAdvanceAssignment = indirectAdvanceAssignment;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,11 +28,9 @@ import java.lang.annotation.Target;
|
|||
|
||||
/**
|
||||
* @author Óscar González Fernández <ogonzalez@igalia.com>
|
||||
*
|
||||
*/
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.METHOD)
|
||||
public @interface AfterCopy {
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,18 +47,22 @@ import org.libreplan.business.workingday.EffortDuration;
|
|||
|
||||
/**
|
||||
* @author Óscar González Fernández <ogonzalez@igalia.com>
|
||||
*
|
||||
*/
|
||||
public class DeepCopy {
|
||||
private static Set<Class<?>> inmmutableTypes = new HashSet<Class<?>>(Arrays
|
||||
.<Class<?>> asList(Boolean.class, String.class, BigDecimal.class,
|
||||
Double.class, Float.class, Integer.class, Short.class,
|
||||
Byte.class, Character.class, LocalDate.class,
|
||||
DateTime.class, EffortDuration.class));
|
||||
|
||||
private static Set<Class<?>> inmmutableTypes = new HashSet<>(Arrays.<Class<?>>asList(
|
||||
Boolean.class, String.class, BigDecimal.class,
|
||||
Double.class, Float.class, Integer.class,
|
||||
Short.class, Byte.class, Character.class,
|
||||
LocalDate.class, DateTime.class, EffortDuration.class));
|
||||
|
||||
private static List<ICustomCopy> DEFAULT_CUSTOM_COPIERS =
|
||||
Arrays.asList(new DateCopy(), new SetCopy(), new MapCopy(), new ListCopy());
|
||||
|
||||
private Map<ByIdentity, Object> alreadyCopiedObjects = new HashMap<>();
|
||||
|
||||
public static boolean isImmutableType(Class<?> klass) {
|
||||
return klass.isPrimitive() || isEnum(klass)
|
||||
|| inmmutableTypes.contains(klass);
|
||||
return klass.isPrimitive() || isEnum(klass) || inmmutableTypes.contains(klass);
|
||||
}
|
||||
|
||||
private static boolean isEnum(Class<?> klass) {
|
||||
|
|
@ -69,16 +73,17 @@ public class DeepCopy {
|
|||
}
|
||||
currentClass = currentClass.getSuperclass();
|
||||
} while (currentClass != null);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public interface ICustomCopy {
|
||||
public boolean canHandle(Object object);
|
||||
|
||||
public Object instantiateCopy(Strategy strategy, Object originValue);
|
||||
boolean canHandle(Object object);
|
||||
|
||||
public void copyDataToResult(DeepCopy deepCopy, Object origin,
|
||||
Strategy strategy, Object result);
|
||||
Object instantiateCopy(Strategy strategy, Object originValue);
|
||||
|
||||
void copyDataToResult(DeepCopy deepCopy, Object origin, Strategy strategy, Object result);
|
||||
}
|
||||
|
||||
private static class DateCopy implements ICustomCopy {
|
||||
|
|
@ -89,9 +94,8 @@ public class DeepCopy {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void copyDataToResult(DeepCopy deepCopy, Object origin,
|
||||
Strategy strategy, Object result) {
|
||||
// already completed
|
||||
public void copyDataToResult(DeepCopy deepCopy, Object origin, Strategy strategy, Object result) {
|
||||
// Already completed
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -102,7 +106,7 @@ public class DeepCopy {
|
|||
|
||||
}
|
||||
|
||||
private static abstract class CollectionCopy implements ICustomCopy {
|
||||
private abstract static class CollectionCopy implements ICustomCopy {
|
||||
|
||||
@Override
|
||||
public Object instantiateCopy(Strategy strategy, Object originValue) {
|
||||
|
|
@ -112,13 +116,11 @@ public class DeepCopy {
|
|||
protected abstract Collection<Object> getResultData(Object originValue);
|
||||
|
||||
@Override
|
||||
public void copyDataToResult(DeepCopy deepCopy, Object origin,
|
||||
Strategy strategy, Object result) {
|
||||
public void copyDataToResult(DeepCopy deepCopy, Object origin, Strategy strategy, Object result) {
|
||||
copy(deepCopy, origin, strategy, (Collection<Object>) result);
|
||||
}
|
||||
|
||||
private void copy(DeepCopy deepCopy, Object origin, Strategy strategy,
|
||||
Collection<Object> destination) {
|
||||
private void copy(DeepCopy deepCopy, Object origin, Strategy strategy, Collection<Object> destination) {
|
||||
Strategy childrenStrategy = getChildrenStrategy(strategy);
|
||||
for (Object each : originDataAsIterable(origin)) {
|
||||
destination.add(deepCopy.copy(each, childrenStrategy));
|
||||
|
|
@ -126,10 +128,7 @@ public class DeepCopy {
|
|||
}
|
||||
|
||||
private Strategy getChildrenStrategy(Strategy strategy) {
|
||||
if (strategy == Strategy.SHARE_COLLECTION_ELEMENTS) {
|
||||
return Strategy.SHARE;
|
||||
}
|
||||
return strategy;
|
||||
return strategy == Strategy.SHARE_COLLECTION_ELEMENTS ? Strategy.SHARE : strategy;
|
||||
}
|
||||
|
||||
private Iterable<Object> originDataAsIterable(Object originValue) {
|
||||
|
|
@ -153,10 +152,7 @@ public class DeepCopy {
|
|||
return new ImplementationInstantiation() {
|
||||
@Override
|
||||
protected Set<?> createDefault() {
|
||||
if (SortedSet.class.isAssignableFrom(klass)) {
|
||||
return new TreeSet<Object>();
|
||||
}
|
||||
return new HashSet<Object>();
|
||||
return SortedSet.class.isAssignableFrom(klass) ? new TreeSet<>() : new HashSet<>();
|
||||
}
|
||||
}.instantiate(klass);
|
||||
}
|
||||
|
|
@ -177,21 +173,20 @@ public class DeepCopy {
|
|||
return new ImplementationInstantiation() {
|
||||
@Override
|
||||
protected Object createDefault() {
|
||||
return new HashMap<Object, Object>();
|
||||
return new HashMap<>();
|
||||
}
|
||||
}.instantiate(klass);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void copyDataToResult(DeepCopy deepCopy, Object origin,
|
||||
Strategy strategy, Object result) {
|
||||
doCopy(deepCopy, (Map<?, ?>) ((Map<?, ?>) origin), strategy, ((Map<Object, Object>) result));
|
||||
public void copyDataToResult(DeepCopy deepCopy, Object origin, Strategy strategy, Object result) {
|
||||
doCopy(deepCopy, (Map<?, ?>) origin, strategy, ((Map<Object, Object>) result));
|
||||
}
|
||||
|
||||
private void doCopy(DeepCopy deepCopy, Map<?, ?> origin,
|
||||
Strategy strategy, Map<Object, Object> resultMap) {
|
||||
private void doCopy(DeepCopy deepCopy, Map<?, ?> origin, Strategy strategy, Map<Object, Object> resultMap) {
|
||||
Strategy keyStrategy = getKeysStrategy(strategy);
|
||||
Strategy valueStrategy = getValuesStrategy(strategy);
|
||||
|
||||
for (Entry<?, ?> entry : origin.entrySet()) {
|
||||
Object key = deepCopy.copy(entry.getKey(), keyStrategy);
|
||||
Object value = deepCopy.copy(entry.getValue(), valueStrategy);
|
||||
|
|
@ -200,19 +195,15 @@ public class DeepCopy {
|
|||
}
|
||||
|
||||
private Strategy getKeysStrategy(Strategy strategy) {
|
||||
if (Strategy.ONLY_SHARE_KEYS == strategy
|
||||
|| Strategy.SHARE_COLLECTION_ELEMENTS == strategy) {
|
||||
return Strategy.SHARE;
|
||||
}
|
||||
return strategy;
|
||||
return Strategy.ONLY_SHARE_KEYS == strategy || Strategy.SHARE_COLLECTION_ELEMENTS == strategy
|
||||
? Strategy.SHARE
|
||||
: strategy;
|
||||
}
|
||||
|
||||
private Strategy getValuesStrategy(Strategy strategy) {
|
||||
if (Strategy.ONLY_SHARE_VALUES == strategy
|
||||
|| Strategy.SHARE_COLLECTION_ELEMENTS == strategy) {
|
||||
return Strategy.SHARE;
|
||||
}
|
||||
return strategy;
|
||||
return Strategy.ONLY_SHARE_VALUES == strategy || Strategy.SHARE_COLLECTION_ELEMENTS == strategy
|
||||
? Strategy.SHARE
|
||||
: strategy;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -232,7 +223,7 @@ public class DeepCopy {
|
|||
return new ImplementationInstantiation() {
|
||||
@Override
|
||||
protected Object createDefault() {
|
||||
return new ArrayList<Object>();
|
||||
return new ArrayList<>();
|
||||
}
|
||||
}.instantiate(klass);
|
||||
}
|
||||
|
|
@ -242,8 +233,8 @@ public class DeepCopy {
|
|||
private static abstract class ImplementationInstantiation {
|
||||
|
||||
private static final String[] VETOED_IMPLEMENTATIONS = {
|
||||
"PersistentSet", "PersistentList", "PersistentMap",
|
||||
"PersistentSortedSet" };
|
||||
"PersistentSet", "PersistentList", "PersistentMap", "PersistentSortedSet"
|
||||
};
|
||||
|
||||
ImplementationInstantiation() {
|
||||
}
|
||||
|
|
@ -251,10 +242,9 @@ public class DeepCopy {
|
|||
<T> T instantiate(Class<?> type) {
|
||||
if (!isVetoed(type)) {
|
||||
try {
|
||||
Constructor<? extends Object> constructor = type
|
||||
.getConstructor();
|
||||
Constructor<? extends Object> constructor = type.getConstructor();
|
||||
return (T) type.cast(constructor.newInstance());
|
||||
} catch (Exception e) {
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
return (T) createDefault();
|
||||
|
|
@ -273,12 +263,6 @@ public class DeepCopy {
|
|||
protected abstract Object createDefault();
|
||||
}
|
||||
|
||||
private static List<ICustomCopy> DEFAULT_CUSTOM_COPIERS = Arrays
|
||||
.<ICustomCopy> asList(new DateCopy(), new SetCopy(), new MapCopy(),
|
||||
new ListCopy());
|
||||
|
||||
private Map<ByIdentity, Object> alreadyCopiedObjects = new HashMap<ByIdentity, Object>();
|
||||
|
||||
private static class ByIdentity {
|
||||
|
||||
private final Object wrapped;
|
||||
|
|
@ -318,13 +302,16 @@ public class DeepCopy {
|
|||
if (couldBeProxyValue == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
T value = desproxify(couldBeProxyValue);
|
||||
if (alreadyCopiedObjects.containsKey(byIdentity(value))) {
|
||||
return (T) alreadyCopiedObjects.get(byIdentity(value));
|
||||
}
|
||||
|
||||
if (Strategy.SHARE == strategy || isImmutable(value)) {
|
||||
return value;
|
||||
}
|
||||
|
||||
ICustomCopy copier = findCopier(value);
|
||||
if (copier != null) {
|
||||
Object resultData = copier.instantiateCopy(strategy, value);
|
||||
|
|
@ -332,18 +319,18 @@ public class DeepCopy {
|
|||
copier.copyDataToResult(this, value, strategy, resultData);
|
||||
return (T) resultData;
|
||||
}
|
||||
|
||||
T result = instantiateUsingDefaultConstructor(getTypedClassFrom(value));
|
||||
alreadyCopiedObjects.put(byIdentity(value), result);
|
||||
copyProperties(value, result);
|
||||
callAferCopyHooks(result);
|
||||
callAfterCopyHooks(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
private <T> T desproxify(T value) {
|
||||
if (value instanceof HibernateProxy) {
|
||||
HibernateProxy proxy = (HibernateProxy) value;
|
||||
return (T) proxy.getHibernateLazyInitializer()
|
||||
.getImplementation();
|
||||
return (T) proxy.getHibernateLazyInitializer().getImplementation();
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
|
@ -364,9 +351,7 @@ public class DeepCopy {
|
|||
} catch (SecurityException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (NoSuchMethodException e) {
|
||||
throw new IllegalArgumentException(
|
||||
"could not invoke default no-args constructor for "
|
||||
+ klass, e);
|
||||
throw new IllegalArgumentException("could not invoke default no-args constructor for " + klass, e);
|
||||
}
|
||||
try {
|
||||
return constructor.newInstance();
|
||||
|
|
@ -382,7 +367,7 @@ public class DeepCopy {
|
|||
if (!isIgnored(each)) {
|
||||
Object sourceValue = readFieldValue(source, each);
|
||||
if (sourceValue != null) {
|
||||
Strategy strategy = getStrategy(each, sourceValue);
|
||||
Strategy strategy = getStrategy(each);
|
||||
try {
|
||||
writeFieldValue(target, each, copy(sourceValue, strategy));
|
||||
} catch (Exception e) {
|
||||
|
|
@ -395,7 +380,7 @@ public class DeepCopy {
|
|||
}
|
||||
|
||||
private List<Field> getAllFieldsFor(Object source) {
|
||||
List<Field> result = new ArrayList<Field>();
|
||||
List<Field> result = new ArrayList<>();
|
||||
Class<? extends Object> currentClass = source.getClass();
|
||||
while (currentClass != null) {
|
||||
result.addAll(Arrays.asList(currentClass.getDeclaredFields()));
|
||||
|
|
@ -433,7 +418,7 @@ public class DeepCopy {
|
|||
}
|
||||
}
|
||||
|
||||
private Strategy getStrategy(Field field, Object sourceValue) {
|
||||
private Strategy getStrategy(Field field) {
|
||||
OnCopy onCopy = field.getAnnotation(OnCopy.class);
|
||||
return onCopy != null ? onCopy.value() : null;
|
||||
}
|
||||
|
|
@ -447,7 +432,7 @@ public class DeepCopy {
|
|||
return null;
|
||||
}
|
||||
|
||||
private void callAferCopyHooks(Object value) {
|
||||
private void callAfterCopyHooks(Object value) {
|
||||
assert value != null;
|
||||
for (Method each : getAfterCopyHooks(value.getClass())) {
|
||||
each.setAccessible(true);
|
||||
|
|
@ -461,7 +446,7 @@ public class DeepCopy {
|
|||
|
||||
private List<Method> getAfterCopyHooks(Class<?> klass) {
|
||||
Class<?> current = klass;
|
||||
List<Method> result = new ArrayList<Method>();
|
||||
List<Method> result = new ArrayList<>();
|
||||
while (current != null) {
|
||||
result.addAll(getAfterCopyDeclaredAt(current));
|
||||
current = current.getSuperclass();
|
||||
|
|
@ -470,7 +455,7 @@ public class DeepCopy {
|
|||
}
|
||||
|
||||
private List<Method> getAfterCopyDeclaredAt(Class<?> klass) {
|
||||
List<Method> result = new ArrayList<Method>();
|
||||
List<Method> result = new ArrayList<>();
|
||||
for (Method each : klass.getDeclaredMethods()) {
|
||||
if (isAfterCopyHook(each)) {
|
||||
result.add(each);
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ import java.util.LinkedList;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.Collections;
|
||||
|
||||
import org.hamcrest.BaseMatcher;
|
||||
import org.hamcrest.Description;
|
||||
|
|
@ -58,7 +59,6 @@ import org.libreplan.business.util.deepcopy.EntityExamples.TestEnum;
|
|||
|
||||
/**
|
||||
* @author Óscar González Fernández <ogonzalez@igalia.com>
|
||||
*
|
||||
*/
|
||||
public class DeepCopyTest {
|
||||
|
||||
|
|
@ -69,8 +69,7 @@ public class DeepCopyTest {
|
|||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void theEntityToCopyMustHaveNotEmptyConstructor() {
|
||||
EntityWithoutNoArgsConstructor entity = new EntityWithoutNoArgsConstructor(
|
||||
"bla");
|
||||
EntityWithoutNoArgsConstructor entity = new EntityWithoutNoArgsConstructor("bla");
|
||||
new DeepCopy().copy(entity);
|
||||
}
|
||||
|
||||
|
|
@ -106,11 +105,13 @@ public class DeepCopyTest {
|
|||
|
||||
@Test
|
||||
public void itKnowsSomeTypesAreImmutable() {
|
||||
Iterable<Class<?>> immutableTypes = Arrays.<Class<?>> asList(
|
||||
Iterable<Class<?>> immutableTypes = Arrays.asList(
|
||||
String.class, BigDecimal.class, Double.class, Float.class,
|
||||
Integer.class, Short.class, Byte.class, Character.class,
|
||||
LocalDate.class, Boolean.class, DateTime.class, double.class,
|
||||
float.class, int.class, short.class, byte.class, char.class);
|
||||
float.class, int.class, short.class, byte.class,
|
||||
char.class);
|
||||
|
||||
assertThat(immutableTypes, everyItem(immutable()));
|
||||
}
|
||||
|
||||
|
|
@ -150,8 +151,7 @@ public class DeepCopyTest {
|
|||
@Test
|
||||
public void setsAreCopied() {
|
||||
EntityA entityA = new EntityA();
|
||||
HashSet<Object> originalSet = new HashSet<Object>(asList("test",
|
||||
2, 3, new Date()));
|
||||
HashSet<Object> originalSet = new HashSet<>(asList("test", 2, 3, new Date()));
|
||||
entityA.setSetProperty(originalSet);
|
||||
EntityA copy = new DeepCopy().copy(entityA);
|
||||
assertEquals(originalSet, copy.getSetProperty());
|
||||
|
|
@ -161,8 +161,7 @@ public class DeepCopyTest {
|
|||
@Test
|
||||
public void theSetImplementationClassIsPreservedIfPossible() {
|
||||
EntityA entityA = new EntityA();
|
||||
Set<Object> originalSet = new LinkedHashSet<Object>(asList("test", 2,
|
||||
3, new Date()));
|
||||
Set<Object> originalSet = new LinkedHashSet<>(asList("test", 2, 3, new Date()));
|
||||
entityA.setSetProperty(originalSet);
|
||||
EntityA copy = new DeepCopy().copy(entityA);
|
||||
assertThat(copy.getSetProperty(), instanceOf(LinkedHashSet.class));
|
||||
|
|
@ -171,9 +170,8 @@ public class DeepCopyTest {
|
|||
@Test
|
||||
public void setsInsideSetsAreRecursivelyCopiedWithoutProblem() {
|
||||
EntityA entityA = new EntityA();
|
||||
HashSet<Object> innerSet = new HashSet<Object>(asList("bla", 3));
|
||||
HashSet<Object> originalSet = new HashSet<Object>(asList("test", 2, 3,
|
||||
new Date(), innerSet));
|
||||
HashSet<Object> innerSet = new HashSet<>(asList("bla", 3));
|
||||
HashSet<Object> originalSet = new HashSet<>(asList("test", 2, 3, new Date(), innerSet));
|
||||
entityA.setSetProperty(originalSet);
|
||||
EntityA copy = new DeepCopy().copy(entityA);
|
||||
assertEquals(originalSet, copy.getSetProperty());
|
||||
|
|
@ -183,7 +181,7 @@ public class DeepCopyTest {
|
|||
@Test
|
||||
public void mapsAreCopied() {
|
||||
EntityA entityA = new EntityA();
|
||||
HashMap<Object, Object> originalMap = new HashMap<Object, Object>();
|
||||
HashMap<Object, Object> originalMap = new HashMap<>();
|
||||
originalMap.put("aa", "blabla");
|
||||
entityA.setMapProperty(originalMap);
|
||||
EntityA copy = new DeepCopy().copy(entityA);
|
||||
|
|
@ -194,7 +192,7 @@ public class DeepCopyTest {
|
|||
@Test
|
||||
public void mapImplementationIsPreservedIfPossible() {
|
||||
EntityA entityA = new EntityA();
|
||||
LinkedHashMap<Object, Object> mapProperty = new LinkedHashMap<Object, Object>();
|
||||
LinkedHashMap<Object, Object> mapProperty = new LinkedHashMap<>();
|
||||
mapProperty.put("ab", "abc");
|
||||
entityA.setMapProperty(mapProperty);
|
||||
EntityA copy = new DeepCopy().copy(entityA);
|
||||
|
|
@ -204,7 +202,7 @@ public class DeepCopyTest {
|
|||
@Test
|
||||
public void listsAreCopied() {
|
||||
EntityA entityA = new EntityA();
|
||||
ArrayList<Object> originalList = new ArrayList<Object>();
|
||||
ArrayList<Object> originalList = new ArrayList<>();
|
||||
originalList.add(2);
|
||||
originalList.add(10);
|
||||
originalList.add("abla");
|
||||
|
|
@ -217,7 +215,7 @@ public class DeepCopyTest {
|
|||
@Test
|
||||
public void listImplementationIsPreservedIfPossible() {
|
||||
EntityA entityA = new EntityA();
|
||||
LinkedList<Object> originalList = new LinkedList<Object>();
|
||||
LinkedList<Object> originalList = new LinkedList<>();
|
||||
originalList.add(2);
|
||||
entityA.setListProperty(originalList);
|
||||
EntityA copy = new DeepCopy().copy(entityA);
|
||||
|
|
@ -244,7 +242,7 @@ public class DeepCopyTest {
|
|||
@Test
|
||||
public void sharedCollectionsAreCopiedWithTheSameReference() {
|
||||
EntityA entityA = new EntityA();
|
||||
List<String> originalList = Arrays.asList("bla");
|
||||
List<String> originalList = Collections.singletonList("bla");
|
||||
entityA.setSharedListProperty(originalList);
|
||||
EntityA copy = new DeepCopy().copy(entityA);
|
||||
assertSame(originalList, copy.getSharedListProperty());
|
||||
|
|
@ -253,64 +251,54 @@ public class DeepCopyTest {
|
|||
@Test
|
||||
public void sharedCollectionElementsKeptTheReferences() {
|
||||
EntityA entityA = new EntityA();
|
||||
HashSet<Object> originalSet = new HashSet<Object>();
|
||||
HashSet<Object> originalSet = new HashSet<>();
|
||||
originalSet.add(new Date());
|
||||
entityA.setSharedElementsProperty(originalSet);
|
||||
EntityA copy = new DeepCopy().copy(entityA);
|
||||
assertNotSame(originalSet, copy.getSharedElementsProperty());
|
||||
assertSame(originalSet.iterator().next(), copy
|
||||
.getSharedElementsProperty().iterator().next());
|
||||
assertSame(originalSet.iterator().next(), copy.getSharedElementsProperty().iterator().next());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void sharedKeyElementsKeepTheSameReferencesForTheKeys() {
|
||||
EntityA entityA = new EntityA();
|
||||
Map<Object, Object> originalMap = new HashMap<Object, Object>();
|
||||
Map<Object, Object> originalMap = new HashMap<>();
|
||||
EntityA originalValue = new EntityA();
|
||||
Date originalKey = new Date();
|
||||
originalMap.put(originalKey, originalValue);
|
||||
entityA.setSharedKeysMapProperty(originalMap);
|
||||
EntityA copy = new DeepCopy().copy(entityA);
|
||||
Map<Object, Object> sharedKeysMapProperty = copy
|
||||
.getSharedKeysMapProperty();
|
||||
assertSame(originalKey, sharedKeysMapProperty.keySet().iterator()
|
||||
.next());
|
||||
assertNotSame(originalValue, sharedKeysMapProperty.values().iterator()
|
||||
.next());
|
||||
Map<Object, Object> sharedKeysMapProperty = copy.getSharedKeysMapProperty();
|
||||
assertSame(originalKey, sharedKeysMapProperty.keySet().iterator().next());
|
||||
assertNotSame(originalValue, sharedKeysMapProperty.values().iterator().next());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void sharedValueElementsKeepTheSameReferencesForTheValues() {
|
||||
EntityA entityA = new EntityA();
|
||||
Map<Object, Object> originalMap = new HashMap<Object, Object>();
|
||||
Map<Object, Object> originalMap = new HashMap<>();
|
||||
EntityA originalValue = new EntityA();
|
||||
Date originalKey = new Date();
|
||||
originalMap.put(originalKey, originalValue);
|
||||
entityA.setSharedValuesMapProperty(originalMap);
|
||||
EntityA copy = new DeepCopy().copy(entityA);
|
||||
Map<Object, Object> copiedMap = copy
|
||||
.getSharedValuesMapProperty();
|
||||
assertNotSame(originalKey, copiedMap.keySet().iterator()
|
||||
.next());
|
||||
assertSame(originalValue, copiedMap.values().iterator()
|
||||
.next());
|
||||
Map<Object, Object> copiedMap = copy.getSharedValuesMapProperty();
|
||||
assertNotSame(originalKey, copiedMap.keySet().iterator().next());
|
||||
assertSame(originalValue, copiedMap.values().iterator().next());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void aSharedCollectionElementsMapKeepTheSameReferencesForTheKeysAndTheValues() {
|
||||
EntityA entityA = new EntityA();
|
||||
Map<Object, Object> originalMap = new HashMap<Object, Object>();
|
||||
Map<Object, Object> originalMap = new HashMap<>();
|
||||
EntityA originalValue = new EntityA();
|
||||
Date originalKey = new Date();
|
||||
originalMap.put(originalKey, originalValue);
|
||||
entityA.setSharedCollectionElementsMapProperty(originalMap);
|
||||
EntityA copy = new DeepCopy().copy(entityA);
|
||||
Map<Object, Object> copiedMap = copy
|
||||
.getSharedCollectionElementsMapProperty();
|
||||
assertSame(originalKey, copiedMap.keySet().iterator()
|
||||
.next());
|
||||
assertSame(originalValue, copiedMap.values().iterator()
|
||||
.next());
|
||||
Map<Object, Object> copiedMap = copy.getSharedCollectionElementsMapProperty();
|
||||
assertSame(originalKey, copiedMap.keySet().iterator().next());
|
||||
assertSame(originalValue, copiedMap.values().iterator().next());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -342,12 +330,11 @@ public class DeepCopyTest {
|
|||
EntityA entityA = new EntityA();
|
||||
parent.setEntityAProperty(entityA);
|
||||
entityA.setParentProperty(parent);
|
||||
HashSet<Object> originalSet = new HashSet<Object>();
|
||||
HashSet<Object> originalSet = new HashSet<>();
|
||||
parent.setSetProperty(originalSet);
|
||||
entityA.setSetProperty(originalSet);
|
||||
Parent copy = new DeepCopy().copy(parent);
|
||||
assertSame(copy.getSetProperty(), copy.getEntityAProperty()
|
||||
.getSetProperty());
|
||||
assertSame(copy.getSetProperty(), copy.getEntityAProperty().getSetProperty());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -382,8 +369,8 @@ public class DeepCopyTest {
|
|||
public void equalObjectsButDifferentAreNotReused() {
|
||||
EntityA entityA = new EntityA();
|
||||
DeepCopy deepCopy = new DeepCopy();
|
||||
entityA.setSet1(new HashSet<Object>());
|
||||
entityA.setSet2(new HashSet<Object>());
|
||||
entityA.setSet1(new HashSet<>());
|
||||
entityA.setSet2(new HashSet<>());
|
||||
EntityA copied = deepCopy.copy(entityA);
|
||||
assertNotSame(copied.getSet1(), copied.getSet2());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@ import java.util.Set;
|
|||
|
||||
/**
|
||||
* @author Óscar González Fernández <ogonzalez@igalia.com>
|
||||
*
|
||||
*/
|
||||
public class EntityExamples {
|
||||
|
||||
|
|
@ -40,15 +39,14 @@ public class EntityExamples {
|
|||
public enum TestEnum {
|
||||
A {
|
||||
},
|
||||
B;
|
||||
B
|
||||
}
|
||||
|
||||
public static class Parent {
|
||||
|
||||
private EntityA entityAProperty;
|
||||
|
||||
private String prueba = "bar";
|
||||
|
||||
private Set<Object> setProperty = new HashSet<Object>();
|
||||
private Set<Object> setProperty = new HashSet<>();
|
||||
|
||||
public EntityA getEntityAProperty() {
|
||||
return entityAProperty;
|
||||
|
|
@ -70,9 +68,8 @@ public class EntityExamples {
|
|||
|
||||
public static class EntityA {
|
||||
|
||||
private static final String staticProperty = "foo";
|
||||
|
||||
private final String finalProperty = "bar";
|
||||
|
||||
private String stringProperty;
|
||||
|
||||
private int intProperty = 2;
|
||||
|
|
@ -83,7 +80,7 @@ public class EntityExamples {
|
|||
|
||||
private Set<Object> setProperty;
|
||||
|
||||
private Map<Object, Object> mapProperty = new HashMap<Object, Object>();
|
||||
private Map<Object, Object> mapProperty = new HashMap<>();
|
||||
|
||||
private List<Object> listProperty;
|
||||
|
||||
|
|
@ -314,9 +311,6 @@ public class EntityExamples {
|
|||
}
|
||||
|
||||
public static class SubClassExample extends SuperclassExample {
|
||||
|
||||
private int intProperty;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -593,11 +593,11 @@ public abstract class AllocationRow {
|
|||
}
|
||||
|
||||
private Constraint constraintForHoursInput() {
|
||||
return (effortInput.isDisabled()) ? null : CONSTRAINT_FOR_HOURS_INPUT;
|
||||
return effortInput.isDisabled() ? null : CONSTRAINT_FOR_HOURS_INPUT;
|
||||
}
|
||||
|
||||
private Constraint constraintForResourcesPerDayInput() {
|
||||
return (intendedResourcesPerDayInput.isDisabled()) ? null : CONSTRAINT_FOR_RESOURCES_PER_DAY;
|
||||
return intendedResourcesPerDayInput.isDisabled() ? null : CONSTRAINT_FOR_RESOURCES_PER_DAY;
|
||||
}
|
||||
|
||||
private void updateUIWithModificationsDone() {
|
||||
|
|
|
|||
|
|
@ -141,8 +141,10 @@ public class ResourceAllocationController extends GenericForwardComposer {
|
|||
|
||||
private EditTaskController editTaskController;
|
||||
|
||||
public ResourceAllocationController(){
|
||||
resourceAllocationModel = (IResourceAllocationModel) SpringUtil.getBean("resourceAllocationModel");
|
||||
public ResourceAllocationController() {
|
||||
if ( resourceAllocationModel == null ) {
|
||||
resourceAllocationModel = (IResourceAllocationModel) SpringUtil.getBean("resourceAllocationModel");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -508,7 +510,6 @@ public class ResourceAllocationController extends GenericForwardComposer {
|
|||
private List<Object> plusAggregatingRow(List<AllocationRow> currentRows) {
|
||||
List<Object> result = new ArrayList<>(currentRows);
|
||||
result.add(null);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ public class AdvanceConsolidationModel implements IAdvanceConsolidationModel {
|
|||
private void createConsolidationIfNeeded() {
|
||||
if (consolidation == null && task != null) {
|
||||
if (advanceIsCalculated()) {
|
||||
IndirectAdvanceAssignment indirectAdvanceAssignment = getIndirecAdvanceAssignment();
|
||||
IndirectAdvanceAssignment indirectAdvanceAssignment = getIndirectAdvanceAssignment();
|
||||
consolidation = CalculatedConsolidation.create(task, indirectAdvanceAssignment);
|
||||
} else {
|
||||
consolidation = NonCalculatedConsolidation.create(task, spreadAdvance);
|
||||
|
|
@ -167,7 +167,7 @@ public class AdvanceConsolidationModel implements IAdvanceConsolidationModel {
|
|||
}
|
||||
}
|
||||
|
||||
private IndirectAdvanceAssignment getIndirecAdvanceAssignment() {
|
||||
private IndirectAdvanceAssignment getIndirectAdvanceAssignment() {
|
||||
if (orderElement != null) {
|
||||
Set<IndirectAdvanceAssignment> indirects = orderElement.getIndirectAdvanceAssignments();
|
||||
for (IndirectAdvanceAssignment indirectAdvanceAssignment : indirects) {
|
||||
|
|
@ -331,7 +331,7 @@ public class AdvanceConsolidationModel implements IAdvanceConsolidationModel {
|
|||
|
||||
private void removeConsolidationInAdvance() {
|
||||
if (advanceIsCalculated()) {
|
||||
IndirectAdvanceAssignment indirectAdvanceAssignment = getIndirecAdvanceAssignment();
|
||||
IndirectAdvanceAssignment indirectAdvanceAssignment = getIndirectAdvanceAssignment();
|
||||
indirectAdvanceAssignment.getCalculatedConsolidation().remove(consolidation);
|
||||
((CalculatedConsolidation) consolidation).setIndirectAdvanceAssignment(null);
|
||||
} else {
|
||||
|
|
@ -342,7 +342,7 @@ public class AdvanceConsolidationModel implements IAdvanceConsolidationModel {
|
|||
|
||||
private void addConsolidationInAdvance() {
|
||||
if (advanceIsCalculated()) {
|
||||
IndirectAdvanceAssignment indirectAdvanceAssignment = getIndirecAdvanceAssignment();
|
||||
IndirectAdvanceAssignment indirectAdvanceAssignment = getIndirectAdvanceAssignment();
|
||||
if (!indirectAdvanceAssignment.getCalculatedConsolidation().contains(consolidation)) {
|
||||
indirectAdvanceAssignment.getCalculatedConsolidation().add((CalculatedConsolidation) consolidation);
|
||||
((CalculatedConsolidation) consolidation).setIndirectAdvanceAssignment(indirectAdvanceAssignment);
|
||||
|
|
@ -368,7 +368,6 @@ public class AdvanceConsolidationModel implements IAdvanceConsolidationModel {
|
|||
private void initTask(Task task) {
|
||||
this.task = task;
|
||||
taskElementDAO.reattach(this.task);
|
||||
|
||||
orderElement = task.getOrderElement();
|
||||
orderElementDAO.reattach(orderElement);
|
||||
}
|
||||
|
|
@ -387,7 +386,7 @@ public class AdvanceConsolidationModel implements IAdvanceConsolidationModel {
|
|||
|
||||
private void initAdvanceConsolidationsDTOs() {
|
||||
if (spreadAdvance != null) {
|
||||
isUnitType = (!spreadAdvance.getAdvanceType().getPercentage());
|
||||
isUnitType = !spreadAdvance.getAdvanceType().getPercentage();
|
||||
createAdvanceConsolidationDTOs();
|
||||
initConsolidatedDates();
|
||||
addNonConsolidatedAdvances();
|
||||
|
|
@ -398,7 +397,7 @@ public class AdvanceConsolidationModel implements IAdvanceConsolidationModel {
|
|||
private void initSpreadAdvance() {
|
||||
if (spreadAdvance != null) {
|
||||
if (advanceIsCalculated()) {
|
||||
IndirectAdvanceAssignment indirectAdvanceAssignment = getIndirecAdvanceAssignment();
|
||||
IndirectAdvanceAssignment indirectAdvanceAssignment = getIndirectAdvanceAssignment();
|
||||
indirectAdvanceAssignment.getCalculatedConsolidation().size();
|
||||
} else {
|
||||
spreadAdvance.getNonCalculatedConsolidation().size();
|
||||
|
|
@ -447,7 +446,7 @@ public class AdvanceConsolidationModel implements IAdvanceConsolidationModel {
|
|||
|
||||
private boolean canBeConsolidateAndShow(AdvanceMeasurement advanceMeasurement) {
|
||||
Date date = advanceMeasurement.getDate().toDateTimeAtStartOfDay().toDate();
|
||||
return ((AdvanceConsolidationDTO.canBeConsolidateAndShow(date)) && (!containsAdvance(advanceMeasurement)));
|
||||
return AdvanceConsolidationDTO.canBeConsolidateAndShow(date) && !containsAdvance(advanceMeasurement);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -469,10 +468,7 @@ public class AdvanceConsolidationModel implements IAdvanceConsolidationModel {
|
|||
}
|
||||
|
||||
private List<AdvanceMeasurement> getAdvances() {
|
||||
if (spreadAdvance != null) {
|
||||
return new ArrayList<>(spreadAdvance.getAdvanceMeasurements());
|
||||
}
|
||||
return new ArrayList<>();
|
||||
return spreadAdvance != null ? new ArrayList<>(spreadAdvance.getAdvanceMeasurements()) : new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -490,10 +486,9 @@ public class AdvanceConsolidationModel implements IAdvanceConsolidationModel {
|
|||
}
|
||||
|
||||
public String infoMessages() {
|
||||
if (getAdvances().size() > 0) {
|
||||
return _("Progress cannot be consolidated.");
|
||||
}
|
||||
return _("There is not any assigned progress to current task");
|
||||
return getAdvances().size() > 0
|
||||
? _("Progress cannot be consolidated.")
|
||||
: _("There is not any assigned progress to current task");
|
||||
}
|
||||
|
||||
public void setConsolidationDTOs(List<AdvanceConsolidationDTO> consolidationDTOs) {
|
||||
|
|
@ -501,10 +496,7 @@ public class AdvanceConsolidationModel implements IAdvanceConsolidationModel {
|
|||
}
|
||||
|
||||
public List<AdvanceConsolidationDTO> getConsolidationDTOs() {
|
||||
if (spreadAdvance != null && orderElement != null) {
|
||||
return consolidationDTOs;
|
||||
}
|
||||
return new ArrayList<>();
|
||||
return spreadAdvance != null && orderElement != null ? consolidationDTOs : new ArrayList<>();
|
||||
}
|
||||
|
||||
private boolean hasResourceAllocation() {
|
||||
|
|
|
|||
|
|
@ -34,7 +34,6 @@ import javax.xml.bind.Marshaller;
|
|||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.cxf.jaxrs.client.WebClient;
|
||||
import org.libreplan.business.common.daos.IConfigurationDAO;
|
||||
import org.libreplan.business.common.exceptions.InstanceNotFoundException;
|
||||
import org.libreplan.business.externalcompanies.entities.ExternalCompany;
|
||||
import org.libreplan.business.orders.daos.IOrderDAO;
|
||||
|
|
@ -89,9 +88,6 @@ public class SubcontractedTasksModel implements ISubcontractedTasksModel {
|
|||
@Autowired
|
||||
private IOrderDAO orderDAO;
|
||||
|
||||
@Autowired
|
||||
private IConfigurationDAO configurationDAO;
|
||||
|
||||
@Override
|
||||
@Transactional(readOnly = true)
|
||||
public List<SubcontractedTaskData> getSubcontractedTasks() {
|
||||
|
|
|
|||
|
|
@ -44,6 +44,10 @@ public class OrderElementWithAdvanceMeasurementsOrEndDateListDTO {
|
|||
@XmlElement(name = "order-element")
|
||||
public List<OrderElementWithAdvanceMeasurementsOrEndDateDTO> orderElements = new ArrayList<>();
|
||||
|
||||
/** Do not remove default constructor */
|
||||
public OrderElementWithAdvanceMeasurementsOrEndDateListDTO() {
|
||||
}
|
||||
|
||||
public OrderElementWithAdvanceMeasurementsOrEndDateListDTO(
|
||||
String externalCompanyNif, List<OrderElementWithAdvanceMeasurementsOrEndDateDTO> orderElements) {
|
||||
|
||||
|
|
|
|||
|
|
@ -18,13 +18,13 @@
|
|||
<http auto-config="false" realm="LibrePlan Web Application" >
|
||||
|
||||
<!-- Web services -->
|
||||
<intercept-url pattern="/ws/rest/bounduser/**" access="ROLE_BOUND_USER" method="GET" />
|
||||
<intercept-url pattern="/ws/rest/bounduser/**" access="ROLE_BOUND_USER" method="POST" />
|
||||
<intercept-url pattern="/ws/rest/subcontracting/**" access="ROLE_WS_SUBCONTRACTING" method="GET" />
|
||||
<intercept-url pattern="/ws/rest/subcontracting/**" access="ROLE_WS_SUBCONTRACTING" method="POST" />
|
||||
<intercept-url pattern="/ws/rest/**" access="ROLE_WS_READER" method="GET" />
|
||||
<intercept-url pattern="/ws/rest/**" access="ROLE_WS_WRITER" method="POST" />
|
||||
<intercept-url pattern="/ws/rest/**" access="ROLE_WS_WRITER" method="DELETE" />
|
||||
<intercept-url pattern="/ws/rest/bounduser/**" access="hasAnyRole('ROLE_BOUND_USER')" method="GET" />
|
||||
<intercept-url pattern="/ws/rest/bounduser/**" access="hasAnyRole('ROLE_BOUND_USER')" method="POST" />
|
||||
<intercept-url pattern="/ws/rest/subcontracting/**" access="hasAnyRole('ROLE_WS_SUBCONTRACTING')" method="GET" />
|
||||
<intercept-url pattern="/ws/rest/subcontracting/**" access="hasAnyRole('ROLE_WS_SUBCONTRACTING')" method="POST" />
|
||||
<intercept-url pattern="/ws/rest/**" access="hasAnyRole('ROLE_WS_READER')" method="GET" />
|
||||
<intercept-url pattern="/ws/rest/**" access="hasAnyRole('ROLE_WS_WRITER')" method="POST" />
|
||||
<intercept-url pattern="/ws/rest/**" access="hasAnyRole('ROLE_WS_WRITER')" method="DELETE" />
|
||||
|
||||
<!-- Web application -->
|
||||
<intercept-url pattern="/common/img/**" access="permitAll" />
|
||||
|
|
@ -116,7 +116,7 @@
|
|||
<intercept-url pattern="/reports/projectStatusReport.zul"
|
||||
access="hasAnyRole('ROLE_SUPERUSER', 'ROLE_PROJECT_STATUS_REPORT')" />
|
||||
|
||||
<intercept-url pattern="/myaccount/userDashboard.zul" access="ROLE_BOUND_USER" />
|
||||
<intercept-url pattern="/myaccount/userDashboard.zul" access="hasAnyRole('ROLE_BOUND_USER')" />
|
||||
|
||||
<intercept-url pattern="/myaccount/monthlyTimesheet.zul"
|
||||
access="hasAnyRole('ROLE_SUPERUSER', 'ROLE_TIMESHEETS', 'ROLE_BOUND_USER')" />
|
||||
|
|
|
|||
|
|
@ -132,13 +132,13 @@
|
|||
|
||||
<n:td width="450" height="165" valign="top">
|
||||
|
||||
<html if="${loginError == 'true' and SPRING_SECURITY_LAST_EXCEPTION.class.name == 'org.springframework.security.DisabledException'}">
|
||||
<html if="${loginError == 'true' and SPRING_SECURITY_LAST_EXCEPTION.class.name == 'org.springframework.security.authentication.DisabledException'}">
|
||||
<![CDATA[
|
||||
<div class="login_ERROR">${i18n:_('User disabled')}</div>
|
||||
]]>
|
||||
</html>
|
||||
|
||||
<html if="${loginError == 'true' and SPRING_SECURITY_LAST_EXCEPTION.class.name == 'org.springframework.security.BadCredentialsException'}">
|
||||
<html if="${loginError == 'true' and SPRING_SECURITY_LAST_EXCEPTION.class.name == 'org.springframework.security.authentication.BadCredentialsException'}">
|
||||
<![CDATA[
|
||||
<div class="login_ERROR">${i18n:_('Incorrect authentication')}</div>
|
||||
]]>
|
||||
|
|
|
|||
|
|
@ -137,14 +137,6 @@
|
|||
<button onClick="emailTemplateController.cancel()"
|
||||
label="${i18n:_('Cancel')}" sclass="cancel-button global-action"/>
|
||||
|
||||
<button upload="true, maxsize=999">
|
||||
<attribute name="onUpload">
|
||||
<![CDATA[
|
||||
System.out.println(event.getMedia());
|
||||
]]>
|
||||
</attribute>
|
||||
</button>
|
||||
|
||||
<script>
|
||||
<!-- Hack for removing unnecessary border of grid column -->
|
||||
zk.afterMount(function() {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue