/* (non-Javadoc)
@see org.biojava.nbio.structure.scop.ScopDatabase#getScopDescriptionBySunid(int)
17516
@Override
	public ScopDescription getScopDescriptionBySunid(int sunid) {
		try {
			ensureDesInstalled();
		} catch (IOException e) {
			throw new ScopIOException(e);
		}
		return sunidMap.get(sunid);
	}
318501
@Override
    public int getModelID(int accessor) throws JMFUninitializedAccessException, JMFSchemaViolationException {

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            JmfTr.entry(this, tc, "getModelID", new Object[] { Integer.valueOf(accessor) });
        int ans;
        checkIndex(accessor);

        synchronized (getMessageLockArtefact()) {
            checkDynamic(accessor);

            if (cache[accessor] != null) {
                ans = ((JMFPart) cache[accessor]).getModelID();
                if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                    JmfTr.exit(this, tc, "getModelID", Integer.valueOf(ans));
                return ans;
            }

            if (contents == null) {
                JMFUninitializedAccessException e = new JMFUninitializedAccessException("Dynamic value at accessor " + accessor + " is missing");
                if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                    JmfTr.exit(this, tc, "getModelID", e);
                throw e;
            }

            // Get offset of the dynamic field
            int realOffset = getAbsoluteOffset(accessor);

            // Read model Id skipping over length
            ans = ArrayUtil.readInt(contents, realOffset + 4);
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            JmfTr.exit(this, tc, "getModelID", Integer.valueOf(ans));
        return ans;
    }
1278200
public Long getId() {
        if (this.genericRecordAttributes.getId() != null) {
            return this.genericRecordAttributes.getId();
        } else if (this.typeARecordAttributes.getId() != null) {
            return this.typeARecordAttributes.getId();
        } else if (this.typeAAAARecordAttributes.getId() != null) {
            return this.typeAAAARecordAttributes.getId();
        } else if (this.typeNSRecordAttributes.getId() != null) {
            return this.typeNSRecordAttributes.getId();
        } else if (this.typeSOARecordAttributes.getId() != null) {
            return this.typeSOARecordAttributes.getId();
        } else if (this.typeMXRecordAttributes.getId() != null) {
            return this.typeMXRecordAttributes.getId();
        } else if (this.typePTRRecordAttributes.getId() != null) {
            return this.typePTRRecordAttributes.getId();
        } else if (this.typeTXTRecordAttributes.getId() != null) {
            return this.typeTXTRecordAttributes.getId();
        } else {
            return null;
        }
    }
541522
@SuppressWarnings("unchecked")
  public Class<? extends Serializable> getIdType() {
    Type type = propertyTypes.get(idName);
    return (Class<? extends Serializable>) (null != type ? type.getReturnedClass() : null);
  }
76812
public CmsUUID getFormatterId() {

        String value = getStringValue(null);
        if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(value)) {
            String[] parts = value.split(SEPARATOR);
            if (parts.length == 2) {
                return new CmsUUID(parts[1]);
            }
        }
        return null;
    }
901903
static private int getOrcAtomicRowColumnId() {
    try {
      Field rowField = OrcRecordUpdater.class.getDeclaredField("ROW");
      rowField.setAccessible(true);
      int rowId = (int) rowField.get(null);
      rowField.setAccessible(false);
      return rowId;
    } catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) {
      throw new RuntimeException("Could not obtain OrcRecordUpdater.ROW value.", e);
    }

  }
494442
public SIMPLocalSubscriptionControllable getLocalSubscriptionControlByID(String id) throws SIMPInvalidRuntimeIDException, SIMPControllableNotFoundException, SIMPException
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "getLocalSubscriptionControlByID");    

    SIMPIterator topicSpaces = getTopicSpaceIterator();
    SIMPLocalSubscriptionControllable localSub = null;
        
    while(topicSpaces.hasNext())
    {
      Topicspace ts = (Topicspace) topicSpaces.next();
      SIMPIterator subs = ts.getLocalSubscriptionIterator();
      while (subs.hasNext())
      {
        SIMPLocalSubscriptionControllable sub = 
          (SIMPLocalSubscriptionControllable)subs.next();
          
        if (sub.getId().equals(id))
        {
          localSub = sub;
          break;
        }
      }
      
      if (localSub != null)
        break;
    }
    
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "getLocalSubscriptionControlByID", localSub);    
    return localSub;
  }
233504
static WebserviceDescription getWebserviceDescriptionByServletLink(String servletLink, Adaptable containerToAdapt) throws UnableToAdaptException {
        return getHighLevelElementByServiceImplBean(servletLink, containerToAdapt, WebserviceDescription.class, LinkType.SERVLET);
    }
153391
@Override
    public Object[] findIdsByColumn(String schemaName, String tableName, String pKeyName, String columnName,
            Object columnValue, Class entityClazz)
    {
        List<Object> rowKeys = new ArrayList<Object>();

        if (getCqlVersion().equalsIgnoreCase(CassandraConstants.CQL_VERSION_3_0))
        {
            rowKeys = findIdsByColumnUsingCql(schemaName, tableName, pKeyName, columnName, columnValue, entityClazz);
        }
        else
        {
            Selector selector = clientFactory.getSelector(pool);
            SlicePredicate slicePredicate = Selector.newColumnsPredicateAll(false, 10000);
            EntityMetadata metadata = KunderaMetadataManager.getEntityMetadata(kunderaMetadata, entityClazz);

            IndexClause ix = Selector.newIndexClause(Bytes.EMPTY, 10000, Selector.newIndexExpression(columnName
                    + Constants.JOIN_COLUMN_NAME_SEPARATOR + columnValue, IndexOperator.EQ,
                    Bytes.fromByteArray(PropertyAccessorHelper.getBytes(columnValue))));

            Map<Bytes, List<Column>> qResults = selector.getIndexedColumns(tableName, ix, slicePredicate,
                    getConsistencyLevel());

            // iterate through complete map and
            Iterator<Bytes> rowIter = qResults.keySet().iterator();
            while (rowIter.hasNext())
            {
                Bytes rowKey = rowIter.next();

                PropertyAccessor<?> accessor = PropertyAccessorFactory.getPropertyAccessor((Field) metadata
                        .getIdAttribute().getJavaMember());
                Object value = accessor.fromBytes(metadata.getIdAttribute().getJavaType(), rowKey.toByteArray());

                rowKeys.add(value);
            }
        }
        if (rowKeys != null && !rowKeys.isEmpty())
        {
            return rowKeys.toArray(new Object[0]);
        }

        if (log.isInfoEnabled())
        {
            log.info("No row keys found, returning null.");
        }
        return null;
    }
948056
@Override
	public List<ScopDescription> getByCategory(ScopCategory category){

		try {
			ensureDesInstalled();
		} catch (IOException e) {
			throw new ScopIOException(e);
		}

		List<ScopDescription> matches = new ArrayList<ScopDescription>();
		for (Integer i : sunidMap.keySet()){
			ScopDescription sc = sunidMap.get(i);
			if ( sc.getCategory().equals(category))

				try {
					matches.add((ScopDescription)sc.clone());
				} catch (CloneNotSupportedException e) {
					throw new RuntimeException("Could not clone " + ScopDescription.class + " subclass", e);
				}

		}
		return matches;
	}
782715
public int getPageIdForRevisionId(final int revisionID)
        throws WikiApiException
    {

        try {
            if (revisionID < 1) {
                throw new IllegalArgumentException();
            }

            int pageId = -1;

            PreparedStatement statement = null;
            ResultSet result = null;

            try {
                statement = this.connection.prepareStatement("SELECT r.ArticleID "
                        + "FROM revisions as r, index_revisionID as idx "
                        + "WHERE idx.RevisionID=? AND idx.RevisionPK=r.PrimaryKey LIMIT 1");
                statement.setInt(1, revisionID);
                result = statement.executeQuery();

                if (result.next()) {
                    pageId = result.getInt(1);
                }
                else {
                    throw new WikiPageNotFoundException("The revision with the ID " + revisionID
                            + " was not found.");
                }

            }
            finally {
                if (statement != null) {
                    statement.close();
                }
                if (result != null) {
                    result.close();
                }
            }

            return pageId;

        }
        catch (WikiPageNotFoundException e) {
            throw e;
        }
        catch (Exception e) {
            throw new WikiApiException(e);
        }
    }
572757
@Override
    public <E> List<E> getColumnsById(String schemaName, String joinTableName, String joinColumnName,
            String inverseJoinColumnName, Object parentId, Class columnJavaType)
    {
        List<Object> foreignKeys = new ArrayList<Object>();

        if (getCqlVersion().equalsIgnoreCase(CassandraConstants.CQL_VERSION_3_0))
        {
            foreignKeys = getColumnsByIdUsingCql(schemaName, joinTableName, joinColumnName, inverseJoinColumnName,
                    parentId, columnJavaType);
        }
        else
        {
            Selector selector = clientFactory.getSelector(pool);

            List<Column> columns = selector.getColumnsFromRow(joinTableName,
                    Bytes.fromByteArray(PropertyAccessorHelper.getBytes(parentId)),
                    Selector.newColumnsPredicateAll(true, 10), getConsistencyLevel());

            foreignKeys = dataHandler.getForeignKeysFromJoinTable(inverseJoinColumnName, columns, columnJavaType);

            if (log.isInfoEnabled())
            {
                log.info("Returning number of keys from join table", foreignKeys != null ? foreignKeys.size() : null);
            }
        }
        return (List<E>) foreignKeys;
    }
569018
@Override
	public List<ScopNode> getTree(ScopDomain domain){
		ScopNode node = getScopNode(domain.getSunid());


		List<ScopNode> tree = new ArrayList<ScopNode>();
		while (node != null){

			//System.out.println("This node: sunid:" + node.getSunid() );
			//System.out.println(getScopDescriptionBySunid(node.getSunid()));
			node = getScopNode(node.getParentSunid());
			if ( node != null)
				tree.add(node);
		}
		Collections.reverse(tree);
		return tree;
	}
1149671
@Override
	public  List<ScopDomain> getDomainsForPDB(String pdbId) {

		try {
			ensureClaInstalled();
		} catch (IOException e) {
			throw new ScopIOException(e);
		}

		List<ScopDomain> doms = domainMap.get(pdbId.toLowerCase());

		List<ScopDomain> retdoms = new ArrayList<ScopDomain>();

		if ( doms == null)
			return retdoms;

		for ( ScopDomain d : doms){
			try {
				ScopDomain n = (ScopDomain) d.clone();
				retdoms.add(n);
			}  catch (CloneNotSupportedException e){
				throw new RuntimeException(ScopDomain.class + " subclass does not support clone()", e);
			}


		}
		return retdoms;
	}
1072388
protected Query buildMtoNImplementorQuery(Collection ids)
    {
        String[] indFkCols = getFksToThisClass();
        String[] indItemFkCols = getFksToItemClass();
        FieldDescriptor[] pkFields = getOwnerClassDescriptor().getPkFields();
        FieldDescriptor[] itemPkFields = getItemClassDescriptor().getPkFields();
        String[] cols = new String[indFkCols.length + indItemFkCols.length];
        int[] jdbcTypes = new int[indFkCols.length + indItemFkCols.length];

        // concatenate the columns[]
        System.arraycopy(indFkCols, 0, cols, 0, indFkCols.length);
        System.arraycopy(indItemFkCols, 0, cols, indFkCols.length, indItemFkCols.length);

        Criteria crit = buildPrefetchCriteria(ids, indFkCols, indItemFkCols, itemPkFields);

        // determine the jdbcTypes of the pks
        for (int i = 0; i < pkFields.length; i++)
        {
            jdbcTypes[i] = pkFields[i].getJdbcType().getType();
        }
        for (int i = 0; i < itemPkFields.length; i++)
        {
            jdbcTypes[pkFields.length + i] = itemPkFields[i].getJdbcType().getType();
        }

        ReportQueryByMtoNCriteria q = new ReportQueryByMtoNCriteria(getItemClassDescriptor().getClassOfObject(), cols,
                crit, false);
        q.setIndirectionTable(getCollectionDescriptor().getIndirectionTable());
        q.setJdbcTypes(jdbcTypes);

        CollectionDescriptor cds = getCollectionDescriptor();
        //check if collection must be ordered
        if (!cds.getOrderBy().isEmpty())
        {
            Iterator iter = cds.getOrderBy().iterator();
            while (iter.hasNext())
            {
                q.addOrderBy((FieldHelper) iter.next());
            }
        }
        
        return q;
    }
112641
public static SPSSODescriptor getSPSsoDescriptor(final EntityDescriptor entityDescriptor) {
        LOGGER.trace("Locating SP SSO descriptor for SAML2 protocol...");
        var spssoDescriptor = entityDescriptor.getSPSSODescriptor(SAMLConstants.SAML20P_NS);
        if (spssoDescriptor == null) {
            LOGGER.trace("Locating SP SSO descriptor for SAML11 protocol...");
            spssoDescriptor = entityDescriptor.getSPSSODescriptor(SAMLConstants.SAML11P_NS);
        }
        if (spssoDescriptor == null) {
            LOGGER.trace("Locating SP SSO descriptor for SAML1 protocol...");
            spssoDescriptor = entityDescriptor.getSPSSODescriptor(SAMLConstants.SAML10P_NS);
        }
        LOGGER.trace("SP SSO descriptor resolved to be [{}]", spssoDescriptor);
        return spssoDescriptor;
    }
710928
public <T extends MPBase> T getById(String id) throws MPException {
        T resource = null;
        for (int i = 0; i < _resourceArray.size(); i++) {
            resource = getByIndex(i);
            try {
                Field field = resource.getClass().getDeclaredField("id");
                field.setAccessible(true);
                String resourceId = field.get(resource).toString();
                if (resourceId.equals(id)) {
                    break;
                }
            } catch (Exception exception) {
                throw new MPException(exception);
            }
        }
        return resource;
    }