Example usage for java.util ArrayList contains

List of usage examples for java.util ArrayList contains

Introduction

In this page you can find the example usage for java.util ArrayList contains.

Prototype

public boolean contains(Object o) 

Source Link

Document

Returns true if this list contains the specified element.

Usage

From source file:CB_Locator.Map.ManagerBase.java

private void getFiles(ArrayList<String> files, ArrayList<String> mapnames, String directory) {
    File dir = FileFactory.createFile(directory);
    String[] dirFiles = dir.list();
    if (dirFiles != null && dirFiles.length > 0) {
        for (String tmp : dirFiles) {
            String FilePath = directory + "/" + tmp;
            String ttt = tmp.toLowerCase();
            if (ttt.endsWith("pack") || ttt.endsWith("map") || ttt.endsWith("xml") || ttt.endsWith("bsh")) {
                if (!mapnames.contains(tmp)) {
                    files.add(FilePath);
                    mapnames.add(tmp);//from  w  ww .  ja va  2s  .  c o  m
                    Log.debug(log, "add: " + tmp);
                }
            }
        }
    }
}

From source file:geva.Mapper.ContextFreeGrammar.java

/**
 * Recursively calculates the minimum depth of a rule
 * @param startRule the current rule investigated
 * @param visitedRules visited rules//  w  w w  .  ja  v a 2  s .c  o m
 */
void calculateMinimumDepthRecursive(Rule startRule, ArrayList<Rule> visitedRules) {
    Symbol tempSymbol;
    Production tempProd;
    Rule currentRule;
    Iterator<Symbol> symbIt;
    Iterator<Production> prodIt;

    if (!visitedRules.contains(startRule)) {
        // Loop through the startRule
        prodIt = startRule.iterator();
        while (prodIt.hasNext()) {
            tempProd = prodIt.next();
            tempProd.setMinimumDepth(0);
            symbIt = tempProd.iterator();
            while (symbIt.hasNext()) {
                tempSymbol = symbIt.next();
                if (tempSymbol.getType() == Enums.SymbolType.NTSymbol) {
                    currentRule = findRule(tempSymbol);
                    if (currentRule != null) {
                        visitedRules.add(startRule);
                        calculateMinimumDepthRecursive(currentRule, visitedRules);
                        if (tempProd.getMinimumDepth() < (currentRule.getMinimumDepth() + 1)) {
                            tempProd.setMinimumDepth(currentRule.getMinimumDepth() + 1);
                        }
                    }
                } else {
                    if (tempProd.getMinimumDepth() < 1) {
                        tempProd.setMinimumDepth(1);
                    }
                }
            }
            if (startRule.getMinimumDepth() > tempProd.getMinimumDepth()) {
                startRule.setMinimumDepth(tempProd.getMinimumDepth());
                //System.out.println("-Setting:"+startRule.getLHS().getSymbolString()+" d:"+startRule.getMinimumDepth());
            }
        }
    }
}

From source file:org.tomahawk.libtomahawk.resolver.PipeLine.java

/**
 * If the {@link ScriptResolver} has resolved the {@link Query}, this method will be called.
 * This method will then calculate a score and assign it to every {@link Result}. If the score
 * is higher than MINSCORE the {@link Result} is added to the output resultList.
 *
 * @param queryKey the {@link Query}'s key
 * @param results  the unfiltered {@link ArrayList} of {@link Result}s
 *///from  w w  w.j av a  2s .co m
