List of usage examples for java.rmi RemoteException RemoteException
public RemoteException(String s, Throwable cause)
From source file:com.amalto.core.delegator.IXtentisWSDelegator.java
@Override public WSString getBusinessConceptValue(WSGetBusinessConceptValue wsGetBusinessConceptValue) throws RemoteException { try {// w w w. j ava2 s .c o m ItemPOJO iv = Util.getItemCtrl2Local() .getItem(new ItemPOJOPK( new DataClusterPOJOPK(wsGetBusinessConceptValue.getWsDataClusterPK().getPk()), wsGetBusinessConceptValue.getWsBusinessConceptPK().getConceptName(), wsGetBusinessConceptValue.getWsBusinessConceptPK().getIds())); return new WSString(itemAsString(iv)); } catch (Exception e) { throw new RemoteException( (e.getCause() == null ? e.getLocalizedMessage() : e.getCause().getLocalizedMessage()), e); } }
From source file:com.amalto.core.delegator.IXtentisWSDelegator.java
@Override public WSStringArray getFullPathValues(WSGetFullPathValues wsGetFullPathValues) throws RemoteException { try {/* www . j av a 2 s . c om*/ Collection res = Util.getItemCtrl2Local().getFullPathValues( new DataClusterPOJOPK(wsGetFullPathValues.getWsDataClusterPK().getPk()), wsGetFullPathValues.getFullPath(), XConverter.WS2VO(wsGetFullPathValues.getWhereItem()), wsGetFullPathValues.getSpellThreshold(), wsGetFullPathValues.getOrderBy(), wsGetFullPathValues.getDirection()); if (res == null) { return null; } return new WSStringArray((String[]) res.toArray(new String[res.size()])); } catch (Exception e) { throw new RemoteException( (e.getCause() == null ? e.getLocalizedMessage() : e.getCause().getLocalizedMessage()), e); } }
From source file:com.amalto.core.delegator.IXtentisWSDelegator.java
@Override public WSItemPK partialPutItem(WSPartialPutItem partialPutItem) throws RemoteException { try {/*w w w. j a v a2 s .c om*/ SaverSession session = SaverSession.newSession(); DocumentSaver saver = SaverHelper.saveItem(partialPutItem, session); // Cause items being saved to be committed to database. session.end(); String[] savedId = saver.getSavedId(); String savedConceptName = saver.getSavedConceptName(); return new WSItemPK(new WSDataClusterPK(partialPutItem.getDatacluster()), savedConceptName, savedId); } catch (Exception e) { LOGGER.error("Could not do partial update.", e); //$NON-NLS-1$ throw new RemoteException(e.getLocalizedMessage(), e); } }
From source file:com.amalto.core.delegator.IXtentisWSDelegator.java
/** * @param wsPutItem The record to be added/updated in MDM. * @return The PK of the record created/updated. * @throws java.rmi.RemoteException In case of server exception. */// w ww .ja v a 2s . c om @Override public WSItemPK putItem(WSPutItem wsPutItem) throws RemoteException { try { WSDataClusterPK dataClusterPK = wsPutItem.getWsDataClusterPK(); WSDataModelPK dataModelPK = wsPutItem.getWsDataModelPK(); String dataClusterName = dataClusterPK.getPk(); String dataModelName = dataModelPK.getPk(); SaverSession session = SaverSession.newSession(); DocumentSaver saver; try { saver = SaverHelper.saveItem(wsPutItem, session, dataClusterName, dataModelName); } catch (Exception e) { try { session.abort(); } catch (Exception e1) { LOGGER.error("Could not abort save session.", e1); //$NON-NLS-1$ } throw new RuntimeException(e); } // Cause items being saved to be committed to database. session.end(); String[] savedId = saver.getSavedId(); String savedConceptName = saver.getSavedConceptName(); return new WSItemPK(dataClusterPK, savedConceptName, savedId); } catch (Exception e) { LOGGER.error("Error during save.", e); //$NON-NLS-1$ // TMDM-5594: Original cause was somehow lost during serialization,implementing a workaround here Throwable cause = e.getCause(); if (cause == null) { throw new RemoteException(e.getLocalizedMessage(), e); } else { throw new RemoteException((cause.getCause() == null ? cause.getLocalizedMessage() : cause.getCause().getLocalizedMessage()), e); } } }
From source file:com.amalto.core.delegator.IXtentisWSDelegator.java
/** * @param wsPutItemArray Items to save/* www . ja v a2 s. co m*/ * @return An array of ids saved to database. * @throws java.rmi.RemoteException In case of server error */ @Override public WSItemPKArray putItemArray(WSPutItemArray wsPutItemArray) throws RemoteException { WSPutItem[] items = wsPutItemArray.getWsPutItem(); try { List<WSItemPK> pks = new LinkedList<WSItemPK>(); SaverSession session = SaverSession.newSession(); for (WSPutItem item : items) { String dataClusterName = item.getWsDataClusterPK().getPk(); String dataModelName = item.getWsDataModelPK().getPk(); DocumentSaver saver; try { saver = SaverHelper.saveItem(item, session, dataClusterName, dataModelName); } catch (Exception e) { try { session.abort(); } catch (Exception e1) { LOGGER.error("Could not abort save session.", e1); //$NON-NLS-1$ } throw new RuntimeException(e); } pks.add(new WSItemPK(new WSDataClusterPK(), saver.getSavedConceptName(), saver.getSavedId())); } // Cause items being saved to be committed to database. session.end(); return new WSItemPKArray(pks.toArray(new WSItemPK[pks.size()])); } catch (Exception e) { LOGGER.error("Error during save.", e); //$NON-NLS-1$ throw new RemoteException( (e.getCause() == null ? e.getLocalizedMessage() : e.getCause().getLocalizedMessage()), e); } }
From source file:com.amalto.core.delegator.IXtentisWSDelegator.java
/** * @param wsPutItemWithReportArray Records to be added to MDM. * @return An array of PKs for the records created/updated. * @throws java.rmi.RemoteException In case of server error. *//*from ww w.j a va2 s. c o m*/ @Override public WSItemPKArray putItemWithReportArray( com.amalto.core.webservice.WSPutItemWithReportArray wsPutItemWithReportArray) throws RemoteException { try { WSPutItemWithReport[] items = wsPutItemWithReportArray.getWsPutItem(); List<WSItemPK> pks = new LinkedList<WSItemPK>(); SaverSession session = SaverSession.newSession(); int itemCounter = 0; for (WSPutItemWithReport item : items) { itemCounter++; WSPutItem wsPutItem = item.getWsPutItem(); String source = item.getSource(); String dataClusterName = wsPutItem.getWsDataClusterPK().getPk(); String dataModelName = wsPutItem.getWsDataModelPK().getPk(); DocumentSaver saver; try { saver = SaverHelper.saveItemWithReport(wsPutItem, session, dataClusterName, dataModelName, source, item.getInvokeBeforeSaving()); // Expected (legacy) behavior: set the before saving message as source. item.setSource(saver.getBeforeSavingMessage()); } catch (SaveException e) { try { session.abort(); } catch (Exception e1) { LOGGER.error("Could not abort save session.", e1); //$NON-NLS-1$ } // Expected (legacy) behavior: set the before saving message as source. item.setSource(e.getBeforeSavingMessage()); if (e.getCause() != null) { if (StringUtils.isEmpty(e.getMessage()) && e.getCause() != null) { throw new RemoteException("Could not save record.", new MultiRecordsSaveException( //$NON-NLS-1$ e.getCause().getMessage(), e.getCause(), itemCounter)); } throw new RemoteException("Could not save record.", //$NON-NLS-1$ new MultiRecordsSaveException(e.getMessage(), e.getCause(), itemCounter)); } throw new RemoteException("Could not save record.", e); //$NON-NLS-1$ } pks.add(new WSItemPK(new WSDataClusterPK(), saver.getSavedConceptName(), saver.getSavedId())); } // Cause items being saved to be committed to database. session.end(); return new WSItemPKArray(pks.toArray(new WSItemPK[pks.size()])); } catch (Exception e) { LOGGER.error("Error during save.", e); //$NON-NLS-1$ throw handleException(e, SAVE_EXCEPTION_MESSAGE); } }
From source file:com.amalto.core.delegator.IXtentisWSDelegator.java
/** * @param wsPutItemWithReport Object that describe the record to be added/updated. * @return The PK of the newly inserted document. * @throws java.rmi.RemoteException In case of server exception. *//* ww w .ja va 2s . c om*/ @Override public WSItemPK putItemWithReport(com.amalto.core.webservice.WSPutItemWithReport wsPutItemWithReport) throws RemoteException { try { WSPutItem wsPutItem = wsPutItemWithReport.getWsPutItem(); WSDataClusterPK dataClusterPK = wsPutItem.getWsDataClusterPK(); WSDataModelPK dataModelPK = wsPutItem.getWsDataModelPK(); String dataClusterName = dataClusterPK.getPk(); String dataModelName = dataModelPK.getPk(); SaverSession session = SaverSession.newSession(); DocumentSaver saver; try { saver = SaverHelper.saveItemWithReport(wsPutItem, session, dataClusterName, dataModelName, wsPutItemWithReport.getSource(), wsPutItemWithReport.getInvokeBeforeSaving()); // Expected (legacy) behavior: set the before saving message as source. wsPutItemWithReport.setSource(saver.getBeforeSavingMessage()); } catch (SaveException e) { try { session.abort(); } catch (Exception e1) { LOGGER.error("Could not abort save session.", e1); //$NON-NLS-1$ } ValidateException ve = Util.getException(e, ValidateException.class); if (ve != null) { throw e; } // Expected (legacy) behavior: set the before saving message as source. wsPutItemWithReport.setSource(e.getBeforeSavingMessage()); throw new RemoteException("Could not save record.", e); //$NON-NLS-1$ } // Cause items being saved to be committed to database. session.end(); String[] savedId = saver.getSavedId(); String conceptName = saver.getSavedConceptName(); return new WSItemPK(dataClusterPK, conceptName, savedId); } catch (Exception e) { LOGGER.error("Error during save.", e); //$NON-NLS-1$ throw handleException(e, SAVE_EXCEPTION_MESSAGE); } }
From source file:com.amalto.core.delegator.IXtentisWSDelegator.java
/** * @param wsPutItemWithCustomReport Information about a put item with report that includes a special user name. * @return The PK of the newly created record. * @throws java.rmi.RemoteException In case of server exception. *///from w w w .ja v a2s.com @Override public WSItemPK putItemWithCustomReport( com.amalto.core.webservice.WSPutItemWithCustomReport wsPutItemWithCustomReport) throws RemoteException { try { WSPutItemWithReport wsPutItemWithReport = wsPutItemWithCustomReport.getWsPutItemWithReport(); WSPutItem wsPutItem = wsPutItemWithReport.getWsPutItem(); WSDataClusterPK dataClusterPK = wsPutItem.getWsDataClusterPK(); WSDataModelPK dataModelPK = wsPutItem.getWsDataModelPK(); String dataClusterName = dataClusterPK.getPk(); String dataModelName = dataModelPK.getPk(); // This method uses a special user SaverSession session = SaverSession.newUserSession(wsPutItemWithCustomReport.getUser()); DocumentSaver saver; try { saver = SaverHelper.saveItemWithReport(wsPutItem, session, dataClusterName, dataModelName, wsPutItemWithReport.getSource(), wsPutItemWithReport.getInvokeBeforeSaving()); // Expected (legacy) behavior: set the before saving message as source. wsPutItemWithReport.setSource(saver.getBeforeSavingMessage()); // Cause items being saved to be committed to database. session.end(); } catch (SaveException e) { try { session.abort(); } catch (Exception e1) { LOGGER.error("Could not abort save session.", e1); //$NON-NLS-1$ } // Expected (legacy) behavior: set the before saving message as source. wsPutItemWithReport.setSource(e.getBeforeSavingMessage()); throw new RemoteException("Could not save record.", e); //$NON-NLS-1$ } String[] savedId = saver.getSavedId(); String conceptName = saver.getSavedConceptName(); return new WSItemPK(dataClusterPK, conceptName, savedId); } catch (Exception e) { LOGGER.error("Error during save.", e); //$NON-NLS-1$ throw new RemoteException( (e.getCause() == null ? e.getLocalizedMessage() : e.getCause().getLocalizedMessage()), e); } }
From source file:com.amalto.core.delegator.IXtentisWSDelegator.java
@Override public WSItemPK updateItemMetadata(WSUpdateMetadataItem wsUpdateMetadataItem) throws RemoteException { try {/*w w w . j a v a 2 s. c o m*/ WSItemPK itemPK = wsUpdateMetadataItem.getWsItemPK(); ItemPOJOPK itemPk = new ItemPOJOPK(new DataClusterPOJOPK(itemPK.getWsDataClusterPK().getPk()), itemPK.getConceptName(), itemPK.getIds()); Item itemCtrl2Local = Util.getItemCtrl2Local(); ItemPOJO item = itemCtrl2Local.getItem(itemPk); item.setTaskId(wsUpdateMetadataItem.getTaskId()); ItemPOJOPK itemPOJOPK = itemCtrl2Local.updateItemMetadata(item); return new WSItemPK(new WSDataClusterPK(itemPOJOPK.getDataClusterPOJOPK().getUniqueId()), itemPOJOPK.getConceptName(), itemPOJOPK.getIds()); } catch (XtentisException e) { if (LOGGER.isDebugEnabled()) { LOGGER.debug(e.getMessage(), e); } throw new RemoteException(e.getLocalizedMessage(), e); } catch (Exception e) { if (LOGGER.isDebugEnabled()) { LOGGER.debug(e.getMessage(), e); } throw new RemoteException( (e.getCause() == null ? e.getLocalizedMessage() : e.getCause().getLocalizedMessage()), e); } }
From source file:com.amalto.core.delegator.IXtentisWSDelegator.java
@Override public WSPipeline extractUsingTransformerThruView( WSExtractUsingTransformerThruView wsExtractUsingTransformerThruView) throws RemoteException { try {/*from w w w. j a va2s.com*/ TransformerContext context = Util.getItemCtrl2Local().extractUsingTransformerThroughView( new DataClusterPOJOPK(wsExtractUsingTransformerThruView.getWsDataClusterPK().getPk()), new TransformerV2POJOPK(wsExtractUsingTransformerThruView.getWsTransformerPK().getPk()), new ViewPOJOPK(wsExtractUsingTransformerThruView.getWsViewPK().getPk()), XConverter.WS2VO(wsExtractUsingTransformerThruView.getWhereItem()), wsExtractUsingTransformerThruView.getSpellTreshold(), wsExtractUsingTransformerThruView.getOrderBy(), wsExtractUsingTransformerThruView.getDirection(), wsExtractUsingTransformerThruView.getSkip(), wsExtractUsingTransformerThruView.getMaxItems()); HashMap<String, TypedContent> pipeline = context.getPipelineClone(); return XConverter.POJO2WS(pipeline); } catch (XtentisException e) { throw (new RemoteException(e.getLocalizedMessage(), e)); } catch (Exception e) { throw new RemoteException( (e.getCause() == null ? e.getLocalizedMessage() : e.getCause().getLocalizedMessage()), e); } }