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.OtRouteActivity.java

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

    if (bSave) {//w  w w  .  ja  v  a 2 s.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(OtRouteActivity.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(OtRouteActivity.this, resp.get(), Toast.LENGTH_SHORT).show();
                            }
                        });
                    }

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

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

/**
 * Gets the shelved changes for the given item specs.
 *
 * @param shelvesetName//from w  w  w . jav a2  s.com
 *        the shelveset name (may be null)
 * @param shelvesetOwner
 *        the user name (may be null), which is the shelveset owner if the
 *        shelveset name is not <code>null</code>
 * @param itemSpecs
 *        the items to query changes for (null for all).
 * @param includeDownloadInfo
 *        If true, the server will include the information needed to
 *        download files. Only set this to true if you are going to be
 *        downloading the files using the objects that are returned. The
 *        call will be faster and require less bandwidth when this parameter
 *        is false (default for overloads that don't specify it)
 * @param itemPropertyFilters
 *        a list of property names to return on the pending change object if
 *        they exist (may be <code>null</code>)
 * @return an array of pending sets with the pending changes for the shelved
 *         changes. May be empty but never null.
 */
public PendingSet[] queryShelvedChanges(final String shelvesetName, final String shelvesetOwner,
        final ItemSpec[] itemSpecs, final boolean includeDownloadInfo, String[] itemPropertyFilters) {
    final AtomicReference<String> workspaceName = new AtomicReference<String>();
    final AtomicReference<String> workspaceOwner = new AtomicReference<String>();

    determineWorkspaceNameAndOwner(itemSpecs, workspaceName, workspaceOwner);

    itemPropertyFilters = mergeWithDefaultItemPropertyFilters(itemPropertyFilters);

    return queryShelvedChanges(workspaceName.get(), workspaceOwner.get(), shelvesetName, shelvesetOwner,
            itemSpecs, includeDownloadInfo, itemPropertyFilters);
}

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

/**
 * Gets detailed information about merges performed on the given target item
 * (and version), optionally qualified by a source item (which can be null).
 *
 * @param sourceItem//  ww w.  j  a va2s .c  o m
 *        the item that is the source of merges to be returned (may be null)
 * @param sourceVersion
 *        the version of the source item for the merges (may be null if
 *        sourceItem is null)
 * @param sourceDeletionID
 *        the deletion ID for the source item, if a specific deletion is
 *        being queried.
 * @param targetItem
 *        the item that is the target of merges to be returned (must not be
 *        <code>null</code> or empty)
 * @param targetVersion
 *        the version of the target item for the merges (must not be
 *        <code>null</code>)
 * @param targetDeletionID
 *        the deletion ID for the target item, if a specific deletion is
 *        being queried.
 * @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 recursion
 *        the type of recursion to apply to the given items (must not be
 *        <code>null</code>)
 * @return the {@link ChangesetMergeDetails} returned by the server.
 */
public ChangesetMergeDetails queryMergesWithDetails(final String sourceItem, final VersionSpec sourceVersion,
        final int sourceDeletionID, final String targetItem, final VersionSpec targetVersion,
        final int targetDeletionID, final VersionSpec versionFrom, final VersionSpec versionTo,
        final RecursionType recursion) {
    Check.notNull(targetItem, "targetItem"); //$NON-NLS-1$
    Check.notNull(targetVersion, "targetVersion"); //$NON-NLS-1$
    Check.notNull(recursion, "recursion"); //$NON-NLS-1$

    final List<String> allPaths = new ArrayList<String>(2);
    ItemSpec sourceItemSpec = null;
    if (sourceItem != null) {
        sourceItemSpec = new ItemSpec(sourceItem, recursion, sourceDeletionID);
        allPaths.add(sourceItem);
    }

    final ItemSpec targetItemSpec = new ItemSpec(targetItem, recursion, targetDeletionID);
    allPaths.add(targetItem);

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

    determineWorkspaceNameAndOwner(allPaths.toArray(new String[allPaths.size()]), workspaceName,
            workspaceOwner);

    return getWebServiceLayer().queryMergesWithDetails(workspaceName.get(), workspaceOwner.get(),
            sourceItemSpec, sourceVersion, targetItemSpec, targetVersion, versionFrom, versionTo,
            VersionControlConstants.MAX_MERGES_RESULTS, true);
}

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

