@Override
public <T extends CdmBase> T load(T cdmEntity) {
+ @SuppressWarnings("unchecked")
T cachedCdmEntity = (T)getFromCache(cdmEntity.getUuid());
if(isCachable(cdmEntity) && cachedCdmEntity == null) {
return termsFromStringValues;
}
- protected <T extends DefinedTermBase>List<T> getTermsFromStringValues(List<String> listValue, TermType type) {
- Collection<DefinedTermBase> termlist = new ArrayList<>();
+ protected <T extends DefinedTermBase> List<T> getTermsFromStringValues(List<String> listValue, TermType type) {
+ List<DefinedTermBase> termlist = new ArrayList<>();
ITermService termService = CdmStore.getService(ITermService.class);
Set<UUID> uuidList = new HashSet<>();
for (String s : listValue) {
- if (!StringUtils.isBlank(s)){
+ if (StringUtils.isNotBlank(s)){
UUID uuid = UUID.fromString(s);
uuidList.add(uuid);
}
}
if (!uuidList.isEmpty()){
termlist = termService.find(uuidList);
- }
-
- if (listValue.isEmpty() ){
+ }else{
termlist = termService.listByTermType(type, null, null, null, null);
-
}
return new ArrayList(termlist);
/**
* @author pplitzner
* @since Nov 24, 2017
- *
*/
public class TermUuidContentProvider implements IStructuredContentProvider {
}
return null;
}
-
-}
+}
\ No newline at end of file
/**
* @author k.luther
* @since 09.10.2018
- *
*/
public class CommonNameNamedAreaSelectionDialog extends NamedAreaSelectionDialog {
- /**
- * @param shell
- * @param title
- * @param multi
- * @param namedArea
- * @param preferenceId
- * @param preselectedVocabularyUuids
- */
protected CommonNameNamedAreaSelectionDialog(Shell shell, String title, boolean multi, NamedArea namedArea,
Object preferenceId) {
super(shell, title, multi, namedArea, preferenceId, createVocabularyUuidList());
-
-
}
private static UUID[] createVocabularyUuidList() {
vocabularies = getAvailableVocabularies();
}
-
protected List<TermVocabulary> getAvailableVocabularies(){
- List<TermVocabulary> vocabularies = new ArrayList();
+ List<TermVocabulary> vocabularies = new ArrayList<>();
UUID[] preselectedVocabularyUuids = createVocabularyUuidList();
CdmPreferenceCache cache = CdmPreferenceCache.instance();
CdmPreference pref = cache.findBestMatching(key);
if (preselectedVocabularyUuids != null){
for(int i=0;i<preselectedVocabularyUuids.length;i++){
- TermVocabulary preselectedVocabulary = CdmStore.getService(IVocabularyService.class).find(preselectedVocabularyUuids[i]);
+ TermVocabulary<?> preselectedVocabulary = CdmStore.getService(IVocabularyService.class).find(preselectedVocabularyUuids[i]);
vocabularies.add(preselectedVocabulary);
}
}
return CdmStore.getService(IVocabularyService.class).listByTermType(TermType.NamedArea, true, null, null, null, null);
}
-
-
}
/**
"Choose an area", false, namedArea, preferenceId);
return getSelectionFromDialog(dialog);
}
-
-
-}
+}
\ No newline at end of file
import java.util.List;
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.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.SubMonitor;
import org.junit.After;
/**
* @author cmathew
* @date 22 Oct 2015
- *
*/
public class ProgressMonitorServiceTest extends RemotingSessionAwareTest {
+ @SuppressWarnings("unused")
private static final Logger logger = LogManager.getLogger(ProgressMonitorServiceTest.class);
ITestService testService = getRemoteApplicationController().getTestService();
IProgressMonitorService progressMonitorService = getRemoteApplicationController().getProgressMonitorService();
-
-
@After
public void revertAuthentication() {
authenticateDefaultUser();
}
@Test
- public void testMonitLongRunningMethodByChangingUser() throws InterruptedException {
+ public void testMonitLongRunningMethodByChangingUser() {
IllegalStateException ise = new IllegalStateException("IllegalStateException");
authenticateExtraUser();
IRemotingProgressMonitor monitor = progressMonitorService.getRemotingMonitor(uuid);
Assert.assertNull(monitor);
-
}
@Test
}
@Test
- public void testMonitLongRunningMethodWithCancellation() throws InterruptedException {
+ public void testMonitLongRunningMethodWithCancellation() {
final UUID uuid = testService.monitLongRunningMethod(null, null, 0);
final int pollInterval = 1000;
expectedMonitor.addReport("Report");
expectedMonitor.done();
- final UUID uuid = testService.monitLongRunningMethod(null, feedbacks, 0);
+ testService.monitLongRunningMethod(null, feedbacks, 0);
final int pollInterval = 1000;
feebackGenerators.remove(1);
this.expectedMonitor = expectedMonitor;
this.monitorUuid = monitorUuid;
}
- /**
- * {@inheritDoc}
- */
+
@Override
public void postOperation(IRemotingProgressMonitor monitor) {
if(expectedMonitor.getResult() instanceof Exception) {
this.waitTime = waitTime;
}
- /**
- * {@inheritDoc}
- */
@Override
public void setFeedbackForMonitor(UUID uuid) {
if(waitTime > 0) {
}
CdmApplicationState.getCurrentAppConfig().getProgressMonitorService().setFeedback(uuid, feedback);
}
-
}
-}
+}
\ No newline at end of file
import java.util.List;
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.Test;
public class ServiceInterceptorTest extends RemotingSessionAwareTest {
- private static final Logger logger = LogManager.getLogger(ServiceInterceptorTest.class);
+ @SuppressWarnings("unused")
+ private static final Logger logger = LogManager.getLogger(ServiceInterceptorTest.class);
private final ITermService termService = getRemoteApplicationController().getTermService();
private static CdmServiceCacher cdmServiceCacher = CdmApplicationState.getCdmServiceCacher();