public void reportResults(final String queryKey, final ArrayList<Result> results, final String resolverId) {
    int priority;
    if (TomahawkApp.PLUGINNAME_USERCOLLECTION.equals(resolverId)) {
        priority = TomahawkRunnable.PRIORITY_IS_REPORTING_LOCALSOURCE;
    } else if (TomahawkApp.PLUGINNAME_SPOTIFY.equals(resolverId)
            || TomahawkApp.PLUGINNAME_DEEZER.equals(resolverId)
            || TomahawkApp.PLUGINNAME_BEATSMUSIC.equals(resolverId)
            || TomahawkApp.PLUGINNAME_RDIO.equals(resolverId)) {
        priority = TomahawkRunnable.PRIORITY_IS_REPORTING_SUBSCRIPTION;
    } else {
        priority = TomahawkRunnable.PRIORITY_IS_REPORTING;
    }
    ThreadManager.getInstance().execute(new TomahawkRunnable(priority) {
        @Override
        public void run() {
            ArrayList<Result> cleanTrackResults = new ArrayList<Result>();
            ArrayList<Result> cleanAlbumResults = new ArrayList<Result>();
            ArrayList<Result> cleanArtistResults = new ArrayList<Result>();
            Query q = Query.getQueryByKey(queryKey);
            if (q != null) {
                for (Result r : results) {
                    if (r != null) {
                        r.setTrackScore(q.howSimilar(r, PIPELINE_SEARCHTYPE_TRACKS));
                        if (r.getTrackScore() >= MINSCORE && !cleanTrackResults.contains(r)) {
                            r.setType(Result.RESULT_TYPE_TRACK);
                            cleanTrackResults.add(r);
                        }
                        if (q.isFullTextQuery()) {
                            r.setAlbumScore(q.howSimilar(r, PIPELINE_SEARCHTYPE_ALBUMS));
                            if (r.getAlbumScore() >= MINSCORE && !cleanAlbumResults.contains(r)) {
                                r.setType(Result.RESULT_TYPE_ALBUM);
                                cleanAlbumResults.add(r);
                            }
                            r.setArtistScore(q.howSimilar(r, PIPELINE_SEARCHTYPE_ARTISTS));
                            if (r.getArtistScore() >= MINSCORE && !cleanArtistResults.contains(r)) {
                                r.setType(Result.RESULT_TYPE_ARTIST);
                                cleanArtistResults.add(r);
                            }
                        }
                    }
                }
                q.addArtistResults(cleanArtistResults);
                q.addAlbumResults(cleanAlbumResults);
                q.addTrackResults(cleanTrackResults);
                sendResultsReportBroadcast(q.getCacheKey());
                if (q.isSolved()) {
                    ThreadManager.getInstance().stop(q);
                }
            }
        }
    });
}

From source file:com.redhat.jenkins.nodesharingbackend.ReservationVerifier.java

@VisibleForTesting
public static void verify(ConfigRepo.Snapshot config, Api api) {
    // Capture multiple plans so we can identify long-lasting problems. The number of samples and delay is to be fine-tuned.
    ArrayList<Map<ExecutorJenkins, PlannedFixup>> plans = new ArrayList<>();
    plans.add(computePlannedFixup(config, api));
    if (plans.get(0).isEmpty())
        return; // If there is nothing to do, no need to doublecheck

    try {/*from ww  w  .j  a va2s . c o m*/
        Thread.sleep(RestEndpoint.TIMEOUT * 2);
    } catch (InterruptedException e) {
        Thread.currentThread().interrupt();
        return;
    }

    plans.add(computePlannedFixup(config, api));
    Map<ExecutorJenkins, PlannedFixup> plan = PlannedFixup.reduce(plans);

    // First kill all dangling reservations, then schedule new ones across the orchestrator to make sure backfills
    // are not blocked by reservations we are about to kill

    // Completed reservations may stick around for a while - avoid reporting that as a problem
    ArrayList<ReservationTask.ReservationExecutable> justCompleted = new ArrayList<>();

    // NC1
    for (Map.Entry<ExecutorJenkins, PlannedFixup> e2pf : plan.entrySet()) {
        ExecutorJenkins executor = e2pf.getKey();
        for (String cancel : e2pf.getValue().toCancel) {
            ShareableComputer computer;
            try {
                computer = ShareableComputer.getByName(cancel);
            } catch (NoSuchElementException e) {
                continue;
            }
            ReservationTask.ReservationExecutable reservation = computer.getReservation();

            if (reservation == null)
                continue;
            ReservationTask parent = reservation.getParent();
            if (!parent.getOwner().equals(executor))
                continue;

            LOGGER.info("Canceling dangling " + reservation);
            reservation.complete();
            justCompleted.add(reservation);
        }
    }

    // NC2
    for (Map.Entry<ExecutorJenkins, PlannedFixup> e2pf : plan.entrySet()) {
        ExecutorJenkins executor = e2pf.getKey();
        for (String host : e2pf.getValue().toSchedule) {
            try {
                ShareableComputer computer = ShareableComputer.getByName(host);
                ReservationTask task = new ReservationTask(executor, host, true);
                LOGGER.info("Starting backfill " + task);
                ReservationTask.ReservationExecutable reservation = computer.getReservation();
                if (reservation != null && !justCompleted.contains(reservation)) {
                    ExecutorJenkins owner = reservation.getParent().getOwner();
                    if (owner.equals(executor))
                        continue;
                    LOGGER.warning("Host " + host + " is already used by " + reservation);
                }

                task.schedule();
            } catch (NoSuchElementException ex) {
                continue; // host disappeared
            }
        }
    }
}

