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:at.meduni.liferay.portlet.bbmrieric.model.D2BiobankClp.java

License:Open Source License

@Override
public boolean isApproved() {
    if (getStatus() == WorkflowConstants.STATUS_APPROVED) {
        return true;
    } else {//ww w. ja v a  2s  .  com
        return false;
    }
}

From source file:br.com.prodevelopment.lapidarios.evento.service.impl.EventoAgendaLocalServiceImpl.java

License:Open Source License

public EventoAgenda addEventoAgenda(long companyId, long groupId, long userIdCreate, String sDataEvento,
        String sHoraEvento, int qtdeVagas, boolean gratuito, double valor, long userResponsavelId,
        long eventoId, long localId, Map<Locale, String> observacaoMap, long classNameId,
        ServiceContext serviceContext) throws SystemException, PortalException {

    Locale locale = LocaleUtil.getSiteDefault();

    Date now = new Date();

    validate(0, eventoId, localId, sDataEvento, sHoraEvento, DateUtil.dateToString(now), userIdCreate,
            qtdeVagas, 1);/*from   w  w  w  . j  ava2s  .co m*/

    User userCreate = userPersistence.findByPrimaryKey(userIdCreate);

    // Recuperar responsvel
    String userResponsavelNome = StringPool.BLANK;
    if (userResponsavelId > 0) {
        User userResponsavel = userPersistence.findByPrimaryKey(userResponsavelId);
        userResponsavelNome = userResponsavel.getFullName();
    }

    // Recuperar evento
    String eventoNome = StringPool.BLANK;
    if (eventoId > 0) {
        Evento evento = eventoPersistence.findByPrimaryKey(eventoId);
        eventoNome = evento.getNome(locale);
    }

    // Recuperar local
    String localNome = StringPool.BLANK;
    if (localId > 0) {
        Local local = localPersistence.findByPrimaryKey(localId);
        localNome = local.getNome();
    }

    // Criar objeto incrementando um novo ID
    long eventoAgendaId = counterLocalService.increment();
    EventoAgenda eventoAgenda = eventoAgendaPersistence.create(eventoAgendaId);

    // Atribui novos valores
    eventoAgenda.setCompanyId(companyId);
    eventoAgenda.setGroupId(groupId);
    eventoAgenda.setCreateUserId(userIdCreate);
    eventoAgenda.setCreateDate(now);
    try {
        Date dataEvento = DateUtil.stringToDate("dd/MM/yyyy", sDataEvento);
        eventoAgenda.setDataEvento(dataEvento);
    } catch (ParseException e) {
        _log.error(e, e);
    }
    eventoAgenda.setHoraEvento(sHoraEvento);
    eventoAgenda.setQtdeVagas(qtdeVagas);
    eventoAgenda.setQtdeVagasPreenchida(0);
    eventoAgenda.setValor(valor);
    eventoAgenda.setUserResponsavelId(userResponsavelId);
    eventoAgenda.setUserResponsavelNome(userResponsavelNome);
    eventoAgenda.setEventoId(eventoId);
    eventoAgenda.setEventoNome(eventoNome);
    eventoAgenda.setLocalId(localId);
    eventoAgenda.setLocalNome(localNome);
    eventoAgenda.setClassNameId(classNameId);
    String className = PortalUtil.getClassName(classNameId);
    eventoAgenda.setClassName(className);
    eventoAgenda.setStatusDate(serviceContext.getModifiedDate(now));
    eventoAgenda.setStatusByUserId(userCreate.getUserId());
    eventoAgenda.setStatusByUserName(userCreate.getFullName());
    if (WorkflowDefinitionLinkLocalServiceUtil.hasWorkflowDefinitionLink(companyId, groupId,
            EventoAgenda.class.getName())) {
        eventoAgenda.setStatus(WorkflowConstants.STATUS_PENDING);
    } else {
        eventoAgenda.setStatus(WorkflowConstants.STATUS_APPROVED);
    }
    eventoAgenda.setObservacaoMap(observacaoMap);
    eventoAgenda.setVersao(Constantes.VERSAO_INICIAL);
    eventoAgenda.setGratuito(gratuito);

    eventoAgendaPersistence.update(eventoAgenda);

    // Workflow
    WorkflowHandlerRegistryUtil.startWorkflowInstance(companyId, groupId, userCreate.getUserId(),
            EventoAgenda.class.getName(), eventoAgendaId, eventoAgenda, serviceContext);

    return eventoAgenda;
}

