Method to get the value for a list of object.

@param _objectList list of objects
@throws EFapsException on error
@return object
3469
public Object getValue(final List<Object> _objectList)
        throws EFapsException
    {
        final List<Object> ret = new ArrayList<Object>();
        for (final Object object : _objectList) {
            ret.add(getValue(object));
        }
        return _objectList.size() > 0 ? (ret.size() > 1 ? ret : ret.get(0)) : null;
    }
934747
public Evaluator evaluate()
        throws EFapsException
    {
        if (this.print == null) {
            execute();
        }
        return Evaluator.get(this.print.getSelection());
    }
633244
public final synchronized Object[] getAllObjects()
	{
		if (tc.isEntryEnabled()) Tr.entry(tc, "getAllObjects");

		Object[] values = _idMap.values();

		if (tc.isEntryEnabled()) Tr.exit(tc, "getAllObjects", values);

		return values;
	}
957905
public function loadObjectList($class_name = "stdClass")
    {
        if ($this->stmt === null) {
            return null;
        }

        $objectList = array();
        while ($object = $this->stmt->fetchObject($class_name)) {
            $objectList[] = $object;
        }
        return $objectList;
    }
29397
public function get()
    {
        $queryset = $this->_filterOrExclude(
            false,
            static::formatConditions(__METHOD__, func_get_args())
        );

        $resultCount = count($queryset);

        if (1 == $resultCount) {
            return $queryset->getResults()[0];
        } elseif (!$resultCount) {
            throw new ObjectDoesNotExist(
                sprintf(
                    '%s matching query does not exist.',
                    $this->model->getMeta()->getNSModelName()
                )
            );
        }

        throw new MultipleObjectsReturned(
            sprintf(
                '"get() returned more than one %s -- it returned %s!"',
                $this->model->getMeta()->getNSModelName(),
                $resultCount
            )
        );
    }
7119
protected List<T> readSources()
        throws EFapsException
    {
        final List<T> ret = new ArrayList<>();
        final QueryBuilder queryBldr = new QueryBuilder(getClassName4Type());
        final MultiPrintQuery multi = queryBldr.getPrint();
        multi.addAttribute(CIAdminProgram.Abstract.Name);
        multi.executeWithoutAccessCheck();
        while (multi.next()) {
            final String name = multi.<String>getAttribute(CIAdminProgram.StaticCompiled.Name);
            ret.add(getNewSource(name, multi.getCurrentInstance()));
        }
        return ret;
    }
50374
def getObjectList(IDs, date, pos):
    
    objList = [getObject(ID, date, pos) for ID in IDs]
    return ObjectList(objList)
