@Override
public TeamOrPersonBase save(TeamOrPersonBase entity) {
- if(CdmStore.getCurrentSessionManager().isRemoting()) {
- return (TeamOrPersonBase) CdmStore.getService(IAgentService.class).merge(entity, true).getMergedEntity();
- } else {
- CdmStore.getService(IAgentService.class).saveOrUpdate(entity) ;
- return entity;
- }
+ return (TeamOrPersonBase) CdmStore.getService(IAgentService.class).merge(entity, true).getMergedEntity();
+
}
@Override
*/
@Override
public Group save(Group entity) {
- if(CdmStore.getCurrentSessionManager().isRemoting()) {
- return CdmStore.getService(IGroupService.class).merge(entity, true).getMergedEntity();
- } else {
- CdmStore.getService(IGroupService.class).saveOrUpdate(entity);
- return entity;
- }
+ return CdmStore.getService(IGroupService.class).merge(entity, true).getMergedEntity();
+
}
/* (non-Javadoc)
@Override
public Media save(Media entity) {
- if(CdmStore.getCurrentSessionManager().isRemoting()) {
- return CdmStore.getService(IMediaService.class).merge(entity, true).getMergedEntity();
- } else {
- CdmStore.getService(IMediaService.class).saveOrUpdate(entity) ;
- return entity;
- }
+ return CdmStore.getService(IMediaService.class).merge(entity, true).getMergedEntity();
+
}
@Override
@Override
public TaxonNameBase save(TaxonNameBase entity) {
TaxonNameBase mergedName = null;
-
- if(CdmStore.getCurrentSessionManager().isRemoting()) {
- mergedName = CdmStore.getService(INameService.class).merge(entity, true).getMergedEntity();
- }
-
- return mergedName;
+ mergedName = CdmStore.getService(INameService.class).merge(entity, true).getMergedEntity();
+ return mergedName;
}
/** {@inheritDoc} */
@Override
public SpecimenOrObservationBase<IIdentifiableEntityCacheStrategy> save(SpecimenOrObservationBase entity) {
- if(CdmStore.getCurrentSessionManager().isRemoting()) {
- return CdmStore.getService(IOccurrenceService.class).merge(entity, true).getMergedEntity();
- } else {
- CdmStore.getService(IOccurrenceService.class).save(entity);
- return entity;
- }
+ return CdmStore.getService(IOccurrenceService.class).merge(entity, true).getMergedEntity();
+
}
/** {@inheritDoc} */
@Override
public Reference save(Reference entity) {
- if(CdmStore.getCurrentSessionManager().isRemoting()) {
- return CdmStore.getService(IReferenceService.class).merge(entity, true).getMergedEntity();
- } else {
- CdmStore.getService(IReferenceService.class).saveOrUpdate(entity);
- return entity;
- }
+ return CdmStore.getService(IReferenceService.class).merge(entity, true).getMergedEntity();
}
/* (non-Javadoc)
}\r
@Override\r
public TaxonBase save(TaxonBase entity) {\r
- if(CdmStore.getCurrentSessionManager().isRemoting()) {\r
- return CdmStore.getService(ITaxonService.class).merge(entity, true).getMergedEntity();\r
- } else {\r
- CdmStore.getService(ITaxonService.class).saveOrUpdate(entity);\r
- return entity;\r
- }\r
+ return CdmStore.getService(ITaxonService.class).merge(entity, true).getMergedEntity();\r
}\r
\r
\r
*/
@Override
public User save(User entity) {
- if(CdmStore.getCurrentSessionManager().isRemoting()) {
- return CdmStore.getService(IUserService.class).merge(entity, true).getMergedEntity();
- } else {
- CdmStore.getService(IUserService.class).saveOrUpdate(entity);
- return entity;
- }
-
+ return CdmStore.getService(IUserService.class).merge(entity, true).getMergedEntity();
}
/* (non-Javadoc)
public User createEntity(Object key, String text) {
try{
User user = User.NewInstance(text, text);
- if(CdmStore.getCurrentSessionManager().isRemoting()) {
- CdmStore.getService(IUserService.class).createUser(user);
- user = CdmStore.getService(IUserService.class).loadWithUpdate(user.getUuid());
- } else {
- CdmStore.getService(IUserService.class).createUser(user);
- }
+ CdmStore.getService(IUserService.class).createUser(user);
+ user = CdmStore.getService(IUserService.class).loadWithUpdate(user.getUuid());
return user;
} catch (AccessDeniedException e){
MessagingUtils.messageDialog("Access denied", getClass(), e.getMessage(), e);
*/
@Override
public void merge() {
- if(CdmStore.getCurrentSessionManager().isRemoting()) {
- CdmStore.getService(ITaxonNodeService.class).merge(taxonNode, true);
- }
+ CdmStore.getService(ITaxonNodeService.class).merge(taxonNode, true);
+
}
@Override
*/
@Override
public void merge() {
- if(CdmStore.getCurrentSessionManager().isRemoting()) {
- group = CdmStore.getService(IGroupService.class).merge(group, true).getMergedEntity();
- }
+ group = CdmStore.getService(IGroupService.class).merge(group, true).getMergedEntity();
+
}
}
*/
@Override
public void merge() {
- if(CdmStore.getCurrentSessionManager().isRemoting()) {
- key = CdmStore.getService(IPolytomousKeyService.class).merge(key,true).getMergedEntity();
- }
+ key = CdmStore.getService(IPolytomousKeyService.class).merge(key,true).getMergedEntity();
+
}
@Override
// commit the conversation and start a new transaction immediately
conversation.commit(true);
- if(CdmStore.getCurrentSessionManager().isRemoting()) {
- CdmStore.getService(IOccurrenceService.class).merge(new ArrayList<SpecimenOrObservationBase>(rootElements), true);
- }
+ CdmStore.getService(IOccurrenceService.class).merge(new ArrayList<SpecimenOrObservationBase>(rootElements), true);
+
monitor.worked(1);
this.setDirty(false);
specimenOrObservationBase.addDerivationEvent(DerivationEvent.NewSimpleInstance(specimenOrObservationBase, mediaSpecimen, derivationEventType));
mediaSpecimen.setCacheStrategy(new DerivedUnitFacadeCacheStrategy());
mediaSpecimen.getTitleCache(); //update title cache
- if(CdmStore.getCurrentSessionManager().isRemoting()) {
- CdmStore.getService(IOccurrenceService.class).merge(specimenOrObservationBase, true);
- }
+ CdmStore.getService(IOccurrenceService.class).merge(specimenOrObservationBase, true);
+
}
//refresh view
Sequence newInstance = Sequence.NewInstance(dnaSample, "", 0); //$NON-NLS-1$
createdElement = newInstance;
}
- if(CdmStore.getCurrentSessionManager().isRemoting()) {
- CdmStore.getService(IOccurrenceService.class).merge((SpecimenOrObservationBase) selectedDerivate, true);
- }
- }
- else if(selectedDerivate instanceof Sequence){
+ CdmStore.getService(IOccurrenceService.class).merge((SpecimenOrObservationBase) selectedDerivate, true);
+ } else if(selectedDerivate instanceof Sequence){
SingleRead newInstance = SingleRead.NewInstance();
((Sequence) selectedDerivate).addSingleRead(newInstance);
createdElement = newInstance;
- if(CdmStore.getCurrentSessionManager().isRemoting()) {
- CdmApplicationState.getCurrentAppConfig().getSequenceService().merge((Sequence)selectedDerivate, true);
- }
+ CdmApplicationState.getCurrentAppConfig().getSequenceService().merge((Sequence)selectedDerivate, true);
+
}
if(selectedDerivate instanceof SpecimenOrObservationBase && DerivedUnit.class.isAssignableFrom(childClass)){
SpecimenOrObservationBase<?> specimenOrObservationBase = (SpecimenOrObservationBase<?>)selectedDerivate;
derivedUnit.setCacheStrategy(new DerivedUnitFacadeCacheStrategy());
derivedUnit.getTitleCache(); //update title cache
createdElement = derivedUnit;
- if(CdmStore.getCurrentSessionManager().isRemoting()) {
- CdmStore.getService(IOccurrenceService.class).merge((SpecimenOrObservationBase) selectedDerivate, true);
- }
+ CdmStore.getService(IOccurrenceService.class).merge((SpecimenOrObservationBase) selectedDerivate, true);
+
}
//refresh view
description = TaxonDescription.NewInstance(taxon);
}
description.addElement(association);
- if(CdmStore.getCurrentSessionManager().isRemoting()){
- CdmStore.getService(ITaxonService.class).merge(taxon);
- }
- else{
- CdmStore.getService(ITaxonService.class).saveOrUpdate(taxon);
- }
+ CdmStore.getService(ITaxonService.class).merge(taxon);
+
derivateView.getConversationHolder().commit();
derivateView.addFieldUnit(fieldUnit);
SingleRead singleRead = (SingleRead)clipBoardTreeNode.getValue();
Sequence sequence = (Sequence)selectedTreeNode.getValue();
sequence.addSingleRead(singleRead);
- if(CdmStore.getCurrentSessionManager().isRemoting()){
- CdmStore.getService(ISequenceService.class).merge(sequence);
- }
- else{
- CdmStore.getService(ISequenceService.class).saveOrUpdate(sequence);
- }
+ CdmStore.getService(ISequenceService.class).merge(sequence);
+
if(activeEditor instanceof DerivateView) {
derivateView.getConversationHolder().commit();
derivateView.refreshTree();
selectedTreeNode.getValue() instanceof SingleRead && selectedTreeNode.getParent().getValue() instanceof Sequence) {
Sequence sequence = (Sequence) selectedTreeNode.getParent().getValue();
sequence.removeSingleRead((SingleRead) selectedTreeNode.getValue());
- if(CdmStore.getCurrentSessionManager().isRemoting()){
- CdmStore.getService(ISequenceService.class).merge(sequence);
- }
- else{
- CdmStore.getService(ISequenceService.class).saveOrUpdate(sequence);
- }
+ CdmStore.getService(ISequenceService.class).merge(sequence);
+
if(activeEditor instanceof DerivateView) {
derivateView.getConversationHolder().commit();
derivateView.refreshTree();
}
if(part instanceof BulkEditor && !(object instanceof SpecimenOrObservationBase<?>)){
((BulkEditor) part).forceDirty();
- if(CdmStore.getCurrentSessionManager().isRemoting()) {
- IStructuredSelection selection = (IStructuredSelection) ((BulkEditor) part).getSelectionProvider().getSelection();
- ((BulkEditor) part).changed(selection.getFirstElement());
- }
+ IStructuredSelection selection = (IStructuredSelection) ((BulkEditor) part).getSelectionProvider().getSelection();
+ ((BulkEditor) part).changed(selection.getFirstElement());
+
}
// take a look at ISaveblePart
if(part instanceof BulkEditor && !(object instanceof SpecimenOrObservationBase<?>)){
((BulkEditor) part).forceDirty();
- if(CdmStore.getCurrentSessionManager().isRemoting()) {
- IStructuredSelection selection = (IStructuredSelection) ((BulkEditor) part).getSelectionProvider().getSelection();
- ((BulkEditor) part).changed(selection.getFirstElement());
- }
+ IStructuredSelection selection = (IStructuredSelection) ((BulkEditor) part).getSelectionProvider().getSelection();
+ ((BulkEditor) part).changed(selection.getFirstElement());
+
}
super.changed(object);
}
*/
@Override
public void merge() {
- if(CdmStore.getCurrentSessionManager().isRemoting()) {
- CdmStore.getService(ISequenceService.class).merge(sequenceNode, true);
- }
+ CdmStore.getService(ISequenceService.class).merge(sequenceNode, true);
+
}
}
/** {@inheritDoc} */
@Override
public void fill(Menu parent, int index) {
- getRecentWindows().fill(parent, index);
+ // getRecentWindows().fill(parent, index);
}
/* (non-Javadoc)
return Status.CANCEL_STATUS;
}
- if(CdmStore.getCurrentSessionManager().isRemoting()) {
- AbstractOperation operation = new RemotingMoveTaxonOperation(taxonNavigator, false, uuids, (TaxonNode)targetITaxonTreeNode, MovingType.CHILD);
- NavigationUtil.executeOperation(operation, null);
- } else {
- AbstractPostOperation operation = new MoveTaxonOperation
- ("Move Taxon", workspaceUndoContext, uuids, targetITaxonTreeNode, this, taxonNavigator, MovingType.CHILD);
- NavigationUtil.executeOperation(operation);
- }
+ AbstractOperation operation = new RemotingMoveTaxonOperation(taxonNavigator, false, uuids, (TaxonNode)targetITaxonTreeNode, MovingType.CHILD);
+ NavigationUtil.executeOperation(operation, null);
+
logger.info("Moved taxa to new parent " + targetITaxonTreeNode);
return Status.OK_STATUS;
return Status.CANCEL_STATUS;
}
- if(CdmStore.getCurrentSessionManager().isRemoting()) {
- AbstractOperation operation = new RemotingMoveTaxonOperation(taxonNavigator, false, uuids, (TaxonNode)targetITaxonTreeNode, MovingType.CHILD);
- NavigationUtil.executeOperation(operation, null);
- } else {
- AbstractPostOperation operation = new MoveTaxonOperation
- ("Move Taxon", workspaceUndoContext, uuids, targetITaxonTreeNode, this, taxonNavigator, MovingType.CHILD);
- NavigationUtil.executeOperation(operation);
- }
+ AbstractOperation operation = new RemotingMoveTaxonOperation(taxonNavigator, false, uuids, (TaxonNode)targetITaxonTreeNode, MovingType.CHILD);
+ NavigationUtil.executeOperation(operation, null);
+
logger.info("Moved taxa to new parent " + targetITaxonTreeNode);
return Status.OK_STATUS;
}
TaxonNode targetNode = (TaxonNode) targetITaxonTreeNode;
- if(CdmStore.getCurrentSessionManager().isRemoting()) {
- AbstractOperation operation = new RemotingMoveTaxonOperation(taxonNavigator, false, uuids, targetNode, MovingType.BEHIND);
- NavigationUtil.executeOperation(operation, null);
- } else {
- AbstractPostOperation operation = new MoveTaxonOperation
- ("Move Taxon", workspaceUndoContext, uuids, targetNode, this, taxonNavigator, MovingType.BEHIND);
- NavigationUtil.executeOperation(operation);
- }
+ AbstractOperation operation = new RemotingMoveTaxonOperation(taxonNavigator, false, uuids, targetNode, MovingType.BEHIND);
+ NavigationUtil.executeOperation(operation, null);
+
logger.info("Moved taxa to new parent " + targetITaxonTreeNode);
return Status.OK_STATUS;
// }else if (returnCode == 2){
*/
@Override
public void merge() {
- if(CdmStore.getCurrentSessionManager().isRemoting()) {
- CdmStore.getService(IVocabularyService.class).merge(new ArrayList<TermVocabulary>(getRootEntities()), true);
- updateDefaultFeatureTree();
- }
+ CdmStore.getService(IVocabularyService.class).merge(new ArrayList<TermVocabulary>(getRootEntities()), true);
+ updateDefaultFeatureTree();
}
public static FeatureTree getDefaultFeatureTree() {
.getAdditionalFeatures();
for (Feature feature : additionalFeatures) {
FeatureNode child = FeatureNode.NewInstance(feature);
- if(CdmStore.getCurrentSessionManager().isRemoting()) {
- CdmStore.getService(IFeatureNodeService.class).merge(child, true);
- } else {
- CdmStore.getService(IFeatureNodeService.class).saveOrUpdate(child);
- }
+ CdmStore.getService(IFeatureNodeService.class).merge(child, true);
+
parent.addChild(child);
}
viewer.refresh();
public boolean performFinish() {
try{
if (selectedFeatureTree != null){
- if(CdmStore.getCurrentSessionManager().isRemoting()) {
- CdmStore.getService(IFeatureTreeService.class).merge(selectedFeatureTree, true);
- } else {
- CdmStore.getService(IFeatureTreeService.class).saveOrUpdate(selectedFeatureTree);
- }
+ CdmStore.getService(IFeatureTreeService.class).merge(selectedFeatureTree, true);
}
conversation.commit();
}finally{
featureTree.setTitleCache(text_title.getText(), true);
viewer.add(featureTree);
- if(CdmStore.getCurrentSessionManager().isRemoting()) {
- CdmStore.getService(IFeatureTreeService.class).merge(featureTree, true);
- } else {
- CdmStore.getService(IFeatureTreeService.class).saveOrUpdate(featureTree);
- }
+ CdmStore.getService(IFeatureTreeService.class).merge(featureTree, true);
+
text_title.setText("");
viewer.setSelection(new StructuredSelection(featureTree));
configurator.setClassificationUuid(classificationChooserWizardPage.getClassification().getUuid());
}
- if(CdmStore.getCurrentSessionManager().isRemoting()) {
- //Job job = CdmStore.getImportManager().createIOServiceJob(configurator, new File(source), SOURCE_TYPE.INPUTSTREAM);
- //CdmStore.getImportManager().run(job);
- CdmStore.getImportManager().runMoniteredOperation(configurator, new File(source), SOURCE_TYPE.INPUTSTREAM);
- } else {
- try {
- configurator.setSource(new FileInputStream(new File(source)));
- } catch (FileNotFoundException e) {
- MessagingUtils.errorDialog("File not found.", this, "Import file was not found.", TaxeditorStorePlugin.PLUGIN_ID, e, false);
- logger.error("File not found!", e);
- return false;
- }
- CdmStore.getImportManager().run(configurator);
- }
+ CdmStore.getImportManager().runMoniteredOperation(configurator, new File(source), SOURCE_TYPE.INPUTSTREAM);
+
return true;
}
configurator.setLastChange(true);
}
}
- if(CdmStore.getCurrentSessionManager().isRemoting()) {
- // create job
- Job job = CdmStore.getExportManager().createIOServiceJob(configurator, new File(urlString));
- // configure the job
- job.setProperty(IProgressConstants.KEEP_PROPERTY, true);
- job.setUser(true);
- // schedule job
- job.schedule();
- } else {
-
- configurator.setDestination(new File(urlString));
- CdmStore.getExportManager().run(configurator);
- }
+
+ // create job
+ Job job = CdmStore.getExportManager().createIOServiceJob(configurator, new File(urlString));
+ // configure the job
+ job.setProperty(IProgressConstants.KEEP_PROPERTY, true);
+ job.setUser(true);
+ // schedule job
+ job.schedule();
+
return true;
}
\r
final Combo combo = page.getCombo();\r
configurator.setClassificationUUID(page.getSelectedClassificationUUID());\r
- if(CdmStore.getCurrentSessionManager().isRemoting()) {\r
- // create job\r
- Job job = CdmStore.getExportManager().createIOServiceJob(configurator, new File(urlString));\r
- // configure the job\r
- job.setProperty(IProgressConstants.KEEP_PROPERTY, true);\r
- job.setUser(true);\r
- // schedule job\r
- job.schedule();\r
- } else {\r
- configurator.setDestination(new File(urlString));\r
- CdmStore.getExportManager().run(configurator);\r
- }\r
+ \r
+ // create job\r
+ Job job = CdmStore.getExportManager().createIOServiceJob(configurator, new File(urlString));\r
+ // configure the job\r
+ job.setProperty(IProgressConstants.KEEP_PROPERTY, true);\r
+ job.setUser(true);\r
+ // schedule job\r
+ job.schedule();\r
+ \r
return true;\r
}\r
\r
\r
\r
configurator.setClassificationUUID(page.getSelectedClassificationUUID());\r
+ // create job\r
+ Job job = CdmStore.getExportManager().createIOServiceJob(configurator, new File(urlString));\r
+ // configure the job\r
+ job.setProperty(IProgressConstants.KEEP_PROPERTY, true);\r
+ job.setUser(true);\r
+ // schedule job\r
+ job.schedule();\r
\r
-\r
- if(CdmStore.getCurrentSessionManager().isRemoting()) {\r
- // create job\r
- Job job = CdmStore.getExportManager().createIOServiceJob(configurator, new File(urlString));\r
- // configure the job\r
- job.setProperty(IProgressConstants.KEEP_PROPERTY, true);\r
- job.setUser(true);\r
- // schedule job\r
- job.schedule();\r
- } else {\r
- configurator.setDestination(new File(urlString));\r
- CdmStore.getExportManager().run(configurator);\r
- }\r
return true;\r
}\r
\r
configurator.setSource(source);
configurator.setDbSchemaValidation(DbSchemaValidation.CREATE);
- if(CdmStore.getCurrentSessionManager().isRemoting()) {
- Job job = CdmStore.getImportManager().createIOServiceJob(configurator, new File(source), SOURCE_TYPE.URI);
- CdmStore.getImportManager().run(job);
- } else {
- CdmStore.getImportManager().run(configurator);
- }
-
-
+ Job job = CdmStore.getImportManager().createIOServiceJob(configurator, new File(source), SOURCE_TYPE.URI);
+ CdmStore.getImportManager().run(job);
+
return true;
}
File exportFile = new File(page.getFolderText() + File.separator + page.getExportFileName());
URI urlString = exportFile.toURI();
configurator.setDestination(urlString);
- if(CdmStore.getCurrentSessionManager().isRemoting()) {
- // create job
- Job job = CdmStore.getExportManager().createIOServiceJob(configurator, exportFile);
- // configure the job
- job.setProperty(IProgressConstants.KEEP_PROPERTY, true);
- job.setUser(true);
- // schedule job
- job.schedule();
- } else {
- CdmStore.getExportManager().run(configurator);
- }
+
+ // create job
+ Job job = CdmStore.getExportManager().createIOServiceJob(configurator, exportFile);
+ // configure the job
+ job.setProperty(IProgressConstants.KEEP_PROPERTY, true);
+ job.setUser(true);
+ // schedule job
+ job.schedule();
+
performFinish = true;
return performFinish;
}
@Override
public boolean performFinish() {
File file = new File(page.getFolderText() + File.separator + page.getExportFileName());
-
- if(CdmStore.getCurrentSessionManager().isRemoting()) {
- // create job
- Job job = CdmStore.getExportManager().createIOServiceJob(configurator, file);
- // configure the job
- job.setProperty(IProgressConstants.KEEP_PROPERTY, true);
- job.setUser(true);
- // schedule job
- job.schedule();
- } else {
- configurator.setDestination(file);
- CdmStore.getExportManager().run(configurator);
- }
+ // create job
+ Job job = CdmStore.getExportManager().createIOServiceJob(configurator, file);
+ // configure the job
+ job.setProperty(IProgressConstants.KEEP_PROPERTY, true);
+ job.setUser(true);
+ // schedule job
+ job.schedule();
+
return true;
}
URI source = dataSourcePage.getUri();
configurator.setSource(source);
configurator.setDbSchemaValidation(DbSchemaValidation.CREATE);
-
- if(CdmStore.getCurrentSessionManager().isRemoting()) {
- Job job = CdmStore.getImportManager().createIOServiceJob(configurator, new File(source), SOURCE_TYPE.URI);
- CdmStore.getImportManager().run(job);
- } else {
- CdmStore.getImportManager().run(configurator);
- }
-
+ Job job = CdmStore.getImportManager().createIOServiceJob(configurator, new File(source), SOURCE_TYPE.URI);
+ CdmStore.getImportManager().run(job);
+
return true;
}
configurator.setSource(source);
configurator.setDbSchemaValidation(DbSchemaValidation.CREATE);
- if(CdmStore.getCurrentSessionManager().isRemoting()) {
- Job job = CdmStore.getImportManager().createIOServiceJob(configurator, new File(source), SOURCE_TYPE.URI);
- CdmStore.getImportManager().run(job);
- } else {
- CdmStore.getImportManager().run(configurator);
- }
-
+ Job job = CdmStore.getImportManager().createIOServiceJob(configurator, new File(source), SOURCE_TYPE.URI);
+ CdmStore.getImportManager().run(job);
+
return true;
}
/** {@inheritDoc} */
@Override
protected void saveEntity() {
- if(CdmStore.getCurrentSessionManager().isRemoting()) {
- CdmStore.getService(IAmplificationService.class).merge(getEntity(), true);
- } else {
- CdmStore.getService(IAmplificationService.class).save(getEntity());
- }
+ CdmStore.getService(IAmplificationService.class).merge(getEntity(), true);
+
}
/** {@inheritDoc} */
protected void saveEntity() {
//CdmStore.getService(IClassificationService.class).saveOrUpdate(getEntity());
Classification classification = getEntity();
- if(CdmStore.getCurrentSessionManager().isRemoting()) {
- CdmStore.getService(IClassificationService.class).merge(getEntity(), true);
- CdmApplicationState.getCurrentDataChangeService()
+ CdmStore.getService(IClassificationService.class).merge(getEntity(), true);
+ CdmApplicationState.getCurrentDataChangeService()
.fireChangeEvent(new CdmChangeEvent(Action.Create, classification, NewTaxonNodeWizard.class), true);
- } else {
- CdmStore.getService(IClassificationService.class).save(getEntity());
- }
+
}
/** {@inheritDoc} */
@Override
protected void saveEntity() {
- if(CdmStore.getCurrentSessionManager().isRemoting()) {
- CdmStore.getService(ICollectionService.class).merge(getEntity(), true);
- } else {
- CdmStore.getService(ICollectionService.class).save(getEntity());
- }
+ CdmStore.getService(ICollectionService.class).merge(getEntity(), true);
+
}
/* (non-Javadoc)
/** {@inheritDoc} */
@Override
protected void saveEntity() {
- if(CdmStore.getCurrentSessionManager().isRemoting()) {
- setEntity(CdmStore.getService(IOccurrenceService.class).merge(getEntity()));
- } else {
- CdmStore.getService(IOccurrenceService.class).save(getEntity());
- }
+ setEntity(CdmStore.getService(IOccurrenceService.class).merge(getEntity()));
+
}
/** {@inheritDoc} */
@Override
protected void saveEntity() {
- if(CdmStore.getCurrentSessionManager().isRemoting()) {
- CdmStore.getService(IOccurrenceService.class).merge(getEntity(), true);
- } else {
- CdmStore.getService(IOccurrenceService.class).save(getEntity());
- }
+ CdmStore.getService(IOccurrenceService.class).merge(getEntity(), true);
+
}
@Override
*/
@Override
protected void saveEntity() {
- if(CdmStore.getCurrentSessionManager().isRemoting()) {
- CdmStore.getService(IGrantedAuthorityService.class).merge(getEntity(), true);
- } else {
- CdmStore.getService(IGrantedAuthorityService.class).save(getEntity());
- }
+ CdmStore.getService(IGrantedAuthorityService.class).merge(getEntity(), true);
+
}
/* (non-Javadoc)
*/
@Override
protected void saveEntity() {
- if(CdmStore.getCurrentSessionManager().isRemoting()) {
- CdmStore.getService(IGroupService.class).merge(getEntity(), true);
- } else {
- CdmStore.getService(IGroupService.class).save(getEntity());
- }
+ CdmStore.getService(IGroupService.class).merge(getEntity(), true);
+
}
/* (non-Javadoc)
*/
@Override
protected void saveEntity() {
- if(CdmStore.getCurrentSessionManager().isRemoting()) {
- CdmStore.getService(IAgentService.class).merge(getEntity(), true);
- } else {
- CdmStore.getService(IAgentService.class).save(getEntity());
- }
+ CdmStore.getService(IAgentService.class).merge(getEntity(), true);
}
/* (non-Javadoc)
/** {@inheritDoc} */
@Override
protected void saveEntity() {
- if(CdmStore.getCurrentSessionManager().isRemoting()) {
- CdmStore.getService(INameService.class).merge(getEntity(), true);
- } else {
- CdmStore.getService(INameService.class).save(getEntity());
- }
+ CdmStore.getService(INameService.class).merge(getEntity(), true);
}
@Override
/** {@inheritDoc} */
@Override
protected void saveEntity() {
- if(CdmStore.getCurrentSessionManager().isRemoting()) {
- CdmStore.getService(IAgentService.class).merge(getEntity(), true);
- } else {
- CdmStore.getService(IAgentService.class).save(getEntity());
- }
+ CdmStore.getService(IAgentService.class).merge(getEntity(), true);
}
@Override
@Override
protected void saveEntity() {
if(!polytomousKeyPage.getPolytomousKeyName().equals("")) {
- if(CdmStore.getCurrentSessionManager().isRemoting()) {
- CdmStore.getService(IPolytomousKeyService.class).merge(getEntity(), true);
- } else {
- CdmStore.getService(IPolytomousKeyService.class).save(getEntity());
- }
+ CdmStore.getService(IPolytomousKeyService.class).merge(getEntity(), true);
}
}
/** {@inheritDoc} */
@Override
protected void saveEntity() {
- if(CdmStore.getCurrentSessionManager().isRemoting()) {
- CdmStore.getService(IPrimerService.class).merge(getEntity(),true);
- } else {
- CdmStore.getService(IPrimerService.class).save(getEntity());
- }
+ CdmStore.getService(IPrimerService.class).merge(getEntity(),true);
+
}
/** {@inheritDoc} */
}
affectedObjects.add(parentNode);
}
- if(CdmStore.getCurrentSessionManager().isRemoting()) {
- CdmApplicationState.getCurrentDataChangeService()
+ CdmApplicationState.getCurrentDataChangeService()
.fireChangeEvent(new CdmChangeEvent(Action.Create, affectedObjects, NewTaxonNodeWizard.class), true);
- }
+
}else{
if (!result.isOk()){
if (!result.getExceptions().isEmpty()){
/** {@inheritDoc} */
@Override
protected void saveEntity() {
- if(CdmStore.getCurrentSessionManager().isRemoting()) {
- CdmStore.getService(IAgentService.class).merge(getEntity(), true);
- } else {
- CdmStore.getService(IAgentService.class).save(getEntity());
- }
+ CdmStore.getService(IAgentService.class).merge(getEntity(), true);
+
}
@Override
@Override
protected void saveEntity() {
- if(CdmStore.getCurrentSessionManager().isRemoting()) {
- CdmStore.getService(IUserService.class).merge(getEntity(), true);
- } else {
- CdmStore.getService(IUserService.class).save(getEntity());
- }
+ CdmStore.getService(IUserService.class).merge(getEntity(), true);
+
}
@Override
static void setInstance(ICdmApplicationConfiguration applicationController,
ICdmSource cdmSource) {
instance = new CdmStore(applicationController, cdmSource);
- if(getCurrentSessionManager().isRemoting()) {
- CdmApplicationState.setCdmServiceCacher(new CdmServiceCacher());
- }
+ CdmApplicationState.setCdmServiceCacher(new CdmServiceCacher());
+
}
private CdmStore(ICdmApplicationConfiguration applicationController,
if(authenticatedUser == null) {
text = "Not logged in " ;
} else {
- if(CdmStore.getCurrentSessionManager().isRemoting()) {
- CdmRemoteSource source = (CdmRemoteSource) CdmStore.getActiveCdmSource();
- String loginInfo = authenticatedUser.getUsername() + "@" + source.getName() + ":" + source.getContextPath();
- PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().setText(ApplicationUtil.getTitle() + " " + loginInfo);
- }
+ CdmRemoteSource source = (CdmRemoteSource) CdmStore.getActiveCdmSource();
+ String loginInfo = authenticatedUser.getUsername() + "@" + source.getName() + ":" + source.getContextPath();
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().setText(ApplicationUtil.getTitle() + " " + loginInfo);
+
text = "Logged in as: " + authenticatedUser.getUsername() + " ";
}
int width = image.calculateWidth();
IEditGeoService editGeoService;
List<Language> languages = Arrays.asList(new Language[]{CdmStore.getDefaultLanguage()});
- if(CdmStore.getCurrentSessionManager().isRemoting()) {
- editGeoService = ((CdmApplicationRemoteController)CdmStore.getCurrentApplicationConfiguration()).getEditGeoService();
- }else{
- editGeoService =(IEditGeoService) CdmStore.getCurrentApplicationConfiguration().getBean(
- "editGeoService");
- }
-
+ editGeoService = ((CdmApplicationRemoteController)CdmStore.getCurrentApplicationConfiguration()).getEditGeoService();
+
String parameter = editGeoService.getDistributionServiceRequestParameterString(
getTaxonDescriptions(),
false,
public NameRelationshipWizard(NameRelationshipDetailSection callingSection) {
NameRelationshipWizard.callingSection = callingSection;
rootElement = callingSection.getEntity();
- if (CdmStore.isActive() && CdmStore.getCurrentSessionManager().isRemoting()) {
+ if (CdmStore.isActive()) {
previousCdmEntitySession = CdmStore.getCurrentSessionManager().getActiveSession();
cdmEntitySession = CdmStore.getCurrentSessionManager().newSession(this, true);
cdmEntitySession.bind();
private CdmBase rootElement;
public EditFromSelectionWizard(EntitySelectionElement selectionElement) {
- if (CdmStore.isActive() && CdmStore.getCurrentSessionManager().isRemoting()) {
+ if (CdmStore.isActive()) {
previousCdmEntitySession = CdmStore.getCurrentSessionManager().getActiveSession();
cdmEntitySession = CdmStore.getCurrentSessionManager().newSession(this, true);
cdmEntitySession.bind();
Collections.sort(biocaseResponses, getComparator());
URI dataSetUri = null;
Abcd206ImportConfigurator configuratorAbcd;
+
List<Abcd206ImportConfigurator> abcdConfigurators = new ArrayList<Abcd206ImportConfigurator>();
DataSetResponse dataSetResponse;
OccurenceQuery bioCaseOccurrenceQuery = null;
}
if (!response.getDataSetUri().equals(dataSetUri)){
configuratorAbcd = Abcd206ImportConfigurator.NewInstance(dataSetUri, null, false);
+ configuratorAbcd.addMediaAsMediaSpecimen(true);
if (configuratorAbcd != null){
abcdConfigurators.add(configuratorAbcd);
}
// new TransientCdmRepository(CdmStore.getCurrentApplicationConfiguration());
//configurator.setCdmAppController(repo);
configurator.setAddMediaAsMediaSpecimen(true);
- if(CdmStore.getCurrentSessionManager().isRemoting()) {
- Job job = CdmStore.getImportManager().createIOServiceJob(configurator, resultStream, SOURCE_TYPE.INPUTSTREAM);
- CdmStore.getImportManager().run(job);
- } else {
- configurator.setSource(resultStream);
- CdmDefaultImport<Abcd206ImportConfigurator> importer = new CdmDefaultImport<Abcd206ImportConfigurator>();
- importer.invoke(configurator);
- }
- // results = repo.getUnits();
+ Job job = CdmStore.getImportManager().createIOServiceJob(configurator, resultStream, SOURCE_TYPE.INPUTSTREAM);
+ CdmStore.getImportManager().run(job);
+
setResults(results);
} catch (ClientProtocolException e) {
logger.error(errorMessage, e);
Abcd206ImportConfigurator configurator = CdmStore.getImportManager().AbcdConfigurator();
configurator.setOccurenceQuery(query);
configurator.setSourceUri(providerSelectionPage.getEndPoint());
+ configurator.setAddMediaAsMediaSpecimen(true);
configurator.setDbSchemaValidation(DbSchemaValidation.CREATE);
- if(CdmStore.getCurrentSessionManager().isRemoting() ) {
- //Job job = CdmStore.getImportManager().createIOServiceJob(configurator, new File(source), SOURCE_TYPE.INPUTSTREAM);
- //CdmStore.getImportManager().run(job);
- try {
- serviceWrapper = providerSelectionPage.getQueryServiceWrapper();
- InputStream stream = null;
-
- final IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- IWorkbenchPage activePart = window.getActivePage();
- if (providerSelectionPage.getQueryType().equals(QueryType.BIOCASE)){
- stream =((BioCaseQueryServiceWrapper) serviceWrapper).query(query, configurator.getSourceUri());
- SpecimenImportReport report = new SpecimenImportReport();
- UnitAssociationWrapper unitNodesList = AbcdParseUtility.parseUnitsNodeList(stream, report);
- NodeList nodeList = unitNodesList.getAssociatedUnits();
- String prefix = unitNodesList.getPrefix();
- String associationType = unitNodesList.getAssociationType();
- URI uri =AbcdParseUtility.parseFirstUri(nodeList, report);
- String content = AbcdParseUtility.parseFirstTextContent(nodeList);
- System.out.println(content);
-
-
- SpecimenImportView specimenImportView = new SpecimenImportView();
- try {
- specimenImportView = (SpecimenImportView) activePart.showView(SpecimenImportView.ID);
- specimenImportView.setEndpoint(providerSelectionPage.getEndPoint());
- specimenImportView.setQuery(query);
- dataImportView = specimenImportView;
- } catch (PartInitException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
-
- }
-
- } else{
- try {
-
- dataImportView = (GbifResponseImportView) activePart.showView(GbifResponseImportView.ID, "query_"+query.toString().replaceAll(",", ""), IWorkbenchPage.VIEW_ACTIVATE);
- dataImportView.setQuery(query);
- // (GbifResponseImportView) activePart.showView(GbifResponseImportView.ID);getWorkbench().getActiveWorkbenchWindow().getActivePage()
- // .showView(GbifResponseImportView.ID, "query_"+query.toString().replaceAll(",", ""),IWorkbenchPage.VIEW_ACTIVATE);
-
- } catch (PartInitException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
+
+ //Job job = CdmStore.getImportManager().createIOServiceJob(configurator, new File(source), SOURCE_TYPE.INPUTSTREAM);
+ //CdmStore.getImportManager().run(job);
+ try {
+ serviceWrapper = providerSelectionPage.getQueryServiceWrapper();
+ InputStream stream = null;
+
+ final IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ IWorkbenchPage activePart = window.getActivePage();
+ if (providerSelectionPage.getQueryType().equals(QueryType.BIOCASE)){
+ stream =((BioCaseQueryServiceWrapper) serviceWrapper).query(query, configurator.getSourceUri());
+ SpecimenImportReport report = new SpecimenImportReport();
+ UnitAssociationWrapper unitNodesList = AbcdParseUtility.parseUnitsNodeList(stream, report);
+ NodeList nodeList = unitNodesList.getAssociatedUnits();
+ String prefix = unitNodesList.getPrefix();
+ String associationType = unitNodesList.getAssociationType();
+ URI uri =AbcdParseUtility.parseFirstUri(nodeList, report);
+ String content = AbcdParseUtility.parseFirstTextContent(nodeList);
+ System.out.println(content);
+
+
+ SpecimenImportView specimenImportView = new SpecimenImportView();
+ try {
+ specimenImportView = (SpecimenImportView) activePart.showView(SpecimenImportView.ID);
+ specimenImportView.setEndpoint(providerSelectionPage.getEndPoint());
+ specimenImportView.setQuery(query);
+ dataImportView = specimenImportView;
+ } catch (PartInitException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
}
+ } else{
+ try {
+
+ dataImportView = (GbifResponseImportView) activePart.showView(GbifResponseImportView.ID, "query_"+query.toString().replaceAll(",", ""), IWorkbenchPage.VIEW_ACTIVATE);
+ dataImportView.setQuery(query);
+ // (GbifResponseImportView) activePart.showView(GbifResponseImportView.ID);getWorkbench().getActiveWorkbenchWindow().getActivePage()
+ // .showView(GbifResponseImportView.ID, "query_"+query.toString().replaceAll(",", ""),IWorkbenchPage.VIEW_ACTIVATE);
+
+ } catch (PartInitException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
}
- // CdmStore.getImportManager().run(configurator);
+
+
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
}
+ // CdmStore.getImportManager().run(configurator);
+
// try {
// switch (providerSelectionPage.getQueryType()) {
// case BIOCASE: