/*
(non-Javadoc)

@see com.ibm.websphere.servlet.session.IBMApplicationSession#getId()
341354
public String getId() {
        String value = null;
        if (_iSess != null) {
            value = _iSess.getId();
        }
        return value;
    }
1141398
public String id() {
        if (null == _id) {
            _id = conf().get(RythmConfigurationKey.ENGINE_ID);
        }
        return _id;
    }
296652
@Nullable
  String getId() {
    ImmutableList<String> parts = getSegments();

    if (!parts.isEmpty()) {
      return parts.get(parts.size() - 1);
    } else {
      return null;
    }
  }
1324383
@Override
    public String getRequestedSessionId() {
        try {
            collaborator.preInvoke(componentMetaData);
            return request.getRequestedSessionId();
        } finally {
            collaborator.postInvoke();
        }
    }
309045
@Override
    public String get() {

        final String s = randomUUID().toString();
        final String id;

        if (count > 0 && length > 0) {
            final StringJoiner joiner = new StringJoiner("/", "", "/" + s);

            IntStream.rangeClosed(0, count - 1)
            .forEach(x -> joiner.add(s.substring(x * length, (x + 1) * length)));
            id = joiner.toString();
        } else {
            id = s;
        }
        return id;
    }
732540
static final String getUserId() {
    UserService userService = UserServiceFactory.getUserService();
    User loggedIn = userService.getCurrentUser();
    Preconditions.checkState(loggedIn != null, "This servlet requires the user to be logged in.");
    return loggedIn.getUserId();
  }
1179201
protected Object getValue(String id, BackedSession s) {
        if (com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
            LoggingUtil.SESSION_LOGGER_WAS.entering(methodClassName, methodNames[GET_VALUE]);
        }
        Connection conn = null;
        PreparedStatement prop_stmt = null;
        ResultSet rs = null;
        boolean psClose = false;
        String sessId = s.getId();

        Object tmp = null;
        conn = getConnection(false);

        if (conn == null) {
            if (com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINER)) {
                LoggingUtil.SESSION_LOGGER_WAS.exiting(methodClassName, methodNames[GET_VALUE], "unable to get con when processing session " + sessId + " for prop " + id);
            }
            return null;
        }

        try {

            InputStream is_large;
            InputStream is_medium;
            InputStream is_small;

            BufferedInputStream bis_small;
            BufferedInputStream bis_medium;
            BufferedInputStream bis_large;

            rs = null;

            if (usingDB2 || usingDerby)
                prop_stmt = conn.prepareStatement(getProp);
            else
                prop_stmt = conn.prepareStatement(getPropNotDB2);

            prop_stmt.setString(1, sessId);
            prop_stmt.setString(2, id);
            prop_stmt.setString(3, getIStore().getId());

            if (com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
                LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[GET_VALUE], "before query for " + id + " session " + sessId);
            }

            rs = prop_stmt.executeQuery();

            if (!rs.next()) {
                rs.close();
                prop_stmt.close();
                psClose = true;
                return null;
            }

            if (com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
                LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[GET_VALUE], "read results after query (FOUND) for " + id + " session " + sessId);
            }

            //Oracle Behaviour:
            // 1)Returns non null stream for long raw even when no data is present. This
            //   voilates JDBC spec. we have bug report into Oracle. Bug id is BUG#1255136
            // 2)Also we cannot use available() for long raw to check to see if any data is present
            //  or not. JDBC doesn't manadate to implement available().
            //
            // Once, Oracle fixes 1), we can use getBinaryStream() which makes coding easy
            //       by not creating byte array and then again creating binary stream from it.
            if (usingOracle) {
                tmp = oracleGetValue(rs, s);
            } else {
                long startTime = System.currentTimeMillis();
                long readSize = 0;
                is_small = rs.getBinaryStream(smallCol);
                boolean found = false;

                if (is_small != null) {
                    if (available(is_small)) {
                        readSize = is_small.available();
                        bis_small = new BufferedInputStream(is_small);
                        try {
                            tmp = ((DatabaseStore) getIStore()).getLoader().loadObject(bis_small);
                        } catch (ClassNotFoundException ce) {
                            com.ibm.ws.ffdc.FFDCFilter.processException(ce, "com.ibm.ws.session.store.db.DatabaseHashMap.getValue", "1335", s);
                            LoggingUtil.SESSION_LOGGER_WAS.logp(Level.SEVERE, methodClassName, methodNames[GET_VALUE], "BackedHashtable.classNotFoundError");
                            LoggingUtil.SESSION_LOGGER_WAS.logp(Level.SEVERE, methodClassName, methodNames[GET_VALUE], "CommonMessage.sessionid", id);
                            LoggingUtil.SESSION_LOGGER_WAS.logp(Level.SEVERE, methodClassName, methodNames[GET_VALUE], "CommonMessage.exception", ce);
                        }
                        bis_small.close();
                        is_small.close();
                        found = true;

                    } else
                        is_small.close();
                }

                if (!found) {
                    is_medium = rs.getBinaryStream(medCol);
                    if (is_medium != null) {
                        if (available(is_medium)) {
                            readSize = is_medium.available();
                            bis_medium = new BufferedInputStream(is_medium);
                            try {
                                tmp = ((DatabaseStore) getIStore()).getLoader().loadObject(bis_medium);
                            } catch (ClassNotFoundException ce) {

                                com.ibm.ws.ffdc.FFDCFilter.processException(ce, "com.ibm.ws.session.store.db.DatabaseHashMap.getValue", "1360", s);
                                LoggingUtil.SESSION_LOGGER_WAS.logp(Level.SEVERE, methodClassName, methodNames[GET_VALUE], "BackedHashtable.classNotFoundError");
                                LoggingUtil.SESSION_LOGGER_WAS.logp(Level.SEVERE, methodClassName, methodNames[GET_VALUE], "CommonMessage.sessionid", id);
                                LoggingUtil.SESSION_LOGGER_WAS.logp(Level.SEVERE, methodClassName, methodNames[GET_VALUE], "CommonMessage.exception", ce);
                            }
                            bis_medium.close();
                            is_medium.close();
                            found = true;
                        } else
                            is_medium.close();
                    }
                }

                //  Only look in the large column for DB2; PM54094: ensure large column not check by Sybase

                if (!found && !usingSybase) {
                    /*
                     * PK77100.
                     * Issue: the semantics expected by WAS from the java.io.InputStream method available() and that provided by the JDBC driver
                     * implementation differ. After session manager executes the query to retrieve an existing object from the database,
                     * session manager has a mechanism to validate whether there is any data remaining for an InputStream by checking
                     * java.io.InputStream.available(). From the JDBC driver standpoint this means the number of bytes currently available
                     * from this InputStream that have already been brought over to the client side but not yet consumed by the application.
                     * When fullyMaterializeLobData=false, no data is initially brought over to the client-side with the SELECT, just the locator.
                     * Initially (i.e. before the first read), available() will return 0. There are no data bytes available that don't require a
                     * blocking read (i.e. flow to the engine) to acquire
                     *
                     * Solution: Calling ResultSet.getBlob() will result into the materialization to the client-side. The subsequent usage of
                     * Blob.length()determines there is any data retrieving from the LARGE Column
                     */
                    //is_large = rs.getBinaryStream(lgCol);

                    Blob getBlobData = rs.getBlob(lgCol);

                    if (getBlobData != null) {
                        if (getBlobData.length() > 0) {
                            is_large = getBlobData.getBinaryStream();

                            if (is_large != null) {
                                //if (available(is_large)) {    // commented out by PK77100
                                //readSize = is_large.available(); // commented out by PK77100
                                readSize = getBlobData.length();
                                bis_large = new BufferedInputStream(is_large);
                                try {
                                    tmp = ((DatabaseStore) getIStore()).getLoader().loadObject(bis_large);
                                } catch (ClassNotFoundException ce) {

                                    com.ibm.ws.ffdc.FFDCFilter.processException(ce, "com.ibm.ws.session.store.db.DatabaseHashMap.getValue", "1387", s);
                                    LoggingUtil.SESSION_LOGGER_WAS.logp(Level.SEVERE, methodClassName, methodNames[GET_VALUE], "BackedHashtable.classNotFoundError");
                                    LoggingUtil.SESSION_LOGGER_WAS.logp(Level.SEVERE, methodClassName, methodNames[GET_VALUE], "CommonMessage.sessionid", id);
                                    LoggingUtil.SESSION_LOGGER_WAS.logp(Level.SEVERE, methodClassName, methodNames[GET_VALUE], "CommonMessage.exception", ce);
                                }
                                bis_large.close();
                                is_large.close();
                                found = true;
                            }//if (is_large != null)
                             //} else   //commented out by PK77100
                             //  is_large.close();  // commented out by PK77100, we only require to close the Binary Stream if the stream is available
                        }//if (getBlobData.length()){
                    }//if (getBlobData!=null)
                } // if (!found)
                SessionStatistics pmiStats = _iStore.getSessionStatistics();
                if (pmiStats != null) {
                    pmiStats.readTimes(readSize, System.currentTimeMillis() - startTime);
                }
            }

            rs.close();
            prop_stmt.close();
            psClose = true;
        } catch (SQLException se) {
            //            if (isStaleConnectionException(se)) {
            //                com.ibm.ws.ffdc.FFDCFilter.processException(se, "com.ibm.ws.session.store.db.DatabaseHashMap.getValue", "1408", s);
            //                LoggingUtil.SESSION_LOGGER_WAS.logp(Level.WARNING, methodClassName, methodNames[GET_VALUE], "StaleConnectionException");
            //            } else {
            com.ibm.ws.ffdc.FFDCFilter.processException(se, "com.ibm.ws.session.store.db.DatabaseHashMap.getValue", "1411", s);
            LoggingUtil.SESSION_LOGGER_WAS.logp(Level.SEVERE, methodClassName, methodNames[GET_VALUE], "DatabaseHashMap.getValueErrBH");
            LoggingUtil.SESSION_LOGGER_WAS.logp(Level.SEVERE, methodClassName, methodNames[GET_VALUE], "CommonMessage.sessionid", sessId + " " + id);
            // spit out sesisonid + property name
            LoggingUtil.SESSION_LOGGER_WAS.logp(Level.SEVERE, methodClassName, methodNames[GET_VALUE], "CommonMessage.exception", se);
            //            }
        } catch (Exception e) {
            com.ibm.ws.ffdc.FFDCFilter.processException(e, "com.ibm.ws.session.store.db.DatabaseHashMap.getValue", "1417", s);
            LoggingUtil.SESSION_LOGGER_WAS.logp(Level.SEVERE, methodClassName, methodNames[GET_VALUE], "DatabaseHashMap.getValueErrBH");
            // PQ87534  LoggingUtil.SESSION_LOGGER_WAS.logp(Level.SEVERE, methodClassName, methodName, "CommonMessage.object", s.toString());
            LoggingUtil.SESSION_LOGGER_WAS.logp(Level.SEVERE, methodClassName, methodNames[GET_VALUE], "CommonMessage.exception", e);

        } finally {
            if (!psClose && prop_stmt != null) {
                closeResultSet(rs);
                closeStatement(prop_stmt);
            }
            closeConnection(conn);
        }

        return tmp;
    }
764064
@Override
    public String getClientID() throws JMSRuntimeException {

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "getClientID");

        String clientId = null;
        try {
            clientId = jmsConnection.getClientID();
        } catch (JMSException jmse) {
            throw (JMSRuntimeException) JmsErrorUtils.getJMS2Exception(jmse, JMSRuntimeException.class);
        } finally {
            if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                SibTr.exit(this, tc, "getClientID", new Object[] { clientId });
        }

        return clientId;
    }
1186853
static final Object getObjectId(Object obj) {
        if (obj == null) {
            throw new NullPointerException();
        }
        if (!(obj instanceof ZooPC)) {
        	//non-peristent class
        	return null;
        }
        long id = Session.getObjectId(obj);
        //non-persistent object --> null
        return id >= 0 ? id : null;
    }
810973
@Override
    public String getId() {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            Tr.entry(tc, "getId");
        if (id == null)
        {
            // Set id to the class name
            id = this.getClass().getName();
        }
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            Tr.exit(tc, "getId", new Object[] { id });
        return id;
    }
1083354
@Id
	@Column(length = 36, nullable = true)
	@GeneratedValue(generator = "uuid")
	@GenericGenerator(name = "uuid", strategy = "uuid2")
	public String getId() {
		return id;
	}
545670
public String getId()
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) 
      SibTr.entry(tc, "getId");
      
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "getId", _aoStream.getID());
    return _aoStream.getID();
  }
994820
public String getSessionid(boolean create) {
        String sessionid = getCookie(SESSIONID_NAME, null);
        if (create && (sessionid == null || sessionid.isEmpty())) {
            sessionid = context.createSessionid();
            this.newsessionid = sessionid;
        }
        return sessionid;
    }
938121
public String getId()
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) 
      SibTr.entry(tc, "getId");

    String id = this.getUuid();
   //we need something unique - therefore cannot use 
   //just topic space ID
   id += this.getRemoteEngineUuid();
    
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) 
      SibTr.exit(tc, "getId", id);
    return id;
  }
127945
@SuppressWarnings("unchecked")
	@Override
	public ID getId(T entity) {
		return (ID) MetadataParser.getItemName(entity);
	}
1130293
public function getId()
    {
        if (!self::$session) {
            Exception::i()->setMessage(self::ERROR_NOT_STARTED)->trigger();
        }

        return session_id();
    }
1341917
@Override
    public String getSessionId() {
        ServletRESTRequestImpl ret = castRequest();
        if (ret != null)
            return ret.getSessionId();
        return null;
    }