Example usage for java.lang Throwable getLocalizedMessage

List of usage examples for java.lang Throwable getLocalizedMessage

Introduction

In this page you can find the example usage for java.lang Throwable getLocalizedMessage.

Prototype

public String getLocalizedMessage() 

Source Link

Document

Creates a localized description of this throwable.

Usage

From source file:cl.gisred.android.RegEquipoActivity.java

private void cerrarFormCrear(boolean bSave, View v) {
    // TODO Usar Layer Indicada
    bSave = false;//  w  w  w.j a v a2  s  .  co m
    if (bSave) {

        final AtomicReference<String> resp = new AtomicReference<>("");

        if (!validarForm(v)) {
            DialogoConfirmacion oDialog = new DialogoConfirmacion();
            oDialog.show(getFragmentManager(), "tagAlert");
            return;
        } else {
            View vAction = getLayoutValidate(v);
            Map<String, Object> objectMap = new HashMap<>();
            for (View view : vAction.getTouchables()) {

                if (view.getClass().equals(GisEditText.class)) {
                    GisEditText oText = (GisEditText) view;

                    if (oText.getText() != null && !oText.getText().toString().isEmpty()) {
                        if (oText.getId() == R.id.txtPoste) {
                            objectMap.put("id_poste_camara", oText.getIdObjeto());
                            objectMap.put("tipo_nodo_conex", oText.getTipo());
                        } else if (oText.getId() == R.id.txtTramoBt) {
                            objectMap.put("id_tramo_bt", oText.getText().toString());
                        } else if (oText.getId() == R.id.txtAddress) {
                            objectMap.put("id_direccion", oText.getIdObjeto());
                            objectMap.put("tipo_direccion", oText.getTipo());
                        }
                    }

                } else if (view.getClass().getGenericSuperclass().equals(EditText.class)) {
                    EditText oText = (EditText) view;

                    if (oText.getId() == R.id.txtNroMedidor) {
                        String oVal = (oText.getText().toString().isEmpty()) ? "0" : oText.getText().toString();
                        objectMap.put("nro_medidor", oVal);
                    }

                } else if (view.getClass().getGenericSuperclass().equals(Spinner.class)) {
                    Spinner oSpinner = (Spinner) view;
                    String sValue = oSpinner.getSelectedItem().toString();

                    if (oSpinner.getId() == R.id.spinnerMarcaMed)
                        objectMap.put("marca_medidor", sValue);
                    else if (oSpinner.getId() == R.id.spinnerFaseCon)
                        objectMap.put("fase_conex", sValue);
                    else if (oSpinner.getId() == R.id.spinnerObservacion)
                        objectMap.put("observacion", sValue);
                }
            }

            objectMap.put("empresa", empresa);
            objectMap.put("modulo", modulo);

            if (mLocation != null) {
                Point p = (Point) GeometryEngine.project(mLocation, egs, wm);

                objectMap.put("X", p.getX());
                objectMap.put("Y", p.getY());
            }

            Graphic newFeatureGraphic = new Graphic(oUbicacion, null, objectMap);
            Graphic[] adds = { newFeatureGraphic };
            LyAgrRegEquipo.applyEdits(adds, null, null, new CallbackListener<FeatureEditResult[][]>() {
                @Override
                public void onCallback(FeatureEditResult[][] featureEditResults) {
                    if (featureEditResults[0] != null) {
                        if (featureEditResults[0][0] != null && featureEditResults[0][0].isSuccess()) {

                            resp.set("Guardado Correctamente Id: " + featureEditResults[0][0].getObjectId());

                            runOnUiThread(new Runnable() {

                                @Override
                                public void run() {
                                    Util.showConfirmation(RegEquipoActivity.this, resp.get());
                                }
                            });
                        }
                    }
                }

                @Override
                public void onError(Throwable throwable) {
                    resp.set("Error al ingresar: " + throwable.getLocalizedMessage());
                    Log.w("onError", resp.get());

                    runOnUiThread(new Runnable() {

                        @Override
                        public void run() {
                            Toast.makeText(RegEquipoActivity.this, resp.get(), Toast.LENGTH_SHORT).show();
                        }
                    });
                }
            });
        }
    }

    bMapTap = false;
    oUbicacion = null;

    if (mBusquedaLayer != null && myMapView.getLayerByID(mBusquedaLayer.getID()) != null)
        myMapView.removeLayer(mBusquedaLayer);

    if (mUbicacionLayer != null && myMapView.getLayerByID(mUbicacionLayer.getID()) != null)
        myMapView.removeLayer(mUbicacionLayer);

    if (mSeleccionLayer != null && myMapView.getLayerByID(mSeleccionLayer.getID()) != null)
        myMapView.removeLayer(mSeleccionLayer);

    if (bVerCapas)
        toogleCapas(fabVerCapas);

    if (bIngCliente)
        menuMultipleActions.setVisibility(View.VISIBLE);
    menuMicroActions.setVisibility(View.VISIBLE);
    fabShowForm.setVisibility(View.GONE);
    formCrear.dismiss();

    if (LyAgrRegEquipo != null)
        LyAgrRegEquipo.setVisible(true);
}