From source file:br.com.prodevelopment.lapidarios.evento.service.impl.EventoAgendaLocalServiceImpl.java

License:Open Source License

public EventoAgenda updateEventoAgenda(long eventoAgendaId, long companyId, long groupId, long modifiedUserId,
        String sDataEvento, String sHoraEvento, int qtdeVagas, boolean gratuito, double valor,
        long userResponsavelId, long eventoId, long localId, Map<Locale, String> observacaoMap,
        long classNameId, ServiceContext serviceContext) throws PortalException, SystemException {

    Locale locale = LocaleUtil.getSiteDefault();

    Date now = new Date();

    // Recuperar evento agenda
    EventoAgenda eventoAgenda = eventoAgendaPersistence.fetchByPrimaryKey(eventoAgendaId);
    double versao = eventoAgenda.getVersao() + 1;

    validate(eventoAgendaId, eventoId, localId, sDataEvento, sHoraEvento, DateUtil.dateToString(now),
            modifiedUserId, qtdeVagas, versao);

    User userModified = userPersistence.findByPrimaryKey(modifiedUserId);

    // Recuperar responsvel
    String userResponsavelNome = StringPool.BLANK;
    if (userResponsavelId > 0) {
        User userResponsavel = userPersistence.findByPrimaryKey(userResponsavelId);
        userResponsavelNome = userResponsavel.getFullName();
    }//from w  w w.  jav a2  s .  com

    // Recuperar evento
    String eventoNome = StringPool.BLANK;
    if (eventoId > 0) {
        Evento evento = eventoPersistence.findByPrimaryKey(eventoId);
        eventoNome = evento.getNome(locale);
    }

    // Recuperar local
    String localNome = StringPool.BLANK;
    if (localId > 0) {
        Local local = localPersistence.findByPrimaryKey(localId);
        localNome = local.getNome();
    }

    // Atribui novos valores
    eventoAgenda.setCompanyId(companyId);
    eventoAgenda.setGroupId(groupId);
    eventoAgenda.setModifiedUserId(modifiedUserId);
    eventoAgenda.setModifiedDate(now);
    try {
        Date dataEvento = DateUtil.stringToDate("dd/MM/yyyy", sDataEvento);
        eventoAgenda.setDataEvento(dataEvento);
    } catch (ParseException e) {
        _log.error(e, e);
    }
    eventoAgenda.setHoraEvento(sHoraEvento);
    eventoAgenda.setQtdeVagas(qtdeVagas);
    eventoAgenda.setQtdeVagasPreenchida(0);
    eventoAgenda.setValor(valor);
    eventoAgenda.setUserResponsavelId(userResponsavelId);
    eventoAgenda.setUserResponsavelNome(userResponsavelNome);
    eventoAgenda.setEventoId(eventoId);
    eventoAgenda.setEventoNome(eventoNome);
    eventoAgenda.setLocalId(localId);
    eventoAgenda.setLocalNome(localNome);
    eventoAgenda.setClassNameId(classNameId);
    String className = PortalUtil.getClassName(classNameId);
    eventoAgenda.setClassName(className);
    eventoAgenda.setStatusDate(serviceContext.getModifiedDate(now));
    eventoAgenda.setStatusByUserId(userModified.getUserId());
    eventoAgenda.setStatusByUserName(userModified.getFullName());
    if (WorkflowDefinitionLinkLocalServiceUtil.hasWorkflowDefinitionLink(companyId, groupId,
            EventoAgenda.class.getName())) {
        eventoAgenda.setStatus(WorkflowConstants.STATUS_PENDING);
    } else {
        eventoAgenda.setStatus(WorkflowConstants.STATUS_APPROVED);
    }
    eventoAgenda.setObservacaoMap(observacaoMap);
    eventoAgenda.setVersao(versao);
    eventoAgenda.setGratuito(gratuito);

    eventoAgendaPersistence.update(eventoAgenda);

    return eventoAgenda;
}

