import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
-import java.util.Comparator;
import java.util.List;
import java.util.Set;
import java.util.UUID;
import org.apache.commons.beanutils.PropertyUtils;
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.lang.StringUtils;
-import org.apache.logging.log4j.LogManager;import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.hibernate.mapping.Map;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
if(c instanceof Set){
// sets need to be sorted to have a defined order
List<CdmBase> list = new ArrayList<>(c);
- java.util.Collections.sort(list, new Comparator<CdmBase>() {
-
- @Override
- public int compare(CdmBase o1, CdmBase o2) {
+ java.util.Collections.sort(list, (o1, o2)-> {
if (o1 == null && o2 == null){
return 0;
}else if (o1 == null){
}
return Integer.compare(o1.getId(), o2.getId());
}
- });
+ );
c = list;
}
return objectFromProperty;
}
- private Class<?> propertyClass(T instance, String baseName) {
- PropertyDescriptor propertyDescriptor = null;
- Class<?> c = null;
- try {
- propertyDescriptor = PropertyUtils.getPropertyDescriptor(instance, baseName);
- if(propertyDescriptor != null){
- c = propertyDescriptor.getClass();
- }
- } catch (IllegalAccessException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (InvocationTargetException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (NoSuchMethodException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- return c;
- }
-
- /**
- * @param <SUB_T>
- * @param clazz
- * @param uuid
- * @param response
- * @param pathProperties
- * @return
- * @throws IOException
- */
@SuppressWarnings("unchecked")
protected final <SUB_T extends T> SUB_T getCdmBaseInstance(Class<SUB_T> clazz,
UUID uuid, HttpServletResponse response, List<String> pathProperties)
return (SUB_T) cdmBaseObject;
}
- /**
- * @param <SUB_T>
- * @param clazz
- * @param uuid
- * @param response
- * @param pathProperty
- * @return
- * @throws IOException
- */
@SuppressWarnings("unchecked")
protected final <SUB_T extends T> SUB_T getCdmBaseInstance(Class<SUB_T> clazz, UUID uuid, HttpServletResponse response, String pathProperty)
throws IOException {
return (SUB_T) cdmBaseObject;
}
- /**
- * @param uuid
- * @param response
- * @param pathProperty
- * @return
- * @throws IOException
- */
protected final T getCdmBaseInstance(UUID uuid, HttpServletResponse response, String pathProperty)
throws IOException {
return getCdmBaseInstance(baseClass, uuid, response, Arrays
.asList(new String[] { pathProperty }));
}
-
- /**
- * @param uuid
- * @param response
- * @param pathProperties
- * @return
- * @throws IOException
- */
protected final T getCdmBaseInstance(UUID uuid, HttpServletResponse response, List<String> pathProperties)
throws IOException {
return getCdmBaseInstance(baseClass, service, uuid, response, pathProperties);
}
- /**
- * @param <CDM_BASE>
- * @param clazz
- * @param service
- * @param uuid
- * @param response
- * @param pathProperties
- * @return
- * @throws IOException
- */
protected final <CDM_BASE extends CdmBase> CDM_BASE getCdmBaseInstance(
Class<CDM_BASE> clazz, IService<CDM_BASE> service, UUID uuid,
HttpServletResponse response, List<String> pathProperties)
return pathProperties;
}
- /**
- * @param instance
- * @param baseName
- * @param response
- * @return
- * @throws IOException
- */
private final Object invokeProperty(T instance,
String baseName, HttpServletResponse response) throws IOException {
return (S)result;
}
-
- /**
- * @param subtreeUuid
- * @param response
- * @return
- * @throws IOException
- */
protected TaxonNode getSubtreeOrError(UUID subtreeUuid, ITaxonNodeService taxonNodeService, HttpServletResponse response) throws IOException {
TaxonNode subtree = null;
if (subtreeUuid != null){
}
}
*/
-
-
-}
+}
\ No newline at end of file
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import org.apache.logging.log4j.LogManager;import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
@Controller
@Api("taxonNode")
@RequestMapping(value = {"/taxonNode/{uuid}"})
+//NOTE by AM: it seems that TaxonNodeController does not inherit from BaseController
+// because doGet method return type is a TaxonNodeDTO not TaxonNode as expected
+// by BaseController
public class TaxonNodeController extends AbstractController<TaxonNode, ITaxonNodeService> {
public static final Logger logger = LogManager.getLogger(TaxonNodeController.class);
public TaxonNodeDto doGetParent(
@PathVariable("uuid") UUID uuid,
HttpServletRequest request,
- HttpServletResponse response
+ @SuppressWarnings("unused") HttpServletResponse response
) {
logger.info("doGetParent() " + requestPathAndQuery(request));