From source file:cl.gisred.android.MicroMedidaActivity.java

private void cerrarDialogCrear(boolean bSave, @Nullable View viewDialog) {
    final AtomicReference<String> resp = new AtomicReference<>("");

    if (bSave) {/*from   w w w .  j  a va2 s. c om*/
        if (!validarVista(viewDialog)) {
            DialogoConfirmacion oDialog = new DialogoConfirmacion();
            oDialog.show(getFragmentManager(), "tagAlert");
            return;
        } else {
            switch (idResLayoutSelect) {
            case R.layout.dialog_poste:
                oLyAddGraphs = LyAddPoste;
                break;
            case R.layout.dialog_direccion:
                oLyAddGraphs = LyAddDireccion;
                break;
            case R.layout.dialog_cliente:
                oLyAddGraphs = LyAddCliente;
                break;
            case R.layout.dialog_cliente_cnr:
                oLyAddGraphs = LyAddClienteCnr;
                break;
            }

            if (oLyAddGraphs != null) {
                View oView = getLayoutValidate(viewDialog);
                Util oUtil = new Util(oUbicacion);

                ArrayList<Map<String, Object>> oAttrToSave = oUtil.getAttrAddByView(oView, idResLayoutSelect,
                        empresa);

                Map<String, Object> attributes = oAttrToSave.get(0);
                Graphic newFeatureGraphic = new Graphic(oUbicacion, null, attributes);
                Graphic[] adds = { newFeatureGraphic };

                if (idResLayoutSelect == R.layout.dialog_cliente_cnr
                        || idResLayoutSelect == R.layout.dialog_cliente) {
                    addsUnion = Util.addAttrUnionPoint(oAttrToSave, oUbicacion);
                }

                oLyAddGraphs.applyEdits(adds, null, null, new CallbackListener<FeatureEditResult[][]>() {

                    @Override
                    public void onCallback(FeatureEditResult[][] featureEditResults) {
                        if (featureEditResults[0] != null) {
                            if (featureEditResults[0][0] != null && featureEditResults[0][0].isSuccess()) {

                                resp.set(
                                        "Guardado Correctamente Id: " + featureEditResults[0][0].getObjectId());

                                if (idResLayoutSelect == R.layout.dialog_cliente_cnr
                                        || idResLayoutSelect == R.layout.dialog_cliente)
                                    LyAddUnion.applyEdits(addsUnion, null, null, callBackUnion());

                                runOnUiThread(new Runnable() {

                                    @Override
                                    public void run() {
                                        Util.showConfirmation(MicroMedidaActivity.this, resp.get());
                                    }
                                });
                            }
                        }
                    }

                    @Override
                    public void onError(Throwable throwable) {
                        resp.set("Error al grabar: " + throwable.getLocalizedMessage());
                        Log.w("onError", resp.get());

                        runOnUiThread(new Runnable() {

                            @Override
                            public void run() {
                                Toast.makeText(MicroMedidaActivity.this, resp.get(), Toast.LENGTH_SHORT).show();
                            }
                        });
                    }

                });
            }
        }
    } else {
        resp.set("Cancelado");
        Toast.makeText(MicroMedidaActivity.this, resp.get(), Toast.LENGTH_LONG).show();
    }

    bMapTap = false;

    if (mBusquedaLayer != null && myMapView.getLayerByID(mBusquedaLayer.getID()) != null)
        myMapView.removeLayer(mBusquedaLayer);

    if (mUbicacionLayer != null && myMapView.getLayerByID(mUbicacionLayer.getID()) != null)
        myMapView.removeLayer(mUbicacionLayer);

    if (mSeleccionLayer != null && myMapView.getLayerByID(mSeleccionLayer.getID()) != null)
        myMapView.removeLayer(mSeleccionLayer);

    oUbicacion = null;
    if (bVerCapas)
        toogleCapas(fabVerCapas);
    //setLayerAddToggle(false);
    if (bIngCliente)
        menuMultipleActions.setVisibility(View.VISIBLE);
    menuMicroActions.setVisibility(View.VISIBLE);
    fabShowDialog.setVisibility(View.GONE);
    dialogCrear.dismiss();
    if (oLyAddGraphs != null)
        oLyAddGraphs.setVisible(true);
}

From source file:cl.gisred.android.MicroMedidaActivity.java

private void cerrarFormCrear(boolean bSave, View v) {
    if (bSave) {//from   www . j a  v  a  2 s. c  o m

        final AtomicReference<String> resp = new AtomicReference<>("");

        if (!validarForm(v)) {
            DialogoConfirmacion oDialog = new DialogoConfirmacion();
            oDialog.show(getFragmentManager(), "tagAlert");
            return;
        } else {
            View vAction = getLayoutValidate(v);
            Map<String, Object> objectMap = new HashMap<>();
            for (View view : vAction.getTouchables()) {

                if (view.getClass().equals(GisEditText.class)) {
                    GisEditText oText = (GisEditText) view;

                    if (oText.getText() != null && !oText.getText().toString().isEmpty()) {
                        if (oText.getId() == R.id.txtPoste) {
                            objectMap.put("id_poste_camara", oText.getIdObjeto());
                            objectMap.put("tipo_nodo_conex", oText.getTipo());
                        } else if (oText.getId() == R.id.txtTramoBt) {
                            objectMap.put("id_tramo_bt", oText.getText().toString());
                        } else if (oText.getId() == R.id.txtAddress) {
                            objectMap.put("id_direccion", oText.getIdObjeto());
                            objectMap.put("tipo_direccion", oText.getTipo());
                        }
                    }

                } else if (view.getClass().getGenericSuperclass().equals(EditText.class)) {
                    EditText oText = (EditText) view;

                    if (oText.getId() == R.id.txtNroMedidor) {
                        String oVal = (oText.getText().toString().isEmpty()) ? "0" : oText.getText().toString();
                        objectMap.put("nro_medidor", oVal);
                    }

                } else if (view.getClass().getGenericSuperclass().equals(Spinner.class)) {
                    Spinner oSpinner = (Spinner) view;
                    String sValue = oSpinner.getSelectedItem().toString();

                    if (oSpinner.getId() == R.id.spinnerMarcaMed)
                        objectMap.put("marca_medidor", sValue);
                    else if (oSpinner.getId() == R.id.spinnerFaseCon)
                        objectMap.put("fase_conex", sValue);
                    else if (oSpinner.getId() == R.id.spinnerObservacion)
                        objectMap.put("observacion", sValue);
                }
            }

            objectMap.put("empresa", empresa);
            objectMap.put("modulo", modulo);

            if (mLocation != null) {
                Point p = (Point) GeometryEngine.project(mLocation, egs, wm);

                objectMap.put("X", p.getX());
                objectMap.put("Y", p.getY());
            }

            Graphic newFeatureGraphic = new Graphic(oUbicacion, null, objectMap);
            Graphic[] adds = { newFeatureGraphic };
            LyAddMicroMed.applyEdits(adds, null, null, new CallbackListener<FeatureEditResult[][]>() {
                @Override
                public void onCallback(FeatureEditResult[][] featureEditResults) {
                    if (featureEditResults[0] != null) {
                        if (featureEditResults[0][0] != null && featureEditResults[0][0].isSuccess()) {

                            resp.set("Guardado Correctamente Id: " + featureEditResults[0][0].getObjectId());

                            runOnUiThread(new Runnable() {

                                @Override
                                public void run() {
                                    Util.showConfirmation(MicroMedidaActivity.this, resp.get());
                                }
                            });
                        }
                    }
                }

                @Override
                public void onError(Throwable throwable) {
                    resp.set("Error al ingresar: " + throwable.getLocalizedMessage());
                    Log.w("onError", resp.get());

                    runOnUiThread(new Runnable() {

                        @Override
                        public void run() {
                            Toast.makeText(MicroMedidaActivity.this, resp.get(), Toast.LENGTH_SHORT).show();
                        }
                    });
                }
            });
        }
    }

    bMapTap = false;
    oUbicacion = null;

    if (mBusquedaLayer != null && myMapView.getLayerByID(mBusquedaLayer.getID()) != null)
        myMapView.removeLayer(mBusquedaLayer);

    if (mUbicacionLayer != null && myMapView.getLayerByID(mUbicacionLayer.getID()) != null)
        myMapView.removeLayer(mUbicacionLayer);

    if (mSeleccionLayer != null && myMapView.getLayerByID(mSeleccionLayer.getID()) != null)
        myMapView.removeLayer(mSeleccionLayer);

    if (bVerCapas)
        toogleCapas(fabVerCapas);

    if (bIngCliente)
        menuMultipleActions.setVisibility(View.VISIBLE);
    menuMicroActions.setVisibility(View.VISIBLE);
    fabShowForm.setVisibility(View.GONE);
    formCrear.dismiss();

    if (LyAddMicroMed != null)
        LyAddMicroMed.setVisible(true);
}

From source file:org.opencms.importexport.CmsImportVersion10.java

/**
 * Parses the links.<p>/*from   w ww.ja v a2 s . c  o  m*/
 *
 * @param cms the CMS context to use
 * @param report the report
 */
private void parseLinks(CmsObject cms, I_CmsReport report) {

    int i = 0;

    sortParseableResources(m_parseables);
    for (CmsResource parsableRes : m_parseables) {
        String resName = cms.getSitePath(parsableRes);

        report.print(org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_SUCCESSION_2,
                String.valueOf(i + 1), String.valueOf(m_parseables.size())), I_CmsReport.FORMAT_NOTE);

        LOG.info("Rewriting parsable resource: " + resName);
        report.print(Messages.get().container(Messages.RPT_PARSE_LINKS_FOR_1, resName),
                I_CmsReport.FORMAT_NOTE);
        report.print(org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_DOTS_0));

        try {
            CmsFile file = cms.readFile(resName);
            // make sure the date last modified is kept...
            file.setDateLastModified(file.getDateLastModified());
            // make sure the file is locked
            CmsLock lock = cms.getLock(file);
            if (lock.isUnlocked()) {
                cms.lockResource(resName);
            } else if (!lock.isDirectlyOwnedInProjectBy(cms)) {
                cms.changeLock(resName);
            }
            // rewrite the file
            cms.writeFile(file);

            report.println(org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_OK_0),
                    I_CmsReport.FORMAT_OK);
        } catch (Throwable e) {
            report.addWarning(e);
            report.println(
                    org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_FAILED_0),
                    I_CmsReport.FORMAT_ERROR);
            if (LOG.isWarnEnabled()) {
                LOG.warn(Messages.get().getBundle().key(Messages.LOG_IMPORTEXPORT_REWRITING_1, resName));
                LOG.warn(e.getMessage(), e);
            }
            if (LOG.isDebugEnabled()) {
                LOG.debug(e.getLocalizedMessage(), e);
            }
        }
        i++;
    }
    cms.getRequestContext().removeAttribute(CmsLogEntry.ATTR_LOG_ENTRY);
}