From source file:br.com.prodevelopment.lapidarios.evento.service.impl.EventoAgendaLocalServiceImpl.java

License:Open Source License

public EventoAgenda updateStatus(long userId, EventoAgenda eventoAgenda, int status,
        ServiceContext serviceContext) throws PortalException, SystemException {

    // Type Task/*from   ww  w .  j av  a 2 s  .co m*/

    User user = userPersistence.findByPrimaryKey(userId);
    Date now = new Date();

    int oldStatus = eventoAgenda.getStatus();

    eventoAgenda.setModifiedUserId(userId);
    eventoAgenda.setModifiedDate(serviceContext.getModifiedDate(now));
    eventoAgenda.setStatus(status);
    eventoAgenda.setStatusByUserId(user.getUserId());
    eventoAgenda.setStatusByUserName(user.getFullName());
    eventoAgenda.setStatusDate(serviceContext.getModifiedDate(now));

    eventoAgendaPersistence.update(eventoAgenda);

    // Trash

    if (oldStatus == WorkflowConstants.STATUS_IN_TRASH) {
        trashEntryLocalService.deleteEntry(EventoAgenda.class.getName(), eventoAgenda.getEventoAgendaId());

        // Workflow
        WorkflowHandlerRegistryUtil.startWorkflowInstance(eventoAgenda.getCompanyId(),
                eventoAgenda.getGroupId(), userId, EventoAgenda.class.getName(),
                eventoAgenda.getEventoAgendaId(), eventoAgenda, serviceContext);
    }

    if (status == WorkflowConstants.STATUS_IN_TRASH) {
        int novoStatus = WorkflowConstants.STATUS_APPROVED;
        if (WorkflowDefinitionLinkLocalServiceUtil.hasWorkflowDefinitionLink(eventoAgenda.getCompanyId(),
                eventoAgenda.getGroupId(), EventoAgenda.class.getName())) {
            novoStatus = WorkflowConstants.STATUS_PENDING;
        }

        trashEntryLocalService.addTrashEntry(userId, eventoAgenda.getGroupId(), EventoAgenda.class.getName(),
                eventoAgenda.getEventoAgendaId(), eventoAgenda.getUuid(), null, novoStatus, null, null);
    }

    return eventoAgenda;
}

From source file:br.com.prodevelopment.lapidarios.loja.service.impl.LojaLocalServiceImpl.java

License:Open Source License