From source file:de.xirp.settings.Option.java

/**
 * Loads the saved preferences for this options values.
 *//*from   ww  w  . j  a v  a2  s  . c  o  m*/
@SuppressWarnings("unchecked")
private void loadSavedPrefs() {
    if (sub == null) {
        loaded = true;
    }
    if (!loaded) {
        // Get a list of the key of this configuration
        Iterator it = sub.getKeys();
        ArrayList<String> keys = new ArrayList<String>();
        while (it.hasNext()) {
            keys.add((String) it.next());
        }
        // Iterate over the values of this option an load
        // the saved value
        for (IValue value : values) {
            String val = value.getSaveKey();
            if (keys.contains(val)) {
                Object obj = sub.getProperty(val);
                value.parseSavedValue(obj);
            }
        }
        loaded = true;
    }
}

From source file:fr.fastconnect.factory.tibco.bw.maven.packaging.MergePropertiesMojo.java

private Properties removeEmptyBindings(Properties properties) {
    ArrayList<String> pars = new ArrayList<String>();

    Pattern pNotEmptyBinding = Pattern.compile(regexNotEmptyBinding);
    Pattern pEmptyBinding = Pattern.compile(regexEmptyBinding);
    String parName;// w w w .  j a  va2  s .c o m

    Enumeration<Object> e = properties.keys();
    // first check if there is at least one non empty binding (non default)
    while (e.hasMoreElements()) {
        String key = (String) e.nextElement();
        Matcher mNotEmptyBinding = pNotEmptyBinding.matcher(key);
        if (mNotEmptyBinding.matches()) {
            parName = mNotEmptyBinding.group(1);
            if (pars.contains(parName))
                continue;
            pars.add(parName);
        }
    }
    // then delete
    e = properties.keys();
    while (e.hasMoreElements()) {
        String key = (String) e.nextElement();
        Matcher mEmptyBinding = pEmptyBinding.matcher(key);
        if (mEmptyBinding.matches()) {
            parName = mEmptyBinding.group(1);
            if (pars.contains(parName)) {
                properties.remove(key);
            }
        }
    }

    return properties;
}

From source file:com.celements.web.service.WebUtilsService.java

public List<DocumentReference> getDocumentParentsList(DocumentReference docRef, boolean includeDoc) {
    ArrayList<DocumentReference> docParents = new ArrayList<DocumentReference>();
    try {/*from   w  ww  .  j  a  v a 2  s. co m*/
        DocumentReference nextParent;
        if (includeDoc) {
            nextParent = docRef;
        } else {
            nextParent = getParentRef(docRef);
        }
        while ((nextParent != null) && getContext().getWiki().exists(nextParent, getContext())
                && !docParents.contains(nextParent)) {
            docParents.add(nextParent);
            nextParent = getParentRef(nextParent);
        }
    } catch (XWikiException e) {
        LOGGER.error("Failed to get parent reference. ", e);
    }
    return docParents;
}