From source file:cl.gisred.android.InspActivity.java

private void cerrarDialogCrear(boolean bSave, @Nullable View viewDialog) {
    final AtomicReference<String> resp = new AtomicReference<>("");

    if (bSave) {//from   w ww.  j a v  a2  s.co  m
        if (!validarVista(viewDialog)) {
            DialogoConfirmacion oDialog = new DialogoConfirmacion();
            oDialog.show(getFragmentManager(), "tagAlert");
            return;
        } else {
            switch (idResLayoutSelect) {
            case R.layout.dialog_poste:
                oLyAddGraphs = LyAddPoste;
                break;
            case R.layout.dialog_direccion:
                oLyAddGraphs = LyAddDireccion;
                break;
            case R.layout.dialog_cliente:
                oLyAddGraphs = LyAddCliente;
                break;
            case R.layout.dialog_cliente_cnr:
                oLyAddGraphs = LyAddClienteCnr;
                break;
            }

            if (oLyAddGraphs != null) {
                View oView = getLayoutValidate(viewDialog);
                Util oUtil = new Util(oUbicacion);

                ArrayList<Map<String, Object>> oAttrToSave = oUtil.getAttrAddByView(oView, idResLayoutSelect,
                        empresa);

                Map<String, Object> attributes = oAttrToSave.get(0);
                Graphic newFeatureGraphic = new Graphic(oUbicacion, null, attributes);
                Graphic[] adds = { newFeatureGraphic };

                if (idResLayoutSelect == R.layout.dialog_cliente_cnr
                        || idResLayoutSelect == R.layout.dialog_cliente) {
                    addsUnion = Util.addAttrUnionPoint(oAttrToSave, oUbicacion);
                }

                oLyAddGraphs.applyEdits(adds, null, null, new CallbackListener<FeatureEditResult[][]>() {

                    @Override
                    public void onCallback(FeatureEditResult[][] featureEditResults) {
                        if (featureEditResults[0] != null) {
                            if (featureEditResults[0][0] != null && featureEditResults[0][0].isSuccess()) {

                                resp.set(
                                        "Guardado Correctamente Id: " + featureEditResults[0][0].getObjectId());

                                if (idResLayoutSelect == R.layout.dialog_cliente_cnr
                                        || idResLayoutSelect == R.layout.dialog_cliente)
                                    LyAddUnion.applyEdits(addsUnion, null, null, callBackUnion());

                                runOnUiThread(new Runnable() {

                                    @Override
                                    public void run() {
                                        Util.showConfirmation(InspActivity.this, resp.get());
                                    }
                                });
                            }
                        }
                    }

                    @Override
                    public void onError(Throwable throwable) {
                        resp.set("Error al grabar: " + throwable.getLocalizedMessage());
                        Log.w("onError", resp.get());

                        runOnUiThread(new Runnable() {

                            @Override
                            public void run() {
                                Toast.makeText(InspActivity.this, resp.get(), Toast.LENGTH_SHORT).show();
                            }
                        });
                    }

                });
            }
        }
    } else {
        resp.set("Cancelado");
        Toast.makeText(InspActivity.this, resp.get(), Toast.LENGTH_LONG).show();
    }

    bMapTap = false;

    if (mBusquedaLayer != null && myMapView.getLayerByID(mBusquedaLayer.getID()) != null)
        myMapView.removeLayer(mBusquedaLayer);

    if (mUbicacionLayer != null && myMapView.getLayerByID(mUbicacionLayer.getID()) != null)
        myMapView.removeLayer(mUbicacionLayer);

    if (mSeleccionLayer != null && myMapView.getLayerByID(mSeleccionLayer.getID()) != null)
        myMapView.removeLayer(mSeleccionLayer);

    oUbicacion = null;
    if (bVerCapas)
        toogleCapas(fabVerCapas);
    //setLayerAddToggle(false);
    menuMultipleActions.setVisibility(View.VISIBLE);
    menuInspeccionActions.setVisibility(View.VISIBLE);
    fabShowDialog.setVisibility(View.GONE);
    dialogCrear.dismiss();
    if (oLyAddGraphs != null)
        oLyAddGraphs.setVisible(true);
}

From source file:it.cnr.icar.eric.client.ui.thin.RegistryObjectCollectionBean.java

public String doCancelOnCurrentROB() {
    String status = "failure";
    try {/*from   ww w. ja  v a2  s  .  co m*/
        doClear();
        append(WebUIResourceBundle.getInstance().getString("publishCanceled"));
        status = "publishCancel";
    } catch (Throwable t) {
        append(WebUIResourceBundle.getInstance().getString("cancelROError") + " " + t.getLocalizedMessage());
    }
    return status;
}

From source file:it.cnr.icar.eric.client.ui.thin.RegistryObjectCollectionBean.java

/**
* This method saves on existing RelatedObject for a RegistryObject
* 
* @param none//from w w  w  .j av  a  2s. c o  m
* @return String
*/
public String doSaveOnCurrentComposedROB() {
    disableSave = true;
    String status = "failure";
    String result = "";
    boolean skipFinally = false;
    try {
        if (this.currentComposedRegistryObject.getRegistryObject() instanceof SpecificationLinkImpl) {
            if (this.currentComposedRegistryObject.getspecificationObject() == null) {
                if (this.currentComposedRegistryObject.getIsInvalidSpecObj()) {
                    status = "failure";
                    append(WebUIResourceBundle.getInstance().getString("invalidSpecificationObject"));
                    skipFinally = true;
                    return status;
                } else {
                    status = "failure";
                    append(WebUIResourceBundle.getInstance().getString("nullSpecificationObject"));
                    skipFinally = true;
                    return status;
                }
            }
        }
        if (this.currentComposedRegistryObject.getRegistryObject() instanceof ServiceBindingImpl) {
            this.changeAccessURIandTargetBinding(this.currentComposedRegistryObject);
            if (this.currentComposedRegistryObject.getRegistryObjectErrorMessage() != null) {
                status = "failure";
                skipFinally = true;
                append(this.currentComposedRegistryObject.getRegistryObjectErrorMessage());
                this.currentComposedRegistryObject.setRegistryObjectErrorMessage(null);
                return status;
            }
            if (this.currentComposedRegistryObject.getIsInvalidTargetBinding()) {
                status = "failure";
                skipFinally = true;
                append(WebUIResourceBundle.getInstance().getString("invalidTargetBindingObject"));
                this.currentComposedRegistryObject.setIsInvalidTargetBinding(false);
                return status;
            }
        }
        if (this.currentComposedRegistryObject.getRegistryObject() instanceof ExternalLinkImpl) {
            this.currentComposedRegistryObject.changeExternalURI();
            if (this.currentComposedRegistryObject.getRegistryObjectErrorMessage() != null) {
                status = "failure";
                skipFinally = true;
                append(this.currentComposedRegistryObject.getRegistryObjectErrorMessage());
                this.currentComposedRegistryObject.setRegistryObjectErrorMessage(null);
                return status;
            }
        }
        if (this.currentComposedRegistryObject.getRegistryObject() instanceof ExternalIdentifier) {
            String tmpstatus = this.checkExternalIdentifier(null,
                    this.currentComposedRegistryObject.getRegistryObject());
            if (tmpstatus != null) {
                skipFinally = true;
                return tmpstatus;
            }
        }
        if (this.currentComposedRegistryObject.getRegistryObject() instanceof RegistryImpl) {
            this.currentComposedRegistryObject.changeOperatorForRegistry();
            if (this.currentComposedRegistryObject.getRegistryObjectErrorMessage() != null) {
                status = "failure";
                skipFinally = true;
                append(this.currentComposedRegistryObject.getRegistryObjectErrorMessage());
                this.currentComposedRegistryObject.setRegistryObjectErrorMessage(null);
                return status;
            }
        }
        String currentComposedROUUID = currentComposedRegistryObject.getId();
        String currentComposedROType = currentComposedRegistryObject.getObjectType();
        // Check to see if the composed RO is already a member of the 
        // drilldown RO's composed object collection.  If not, call 
        // appropriate addXXX method
        boolean isNew = isComposedObjectNew();
        if (isNew) {
            setNewComposedROB();
        } else {
            resetComposedROB();
        }
        currentRegistryObject.resetRelatedObjects();
        currentRegistryObject.initRelatedObjects();
        // passROB = currentRegistryObject;
        result = WebUIResourceBundle.getInstance().getString("publishSuccessful");

        RegistryObject ro = currentComposedRegistryObject.getRegistryObject();
        handleSavesToDrilldownObject(ro);
        resetCurrentComposedRegistryObjectBean();
        setCurrentRelatedObjectsData(relationshipName);
        /*
         * If ro is a pseudo composed object, such as ClassificationNode,
         * flag it as dirty, but not its parent
         */
        if (currentComposedROType.equalsIgnoreCase("ClassificationNode")) {
            setPseudoComposedObjectAsDirty(currentComposedROUUID);
        } else {
            currentRegistryObject.setDirty(true);
        }
        currentRegistryObject.setSelected(true);
        status = "saveSuccessful";
    } catch (Throwable t) {
        status = "failure";
        result = WebUIResourceBundle.getInstance().getString("errorSavingCO") + ": " + t.getLocalizedMessage();
        log.error(result, t);
        append(WebUIResourceBundle.getInstance().getString("saveCOError") + t.getLocalizedMessage());
    } finally {
        if (!skipFinally) {
            disableSave = false;
            //setting newComposedObject to true so as to force cleaning of Object
            newComposedObject = true;
            cleanupComposedROB();
        }
    }
    append(result);
    return status;
}