/**
 * Queries the server for history about an item. Results are returned as an
 * {@link Iterator} of {@link Changeset}s.
 *
 * @param serverOrLocalPath//from   w  w  w.  ja v a 2  s .  c o  m
 *        the server or local path to the server item being queried for its
 *        history (must not be <code>null</code> or empty).
 * @param version
 *        the version of the item to query history for (history older than
 *        this version will be returned) (must not be <code>null</code>)
 * @param deletionID
 *        the deletion ID for the item, if it is a deleted item (pass 0 if
 *        the item is not deleted).
 * @param recursion
 *        whether to query recursively (must not be <code>null</code>)
 * @param user
 *        only include historical changes made by this user (pass null to
 *        retrieve changes made by all users).
 * @param versionFrom
 *        the beginning version to query historical changes from (pass null
 *        to start at the first version).
 * @param versionTo
 *        the ending version to query historical changes to (pass null to
 *        end at the most recent version).
 * @param maxCount
 *        the maximum number of changes to return (pass Integer.MAX_VALUE
 *        for all available values). Must be > 0.
 * @param includeFileDetails
 *        true to include individual file change details with the returned
 *        results, false to return only general changeset information.
 * @param slotMode
 *        if true, all items that have occupied the given serverPath (during
 *        different times) will have their changes returned. If false, only
 *        the item that matches that path at the given version will have its
 *        changes returned.
 * @param sortAscending
 *        when <code>true</code> gets the top maxCount changes in ascending
 *        order, when <code>false</code> gets them in descending order
 * @return the changesets that matched the history query, null if the server
 *         did not return a changeset array.
 */
public Iterator<Changeset> queryHistoryIterator(final String serverOrLocalPath, final VersionSpec version,
        final int deletionID, final RecursionType recursion, final String user, final VersionSpec versionFrom,
        final VersionSpec versionTo, final int maxCount, final boolean includeFileDetails,
        final boolean slotMode, final boolean includeDownloadInfo, final boolean sortAscending)
        throws ServerPathFormatException {
    Check.notNullOrEmpty(serverOrLocalPath, "serverOrLocalPath"); //$NON-NLS-1$
    Check.notNull(version, "version"); //$NON-NLS-1$
    Check.notNull(recursion, "recursion"); //$NON-NLS-1$
    Check.isTrue(maxCount > 0, "maxCount must be greater than 0"); //$NON-NLS-1$

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

    determineWorkspaceNameAndOwner(serverOrLocalPath, workspaceName, workspaceOwner);

    /*
     * Local paths require valid workspace name and owner.
     */
    if ((workspaceName.get() == null || workspaceOwner.get() == null)
            && ServerPath.isServerPath(serverOrLocalPath) == false) {
        Check.isTrue(false, MessageFormat.format("Could not determine the workspace for local path {0}", //$NON-NLS-1$
                serverOrLocalPath));
    }

    final ItemSpec itemSpec = new ItemSpec(serverOrLocalPath, recursion, deletionID);

    final HistoryIterator iterator = new HistoryIterator(getWebServiceLayer(), workspaceName.get(),
            workspaceOwner.get(), itemSpec, version, user, versionFrom, versionTo, maxCount, includeFileDetails,
            includeDownloadInfo, slotMode, sortAscending);

    iterator.prime();

    return iterator;
}

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

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

    if (bSave) {//ww  w . ja va2 s . com
        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(MedidorActivity.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(MedidorActivity.this, resp.get(), Toast.LENGTH_SHORT).show();
                            }
                        });
                    }

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

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

/**
 * Gets the shelved changes for the given item specs.
 *
 * @param workspaceName//ww w.j  a v  a2  s. c om
 *        the name of the workspace to query for (may be <code>null</code>)
 * @param workspaceOwner
 *        the owner of the workspace to query for (may be <code>null</code>)
 * @param shelvesetName
 *        the shelveset name (may be null)
 * @param shelvesetOwner
 *        the user name (may be null), which is the shelveset owner if the
 *        shelveset name is not <code>null</code>
 * @param itemSpecs
 *        the items to query changes for (null for all).
 * @param includeDownloadInfo
 *        If true, the server will include the information needed to
 *        download files. Only set this to true if you are going to be
 *        downloading the files using the objects that are returned. The
 *        call will be faster and require less bandwidth when this parameter
 *        is false (default for overloads that don't specify it)
 * @param itemPropertyFilters
 *        a list of property names to return on the pending change object if
 *        they exist (may be <code>null</code>)
 * @return an array of pending sets with the pending changes for the shelved
 *         changes. May be empty but never null.
 */
public PendingSet[] queryShelvedChanges(final String workspaceName, final String workspaceOwner,
        final String shelvesetName, final String shelvesetOwner, final ItemSpec[] itemSpecs,
        final boolean includeDownloadInfo, String[] itemPropertyFilters) {
    final AtomicReference<Failure[]> failures = new AtomicReference<Failure[]>();

    itemPropertyFilters = mergeWithDefaultItemPropertyFilters(itemPropertyFilters);

    final PendingSet[] ret = getWebServiceLayer().queryShelvedChanges(workspaceName, workspaceOwner,
            shelvesetName, shelvesetOwner, itemSpecs, includeDownloadInfo, failures, itemPropertyFilters);

    reportFailures(failures.get());

    return ret;
}

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