150911
private void getValues4Instances(final String _oid)
        throws EFapsException
    {
        // group the instance by type
        // check if the current instance is the list (happens if this
        // value select is e.g. part of a linkto
        final Map<Type, List<Instance>> type2instance = new HashMap<>();
        final Instance currentInst = Instance.get(_oid);
        final List<Instance> instances = new ArrayList<>();
        if (getOneSelect().getQuery().getInstanceList().contains(currentInst)) {
            instances.addAll(getOneSelect().getQuery().getInstanceList());
        } else {
            for (final Object object : getOneSelect().getObjectList()) {
                final String oid =  (String) super.getValue(object);
                instances.add(Instance.get(oid));
            }
        }

        for (final Instance instance : instances) {
            final List<Instance> tmpList;
            if (type2instance.containsKey(instance.getType())) {
                tmpList = type2instance.get(instance.getType());
            } else {
                tmpList = new ArrayList<>();
                type2instance.put(instance.getType(), tmpList);
            }
            tmpList.add(instance);
        }

        // make one union part for every type
        for (final Entry<Type, List<Instance>> entry : type2instance.entrySet()) {

            boolean union = false;
            final Set<Classification> classTypes = new HashSet<>();
            Type curr = entry.getKey();
            while (curr.getParentType() != null) {
                classTypes.addAll(curr.getClassifiedByTypes());
                curr = curr.getParentType();
            }
            classTypes.addAll(curr.getClassifiedByTypes());
            final SQLSelect unionSelect = new SQLSelect();
            for (final Classification clazz : classTypes) {

                final Attribute typeAttr = clazz.getClassifyRelationType()
                                .getAttribute(clazz.getRelTypeAttributeName());
                final Attribute linkAttr = clazz.getClassifyRelationType()
                                .getAttribute(clazz.getRelLinkAttributeName());
                final SQLSelect select;
                if (union) {
                    unionSelect.addPart(SQLPart.UNION).addPart(SQLPart.ALL);
                    select = new SQLSelect();
                } else {
                    select = unionSelect;
                    union = true;
                }
                select.column(0, "ID")
                    .column(0, linkAttr.getSqlColNames().get(0))
                    .column(0, typeAttr.getSqlColNames().get(0))
                    .from(clazz.getClassifyRelationType().getMainTable().getSqlTable(), 0)
                    .addPart(SQLPart.WHERE)
                    .addColumnPart(0, linkAttr.getSqlColNames().get(0))
                    .addPart(SQLPart.IN).addPart(SQLPart.PARENTHESIS_OPEN);

                boolean first = true;
                for (final Instance instance : entry.getValue()) {
                    if (first) {
                        first = false;
                    } else {
                        select.addPart(SQLPart.COMMA);
                    }
                    select.addValuePart(instance.getId());
                }
                select.addPart(SQLPart.PARENTHESIS_CLOSE);
                if (clazz.getClassifyRelationType().getMainTable().getSqlColType() != null) {
                    select.addPart(SQLPart.AND)
                        .addColumnPart(0, clazz.getClassifyRelationType().getMainTable().getSqlColType())
                        .addPart(SQLPart.EQUAL).addValuePart(clazz.getClassifyRelationType().getId());
                }
                if (union && !select.equals(unionSelect)) {
                    unionSelect.addNestedSelectPart(select.getSQL());
                }
            }
            if (classTypes.size() > 0) {
                executeOneCompleteStmt(unionSelect.getSQL(), entry.getValue());
            }
        }
    }
1323074
public boolean isMultiple()
        throws EFapsException
    {
        final boolean ret;
        if (this.valueSelect == null) {
            ret = this.fromSelect.getMainOneSelect().isMultiple(this.currentObject);
        } else {
            ret = this.objectList.size() > 1;
        }
        return ret;
    }
