Example usage for com.liferay.portal.kernel.workflow WorkflowConstants STATUS_ANY

List of usage examples for com.liferay.portal.kernel.workflow WorkflowConstants STATUS_ANY

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.workflow WorkflowConstants STATUS_ANY.

Prototype

int STATUS_ANY

To view the source code for com.liferay.portal.kernel.workflow WorkflowConstants STATUS_ANY.

Click Source Link

Usage

From source file:ch.inofix.contact.service.impl.ContactLocalServiceImpl.java

License:Open Source License

@Override
public Hits search(long userId, long groupId, String keywords, int start, int end, Sort sort)
        throws PortalException {

    if (sort == null) {
        sort = new Sort(Field.MODIFIED_DATE, true);
    }// ww  w  . ja  va2s.  com

    String company = null;
    String fullName = null;
    boolean andOperator = false;

    if (Validator.isNotNull(keywords)) {

        company = keywords;
        fullName = keywords;

    } else {
        andOperator = true;
    }

    return search(userId, groupId, 0, company, fullName, WorkflowConstants.STATUS_ANY, null, andOperator, start,
            end, sort);

}

From source file:ch.inofix.referencemanager.service.impl.BibliographyServiceImpl.java

License:Open Source License

/**
 * @param userId//w w  w  .ja v  a2  s.  co m
 *            the userId of the current user
 * @param groupId
 *            the scopeGroupId of the bibliography. 0 means: any scope.
 * @param ownerUserId
 *            the userId of the bibliography owner. -1 means: ignore
 *            ownerUserId parameter.
 * @param keywords
 * @param start
 * @param end
 * @param sort
 * @return the hits for the given parameters
 * @since 1.0.0
 * @throws PortalException
 */
public Hits search(long userId, long groupId, long ownerUserId, String keywords, int start, int end, Sort sort)
        throws PortalException {

    if (sort == null) {
        sort = new Sort(Field.MODIFIED_DATE, true);
    }

    Indexer<Bibliography> indexer = IndexerRegistryUtil.getIndexer(Bibliography.class.getName());

    SearchContext searchContext = new SearchContext();

    searchContext.setAttribute(Field.STATUS, WorkflowConstants.STATUS_ANY);

    searchContext.setAttribute("paginationType", "more");

    User user = UserLocalServiceUtil.getUser(userId);

    searchContext.setCompanyId(user.getCompanyId());

    searchContext.setEnd(end);

    if (groupId > 0) {
        searchContext.setGroupIds(new long[] { groupId });
    }
    searchContext.setSorts(sort);
    searchContext.setStart(start);
    searchContext.setUserId(userId);
    searchContext.setOwnerUserId(ownerUserId);

    return indexer.search(searchContext);

}

From source file:ch.inofix.referencemanager.service.impl.ReferenceLocalServiceImpl.java

License:Open Source License

public void match(Reference reference) throws PortalException {

    _log.info("match");

    long defaultGroupId = GetterUtil.getLong(PropsUtil.get("default.group.id"));

    Hits hits = search(reference.getUserId(), defaultGroupId, -1, null, reference.getTitle(), null,
            WorkflowConstants.STATUS_ANY, null, false, 0, 20, null);

    _log.info("hits.getLength() = " + hits.getLength());

    if (hits.getLength() == 0) {

        // not yet in the pool of common references

        _log.info("not yet in the global references ");

        // TODO: strip the private fields from the reference
        String bibTeX = reference.getBibTeX();

        ServiceContext serviceContext = new ServiceContext();
        serviceContext.setScopeGroupId(defaultGroupId);

        Reference globalReference = addReference(reference.getUserId(), bibTeX, serviceContext);

        refRefRelationLocalService.addRefRefRelation(reference.getUserId(), globalReference.getReferenceId(),
                reference.getReferenceId(), new ServiceContext());
    }/*from w  w w  .j a v  a  2 s.  c o  m*/
}

From source file:ch.inofix.referencemanager.service.impl.ReferenceLocalServiceImpl.java

License:Open Source License

@Override
public Hits search(long userId, long groupId, long bibliographyId, String keywords, int start, int end,
        Sort sort) throws PortalException {

    if (sort == null) {
        sort = new Sort(Field.MODIFIED_DATE, true);
    }//  ww  w  . java 2s  . c  o m

    String author = null;
    String title = null;
    String year = null;

    boolean andOperator = false;

    if (Validator.isNotNull(keywords)) {

        author = keywords;
        title = keywords;
        year = keywords;

    } else {
        andOperator = true;
    }

    return search(userId, groupId, bibliographyId, author, title, year, WorkflowConstants.STATUS_ANY, null,
            andOperator, start, end, sort);

}

From source file:ch.inofix.timetracker.service.impl.TaskRecordLocalServiceImpl.java

License:Open Source License

@Override
public Hits search(long userId, long groupId, String keywords, int start, int end, Sort sort)
        throws PortalException {

    if (sort == null) {
        sort = new Sort(Field.MODIFIED_DATE, true);
    }//from  ww  w  . java 2 s  .  c om

    Indexer<TaskRecord> indexer = IndexerRegistryUtil.getIndexer(TaskRecord.class.getName());

    SearchContext searchContext = new SearchContext();

    searchContext.setAttribute(Field.STATUS, WorkflowConstants.STATUS_ANY);

    searchContext.setAttribute("paginationType", "more");

    Group group = GroupLocalServiceUtil.getGroup(groupId);

    searchContext.setCompanyId(group.getCompanyId());

    searchContext.setEnd(end);
    if (groupId > 0) {
        searchContext.setGroupIds(new long[] { groupId });
    }
    searchContext.setSorts(sort);
    searchContext.setStart(start);
    searchContext.setUserId(userId);

    searchContext.setKeywords(keywords);

    return indexer.search(searchContext);

}