From source file:com.cdvdev.subscriptiondemo.helpers.IabHelper.java

int querySkuDetails(String itemType, Inventory inv, List<String> moreSkus)
        throws RemoteException, JSONException {
    logDebug("Querying SKU details.");
    ArrayList<String> skuList = new ArrayList<String>();
    skuList.addAll(inv.getAllOwnedSkus(itemType));
    if (moreSkus != null) {
        for (String sku : moreSkus) {
            if (!skuList.contains(sku)) {
                skuList.add(sku);/*from w ww . ja  v  a  2s . c  o m*/
            }
        }
    }

    if (skuList.size() == 0) {
        logDebug("queryPrices: nothing to do because there are no SKUs.");
        return BILLING_RESPONSE_RESULT_OK;
    }

    // Split the sku list in blocks of no more than 20 elements.
    ArrayList<ArrayList<String>> packs = new ArrayList<ArrayList<String>>();
    ArrayList<String> tempList;
    int n = skuList.size() / 20;
    int mod = skuList.size() % 20;
    for (int i = 0; i < n; i++) {
        tempList = new ArrayList<String>();
        for (String s : skuList.subList(i * 20, i * 20 + 20)) {
            tempList.add(s);
        }
        packs.add(tempList);
    }
    if (mod != 0) {
        tempList = new ArrayList<String>();
        for (String s : skuList.subList(n * 20, n * 20 + mod)) {
            tempList.add(s);
        }
        packs.add(tempList);
    }

    for (ArrayList<String> skuPartList : packs) {
        Bundle querySkus = new Bundle();
        querySkus.putStringArrayList(GET_SKU_DETAILS_ITEM_LIST, skuPartList);
        Bundle skuDetails = mIInAppBillingService.getSkuDetails(3, mContext.getPackageName(), itemType,
                querySkus);

        if (!skuDetails.containsKey(RESPONSE_GET_SKU_DETAILS_LIST)) {
            int response = getResponseCodeFromBundle(skuDetails);
            if (response != BILLING_RESPONSE_RESULT_OK) {
                logDebug("getSkuDetails() failed: " + getResponseDesc(response));
                return response;
            } else {
                logError("getSkuDetails() returned a bundle with neither an error nor a detail list.");
                return IABHELPER_BAD_RESPONSE;
            }
        }

        ArrayList<String> responseList = skuDetails.getStringArrayList(RESPONSE_GET_SKU_DETAILS_LIST);

        for (String thisResponse : responseList) {
            SkuDetails d = new SkuDetails(itemType, thisResponse);
            logDebug("Got sku details: " + d);
            inv.addSkuDetails(d);
        }
    }

    return BILLING_RESPONSE_RESULT_OK;
}

From source file:edu.uci.ics.asterix.optimizer.rules.am.AbstractIntroduceAccessMethodRule.java

/**
 * Returns the field name corresponding to the assigned variable at
 * varIndex. Returns null if the expr at varIndex does not yield to a field
 * access function after following a set of allowed functions.
 * /*from   w w w.  jav  a2s . c o m*/
 * @throws AlgebricksException
 */