979823
public static void index(final IndexContext _context,
                             final List<Instance> _instances)
        throws EFapsException
    {
        if (CollectionUtils.isNotEmpty(_instances)) {
            final Company currentCompany = Context.getThreadContext().getCompany();
            final String currentLanguage = Context.getThreadContext().getLanguage();

            Context.getThreadContext().setCompany(Company.get(_context.getCompanyId()));
            Context.getThreadContext().setLanguage(_context.getLanguage());
            final IndexWriterConfig config = new IndexWriterConfig(_context.getAnalyzer());
            try (
                    IndexWriter writer = new IndexWriter(_context.getDirectory(), config);
                    TaxonomyWriter taxonomyWriter = new DirectoryTaxonomyWriter(_context.getTaxonomyDirectory());
                ) {

                final IndexDefinition def = IndexDefinition.get(_instances.get(0).getType().getUUID());
                final MultiPrintQuery multi = new MultiPrintQuery(_instances);
                for (final IndexField field : def.getFields()) {
                    multi.addSelect(field.getSelect());
                }
                Attribute createdAttr = null;
                if (!_instances.get(0).getType().getAttributes(CreatedType.class).isEmpty()) {
                    createdAttr = _instances.get(0).getType().getAttributes(CreatedType.class).iterator().next();
                    multi.addAttribute(createdAttr);
                }
                multi.addMsgPhrase(def.getMsgPhrase());
                multi.executeWithoutAccessCheck();
                while (multi.next()) {
                    final String oid = multi.getCurrentInstance().getOid();
                    final String type = multi.getCurrentInstance().getType().getLabel();
                    final DateTime created;
                    if (createdAttr == null) {
                        created = new DateTime();
                    } else {
                        created = multi.getAttribute(createdAttr);
                    }

                    final Document doc = new Document();
                    doc.add(new FacetField(Dimension.DIMTYPE.name(), type));
                    doc.add(new FacetField(Dimension.DIMCREATED.name(), String.valueOf(created.getYear()),
                                    String.format("%02d", created.getMonthOfYear())));
                    doc.add(new StringField(Key.OID.name(), oid, Store.YES));
                    doc.add(new TextField(DBProperties.getProperty("index.Type"), type, Store.YES));
                    doc.add(new NumericDocValuesField(Key.CREATED.name(), created.getMillis()));
                    doc.add(new StringField(Key.CREATEDSTR.name(),
                                    DateTools.dateToString(created.toDate(), DateTools.Resolution.DAY), Store.NO));

                    final StringBuilder allBldr = new StringBuilder()
                                    .append(type).append(" ");

                    for (final IndexField field : def.getFields()) {
                        final String name = DBProperties.getProperty(field.getKey());
                        Object value = multi.getSelect(field.getSelect());
                        if (value != null) {
                            if (StringUtils.isNoneEmpty(field.getTransform())) {
                                final Class<?> clazz = Class.forName(field.getTransform(),
                                                false, EFapsClassLoader.getInstance());
                                final ITransformer transformer = (ITransformer) clazz.newInstance();
                                value = transformer.transform(value);
                            }
                            switch (field.getFieldType()) {
                                case LONG:
                                    long val = 0;
                                    if (value instanceof String) {
                                        val = NumberUtils.toLong((String) value);
                                    } else if (value instanceof Number) {
                                        val = ((Number) value).longValue();
                                    }
                                    doc.add(new LongField(name, val, Store.YES));
                                    allBldr.append(value).append(" ");
                                    break;
                                case SEARCHLONG:
                                    long val2 = 0;
                                    if (value instanceof String) {
                                        val2 = NumberUtils.toLong((String) value);
                                    } else if (value instanceof Number) {
                                        val2 = ((Number) value).longValue();
                                    }
                                    doc.add(new LongField(name, val2, Store.NO));
                                    allBldr.append(value).append(" ");
                                    break;
                                case STRING:
                                    doc.add(new StringField(name, String.valueOf(value), Store.YES));
                                    allBldr.append(value).append(" ");
                                    break;
                                case SEARCHSTRING:
                                    doc.add(new StringField(name, String.valueOf(value), Store.NO));
                                    allBldr.append(value).append(" ");
                                    break;
                                case TEXT:
                                    doc.add(new TextField(name, String.valueOf(value), Store.YES));
                                    allBldr.append(value).append(" ");
                                    break;
                                case SEARCHTEXT:
                                    doc.add(new TextField(name, String.valueOf(value), Store.NO));
                                    allBldr.append(value).append(" ");
                                    break;
                                case STORED:
                                    doc.add(new StoredField(name, String.valueOf(value)));
                                    allBldr.append(value).append(" ");
                                    break;
                                default:
                                    break;
                            }
                        }
                    }
                    doc.add(new StoredField(Key.MSGPHRASE.name(), multi.getMsgPhrase(def.getMsgPhrase())));
                    doc.add(new TextField(Key.ALL.name(), allBldr.toString(), Store.NO));
                    writer.updateDocument(new Term(Key.OID.name(), oid),
                                    Index.getFacetsConfig().build(taxonomyWriter, doc));
                    LOG.debug("Add Document: {}", doc);
                }
                writer.close();
                taxonomyWriter.close();
            } catch (final IOException | ClassNotFoundException | InstantiationException | IllegalAccessException e) {
                throw new EFapsException(Indexer.class, "IOException", e);
            } finally {
                Context.getThreadContext().setCompany(currentCompany);
                Context.getThreadContext().setLanguage(currentLanguage);
            }
        }
    }