From source file:it.cnr.icar.eric.client.ui.thin.RegistryObjectCollectionBean.java

/**
 * This method creates a RegistryObject type
 * dynamically. To add new Related ROB's.
 * //  w  w  w  .  jav a  2s.  c  o m
 * @param none
 * @return String
 */
public String doAddCurrentComposedROB() {
    String status = "failure";
    try {
        LifeCycleManagerImpl lcm = RegistryBrowser.getBLCM();
        Class<? extends LifeCycleManagerImpl> clazz = lcm.getClass();
        String type = getCurrentComposedRegistryObjectType();
        String methodName = "createObject";
        Method m = null;
        // Create new composed RO using the LCM; create and store the ROB
        Class<?> argClass[] = new Class[1];
        argClass[0] = type.getClass();
        m = clazz.getMethod(methodName, argClass);
        Object args[] = new Object[1];
        args[0] = type;
        Object ro = m.invoke(lcm, args);
        if (ro instanceof RegistryObject) {
            VersionInfoType vit = BindingUtility.getInstance().rimFac.createVersionInfoType();
            ((RegistryObjectImpl) ro).setVersionInfo(vit);
        }
        RegistryObjectBean rob = null;
        List<SearchResultValueBean> searchResultValueBeans = new ArrayList<SearchResultValueBean>(4);
        searchResultValueBeans.add(new SearchResultValueBean("", ""));
        searchResultValueBeans.add(new SearchResultValueBean("", ""));
        searchResultValueBeans.add(new SearchResultValueBean("", ""));
        searchResultValueBeans.add(new SearchResultValueBean("", ""));
        if (ro instanceof TelephoneNumber) {
            rob = new RegistryObjectBean(searchResultValueBeans, currentRegistryObject.getRegistryObject(),
                    "TelephoneNumber", (TelephoneNumber) ro, false);
        } else if (ro instanceof PostalAddress) {
            rob = new RegistryObjectBean(searchResultValueBeans, currentRegistryObject.getRegistryObject(),
                    "PostalAddress", (PostalAddress) ro, false);
        } else if (ro instanceof EmailAddress) {
            rob = new RegistryObjectBean(searchResultValueBeans, currentRegistryObject.getRegistryObject(),
                    "EmailAddress", (EmailAddress) ro, false);
        } else if (ro instanceof Slot) {
            List<String> valueList = new ArrayList<String>();
            valueList.add("");
            ((Slot) ro).setValues(valueList);
            rob = new RegistryObjectBean(searchResultValueBeans, currentRegistryObject.getRegistryObject(),
                    "Slot", (Slot) ro, false);
        } else if (ro instanceof Concept) {
            if (currentRegistryObject.getRegistryObject().getObjectType().getValue()
                    .equalsIgnoreCase("ClassificationScheme")) {
                ClassificationScheme cs = (ClassificationScheme) currentRegistryObject.getRegistryObject();
                ((ConceptImpl) ro).setClassificationScheme(cs);
            } else {
                Concept cn = (Concept) currentRegistryObject.getRegistryObject();
                ClassificationScheme cs = cn.getClassificationScheme();
                if (null != cs) {
                    ((ConceptImpl) ro).setClassificationScheme(cn.getClassificationScheme());
                }
                ((ConceptImpl) ro).setParentConcept(cn);
            }
            rob = new RegistryObjectBean(searchResultValueBeans, (RegistryObject) ro);
        } else if (ro instanceof RegistryObject) {
            rob = new RegistryObjectBean(searchResultValueBeans, (RegistryObject) ro);
        }
        rob.setNew(true);
        currentComposedRegistryObject = rob;
        registryObjectLookup.put(rob.getId(), rob);
        // Return status so JSF runtime can do page navigation
        status = "showDetailsPage";
    } catch (Throwable t) {
        log.warn(WebUIResourceBundle.getInstance().getString("message.UnableToCreateComposedObject"), t);
        append(WebUIResourceBundle.getInstance().getString("createCOError") + " " + t.getLocalizedMessage());
    }
    return status;
}