public Loja addLoja(long companyId, long groupId, long userIdCreate, String razaoSocial, String nomeFantasia,
        Map<Locale, String> observacaoMap, String cnpj, String endLogradouro, String endNumero,
        String endComplemento, String endCep, String endBairro, String endCidade, String endUf, String endPais,
        double versao, List<EnderecoEmail> enderecosEmail, List<Telefone> telefones, long classNameId,
        ServiceContext serviceContext) throws SystemException, PortalException {

    validate(0, razaoSocial, nomeFantasia, cnpj, userIdCreate, versao);

    User userCreate = userPersistence.findByPrimaryKey(userIdCreate);

    // Criar objeto incrementando um novo ID
    long lojaId = counterLocalService.increment();
    Loja loja = lojaPersistence.create(lojaId);

    Date now = new Date();

    // Atribui novos valores
    loja.setCompanyId(companyId);/*from w  ww  . j ava 2s  .c o  m*/
    loja.setGroupId(groupId);
    loja.setCreateUserId(userIdCreate);
    loja.setCreateDate(now);
    loja.setRazaoSocial(razaoSocial);
    loja.setNomeFantasia(nomeFantasia);
    loja.setObservacaoMap(observacaoMap);
    loja.setCnpj(cnpj);
    loja.setEndLogradouro(endLogradouro);
    loja.setEndNumero(endNumero);
    loja.setEndComplemento(endComplemento);
    loja.setEndCep(endCep);
    loja.setEndBairro(endBairro);
    loja.setEndCidade(endCidade);
    loja.setEndUf(endUf);
    loja.setEndPais(endPais);
    loja.setClassNameId(classNameId);
    String className = PortalUtil.getClassName(classNameId);
    loja.setClassName(className);
    loja.setStatusDate(serviceContext.getModifiedDate(now));
    loja.setStatusByUserId(userCreate.getUserId());
    loja.setStatusByUserName(userCreate.getFullName());
    if (WorkflowDefinitionLinkLocalServiceUtil.hasWorkflowDefinitionLink(companyId, groupId,
            Loja.class.getName())) {
        loja.setStatus(WorkflowConstants.STATUS_PENDING);
    } else {
        loja.setStatus(WorkflowConstants.STATUS_APPROVED);
    }
    loja.setVersao(versao);

    lojaPersistence.update(loja);

    // Contato
    Contato contato = ContatoLocalServiceUtil.addContato(companyId, groupId, userIdCreate, Loja.class.getName(),
            loja.getLojaId(), nomeFantasia, null, null, null, 0, null, null, null);

    // Telefones
    TelefoneLocalServiceUtil.updateTelefones(companyId, groupId, userIdCreate, Contato.class.getName(),
            contato.getContatoId(), telefones);

    // Enderecos de email
    EnderecoEmailLocalServiceUtil.updateEnderecosEmail(companyId, groupId, userIdCreate,
            Contato.class.getName(), contato.getContatoId(), enderecosEmail);

    // Asset
    updateAsset(loja.getCreateUserId(), loja, serviceContext.getAssetCategoryIds(),
            serviceContext.getAssetTagNames(), serviceContext.getAssetLinkEntryIds());

    // Social
    socialActivityLocalService.addActivity(userIdCreate, loja.getGroupId(), Loja.class.getName(), lojaId,
            CadastroLojaActivityKeys.ADD_LOJA, getExtraDataJSON(loja), 0);

    // Workflow
    WorkflowHandlerRegistryUtil.startWorkflowInstance(companyId, groupId, userCreate.getUserId(),
            Loja.class.getName(), lojaId, loja, serviceContext);
    Loja lojaAtiva = lojaPersistence.fetchByCG_OrdemIndicadaAtual(companyId, groupId, true,
            WorkflowConstants.STATUS_APPROVED);
    if (Validator.isNull(lojaAtiva)) {
        loja.setOrdemIndicadaAtual(true);
        lojaPersistence.update(loja);
    }

    return loja;
}

From source file:br.com.prodevelopment.lapidarios.loja.service.impl.LojaLocalServiceImpl.java

License:Open Source License

public Loja updateStatus(long userId, Loja loja, int status, ServiceContext serviceContext)
        throws PortalException, SystemException {

    // Type Task/*w w w  .jav a2s .  co m*/

    User user = userPersistence.findByPrimaryKey(userId);
    Date now = new Date();

    int oldStatus = loja.getStatus();

    loja.setModifiedUserId(user.getUserId());
    loja.setModifiedDate(serviceContext.getModifiedDate(now));
    loja.setStatus(status);
    loja.setStatusByUserId(user.getUserId());
    loja.setStatusByUserName(user.getFullName());
    loja.setStatusDate(serviceContext.getModifiedDate(now));

    lojaPersistence.update(loja);

    // Trash

    if (oldStatus == WorkflowConstants.STATUS_IN_TRASH) {
        trashEntryLocalService.deleteEntry(Loja.class.getName(), loja.getLojaId());

        // Workflow
        WorkflowHandlerRegistryUtil.startWorkflowInstance(loja.getCompanyId(), loja.getGroupId(), userId,
                Loja.class.getName(), loja.getLojaId(), loja, serviceContext);
    }

    if (status == WorkflowConstants.STATUS_IN_TRASH) {
        int novoStatus = WorkflowConstants.STATUS_APPROVED;
        if (WorkflowDefinitionLinkLocalServiceUtil.hasWorkflowDefinitionLink(loja.getCompanyId(),
                loja.getGroupId(), Loja.class.getName())) {
            novoStatus = WorkflowConstants.STATUS_PENDING;
        }

        trashEntryLocalService.addTrashEntry(userId, loja.getGroupId(), Loja.class.getName(), loja.getLojaId(),
                loja.getUuid(), null, novoStatus, null, null);
    }

    return loja;
}