protected List<String> getFieldNameFromSubTree(IOptimizableFuncExpr optFuncExpr,
        OptimizableOperatorSubTree subTree, int opIndex, int assignVarIndex, ARecordType recordType,
        int funcVarIndex, ILogicalExpression parentFuncExpr) throws AlgebricksException {
    // Get expression corresponding to opVar at varIndex.
    AbstractLogicalExpression expr = null;
    AbstractFunctionCallExpression childFuncExpr = null;
    AbstractLogicalOperator op = subTree.assignsAndUnnests.get(opIndex);
    if (op.getOperatorTag() == LogicalOperatorTag.ASSIGN) {
        AssignOperator assignOp = (AssignOperator) op;
        expr = (AbstractLogicalExpression) assignOp.getExpressions().get(assignVarIndex).getValue();
        childFuncExpr = (AbstractFunctionCallExpression) expr;
    } else {
        UnnestOperator unnestOp = (UnnestOperator) op;
        expr = (AbstractLogicalExpression) unnestOp.getExpressionRef().getValue();
        if (expr.getExpressionTag() != LogicalExpressionTag.FUNCTION_CALL) {
            return null;
        }
        childFuncExpr = (AbstractFunctionCallExpression) expr;
        if (childFuncExpr.getFunctionIdentifier() != AsterixBuiltinFunctions.SCAN_COLLECTION) {
            return null;
        }
        expr = (AbstractLogicalExpression) childFuncExpr.getArguments().get(0).getValue();
    }
    if (expr.getExpressionTag() != LogicalExpressionTag.FUNCTION_CALL) {
        return null;
    }
    AbstractFunctionCallExpression funcExpr = (AbstractFunctionCallExpression) expr;
    FunctionIdentifier funcIdent = funcExpr.getFunctionIdentifier();

    boolean isByName = false;
    boolean isFieldAccess = false;
    String fieldName = null;
    List<String> nestedAccessFieldName = null;
    int fieldIndex = -1;
    if (funcIdent == AsterixBuiltinFunctions.FIELD_ACCESS_BY_NAME) {
        ILogicalExpression nameArg = funcExpr.getArguments().get(1).getValue();
        if (nameArg.getExpressionTag() != LogicalExpressionTag.CONSTANT) {
            return null;
        }
        ConstantExpression constExpr = (ConstantExpression) nameArg;
        fieldName = ((AString) ((AsterixConstantValue) constExpr.getValue()).getObject()).getStringValue();
        isFieldAccess = true;
        isByName = true;
    } else if (funcIdent == AsterixBuiltinFunctions.FIELD_ACCESS_BY_INDEX) {
        ILogicalExpression idxArg = funcExpr.getArguments().get(1).getValue();
        if (idxArg.getExpressionTag() != LogicalExpressionTag.CONSTANT) {
            return null;
        }
        ConstantExpression constExpr = (ConstantExpression) idxArg;
        fieldIndex = ((AInt32) ((AsterixConstantValue) constExpr.getValue()).getObject()).getIntegerValue();
        isFieldAccess = true;
    } else if (funcIdent == AsterixBuiltinFunctions.FIELD_ACCESS_NESTED) {
        ILogicalExpression nameArg = funcExpr.getArguments().get(1).getValue();
        if (nameArg.getExpressionTag() != LogicalExpressionTag.CONSTANT) {
            return null;
        }
        ConstantExpression constExpr = (ConstantExpression) nameArg;
        AOrderedList orderedNestedFieldName = (AOrderedList) ((AsterixConstantValue) constExpr.getValue())
                .getObject();
        nestedAccessFieldName = new ArrayList<String>();
        for (int i = 0; i < orderedNestedFieldName.size(); i++) {
            nestedAccessFieldName.add(((AString) orderedNestedFieldName.getItem(i)).getStringValue());
        }
        isFieldAccess = true;
        isByName = true;
    }
    if (isFieldAccess) {
        optFuncExpr.setLogicalExpr(funcVarIndex, parentFuncExpr);
        int[] assignAndExpressionIndexes = null;

        //go forward through nested assigns until you find the relevant one
        for (int i = opIndex + 1; i < subTree.assignsAndUnnests.size(); i++) {
            AbstractLogicalOperator subOp = subTree.assignsAndUnnests.get(i);
            List<LogicalVariable> varList;

            if (subOp.getOperatorTag() == LogicalOperatorTag.ASSIGN) {
                //Nested was an assign
                varList = ((AssignOperator) subOp).getVariables();
            } else if (subOp.getOperatorTag() == LogicalOperatorTag.UNNEST) {
                //Nested is not an assign
                varList = ((UnnestOperator) subOp).getVariables();
            } else {
                break;
            }

            //Go through variables in assign to check for match
            for (int varIndex = 0; varIndex < varList.size(); varIndex++) {
                LogicalVariable var = varList.get(varIndex);
                ArrayList<LogicalVariable> parentVars = new ArrayList<LogicalVariable>();
                expr.getUsedVariables(parentVars);

                if (parentVars.contains(var)) {
                    //Found the variable we are looking for.
                    //return assign and index of expression
                    int[] returnValues = { i, varIndex };
                    assignAndExpressionIndexes = returnValues;
                }
            }
        }
        if (assignAndExpressionIndexes != null && assignAndExpressionIndexes[0] > -1) {
            //We found the nested assign

            //Recursive call on nested assign
            List<String> parentFieldNames = getFieldNameFromSubTree(optFuncExpr, subTree,
                    assignAndExpressionIndexes[0], assignAndExpressionIndexes[1], recordType, funcVarIndex,
                    parentFuncExpr);

            if (parentFieldNames == null) {
                //Nested assign was not a field access. 
                //We will not use index
                return null;
            }

            if (!isByName) {
                try {
                    fieldName = ((ARecordType) recordType.getSubFieldType(parentFieldNames))
                            .getFieldNames()[fieldIndex];
                } catch (IOException e) {
                    throw new AlgebricksException(e);
                }
            }
            optFuncExpr.setSourceVar(funcVarIndex, ((AssignOperator) op).getVariables().get(assignVarIndex));
            //add fieldName to the nested fieldName, return
            if (nestedAccessFieldName != null) {
                for (int i = 0; i < nestedAccessFieldName.size(); i++) {
                    parentFieldNames.add(nestedAccessFieldName.get(i));
                }
            } else {
                parentFieldNames.add(fieldName);
            }
            return (parentFieldNames);
        }

        optFuncExpr.setSourceVar(funcVarIndex, ((AssignOperator) op).getVariables().get(assignVarIndex));
        //no nested assign, we are at the lowest level.
        if (isByName) {
            if (nestedAccessFieldName != null) {
                return nestedAccessFieldName;
            }
            return new ArrayList<String>(Arrays.asList(fieldName));
        }
        return new ArrayList<String>(Arrays.asList(recordType.getFieldNames()[fieldIndex]));

    }

    if (funcIdent != AsterixBuiltinFunctions.WORD_TOKENS && funcIdent != AsterixBuiltinFunctions.GRAM_TOKENS
            && funcIdent != AsterixBuiltinFunctions.SUBSTRING
            && funcIdent != AsterixBuiltinFunctions.SUBSTRING_BEFORE
            && funcIdent != AsterixBuiltinFunctions.SUBSTRING_AFTER
            && funcIdent != AsterixBuiltinFunctions.CREATE_POLYGON
            && funcIdent != AsterixBuiltinFunctions.CREATE_MBR
            && funcIdent != AsterixBuiltinFunctions.CREATE_RECTANGLE
            && funcIdent != AsterixBuiltinFunctions.CREATE_CIRCLE
            && funcIdent != AsterixBuiltinFunctions.CREATE_LINE
            && funcIdent != AsterixBuiltinFunctions.CREATE_POINT) {
        return null;
    }
    // We use a part of the field in edit distance computation
    if (optFuncExpr.getFuncExpr().getFunctionIdentifier() == AsterixBuiltinFunctions.EDIT_DISTANCE_CHECK) {
        optFuncExpr.setPartialField(true);
    }
    // We expect the function's argument to be a variable, otherwise we
    // cannot apply an index.
    ILogicalExpression argExpr = funcExpr.getArguments().get(0).getValue();
    if (argExpr.getExpressionTag() != LogicalExpressionTag.VARIABLE) {
        return null;
    }
    LogicalVariable curVar = ((VariableReferenceExpression) argExpr).getVariableReference();
    // We look for the assign or unnest operator that produces curVar below
    // the current operator
    for (int assignOrUnnestIndex = opIndex + 1; assignOrUnnestIndex < subTree.assignsAndUnnests
            .size(); assignOrUnnestIndex++) {
        AbstractLogicalOperator curOp = subTree.assignsAndUnnests.get(assignOrUnnestIndex);
        if (curOp.getOperatorTag() == LogicalOperatorTag.ASSIGN) {
            AssignOperator assignOp = (AssignOperator) curOp;
            List<LogicalVariable> varList = assignOp.getVariables();
            for (int varIndex = 0; varIndex < varList.size(); varIndex++) {
                LogicalVariable var = varList.get(varIndex);
                if (var.equals(curVar)) {
                    optFuncExpr.setSourceVar(funcVarIndex, var);
                    return getFieldNameFromSubTree(optFuncExpr, subTree, assignOrUnnestIndex, varIndex,
                            recordType, funcVarIndex, childFuncExpr);
                }
            }
        } else {
            UnnestOperator unnestOp = (UnnestOperator) curOp;
            LogicalVariable var = unnestOp.getVariable();
            if (var.equals(curVar)) {
                getFieldNameFromSubTree(optFuncExpr, subTree, assignOrUnnestIndex, 0, recordType, funcVarIndex,
                        childFuncExpr);
            }
        }
    }
    return null;
}