/**
 * Removes a label that was applied to an item.
 *
 * @param label/* ww w .  j a v a 2 s. com*/
 *        the label to remove (must not be <code>null</code>)
 * @param scope
 *        the scope of the label to remove (must not be <code>null</code>)
 * @param items
 *        the items to remove from the label (must not be <code>null</code>
 *        or empty)
 * @param version
 *        the version of the items to remove to match (may be
 *        <code>null</code>)
 * @return the label results, null if none were returned. May be empty but
 *         never null.
 */
public LabelResult[] unlabelItem(final String label, final String scope, final ItemSpec[] items,
        final VersionSpec version) {
    Check.notNull(label, "label"); //$NON-NLS-1$
    Check.notNullOrEmpty(items, "items"); //$NON-NLS-1$
    Check.notNull(version, "version"); //$NON-NLS-1$

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

    determineWorkspaceNameAndOwner(items, workspaceName, workspaceOwner);

    final AtomicReference<Failure[]> failuresHolder = new AtomicReference<Failure[]>();

    final LabelResult[] results = getWebServiceLayer().unlabelItem(workspaceName.get(), workspaceOwner.get(),
            label, scope, items, version, failuresHolder);

    reportFailures(failuresHolder.get());

    return results;
}

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

/**
 * Get pending changes for the given item specs, even from another user's
 * workspace./*from  w w w .  j  a v  a  2 s. c o  m*/
 *
 * @param itemSpecs
 *        the ItemSpecs to get pending changes for (must not be
 *        <code>null</code> or empty)
 * @param queryWorkspaceName
 *        the name of the workspace to query for pending changes. Pass null
 *        to match all.
 * @param queryWorkspaceOwner
 *        the owner of the workspace to query for pending changes. Pass null
 *        to match all.
 * @param includeCandidates
 *        if <code>true</code> for a local workspace, candidate changes will
 *        be populated on the pending set. A pending set will be returned if
 *        the workspace contains pending changes or candidate changes
 * @param itemPropertyFilters
 *        a list of property names to return on the pending change object if
 *        they exist (may be <code>null</code>)
 * @return a pending set including all the pending changes. May be empty but
 *         never null.
 */
public PendingSet[] queryPendingSets(final ItemSpec[] itemSpecs, final boolean includeDownloadInfo,
        final String queryWorkspaceName, final String queryWorkspaceOwner, final boolean includeCandidates,
        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 AtomicReference<Failure[]> failures = new AtomicReference<Failure[]>();

    final PendingSet[] ret = getWebServiceLayer().queryPendingSets(workspaceName.get(), workspaceOwner.get(),
            queryWorkspaceName, queryWorkspaceOwner, itemSpecs, includeDownloadInfo, failures,
            includeCandidates, itemPropertyFilters);

    reportFailures(failures.get());

    return ret;
}

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

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

    if (bSave) {//from  www  . ja  v  a2  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(LectorActivity.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(LectorActivity.this, resp.get(), Toast.LENGTH_SHORT).show();
                            }
                        });
                    }

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

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

/**
 * Queries the server for history about an item. History items are returned
 * as an array of changesets.//from   w w  w.  j  av a  2 s . c om
 *
 * @param serverOrLocalPath
 *        the server or local path to the server item being queried for its
 *        history (must not be <code>null</code> or empty).
 * @param version
 *        the version of the item to query history for (history older than
 *        this version will be returned) (must not be <code>null</code>)
 * @param deletionID
 *        the deletion ID for the item, if it is a deleted item (pass 0 if
 *        the item is not deleted).
 * @param recursion
 *        whether to query recursively (must not be <code>null</code>)
 * @param user
 *        only include historical changes made by this user (pass null to
 *        retrieve changes made by all users).
 * @param versionFrom
 *        the beginning version to query historical changes from (pass null
 *        to start at the first version).
 * @param versionTo
 *        the ending version to query historical changes to (pass null to
 *        end at the most recent version).
 * @param maxCount
 *        the maximum number of changes to return (pass Integer.MAX_VALUE
 *        for all available values). Must be > 0.
 * @param includeFileDetails
 *        true to include individual file change details with the returned
 *        results, false to return only general changeset information.
 * @param slotMode
 *        if true, all items that have occupied the given serverPath (during
 *        different times) will have their changes returned. If false, only
 *        the item that matches that path at the given version will have its
 *        changes returned.
 * @param sortAscending
 *        when <code>true</code> gets the top maxCount changes in ascending
 *        order, when <code>false</code> gets them in descending order
 * @return the changesets that matched the history query, null if the server
 *         did not return a changeset array.
 */
