import eu.etaxonomy.cdm.api.service.dto.DescriptionBaseDto;
import eu.etaxonomy.cdm.model.common.CdmBase;
import eu.etaxonomy.cdm.model.common.ICdmBase;
-import eu.etaxonomy.cdm.model.description.DescriptionBase;
import eu.etaxonomy.cdm.model.name.NomenclaturalSource;
import eu.etaxonomy.cdm.model.name.TaxonName;
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
/**
* Scans eu.etaxonomy.taxeditor.store.cdmViewer extension point.
+ *
* @author pplitzner
* @date Jul 7, 2015
*/
ReferencingObjectDto dto = (ReferencingObjectDto)o;
uuidAndTitleCache = dto.getOpenInTarget() != null ? dto.getOpenInTarget() : dto;
}else if (o instanceof UuidAndTitleCache){
- uuidAndTitleCache = (UuidAndTitleCache<CdmBase>)o;
+ uuidAndTitleCache = (UuidAndTitleCache<?>)o;
}else if (o instanceof TermNodeDto){
uuidAndTitleCache = new UuidAndTitleCache<>(DefinedTermBase.class, ((TermNodeDto)o).getTerm().getUuid(), null, ((TermNodeDto)o).getTerm().getTitleCache());
}else if (o instanceof DescriptionBaseDto){
import java.lang.reflect.Field;
import java.util.Map;
-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.junit.BeforeClass;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager;
import net.sf.ehcache.CacheManager;
-
/**
* Base class for remoting tests, responsible for
* - starting / stop the cdm server
* - running some basic connection tests
* - setting up the remote configuration.
- *
*/
@Transactional(TransactionMode.DISABLED)
@SpringApplicationContext("file:./target/classes/eu/etaxonomy/cdm/testRemotingApplicationContext.xml")
e.printStackTrace();
// Assert.fail("Server failed to start. Reason : " + e.getMessage());
}
-
-
}
public static void emptyAllCachesExceptModelCache() {
}
}
-
public static void initializeController(String sourceName, String host, int port, String contextPath, String username, String password) {
if(CdmApplicationState.getCurrentAppConfig() != null) {
UsernamePasswordAuthenticationToken token = new UsernamePasswordAuthenticationToken(username, password);
Authentication authentication = getRemoteApplicationController().getAuthenticationManager().authenticate(token);
-
User user = (User) authentication.getPrincipal();
/* circumventing problem with hibernate not refreshing the transient collection authorities in this case,
* see http://dev.e-taxonomy.eu/trac/ticket/4053 */
CdmApplicationState.setCurrentSecurityContext(SecurityContextHolder.getContext());
-
-
-
// SecurityContextHolder.clearContext();
// SecurityContextImpl sc = new SecurityContextImpl();
// Authentication token = new UsernamePasswordAuthenticationToken(username,password);
}
-
protected static CdmApplicationRemoteController getRemoteApplicationController() {
return (CdmApplicationRemoteController) CdmApplicationState.getCurrentAppConfig();
}
return cdmEntitySessionManager;
}
-
protected static CdmEntitySession getSession(ICdmEntitySessionEnabled sessionOwner) {
Map<ICdmEntitySessionEnabled, CdmEntitySession> ownerSessionMap =
(Map<ICdmEntitySessionEnabled, CdmEntitySession>) getFieldValueViaReflection(cdmEntitySessionManager, "ownerSessionMap");
return (ConversationalTransientEntityCacher) getFieldValueViaReflection(getSession(sessionOwner), "cdmTransientEntityCacher");
}
-
protected static Object getFieldValueViaReflection(Object object, String fieldName) {
Class<?> clazz = object.getClass();
try {
Field field = clazz.getDeclaredField(fieldName);
field.setAccessible(true);
return field.get(object);
- } catch (NoSuchFieldException e) {
- e.printStackTrace();
- } catch (SecurityException e) {
- e.printStackTrace();
- } catch (IllegalArgumentException e) {
- e.printStackTrace();
- } catch (IllegalAccessException e) {
+ } catch (NoSuchFieldException | SecurityException |
+ IllegalArgumentException | IllegalAccessException e) {
e.printStackTrace();
}
return null;
}
-
protected static void authenticateDefaultUser() {
authenticate(user, password);
}
-
-
-}
+}
\ No newline at end of file
package eu.etaxonomy.taxeditor.session;
import java.util.ArrayList;
-import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
-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.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Ignore;
Assert.fail();
}
- Set<Integer> ids = new HashSet<Integer>();
+ List<Integer> ids = new ArrayList<>();
ids.add(2753);
ids.add(2754);
ids.add(2751);
- List<PolytomousKeyNode> nodes = polytomousKeyNodeService.findById(ids);
+ List<PolytomousKeyNode> nodes = polytomousKeyNodeService.loadByIds(ids, null);
for (PolytomousKeyNode child:nodes){
child.setSubkey(null);
// polytomousKeyNodeService.merge(child);
PolytomousKeyNode rootNode = pKey.getRoot();
List<PolytomousKeyNode> children = rootNode.getChildren();
PolytomousKeyNode child = rootNode.getChildAt(0);
- DeleteResult result = polytomousKeyNodeService.delete(child.getUuid(), true);
+ polytomousKeyNodeService.delete(child.getUuid(), true);
pKey = CdmBase.deproxy(polytomousKeyService.load(polytomousKeyUuid),PolytomousKey.class);
vocNameFeature.addTerm(newTerm);
+ @SuppressWarnings({ "unchecked", "rawtypes"})
List<MergeResult<TermVocabulary<Feature>>> mergeResults = (List)vocabularyService.merge(vocs, true);
for(MergeResult<TermVocabulary<Feature>> result : mergeResults){