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

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

Introduction

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

Prototype

int STATUS_APPROVED

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

Click Source Link

Usage

From source file:com.cd.learning.hook.MBUtil.java

License:Open Source License

public static void updateCategoryStatistics(long companyId, final long categoryId) {

    Callable<Void> callable = new ShardCallable<Void>(companyId) {

        @Override/*from   w  ww  . j  a  v  a 2 s .  c  o  m*/
        protected Void doCall() throws Exception {
            MBCategory category = MBCategoryLocalServiceUtil.fetchMBCategory(categoryId);

            if (category == null) {
                return null;
            }

            int messageCount = _getMessageCount(category);

            int threadCount = MBThreadLocalServiceUtil.getCategoryThreadsCount(category.getGroupId(),
                    category.getCategoryId(), WorkflowConstants.STATUS_APPROVED);

            category.setMessageCount(messageCount);
            category.setThreadCount(threadCount);

            MBCategoryLocalServiceUtil.updateMBCategory(category);

            return null;
        }

    };

    TransactionCommitCallbackRegistryUtil.registerCallback(callable);
}

From source file:com.cd.learning.hook.MBUtil.java

License:Open Source License

public static void updateCategoryThreadCount(long companyId, final long categoryId) {

    Callable<Void> callable = new ShardCallable<Void>(companyId) {

        @Override/*w w w.j  ava2  s.  com*/
        protected Void doCall() throws Exception {
            MBCategory category = MBCategoryLocalServiceUtil.fetchMBCategory(categoryId);

            if (category == null) {
                return null;
            }

            int threadCount = MBThreadLocalServiceUtil.getCategoryThreadsCount(category.getGroupId(),
                    category.getCategoryId(), WorkflowConstants.STATUS_APPROVED);

            category.setThreadCount(threadCount);

            MBCategoryLocalServiceUtil.updateMBCategory(category);

            return null;
        }

    };

    TransactionCommitCallbackRegistryUtil.registerCallback(callable);
}

From source file:com.cd.learning.hook.MBUtil.java

License:Open Source License

public static void updateThreadMessageCount(long companyId, final long threadId) {

    Callable<Void> callable = new ShardCallable<Void>(companyId) {

        @Override/*from   w w w.  j a  va  2s .  co m*/
        protected Void doCall() throws Exception {
            MBThread thread = MBThreadLocalServiceUtil.fetchThread(threadId);

            if (thread == null) {
                return null;
            }

            int messageCount = MBMessageLocalServiceUtil.getThreadMessagesCount(threadId,
                    WorkflowConstants.STATUS_APPROVED);

            thread.setMessageCount(messageCount);

            MBThreadLocalServiceUtil.updateMBThread(thread);

            return null;
        }

    };

    TransactionCommitCallbackRegistryUtil.registerCallback(callable);
}

From source file:com.cd.learning.hook.MBUtil.java

License:Open Source License

private static int _getMessageCount(MBCategory category) throws SystemException {

    return MBMessageLocalServiceUtil.getCategoryMessagesCount(category.getGroupId(), category.getCategoryId(),
            WorkflowConstants.STATUS_APPROVED);
}

From source file:com.crm.alarm.service.impl.AlarmEntryLocalServiceImpl.java

License:Open Source License

public AlarmEntry updateAlarm(long userId, long alarmId, String code, String title, boolean autoTicket,
        long categoryId, int waitDuration, String processClass, String processMethod, String properties,
        String description, String solution, int status) throws PortalException, SystemException {
    validate(code, title, categoryId, solution, autoTicket, processClass, processMethod, properties);

    AlarmEntry alarm = getAlarm(alarmId);

    alarm.setAlias(code.toUpperCase());/*from  w w w. j a va2s  .c om*/
    alarm.setTitle(title);
    alarm.setDescription(description);
    alarm.setSolution(solution);

    alarm.setCategoryId(categoryId);
    alarm.setAutoTicket(autoTicket);

    alarm.setWaitDuration(waitDuration);
    alarm.setProcessClass(processClass);
    alarm.setProcessMethod(processMethod);
    alarm.setProperties(properties);

    alarm.setStatus(WorkflowConstants.STATUS_APPROVED);

    return updateAlarm(userId, alarm);
}

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());/*  w  w  w .j  av  a2 s.c o 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.provisioning.service.impl.CommandEntryLocalServiceImpl.java

License:Open Source License

public CommandEntry addCommand(long userId, String code, String title, String provisioningType,
        boolean retryEnable, int maxRetry, boolean logEnable, int priority, int timeout, String properties,
        String description) throws PortalException, SystemException {
    // Finder//from w  w  w  .ja  v  a 2s  .  com
    User user = userPersistence.findByPrimaryKey(userId);
    code = code.trim().toUpperCase();

    Date now = new Date();

    validate(code, title, provisioningType, description);

    CommandEntry command = commandEntryPersistence.create(0);

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

    command.setAlias(code);
    command.setTitle(title);
    command.setProvisioningType(provisioningType);
    command.setDescription(description);

    command.setRetryEnable(retryEnable);
    command.setMaxRetry(maxRetry);
    command.setPriority(priority);
    command.setTimeout(timeout);
    command.setProperties(properties);

    command.setStatus(WorkflowConstants.STATUS_APPROVED);

    commandEntryPersistence.update(command, false);

    return command;
}

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

License:Open Source License

public CommandEntry updateCommand(long userId, long commandId, String code, String title,
        String provisioningType, boolean retryEnable, int maxRetry, boolean logEnable, int priority,
        int timeout, String properties, String description) throws PortalException, SystemException {
    // Finder/*from   www  .j a v a 2  s  .c  o m*/
    User user = userPersistence.findByPrimaryKey(userId);
    code = code.trim().toUpperCase();

    Date now = new Date();

    validate(code, title, provisioningType, description);

    CommandEntry command = getCommand(commandId);

    command.setUserId(user.getUserId());
    command.setUserName(user.getScreenName());
    command.setModifiedDate(now);

    command.setAlias(code);
    command.setTitle(title);
    command.setProvisioningType(provisioningType);
    command.setDescription(description);

    command.setRetryEnable(retryEnable);
    command.setMaxRetry(maxRetry);
    command.setPriority(priority);
    command.setTimeout(timeout);
    command.setProperties(properties);

    command.setStatus(WorkflowConstants.STATUS_APPROVED);

    commandEntryPersistence.update(command, false);

    return command;
}

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 .ja  v  a2s  .  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/*w ww  .j a va 2 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;
}