From source file:com.gcrm.action.crm.BaseEditAction.java

/**
 * Gets the base information for entity.
 * /*  w ww .  j av  a 2 s .  c o m*/
 * @param entity instance
 */
@SuppressWarnings({ "rawtypes", "unchecked" })
protected void getBaseInfo(BaseEntity entity, String entityName, String namespace) {
    User createdUser = entity.getCreated_by();
    if (createdUser != null) {
        this.setCreatedBy(createdUser.getName());
    }
    User updatedUser = entity.getUpdated_by();
    if (updatedUser != null) {
        this.setUpdatedBy(updatedUser.getName());
    }
    SimpleDateFormat dateFormat = new SimpleDateFormat(Constant.DATE_TIME_FORMAT);
    Date createdOn = entity.getCreated_on();
    if (createdOn != null) {
        this.setCreatedOn(dateFormat.format(createdOn));
    }
    Date updatedOn = entity.getUpdated_on();
    if (updatedOn != null) {
        this.setUpdatedOn(dateFormat.format(updatedOn));
    }
    User owner = entity.getOwner();
    if (owner != null) {
        ownerID = owner.getId();
        ownerText = owner.getName();
    }

    // Sets navigation history
    HttpServletRequest request = ServletActionContext.getRequest();
    HttpSession session = request.getSession();
    ArrayList navigationList = (ArrayList) session.getAttribute(Constant.NAVIGATION_HISTORY);
    if (navigationList == null) {
        navigationList = new ArrayList();
    }
    String entityLabel = getText("entity." + CommonUtil.lowerCaseString(entityName) + ".label");
    if (!CommonUtil.isNullOrEmpty(entity.getName())) {
        entityLabel += " - " + entity.getName();
    }
    String navigatoin = "<a href='" + namespace + "edit" + entityName + ".action?id=" + entity.getId() + "'>"
            + entityLabel + "</a>";
    if (navigationList.contains(navigatoin)) {
        navigationList.remove(navigatoin);
    }
    navigationList.add(navigatoin);
    if (navigationList.size() > Constant.NAVIGATION_HISTORY_COUNT) {
        navigationList.remove(0);
    }
    session.setAttribute(Constant.NAVIGATION_HISTORY, navigationList);
}