Example usage for java.util.concurrent.atomic AtomicReference get

List of usage examples for java.util.concurrent.atomic AtomicReference get

Introduction

In this page you can find the example usage for java.util.concurrent.atomic AtomicReference get.

Prototype

public final V get() 

Source Link

Document

Returns the current value, with memory effects as specified by VarHandle#getVolatile .

Usage

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

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

    if (bSave) {/*ww w  .  ja  v  a2s .  c  o  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(CatastroActivity.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(CatastroActivity.this, resp.get(), Toast.LENGTH_SHORT).show();
                            }
                        });
                    }

                });
            }
        }
    } else {
        resp.set("Cancelado");
        Toast.makeText(CatastroActivity.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);
    menuCatastroActions.setVisibility(View.VISIBLE);
    fabShowDialog.setVisibility(View.GONE);
    dialogCrear.dismiss();
    if (oLyAddGraphs != null)
        oLyAddGraphs.setVisible(true);
}

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

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

    if (bSave) {/*ww w . j  a  va2s . c o 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(MapsActivity.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(MapsActivity.this, resp.get(), Toast.LENGTH_SHORT).show();
                            }
                        });
                    }

                });
            }
        }
    } else {
        resp.set("Cancelado");
        Toast.makeText(MapsActivity.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);
    fabShowDialog.setVisibility(View.GONE);
    dialogCrear.dismiss();
    if (oLyAddGraphs != null)
        oLyAddGraphs.setVisible(true);
}

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

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

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

        if (!validarZoneLimit(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", oText.getIdObjeto());
                            oUbicacion = oText.getPoint();
                        } else if (oText.getId() == R.id.txtTramoBt) {
                            objectMap.put("id_tramo", oText.getText().toString());
                        }
                    }
                }
            }

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

            Graphic newFeatureGraphic = new Graphic(oUbicacion, null, objectMap);
            Graphic[] adds = { newFeatureGraphic };
            LyRetRegEquipo.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 (LyRetRegEquipo != null)
        LyRetRegEquipo.setVisible(true);
}

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

private void cerrarFormLimit(boolean bSave, View v) {
    if (bSave) {//  w  ww .j ava 2  s  .c  om

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

        if (!validarZoneLimit(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", oText.getIdObjeto());
                            oUbicacion = oText.getPoint();
                        } else if (oText.getId() == R.id.txtTramoBt) {
                            objectMap.put("id_tramo", oText.getText().toString());
                        }
                    }
                }
            }

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

            Graphic newFeatureGraphic = new Graphic(oUbicacion, null, objectMap);
            Graphic[] adds = { newFeatureGraphic };
            LyAddZoneLimit.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 (LyAddZoneLimit != null)
        LyAddZoneLimit.setVisible(true);
}

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

private void cerrarFormMant(boolean bSave, View v) {
    if (bSave) {/*from www.ja 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().getGenericSuperclass().equals(Spinner.class)) {
                    Spinner oSpinner = (Spinner) view;
                    String sValue = oSpinner.getSelectedItem().toString();

                    if (oSpinner.getId() == R.id.spinnerElement)
                        objectMap.put("elemento", sValue);
                    else if (oSpinner.getId() == R.id.spinnerDiagnostic)
                        objectMap.put("diagnostico", sValue);
                    else if (oSpinner.getId() == R.id.spinnerMaterial)
                        objectMap.put("material", sValue);
                    else if (oSpinner.getId() == R.id.spinnerCriticidad)
                        objectMap.put("criticidad", sValue);
                }
            }

            objectMap.put("id_padre", idNodo);
            objectMap.put("rotulo", rotulo);
            objectMap.put("empresa", empresa);
            objectMap.put("estado", "Informado");

            Graphic newFeatureGraphic = new Graphic(oUbicacionForm, null, objectMap);
            Graphic[] adds = { newFeatureGraphic };
            LyAddMantCatastro.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(MantCatastroActivity.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(MantCatastroActivity.this, resp.get(), Toast.LENGTH_SHORT).show();
                        }
                    });
                }
            });
        }
    }

    bMapTap = false;
    oUbicacionForm = 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);

    fabShowForm.setVisibility(View.GONE);
    formMant.dismiss();

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

From source file:com.microsoft.tfs.core.clients.versioncontrol.VersionControlClient.java

/**
 * Query the collection of labels that match the given specifications.
 *
 * @param label/*from w ww. java  2 s .  c o  m*/
 *        the label name to match (may be null?).
 * @param scope
 *        the scope of the label to match (may be null?).
 * @param owner
 *        the owner of the label to match (may be null?).
 * @param includeItemDetails
 *        if true, details about the labeled items are included in the
 *        results, otherwise only general label information is included.
 * @param filterItem
 *        if not <code>null</code>, only labels containing this item are
 *        returned.
 * @param filterItemVersion
 *        if filterItem was supplied, only labels that include this version
 *        of the filterItem are returned, otherwise may be null.
 * @return the label items that matched the query. May be empty but never
 *         null.
 */
public VersionControlLabel[] queryLabels(final String label, final String scope, final String owner,
        final boolean includeItemDetails, final String filterItem, final VersionSpec filterItemVersion) {
    final AtomicReference<String> workspaceName = new AtomicReference<String>();
    final AtomicReference<String> workspaceOwner = new AtomicReference<String>();

    determineWorkspaceNameAndOwner(filterItem, workspaceName, workspaceOwner);

    if (filterItem != null && (workspaceName.get() == null || workspaceOwner.get() == null)
            && ServerPath.isServerPath(filterItem) == false) {
        Check.isTrue(false,
                MessageFormat.format("Could not determine the workspace for local path {0}", filterItem)); //$NON-NLS-1$
    }

    return getWebServiceLayer().queryLabels(workspaceName.get(), workspaceOwner.get(), label, scope, owner,
            filterItem, filterItemVersion, includeItemDetails, true);
}

From source file:com.microsoft.tfs.core.clients.versioncontrol.VersionControlClient.java

/**
 * Gets source changes for a given {@link ItemSpec} in a specific version
 * range. The result is the set of changes as ExtendedMerge objects, which
 * contain the source of the merge (item, version, deletionID, and change)
 * as well as the changeset details. The {@link Changeset} is not a complete
 * object: only the owner, committer, date, comment, and changesetID are
 * available. No items, release notes, or other data are available.
 *
 * @param targetItemSpec//from  w ww . j  ava2s  .c o m
 *        the item that is the target of merges to be queried (must not be
 *        <code>null</code>)
 * @param targetVersionSpec
 *        the version of the target item to query at (must not be
 *        <code>null</code>)
 * @param versionFrom
 *        the oldest version to be included in the results (may be null)
 * @param versionTo
 *        the most recent version to be included in the results (may be
 *        null)
 * @param options
 *        the options to use (must not be <code>null</code>)
 * @return the {@link ChangesetMergeDetails} returned by the server.
 */
public ExtendedMerge[] queryMergesExtended(final ItemSpec targetItemSpec, final VersionSpec targetVersionSpec,
        final VersionSpec versionFrom, final VersionSpec versionTo, final QueryMergesExtendedOptions options) {
    Check.notNull(targetItemSpec, "targetItemSpec"); //$NON-NLS-1$
    Check.notNull(targetVersionSpec, "targetVersionSpec"); //$NON-NLS-1$
    Check.notNull(options, "options"); //$NON-NLS-1$

    final AtomicReference<String> workspaceName = new AtomicReference<String>();
    final AtomicReference<String> workspaceOwner = new AtomicReference<String>();

    determineWorkspaceNameAndOwner(targetItemSpec, workspaceName, workspaceOwner);

    return getWebServiceLayer().queryMergesExtended(workspaceName.get(), workspaceOwner.get(), targetItemSpec,
            targetVersionSpec, versionFrom, versionTo, options);
}

From source file:com.microsoft.tfs.core.clients.versioncontrol.VersionControlClient.java

/**
 * Gets extended information about items, with full results control.
 *
 * @param workspaceName/*from w w  w. j  a  v  a2  s . co m*/
 *        the name of the workspace to get extended information for. If the
 *        paths in the itemSpecs are server paths, this parameter is ignored
 *        (may be null). If this parameter is null and the itemSpec paths
 *        are local, the correct local workspace is determined
 *        automatically.
 * @param workspaceOwner
 *        the owner of the workspace to get extended information for. If the
 *        paths in the itemSpecs are server paths, this parameter is ignored
 *        (may be null). If this parameter is null and the itemSpec paths
 *        are local, the correct local workspace is determined
 *        automatically.
 * @param itemSpecs
 *        instances of {@link ItemSpec} that describe the item sets you want
 *        returned. One {@link ItemSet} will be returned for each
 *        {@link ItemSpec} (must not be <code>null</code> or empty)
 * @param deletedState
 *        the deleted state of items you want to list (must not be
 *        <code>null</code>)
 * @param itemType
 *        the types of items you want to list (must not be <code>null</code>
 *        )
 * @param options
 *        the {@link GetItemsOptions} which control the returned results
 *        (must not be <code>null</code>)
 * @param itemPropertyFilters
 *        a list of versioned item properties to return with each extended
 *        item (may be <code>null</code>)
 * @return an array of {@link ExtendedItem} arrays, each outer array
 *         representing one given {@link ItemSpec}, and each inner array
 *         representing the matches found for those {@link ItemSpec}s
 *         (should be only one object in these inner arrays because
 *         recursion is not an option). Inner arrays may be empty but are
 *         never null.
 */
public ExtendedItem[][] getExtendedItems(String workspaceName, String workspaceOwner,
        final ItemSpec[] itemSpecs, final DeletedState deletedState, final ItemType itemType,
        final GetItemsOptions options, String[] itemPropertyFilters) {
    Check.notNullOrEmpty(itemSpecs, "itemSpecs"); //$NON-NLS-1$
    Check.notNull(deletedState, "deletedState"); //$NON-NLS-1$
    Check.notNull(itemType, "itemType"); //$NON-NLS-1$
    Check.notNull(options, "options"); //$NON-NLS-1$

    itemPropertyFilters = mergeWithDefaultItemPropertyFilters(itemPropertyFilters);

    if (options.contains(GetItemsOptions.UNSORTED) || options.contains(GetItemsOptions.DOWNLOAD)) {
        throw new VersionControlException(MessageFormat.format(
                Messages.getString("VersionControlClient.TheUnsortedAndDownloadOptionsAreNotAllowedFormat"), //$NON-NLS-1$
                GetItemsOptions.UNSORTED.toString(), GetItemsOptions.DOWNLOAD.toString()));
    }

    /*
     * Detect the correct local workspace if none was supplied. Only works
     * if the paths are local paths. For server paths, a null name and owner
     * is returned, and sending that to the server results in less
     * information returned (no version info, etc.).
     */
    if (workspaceName == null && workspaceOwner == null) {
        final AtomicReference<String> workspaceNameHolder = new AtomicReference<String>();
        final AtomicReference<String> workspaceOwnerHolder = new AtomicReference<String>();

        determineWorkspaceNameAndOwner(itemSpecs, workspaceNameHolder, workspaceOwnerHolder);

        workspaceName = workspaceNameHolder.get();
        workspaceOwner = workspaceOwnerHolder.get();
    }

    return getWebServiceLayer().queryItemsExtended(workspaceName, workspaceOwner, itemSpecs, deletedState,
            itemType, options, itemPropertyFilters);
}

From source file:com.microsoft.tfs.core.clients.versioncontrol.VersionControlClient.java

/**
 * Gets information about multiple items. An {@link ItemSet} is returned for
 * each query item./*www .j av  a2  s.  com*/
 *
 * @param itemSpecs
 *        the items to get information about (must not be <code>null</code>
 *        or empty)
 * @param version
 *        the version of each of the items to get information about (not
 *        null)
 * @param deletedState
 *        the deleted state of items (must not be <code>null</code>)
 * @param itemType
 *        the types of matching items that should be returned (must not be
 *        <code>null</code>)
 * @param options
 *        flags that control the amount of information returned for the item
 * @param itemPropertyFilters
 *        a list of versioned item properties to return with each item (may
 *        be <code>null</code>)
 * @return an array of {@link ItemSet} instances, one for each given
 *         {@link ItemSpec} in the original order. May be empty but never
 *         null.
 */
public ItemSet[] getItems(final ItemSpec[] itemSpecs, final VersionSpec version,
        final DeletedState deletedState, final ItemType itemType, final GetItemsOptions options,
        String[] itemPropertyFilters) {
    Check.notNullOrEmpty(itemSpecs, "itemSpecs"); //$NON-NLS-1$

    itemPropertyFilters = mergeWithDefaultItemPropertyFilters(itemPropertyFilters);

    final AtomicReference<String> workspaceName = new AtomicReference<String>();
    final AtomicReference<String> workspaceOwner = new AtomicReference<String>();

    determineWorkspaceNameAndOwner(itemSpecs, workspaceName, workspaceOwner);

    final ItemSet[] sets = getWebServiceLayer().queryItems(workspaceName.get(), workspaceOwner.get(), itemSpecs,
            version, deletedState, itemType, options.contains(GetItemsOptions.DOWNLOAD), options,
            itemPropertyFilters, null);

    /*
     * If the server did not sort the set contents, sort them locally.
     */
    if (options.contains(GetItemsOptions.UNSORTED) == false) {
        for (int i = 0; i < sets.length; i++) {
            /*
             * Sort a temporary copy (using the Item sort logic) and set it
             * back on the object.
             */
            final Item[] items = sets[i].getItems();

            Arrays.sort(items);

            sets[i].setItems(items);
        }
    }

    return sets;
}

From source file:com.microsoft.tfs.core.clients.versioncontrol.VersionControlClient.java

/**
 * Look up the merge candidates for merging between the requested items.
 *
 * @param sourcePath//from   w w w  .j  a v a  2  s. c  o m
 *        the local or server path of the source of the potential merge
 *        (must not be <code>null</code> or empty)
 * @param targetPath
 *        the local or server path of the target of the potential merge
 *        (must not be <code>null</code> or empty)
 * @param recursion
 *        what level of recursion we should apply to the candidate search
 *        (may be <code>null</code>).
 * @param mergeFlags
 *        merge command option(s) compatible with the /cadidate option (must
 *        not be <code>null</code>).
 * @return the array of merge candidates returned by the server. May be
 *         empty but never <code>null</code>.
 */
public MergeCandidate[] getMergeCandidates(final String sourcePath, final String targetPath,
        final RecursionType recursion, final MergeFlags mergeFlags) {
    Check.notNullOrEmpty(sourcePath, "sourcePath"); //$NON-NLS-1$
    Check.notNullOrEmpty(targetPath, "targetPath"); //$NON-NLS-1$
    Check.notNull(mergeFlags, "mergeFlags"); //$NON-NLS-1$

    final AtomicReference<String> workspaceName = new AtomicReference<String>();
    final AtomicReference<String> workspaceOwner = new AtomicReference<String>();

    determineWorkspaceNameAndOwner(new String[] { sourcePath, targetPath }, workspaceName, workspaceOwner);

    return getWebServiceLayer().queryMergeCandidates(workspaceName.get(), workspaceOwner.get(),
            new ItemSpec(sourcePath, recursion), new ItemSpec(targetPath, recursion), mergeFlags);
}