From source file:com.crm.merchant.service.impl.MerchantAgentLocalServiceImpl.java

License:Open Source License

protected MerchantAgent updateAgent(long userId, MerchantAgent agent, int status, String description)
        throws PortalException, SystemException {
    Date now = new Date();

    User user = userPersistence.findByPrimaryKey(userId);

    status = (status == WorkflowConstants.STATUS_ANY) ? WorkflowConstants.STATUS_APPROVED : status;

    agent.setUserId(user.getUserId());//from ww  w .j a  v a2  s  .  co m
    agent.setUserName(user.getScreenName());
    if (agent.isNew()) {
        agent.setCreateDate(now);
    }
    agent.setModifiedDate(now);

    agent.setStatus(status);
    agent.setDescription(description);

    return merchantAgentPersistence.update(agent, false);
}

From source file:com.crm.merchant.service.impl.MerchantEntryLocalServiceImpl.java

License:Open Source License

protected MerchantEntry updateMerchant(long userId, MerchantEntry merchant, int status, String description)
        throws PortalException, SystemException {
    Date now = new Date();

    User user = userLocalService.getUser(userId);

    if (merchant.isNew()) {
        merchant.setCreateDate(now);/*from   w  w w  . j ava 2s .  com*/
    }
    merchant.setUserId(userId);
    merchant.setUserName(user.getScreenName());
    merchant.setModifiedDate(now);

    status = (status == WorkflowConstants.STATUS_ANY) ? merchant.getStatus() : status;

    merchant.setStatus(status);
    merchant.setDescription(description);

    return merchantEntryPersistence.update(merchant, false);
}

From source file:com.crm.product.service.impl.ProductEntryLocalServiceImpl.java

License:Open Source License

protected ProductEntry updateProduct(long userId, ProductEntry product, int status)
        throws PortalException, SystemException {
    // Finder/*from w ww  . java 2s .  c  o m*/
    User user = userPersistence.findByPrimaryKey(userId);

    Date now = new Date();

    product.setUserId(user.getUserId());
    product.setUserName(user.getScreenName());
    if (product.isNew()) {
        product.setCreateDate(now);
    }
    product.setModifiedDate(now);

    status = (status == WorkflowConstants.STATUS_ANY) ? product.getStatus() : status;

    product.setStatus(status);

    return productEntryPersistence.update(product, false);
}

From source file:com.crm.provisioning.service.impl.ProvisioningActionLocalServiceImpl.java

License:Open Source License

protected ProvisioningAction updateAction(long userId, ProvisioningAction provisioningAction)
        throws PortalException, SystemException {
    // Finder/*  w w w. j  av  a 2  s  . c  om*/
    User user = userPersistence.findByPrimaryKey(userId);

    Date now = new Date();

    provisioningAction.setUserId(user.getUserId());
    provisioningAction.setUserName(user.getScreenName());
    if (provisioningAction.isNew()) {
        provisioningAction.setCreateDate(now);
    }
    provisioningAction.setModifiedDate(now);

    if (provisioningAction.getStatus() == WorkflowConstants.STATUS_ANY) {
        provisioningAction.setStatus(WorkflowConstants.STATUS_APPROVED);
    }

    return provisioningActionPersistence.update(provisioningAction, false);
}

From source file:com.crm.provisioning.service.impl.ProvisioningEntryLocalServiceImpl.java

License:Open Source License

public ProvisioningEntry addProvisioning(long userId, long branchId, String type, String code, String title,
        String connectionHost, int connectionPort, String connectByUserName, String connectByPassword,
        String processClass, String processMethod, String properties, int status, String description)
        throws PortalException, SystemException {
    // Finder//from  ww w .  j av a2  s. c  o  m
    User user = userPersistence.findByPrimaryKey(userId);
    code = code.trim().toUpperCase();

    Date now = new Date();

    validate(code, title, type, connectionHost, connectionPort, connectByUserName, connectByPassword,
            processClass, processMethod, properties);

    ProvisioningEntry provisioning = provisioningEntryPersistence.create(0);

    provisioning.setUserId(user.getUserId());
    provisioning.setUserName(user.getScreenName());
    provisioning.setCreateDate(now);
    provisioning.setModifiedDate(now);

    provisioning.setProvisioningType(type);
    provisioning.setAlias(code);
    provisioning.setTitle(title);
    provisioning.setDescription(description);

    provisioning.setConnectionHost(connectionHost);
    provisioning.setConnectionPort(connectionPort);
    provisioning.setConnectByUserName(connectByUserName);
    provisioning.setConnectByPassword(connectByPassword);

    provisioning.setProcessClass(processClass);
    provisioning.setProcessMethod(processMethod);
    provisioning.setProperties(properties);

    if (status == WorkflowConstants.STATUS_ANY) {
        status = WorkflowConstants.STATUS_APPROVED;
    }
    provisioning.setStatus(status);

    provisioningEntryPersistence.update(provisioning, false);

    return provisioning;
}