1288965
private List<Object> getCollectionValue(JsonParser jsonParser) throws IOException {
        LOG.info("Start parsing {} array", jsonParser.getCurrentName());
        List<Object> list = new ArrayList<>();
        while (jsonParser.nextToken() != JsonToken.END_ARRAY) {
            if (jsonParser.getCurrentToken() == JsonToken.START_OBJECT) {
                Object embedded = getEmbeddedObject(jsonParser);
                list.add(embedded);
            }
            if (!"}".equals(jsonParser.getText())) {
                list.add(jsonParser.getText());
            } else {
                LOG.info("Array is over.");
            }
        }
        return list;
    }
259867
public void getInterestingObjects (ArrayList<ObjectInfo> list)
    {
        for (Iterator<Section> iter = getSections(); iter.hasNext(); ) {
            Section sect = iter.next();
            for (ObjectInfo element : sect.objectInfo) {
                list.add(element);
            }
        }
    }
1293192
public void getAllObjects (ArrayList<ObjectInfo> list)
    {
        for (Iterator<Section> iter = getSections(); iter.hasNext(); ) {
            iter.next().getAllObjects(list);
        }
    }
343021
@SuppressWarnings("unchecked")
    public <T> T getAttribute(final Attribute _attribute)
        throws EFapsException
    {
        return (T) getAttribute(_attribute.getName());
    }
394248
@SuppressWarnings("unchecked")
    private <T> List<T> getListValue(Class<T> type, String propertyName, EDBObject object) {
        List<T> temp = new ArrayList<>();
        for (int i = 0;; i++) {
            String property = getEntryNameForList(propertyName, i);
            Object obj = object.getObject(property);
            if (obj == null) {
                break;
            }
            if (OpenEngSBModel.class.isAssignableFrom(type)) {
                obj = convertEDBObjectToUncheckedModel(type, edbService.getObject(object.getString(property)));
            }
            temp.add((T) obj);
            object.remove(property);
        }
        return temp;
    }
528128
protected List<Object> getObjects(final Evaluator _evaluator)
        throws EFapsException
    {
        final List<Object> result;
        if (_evaluator == null) {
            result = this.objects;
        } else {
            result = new ArrayList<>();
            final AbstractElement<?> element = getElements().get(getElements().size() - 1);
            final String path = element.getPath();
            final Select instSelection = _evaluator.getSelection().getInstSelects().get(StringUtils.isEmpty(path)
                            ? Selection.BASEPATH
                            : path);
            final List<Object> instObjs = instSelection.getObjects(null);
            final Iterator<Object> objIter = this.objects.iterator();
            for (final Object instObj : instObjs) {
                if (_evaluator.getAccess().hasAccess((Instance) instObj)) {
                    result.add(objIter.next());
                } else {
                    objIter.next();
                }
            }
        }
        return Collections.unmodifiableList(result);
    }
721450
@SuppressWarnings({"unchecked", "rawtypes"})
    public List<E> getValueAsList() {

        final Object fieldValue = getValue();
        final Class<?> fieldType = getType();

        if(Collection.class.isAssignableFrom(fieldType)) {
            final Collection<Object> value = (fieldValue == null ? new ArrayList<Object>() : (Collection<Object>) fieldValue);
            final List<Object> list = Utils.convertCollectionToList(value);
            return (List)list;

        } else if(fieldType.isArray()) {
            Class<?> componentType = fieldType.getComponentType();
            final List<Object> list = Utils.asList(fieldValue, componentType);
            return (List)list;

        } else {
            throw new IllegalStateException(MessageBuilder.create("validation.notSupportType")
                    .var("property", getFieldPath())
                    .varWithClass("type", fieldType)
                    .format());
        }

    }