From source file:it.cnr.icar.eric.client.ui.thin.RegistryObjectCollectionBean.java

public String doAdd() {
    String status = "failure";
    if (!isUserAllowedToPublish()) {
        status = RegistryBrowser.getInstance().getAuthenticationStatus();
    } else {/*from  w  w  w. j av  a2 s  .  com*/
        try {
            doClear();
            // Get object type from the drop down list
            // use the newObjectType reference
            // Create the new RO using lcm
            String newType = getNonQualifiedObjectType();
            RegistryObject ro = createNewRegistryObject(newType);
            if (ro instanceof ExtrinsicObjectImpl) {
                Concept type = (RegistryBrowser.getBQM()).findConceptByPath(newObjectType);
                ((ExtrinsicObjectImpl) ro).setObjectType(type);
            }
            // Create the SRVBs
            // Create the ROB using the RO and SRVBs
            // Register the ROB
            ArrayList<RegistryObject> ros = new ArrayList<RegistryObject>(1);
            ros.add(ro);
            handleRegistryObjects(ros);
            // Set the last ROB in the collection to the currentRegisryObject
            Iterator<RegistryObjectBean> robItr = registryObjectBeans.iterator();
            while (robItr.hasNext()) {
                RegistryObjectBean rob = robItr.next();
                if (!robItr.hasNext()) {
                    currentRegistryObject = rob;
                    currentRegistryObject.setNew(true);
                }
            }
            // Initialize composed objects of the current ROB
            currentRegistryObject.initRelatedObjects();
            setRowClasses(currentRegistryObject);
            status = "addSuccessful";
        } catch (Throwable t) {
            log.error(WebUIResourceBundle.getInstance().getString("message.CouldNotCreateNewRegistryObject"),
                    t);
            append(WebUIResourceBundle.getInstance().getString("createROError") + " "
                    + t.getLocalizedMessage());
        }
    }
    return status;
}