public Changeset[] queryHistory(final String serverOrLocalPath, final VersionSpec version, final int deletionID,
        final RecursionType recursion, final String user, final VersionSpec versionFrom,
        final VersionSpec versionTo, int maxCount, final boolean includeFileDetails, final boolean slotMode,
        final boolean includeDownloadInfo, final boolean sortAscending) throws ServerPathFormatException {
    Check.notNullOrEmpty(serverOrLocalPath, "serverOrLocalPath"); //$NON-NLS-1$
    Check.notNull(version, "version"); //$NON-NLS-1$
    Check.notNull(recursion, "recursion"); //$NON-NLS-1$
    Check.isTrue(maxCount > 0, "maxCount must be greater than 0"); //$NON-NLS-1$

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

    determineWorkspaceNameAndOwner(serverOrLocalPath, workspaceName, workspaceOwner);

    /*
     * Local paths require valid workspace name and owner.
     */
    if ((workspaceName.get() == null || workspaceOwner.get() == null)
            && ServerPath.isServerPath(serverOrLocalPath) == false) {
        Check.isTrue(false, MessageFormat.format("Could not determine the workspace for local path {0}", //$NON-NLS-1$
                serverOrLocalPath));
    }

    final ItemSpec spec = new ItemSpec(serverOrLocalPath, recursion, deletionID);

    final VersionSpec fromSpec = (versionFrom != null) ? versionFrom : new ChangesetVersionSpec(1);

    VersionSpec endVersion = versionTo;

    final ArrayList<Changeset> foundChangeSets = new ArrayList<Changeset>();

    /*
     * Changesets come in newest first (reverse chronological order).
     *
     * Fetch the changesets in chunks of HISTORY_ITEMS_CHUNK_SIZE. If we've
     * hit maxCount, or we've hit the first changeset (number 1), or the
     * server sent us fewer changesets than we expected (including 0), we
     * quit and return the results to the user.
     *
     * We decrement maxCount as our counter. chunk is kept just for tracing.
     */
    int chunk = 1;
    while (maxCount > 0) {
        if (log.isDebugEnabled()) {
            log.debug(MessageFormat.format("chunk {0}, maxCount {1}", //$NON-NLS-1$
                    Integer.toString(chunk++), Integer.toString(maxCount)));
        }

        // NOTE chunk is just for tracing, it only gets incremented when
        // debug is enabled.

        final int requestedCount = Math.min(maxCount, HISTORY_ITEMS_CHUNK_SIZE);

        if (log.isDebugEnabled()) {
            log.debug(MessageFormat.format("requestedCount {0}", Integer.toString(requestedCount))); //$NON-NLS-1$
        }

        if (log.isDebugEnabled()) {
            log.debug(
                    MessageFormat.format("requesting from {0} to {1}", ((fromSpec != null) ? fromSpec.toString() //$NON-NLS-1$
                            : "null"), ((endVersion != null) ? endVersion.toString() : "null"))); //$NON-NLS-1$ //$NON-NLS-2$
        }

        final Changeset[] sets = getWebServiceLayer().queryHistory(workspaceName.get(), workspaceOwner.get(),
                spec, version, user, fromSpec, endVersion, requestedCount, includeFileDetails,
                includeDownloadInfo, slotMode, sortAscending);

        if (sets == null) {
            log.debug("got null history sets"); //$NON-NLS-1$
            return null;
        }

        if (sets.length == 0) {
            log.debug("got empty history sets"); //$NON-NLS-1$
            break;
        }

        // if the user asked for the changes, sort them
        if (includeFileDetails) {
            for (final Changeset set : sets) {
                set.sortChanges();
            }
        }

        // Add all to the list
        foundChangeSets.addAll(Arrays.asList(sets));

        if (log.isDebugEnabled()) {
            log.debug(MessageFormat.format("got {0} history sets", sets.length)); //$NON-NLS-1$
        }

        /*
         * If the server sent us fewer than we had hoped, we should break,
         * because we're done.
         */
        if (sets.length < requestedCount) {
            log.debug("got less than a full chunk so exiting"); //$NON-NLS-1$
            break;
        }

        /*
         * Save the change set number of the last item in the list (which is
         * the oldest, chronologically), so we can create the end version
         * spec for the next time through the loop.
         */
        final int lastChangesetID = sets[sets.length - 1].getChangesetID();

        /*
         * This check saves us from asking for any more changesets when we
         * know we're done.
         */
        if (lastChangesetID == 1) {
            break;
        }

        /*
         * Decrement the counter by the number we just got, and set up the
         * end version for the next query.
         */
        maxCount -= sets.length;
        endVersion = new ChangesetVersionSpec(lastChangesetID - 1);
    }

    return foundChangeSets.toArray(new Changeset[foundChangeSets.size()]);
}