Examples of UtilTimer


Examples of org.ofbiz.base.util.UtilTimer

     * DOCUMENT ME!
     *
     * @param genericValueVector
     */
    public void addContentsRow(Vector genericValueVector) {
        UtilTimer utilTimer = new UtilTimer();

        if (TIMER) {
            utilTimer.timerString(5, "[DataBuffer.addContentsRow] Start");
        }

        contents.add(genericValueVector);

        if (TIMER) {
            utilTimer.timerString(5, "[DataBuffer.addContentsRow] Finish");
        }

        setRowCount(getRowCount() + 1);
    }
View Full Code Here

Examples of org.ofbiz.base.util.UtilTimer

     * @param entityNumber
     *
     * @return
     */
    public GenericValue getGenericValue(int row, int entityNumber) {
        UtilTimer utilTimer = new UtilTimer();

        if (TIMER) {
            utilTimer.timerString(5,
                "[DataBuffer.getGenericValue(row, entityNumber)] Start");
        }

        GenericValue genericValue = (GenericValue) (getContentsRow(row).get(entityNumber));

        if (TIMER) {
            utilTimer.timerString(5,
                "[DataBuffer.getGenericValue(row, entityNumber)] Finished");
        }

        return genericValue;
    }
View Full Code Here

Examples of org.ofbiz.base.util.UtilTimer

     * @throws GenericEntityException
     */
    public GenericValue getGenericValue(int row, String entityName,
        boolean isMandatory) throws GenericEntityException {
        // THIS IS SLOW.  AVOID USING IT!  Try to use getGenericValue(int row, int entityNumber) instead.
        UtilTimer utilTimer = new UtilTimer();

        if (TIMER) {
            utilTimer.timerString(5,
                "[DataBuffer.getGenericValue(row, entityName)] Start");
        }

        Vector contentsRow = getContentsRow(row);

        if (contentsRow == null) {
            throw new GenericEntityException("Row " + String.valueOf(row) +
                " does not exist in the data buffer.");
        }

        Iterator gVI = getContentsRow(row).iterator();

        while (gVI.hasNext()) {
            GenericValue testGV = (GenericValue) gVI.next();

            if (testGV.getEntityName().equals(entityName)) {
                if (TIMER) {
                    utilTimer.timerString(5,
                        "[DataBuffer.getGenericValue(row, entityName)] Finished");
                }

                return testGV;
            }
View Full Code Here

Examples of org.ofbiz.base.util.UtilTimer

     * @throws GenericEntityException
     */
    public GenericValue getGenericValue(String entityName, Vector contentsRow)
        throws GenericEntityException {
        // THIS IS SLOW.  AVOID USING IT!  Try to use getGenericValue(int row, int entityNumber) instead.
        UtilTimer utilTimer = new UtilTimer();

        if (TIMER) {
            utilTimer.timerString(5,
                "[DataBuffer.getGenericValue(entityName, contentsRow)] Start");
        }

        // Find the correct generic value for the specified entity.
        GenericValue gV = null;
        Iterator contentsRowI = contentsRow.iterator();

        while (contentsRowI.hasNext()) {
            GenericValue testEntity = (GenericValue) contentsRowI.next();

            if (testEntity.getEntityName().equals(entityName)) {
                if (TIMER) {
                    utilTimer.timerString(5,
                        "[DataBuffer.getGenericValue(entityName, contentsRow)] Finished");
                }

                return testEntity;
            }
View Full Code Here

Examples of org.ofbiz.base.util.UtilTimer

                    if (TIMER) utilTimer.timerString(6, "[DataBuffer.getRowFromHTML] Finished");
                    return contentsRow;
            }
    */
    public Vector createEmptyRow() throws GenericEntityException {
        UtilTimer utilTimer = new UtilTimer();

        if (TIMER) {
            utilTimer.timerString(5, "[DataBuffer.createEmptyRow] Start");
        }

        Vector entityNameVector = getParentDataMatrix().getEntityNameVector();
        Vector contentsRow = new Vector(entityNameVector.size());
        Iterator entityIterator = entityNameVector.iterator();

        while (entityIterator.hasNext()) {
            String entityName = (String) entityIterator.next();

            ModelEntity entityME = getDelegator().getModelEntity(entityName);
            GenericValue blankGV = new GenericValue(entityME);
            blankGV.setDelegator(getDelegator());
            contentsRow.add(blankGV);
        }

        if (TIMER) {
            utilTimer.timerString(5, "[DataBuffer.createEmptyRow] Finished");
        }

        return contentsRow;
    }
View Full Code Here

Examples of org.ofbiz.base.util.UtilTimer

     * DOCUMENT ME!
     *
     * @throws GenericEntityException
     */
    public void addEmptyRow() throws GenericEntityException {
        UtilTimer utilTimer = new UtilTimer();

        if (TIMER) {
            utilTimer.timerString(5, "[DataBuffer.addEmptyRow] Start");
        }

        addContentsRow(createEmptyRow());

        if (TIMER) {
            utilTimer.timerString(5, "[DataBuffer.addEmptyRow] Finished");
        }

        return;
    }
View Full Code Here

Examples of org.ofbiz.base.util.UtilTimer

    protected UIDisplayObject uiDisplayObject = null;

    public UIFieldInfo(GenericValue uiScreenSectionInfoGV,
        GenericDelegator delegator, UICache uiCache)
        throws GenericEntityException {
        UtilTimer timer = new UtilTimer();

        if (TIMER) {
            timer.timerString(1, "[UIFieldInfo.UIFieldInfo] Start");
        }

        setSectionId(uiScreenSectionInfoGV.getString("sectionId"));
        setPartyId(uiScreenSectionInfoGV.getString("partyId"));
        setAttributeId(uiScreenSectionInfoGV.getString("attributeId"));
        setDisplayObjectId(uiScreenSectionInfoGV.getString("displayObjectId"));
        setMaxLength(uiScreenSectionInfoGV.getString("maxLength"));
        setIsMandatory(uiScreenSectionInfoGV.getString("isMandatory"));
        setIsReadOnly(uiScreenSectionInfoGV.getString("isReadOnly"));
        setIsVisible(uiScreenSectionInfoGV.getString("isVisible"));
        setIsSearchable(uiScreenSectionInfoGV.getString("isSearchable"));
        setDisplayOrder(uiScreenSectionInfoGV.getString("displayOrder"));
        setDisplayLabel(uiScreenSectionInfoGV.getString("displayLabel"));
        setDisplayLength(uiScreenSectionInfoGV.getString("displayLength"));
        setColSpan(uiScreenSectionInfoGV.getString("colSpan"));
        setRowSpan(uiScreenSectionInfoGV.getString("rowSpan"));
        setStartOnNewRow(uiScreenSectionInfoGV.getString("startOnNewRow"));

        // Get the UIDisplayObject.
        if (TIMER) {
            timer.timerString(2,
                "[UIFieldInfo.UIFieldInfo] Looking for UIDisplayObject in cache.");
        }

        String displayObjectId = getDisplayObjectId();
        UIDisplayObject uiDisplayObject = uiCache.getUiDisplayObject(displayObjectId);

        if (uiDisplayObject == null) {
            if (TIMER) {
                timer.timerString(2,
                    "[UIFieldInfo.UIFieldInfo] UIDisplayObject not found in cache. Creating a new one.");
            }

            uiDisplayObject = new UIDisplayObject(displayObjectId, delegator);
            uiCache.putUiDisplayObject(displayObjectId, uiDisplayObject);
        } else {
            if (TIMER) {
                timer.timerString(2,
                    "[UIFieldInfo.UIFieldInfo] Found UIDisplayObject in cache.");
            }
        }

        setUiDisplayObject(uiDisplayObject);

        if (TIMER) {
            timer.timerString(2, "[UIFieldInfo.UIFieldInfo] Got UIDisplayObject");
        }

        // Get the UIAttribute object.
        if (TIMER) {
            timer.timerString(2,
                "[UIFieldInfo.UIFieldInfo] Looking for UIAttribute " +
                attributeId + " in cache.");
        }

        String attributeId = getAttributeId();
        UIAttribute uiAttribute = uiCache.getUiAttribute(attributeId);

        if (uiAttribute == null) {
            throw new GenericEntityException("Attribute " + attributeId +
                " does not appear in any of the entities for this screen section.");
        } else {
            if (TIMER) {
                timer.timerString(2,
                    "[UIFieldInfo.UIFieldInfo] Found UIAttribute in cache.");
            }
        }

        setUiAttribute(uiAttribute);

        if (TIMER) {
            timer.timerString(2, "[UIFieldInfo.UIFieldInfo] Got UIAttribute");
        }

        // Get the UIScreenSectionEntity object.
        if (TIMER) {
            timer.timerString(2,
                "[UIFieldInfo.UIFieldInfo] Looking for UIScreenSectionEntity in cache.");
        }

        String sectionId = getSectionId();
        String entityId = getUiAttribute().getEntityId();
        UIScreenSectionEntity uiScreenSectionEntity = uiCache.getUiScreenSectionEntity(sectionId,
                entityId);

        if (uiScreenSectionEntity == null) {

            throw new GenericEntityException("Attribute '" +
                getUiAttribute().getAttributeName() +
                "' does not appear in any of the entities for this screen section.");
        } else {
            if (TIMER) {
                timer.timerString(2,
                    "[UIFieldInfo.UIFieldInfo] Found UIScreenSectionEntity in cache.");
            }
        }

        setUiScreenSectionEntity(uiScreenSectionEntity);

        if (TIMER) {
            timer.timerString(2,
                "[UIFieldInfo.UIFieldInfo] Got UIScreenSectionEntity");
        }

        if (TIMER) {
            timer.timerString(1, "[UIFieldInfo.UIFieldInfo] End");
        }
    }
View Full Code Here

Examples of org.ofbiz.base.util.UtilTimer

    //  public UIAttribute(GenericValue uiAttributeGV, GenericDelegator delegator) throws GenericEntityException {
    //    initialize(uiAttributeGV, delegator);
    //  }
    public void initialize(GenericValue uiAttributeGV,
        GenericDelegator delegator) throws GenericEntityException {
        UtilTimer timer = new UtilTimer();

        if (TIMER) {
            timer.timerString(6, "[UIAttribute.initialize] Start");
        }

        setAttributeId(uiAttributeGV.getString("attributeId"));
        setEntityId(uiAttributeGV.getString("entityId"));
        setAttributeName(uiAttributeGV.getString("attributeName"));
        setDescription(uiAttributeGV.getString("description"));
        setColumnName(uiAttributeGV.getString("columnName"));
        setDisplayObjectId(uiAttributeGV.getString("displayObjectId"));
        setIsMandatory(uiAttributeGV.getString("isMandatory"));
        setIsReadOnly(uiAttributeGV.getString("isReadOnly"));
        setIsVisible(uiAttributeGV.getString("isVisible"));
        setIsExtension(uiAttributeGV.getString("isExtension"));
        setIsSearchable(uiAttributeGV.getString("isSearchable"));
        setDisplayLabel(uiAttributeGV.getString("displayLabel"));
        setDisplayOrder(uiAttributeGV.getString("displayOrder"));
        setMaxLength(uiAttributeGV.getString("maxLength"));
        setDisplayLength(uiAttributeGV.getString("displayLength"));
        setColSpan(uiAttributeGV.getString("colSpan"));
        setRowSpan(uiAttributeGV.getString("rowSpan"));
        setStartOnNewRow(uiAttributeGV.getString("startOnNewRow"));

        setGenericValue(uiAttributeGV);

        if (TIMER) {
            timer.timerString(6, "[UIAttribute.initialize] End");
        }
    }
View Full Code Here

Examples of org.ofbiz.base.util.UtilTimer

        this.dctx = dctx;
        serviceDebugMode = "true".equals(UtilProperties.getPropertyValue("service", "servicedispatcher.servicedebugmode", "true"));
    }

    private Map<String, ModelService> getModelServices() {
        UtilTimer utilTimer = new UtilTimer();
        Document document;
        if (this.isFromURL) {
            // utilTimer.timerString("Before getDocument in file " + readerURL);
            document = getDocument(readerURL);

            if (document == null) {
                return null;
            }
        } else {
            // utilTimer.timerString("Before getDocument in " + handler);
            try {
                document = handler.getDocument();
            } catch (GenericConfigException e) {
                Debug.logError(e, "Error getting XML document from resource", module);
                return null;
            }
        }

        Map<String, ModelService> modelServices = FastMap.newInstance();
        if (this.isFromURL) {// utilTimer.timerString("Before getDocumentElement in file " + readerURL);
        } else {// utilTimer.timerString("Before getDocumentElement in " + handler);
        }

        Element docElement = document.getDocumentElement();
        if (docElement == null) {
            return null;
        }

        docElement.normalize();

        String resourceLocation = handler.getLocation();
        try {
            resourceLocation = handler.getURL().toExternalForm();
        } catch (GenericConfigException e) {
            Debug.logError(e, "Could not get resource URL", module);
        }

        int i = 0;
        Node curChild = docElement.getFirstChild();
        if (curChild != null) {
            if (this.isFromURL) {
                utilTimer.timerString("Before start of service loop in file " + readerURL);
            } else {
                utilTimer.timerString("Before start of service loop in " + handler);
            }

            do {
                if (curChild.getNodeType() == Node.ELEMENT_NODE && "service".equals(curChild.getNodeName())) {
                    i++;
                    Element curServiceElement = (Element) curChild;
                    String serviceName = UtilXml.checkEmpty(curServiceElement.getAttribute("name"));

                    // check to see if service with same name has already been read
                    if (modelServices.containsKey(serviceName)) {
                        Debug.logWarning("WARNING: Service " + serviceName + " is defined more than once, " +
                            "most recent will over-write previous definition(s)", module);
                    }

                    // utilTimer.timerString("  After serviceName -- " + i + " --");
                    ModelService service = createModelService(curServiceElement, resourceLocation);

                    // utilTimer.timerString("  After createModelService -- " + i + " --");
                    if (service != null) {
                        modelServices.put(serviceName, service);
                        // utilTimer.timerString("  After modelServices.put -- " + i + " --");
                        /*
                        int reqIn = service.getParameterNames(ModelService.IN_PARAM, false).size();
                        int optIn = service.getParameterNames(ModelService.IN_PARAM, true).size() - reqIn;
                        int reqOut = service.getParameterNames(ModelService.OUT_PARAM, false).size();
                        int optOut = service.getParameterNames(ModelService.OUT_PARAM, true).size() - reqOut;

                        if (Debug.verboseOn()) {
                            String msg = "-- getModelService: # " + i + " Loaded service: " + serviceName +
                                " (IN) " + reqIn + "/" + optIn + " (OUT) " + reqOut + "/" + optOut;

                            Debug.logVerbose(msg, module);
                        }
                        */
                    } else {
                        Debug.logWarning(
                            "-- -- SERVICE ERROR:getModelService: Could not create service for serviceName: " +
                            serviceName, module);
                    }

                }
            } while ((curChild = curChild.getNextSibling()) != null);
        } else {
            Debug.logWarning("No child nodes found.", module);
        }
        if (this.isFromURL) {
            utilTimer.timerString("Finished file " + readerURL + " - Total Services: " + i + " FINISHED");
            Debug.logImportant("Loaded [" + StringUtil.leftPad(Integer.toString(i), 3) + "] Services from " + readerURL, module);
        } else {
            utilTimer.timerString("Finished document in " + handler + " - Total Services: " + i + " FINISHED");
            if (Debug.importantOn()) {
                Debug.logImportant("Loaded [" + StringUtil.leftPad(Integer.toString(i), 3) + "] Services from " + resourceLocation, module);
            }
        }
        return modelServices;
View Full Code Here

Examples of org.ofbiz.base.util.UtilTimer

    protected GenericDelegator delegator = null;
    protected boolean attributesLoaded = false;

    public UIDisplayObject(String displayObjectId, GenericDelegator delegator)
        throws GenericEntityException {
        UtilTimer timer = new UtilTimer();

        if (TIMER) {
            timer.timerString(3, "[UIDisplayObject.UIDisplayObject] Start");
        }

        // Get the UI display object generic value from the database.
        ModelEntity uiDisplayObjectEntity = delegator.getModelEntity(
                "UiDisplayObject");
        HashMap findMap = new HashMap();
        findMap.put("displayObjectId", displayObjectId);

        GenericPK uiDisplayObjectPK = new GenericPK(uiDisplayObjectEntity,
                findMap);
        GenericValue uiDisplayObjectGV = delegator.findByPrimaryKey(uiDisplayObjectPK);

        if (uiDisplayObjectGV == null) {
            throw new GenericEntityException(
                "No display object was found with ID " + displayObjectId);
        }

        setDisplayObjectId(displayObjectId);
        setDisplayTypeId(uiDisplayObjectGV.getString("displayTypeId"));
        setDelegator(delegator);

        if (TIMER) {
            timer.timerString(3, "[UIDisplayObject.UIDisplayObject] End");
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.