From source file:ca.efendi.datafeeds.web.internal.portlet.DatafeedsPortlet.java

License:Apache License

protected int getStatus(final RenderRequest renderRequest) throws Exception {
    final ThemeDisplay themeDisplay = (ThemeDisplay) renderRequest.getAttribute(WebKeys.THEME_DISPLAY);
    if (!themeDisplay.isSignedIn()) {
        return WorkflowConstants.STATUS_APPROVED;
    }//from w ww. j  ava 2s . com
    final String value = renderRequest.getParameter("status");
    final int status = GetterUtil.getInteger(value);
    if ((value != null) && (status == WorkflowConstants.STATUS_APPROVED)) {
        return WorkflowConstants.STATUS_APPROVED;
    }
    final long resourcePrimKey = ParamUtil.getLong(renderRequest, "resourcePrimKey");
    if (resourcePrimKey == 0) {
        return WorkflowConstants.STATUS_APPROVED;
    }
    //final PermissionChecker permissionChecker = themeDisplay.getPermissionChecker();
    /**
     * if (KBArticlePermission.contains( permissionChecker, resourcePrimKey,
     * ActionKeys.UPDATE)) {
     *
     * return ParamUtil.getInteger( renderRequest, "status",
     * WorkflowConstants.STATUS_ANY); }
     */
    return WorkflowConstants.STATUS_APPROVED;
}

From source file:ch.inofix.referencemanager.model.impl.BibliographyImpl.java

License:Open Source License

public boolean isApproved() {
    if (getStatus() == WorkflowConstants.STATUS_APPROVED) {
        return true;
    } else {//from   w w w .  j  a  va2 s .com
        return false;
    }
}

From source file:com.bemis.portal.report.model.impl.ReportRequestImpl.java

License:Open Source License

@Override
public List<FileEntry> getAttachmentsFileEntries(int start, int end) throws PortalException {

    List<FileEntry> fileEntries = new ArrayList<>();

    long attachmentsFolderId = getAttachmentsFolderId();

    if (attachmentsFolderId != DLFolderConstants.DEFAULT_PARENT_FOLDER_ID) {
        fileEntries = PortletFileRepositoryUtil.getPortletFileEntries(getGroupId(), attachmentsFolderId,
                WorkflowConstants.STATUS_APPROVED, start, end, null);
    }//from  w  w  w  .  ja v  a 2s  . com

    return fileEntries;
}

From source file:com.bemis.portal.report.model.impl.ReportRequestImpl.java

License:Open Source License

@Override
public int getAttachmentsFileEntriesCount() throws PortalException {
    int attachmentsFileEntriesCount = 0;

    long attachmentsFolderId = getAttachmentsFolderId();

    if (attachmentsFolderId != DLFolderConstants.DEFAULT_PARENT_FOLDER_ID) {
        attachmentsFileEntriesCount = PortletFileRepositoryUtil.getPortletFileEntriesCount(getGroupId(),
                attachmentsFolderId, WorkflowConstants.STATUS_APPROVED);
    }//from ww  w  . ja va2 s.  co m

    return attachmentsFileEntriesCount;
}