Java 类ims.emergency.vo.DiscriminatorConfigVo 实例源码

项目:AvoinApotti    文件:Logic.java   
private void populateInstanceControls(DiscriminatorConfigVo discriminatorConfig)
{
    clearInstanceControls();

    if (discriminatorConfig == null)
        return;

    form.txtName().setValue(discriminatorConfig.getDiscriminatorName());
    form.txtDescriprion().setValue(discriminatorConfig.getDiscriminatorDescription());
    form.chkActive().setValue(discriminatorConfig.getIsActive());
    form.cmbDefaultPriority().setValue(discriminatorConfig.getDefaultTriagePriority());
    form.ccTaxonomyMappings().setValue(discriminatorConfig.getTaxonomyMap());

    populateGridKeywords(discriminatorConfig.getKeywords());

}
项目:AvoinApotti    文件:Logic.java   
public int compare(DiscriminatorConfigVo ob1, DiscriminatorConfigVo ob2)
{
    String discriminatorName1 = null;
    String discriminatorName2 = null;

    if (ob1 instanceof DiscriminatorConfigVo)
    {
        DiscriminatorConfigVo ps1 = (DiscriminatorConfigVo) ob1;
        discriminatorName1 = ps1.getDiscriminatorName().toUpperCase();
    }

    if (ob2 instanceof DiscriminatorConfigVo)
    {
        DiscriminatorConfigVo ps2 = (DiscriminatorConfigVo) ob2;
        discriminatorName2 = ps2.getDiscriminatorName().toUpperCase();
    }

    if (discriminatorName1 != null)
        return discriminatorName1.compareTo(discriminatorName2) * direction;
    if (discriminatorName2 != null)
        return (-1) * direction;

    return 0;
}
项目:AvoinApotti    文件:Logic.java   
public int compare(Object ob1, Object ob2)
{
    String name1 = null;
    String name2 = null;

    if (ob1 instanceof DiscriminatorConfigVo)
    {
        DiscriminatorConfigVo ps1 = (DiscriminatorConfigVo) ob1;
        name1 = ps1 != null ? ps1.getDiscriminatorName() : null;
    }

    if (ob2 instanceof DiscriminatorConfigVo)
    {
        DiscriminatorConfigVo ps2 = (DiscriminatorConfigVo) ob2;
        name2 = ps2 != null ? ps2.getDiscriminatorName() : null;
    }

    if (name1 != null)
        return name1.compareTo(name2) * direction;

    if (name2 != null)
        return (-1) * direction;

    return 0;
}
项目:AvoinApotti    文件:DiscriminatorConfigurationImpl.java   
public DiscriminatorConfigVo getDiscriminatorConfig(DiscriminatorConfigVo discriminatorConfig)
{
    DomainFactory factory = getDomainFactory();

    if (discriminatorConfig == null || !discriminatorConfig.getID_DiscriminatorConfigIsNotNull())
    {
        throw new CodingRuntimeException("Cannot get DiscriminatorConfig on null Id ");
    }

    StringBuffer hql = new StringBuffer();

    hql.append(" select Discriminator from DiscriminatorConfig as Discriminator where Discriminator.id = :discriminatorID");

    List<?> list = factory.find(hql.toString(), new String[] { "discriminatorID" }, new Object[] { discriminatorConfig.getID_DiscriminatorConfig() });

    if (list != null && list.size() > 0)
        return DiscriminatorConfigVoAssembler.createDiscriminatorConfigVoCollectionFromDiscriminatorConfig(list).get(0);

    return null;
}
项目:openMAXIMS    文件:Logic.java   
private void populateInstanceControls(DiscriminatorConfigVo discriminatorConfig)
{
    clearInstanceControls();

    if (discriminatorConfig == null)
        return;

    form.txtName().setValue(discriminatorConfig.getDiscriminatorName());
    form.txtDescriprion().setValue(discriminatorConfig.getDiscriminatorDescription());
    form.chkActive().setValue(discriminatorConfig.getIsActive());
    form.cmbDefaultPriority().setValue(discriminatorConfig.getDefaultTriagePriority());
    form.ccTaxonomyMappings().setValue(discriminatorConfig.getTaxonomyMap());

    populateGridKeywords(discriminatorConfig.getKeywords());

}
项目:openMAXIMS    文件:Logic.java   
public int compare(DiscriminatorConfigVo ob1, DiscriminatorConfigVo ob2)
{
    String discriminatorName1 = null;
    String discriminatorName2 = null;

    if (ob1 instanceof DiscriminatorConfigVo)
    {
        DiscriminatorConfigVo ps1 = (DiscriminatorConfigVo) ob1;
        discriminatorName1 = ps1.getDiscriminatorName().toUpperCase();
    }

    if (ob2 instanceof DiscriminatorConfigVo)
    {
        DiscriminatorConfigVo ps2 = (DiscriminatorConfigVo) ob2;
        discriminatorName2 = ps2.getDiscriminatorName().toUpperCase();
    }

    if (discriminatorName1 != null)
        return discriminatorName1.compareTo(discriminatorName2) * direction;
    if (discriminatorName2 != null)
        return (-1) * direction;

    return 0;
}
项目:openMAXIMS    文件:Logic.java   
public int compare(Object ob1, Object ob2)
{
    String name1 = null;
    String name2 = null;

    if (ob1 instanceof DiscriminatorConfigVo)
    {
        DiscriminatorConfigVo ps1 = (DiscriminatorConfigVo) ob1;
        name1 = ps1 != null ? ps1.getDiscriminatorName() : null;
    }

    if (ob2 instanceof DiscriminatorConfigVo)
    {
        DiscriminatorConfigVo ps2 = (DiscriminatorConfigVo) ob2;
        name2 = ps2 != null ? ps2.getDiscriminatorName() : null;
    }

    if (name1 != null)
        return name1.compareTo(name2) * direction;

    if (name2 != null)
        return (-1) * direction;

    return 0;
}
项目:openMAXIMS    文件:DiscriminatorConfigurationImpl.java   
public DiscriminatorConfigVo getDiscriminatorConfig(DiscriminatorConfigVo discriminatorConfig)
{
    DomainFactory factory = getDomainFactory();

    if (discriminatorConfig == null || !discriminatorConfig.getID_DiscriminatorConfigIsNotNull())
    {
        throw new CodingRuntimeException("Cannot get DiscriminatorConfig on null Id ");
    }

    StringBuffer hql = new StringBuffer();

    hql.append(" select Discriminator from DiscriminatorConfig as Discriminator where Discriminator.id = :discriminatorID");

    List<?> list = factory.find(hql.toString(), new String[] { "discriminatorID" }, new Object[] { discriminatorConfig.getID_DiscriminatorConfig() });

    if (list != null && list.size() > 0)
        return DiscriminatorConfigVoAssembler.createDiscriminatorConfigVoCollectionFromDiscriminatorConfig(list).get(0);

    return null;
}
项目:openMAXIMS    文件:Logic.java   
private void populateInstanceControls(DiscriminatorConfigVo discriminatorConfig)
{
    clearInstanceControls();

    if (discriminatorConfig == null)
        return;

    form.txtName().setValue(discriminatorConfig.getDiscriminatorName());
    form.txtDescriprion().setValue(discriminatorConfig.getDiscriminatorDescription());
    form.chkActive().setValue(discriminatorConfig.getIsActive());
    form.cmbDefaultPriority().setValue(discriminatorConfig.getDefaultTriagePriority());
    form.ccTaxonomyMappings().setValue(discriminatorConfig.getTaxonomyMap());

    populateGridKeywords(discriminatorConfig.getKeywords());

}
项目:openMAXIMS    文件:Logic.java   
public int compare(DiscriminatorConfigVo ob1, DiscriminatorConfigVo ob2)
{
    String discriminatorName1 = null;
    String discriminatorName2 = null;

    if (ob1 instanceof DiscriminatorConfigVo)
    {
        DiscriminatorConfigVo ps1 = (DiscriminatorConfigVo) ob1;
        discriminatorName1 = ps1.getDiscriminatorName().toUpperCase();
    }

    if (ob2 instanceof DiscriminatorConfigVo)
    {
        DiscriminatorConfigVo ps2 = (DiscriminatorConfigVo) ob2;
        discriminatorName2 = ps2.getDiscriminatorName().toUpperCase();
    }

    if (discriminatorName1 != null)
        return discriminatorName1.compareTo(discriminatorName2) * direction;
    if (discriminatorName2 != null)
        return (-1) * direction;

    return 0;
}
项目:openMAXIMS    文件:Logic.java   
public int compare(Object ob1, Object ob2)
{
    String name1 = null;
    String name2 = null;

    if (ob1 instanceof DiscriminatorConfigVo)
    {
        DiscriminatorConfigVo ps1 = (DiscriminatorConfigVo) ob1;
        name1 = ps1 != null ? ps1.getDiscriminatorName() : null;
    }

    if (ob2 instanceof DiscriminatorConfigVo)
    {
        DiscriminatorConfigVo ps2 = (DiscriminatorConfigVo) ob2;
        name2 = ps2 != null ? ps2.getDiscriminatorName() : null;
    }

    if (name1 != null)
        return name1.compareTo(name2) * direction;

    if (name2 != null)
        return (-1) * direction;

    return 0;
}
项目:openMAXIMS    文件:DiscriminatorConfigurationImpl.java   
public DiscriminatorConfigVo getDiscriminatorConfig(DiscriminatorConfigVo discriminatorConfig)
{
    DomainFactory factory = getDomainFactory();

    if (discriminatorConfig == null || !discriminatorConfig.getID_DiscriminatorConfigIsNotNull())
    {
        throw new CodingRuntimeException("Cannot get DiscriminatorConfig on null Id ");
    }

    StringBuffer hql = new StringBuffer();

    hql.append(" select Discriminator from DiscriminatorConfig as Discriminator where Discriminator.id = :discriminatorID");

    List<?> list = factory.find(hql.toString(), new String[] { "discriminatorID" }, new Object[] { discriminatorConfig.getID_DiscriminatorConfig() });

    if (list != null && list.size() > 0)
        return DiscriminatorConfigVoAssembler.createDiscriminatorConfigVoCollectionFromDiscriminatorConfig(list).get(0);

    return null;
}
项目:openmaxims-linux    文件:Logic.java   
private void populateInstanceControls(DiscriminatorConfigVo discriminatorConfig)
{
    clearInstanceControls();

    if (discriminatorConfig == null)
        return;

    form.txtName().setValue(discriminatorConfig.getDiscriminatorName());
    form.txtDescriprion().setValue(discriminatorConfig.getDiscriminatorDescription());
    form.chkActive().setValue(discriminatorConfig.getIsActive());
    form.cmbDefaultPriority().setValue(discriminatorConfig.getDefaultTriagePriority());
    form.ccTaxonomyMappings().setValue(discriminatorConfig.getTaxonomyMap());

    populateGridKeywords(discriminatorConfig.getKeywords());

}
项目:openmaxims-linux    文件:Logic.java   
public int compare(DiscriminatorConfigVo ob1, DiscriminatorConfigVo ob2)
{
    String discriminatorName1 = null;
    String discriminatorName2 = null;

    if (ob1 instanceof DiscriminatorConfigVo)
    {
        DiscriminatorConfigVo ps1 = (DiscriminatorConfigVo) ob1;
        discriminatorName1 = ps1.getDiscriminatorName().toUpperCase();
    }

    if (ob2 instanceof DiscriminatorConfigVo)
    {
        DiscriminatorConfigVo ps2 = (DiscriminatorConfigVo) ob2;
        discriminatorName2 = ps2.getDiscriminatorName().toUpperCase();
    }

    if (discriminatorName1 != null)
        return discriminatorName1.compareTo(discriminatorName2) * direction;
    if (discriminatorName2 != null)
        return (-1) * direction;

    return 0;
}
项目:openmaxims-linux    文件:Logic.java   
public int compare(Object ob1, Object ob2)
{
    String name1 = null;
    String name2 = null;

    if (ob1 instanceof DiscriminatorConfigVo)
    {
        DiscriminatorConfigVo ps1 = (DiscriminatorConfigVo) ob1;
        name1 = ps1 != null ? ps1.getDiscriminatorName() : null;
    }

    if (ob2 instanceof DiscriminatorConfigVo)
    {
        DiscriminatorConfigVo ps2 = (DiscriminatorConfigVo) ob2;
        name2 = ps2 != null ? ps2.getDiscriminatorName() : null;
    }

    if (name1 != null)
        return name1.compareTo(name2) * direction;

    if (name2 != null)
        return (-1) * direction;

    return 0;
}
项目:openmaxims-linux    文件:DiscriminatorConfigurationImpl.java   
public DiscriminatorConfigVo getDiscriminatorConfig(DiscriminatorConfigVo discriminatorConfig)
{
    DomainFactory factory = getDomainFactory();

    if (discriminatorConfig == null || !discriminatorConfig.getID_DiscriminatorConfigIsNotNull())
    {
        throw new CodingRuntimeException("Cannot get DiscriminatorConfig on null Id ");
    }

    StringBuffer hql = new StringBuffer();

    hql.append(" select Discriminator from DiscriminatorConfig as Discriminator where Discriminator.id = :discriminatorID");

    List<?> list = factory.find(hql.toString(), new String[] { "discriminatorID" }, new Object[] { discriminatorConfig.getID_DiscriminatorConfig() });

    if (list != null && list.size() > 0)
        return DiscriminatorConfigVoAssembler.createDiscriminatorConfigVoCollectionFromDiscriminatorConfig(list).get(0);

    return null;
}
项目:AvoinApotti    文件:Logic.java   
private void getSelectedInstance()
{

    DiscriminatorConfigVo voDiscriminatorConfig = domain.getDiscriminatorConfig(form.grdDiscriminator().getSelectedRow().getValue());

    if (voDiscriminatorConfig == null)
    {
        return;
    }

    form.getLocalContext().setSelectedItem(voDiscriminatorConfig);
    clearInstanceControls();
    populateInstanceControls(voDiscriminatorConfig);
    updateControlsState();
}
项目:openMAXIMS    文件:Logic.java   
private void getSelectedInstance()
{

    DiscriminatorConfigVo voDiscriminatorConfig = domain.getDiscriminatorConfig(form.grdDiscriminator().getSelectedRow().getValue());

    if (voDiscriminatorConfig == null)
    {
        return;
    }

    form.getLocalContext().setSelectedItem(voDiscriminatorConfig);
    clearInstanceControls();
    populateInstanceControls(voDiscriminatorConfig);
    updateControlsState();
}
项目:openMAXIMS    文件:Logic.java   
private void getSelectedInstance()
{

    DiscriminatorConfigVo voDiscriminatorConfig = domain.getDiscriminatorConfig(form.grdDiscriminator().getSelectedRow().getValue());

    if (voDiscriminatorConfig == null)
    {
        return;
    }

    form.getLocalContext().setSelectedItem(voDiscriminatorConfig);
    clearInstanceControls();
    populateInstanceControls(voDiscriminatorConfig);
    updateControlsState();
}
项目:openmaxims-linux    文件:Logic.java   
private void getSelectedInstance()
{

    DiscriminatorConfigVo voDiscriminatorConfig = domain.getDiscriminatorConfig(form.grdDiscriminator().getSelectedRow().getValue());

    if (voDiscriminatorConfig == null)
    {
        return;
    }

    form.getLocalContext().setSelectedItem(voDiscriminatorConfig);
    clearInstanceControls();
    populateInstanceControls(voDiscriminatorConfig);
    updateControlsState();
}
项目:AvoinApotti    文件:Logic.java   
@Override
    protected void onBtnAddToListClick() throws PresentationLogicException
    {
        grdDiscriminatorSelectRowCollection rows = form.grdDiscriminatorSelect().getRows();
        DiscriminatorConfigVo firstPriority = null;

//      for (int i = rows.size() - 1; i >= 0; i--)
        for (int i = 0 ; i < rows.size() ; i++)
        {
            grdDiscriminatorSelectRow discriminator = rows.get(i);

            if (form.grdSelectedDiscriminators().getRows().size() >= 1)
            {
                if (form.grdSelectedDiscriminators().getRows().get(0) != null)
                {
                    firstPriority = form.grdSelectedDiscriminators().getRows().get(0).getValue();
                }
            }

            if (discriminator.getcolSelect() == true)
            {
                if (!isAlreadyAdded(discriminator))
                {
                    grdSelectedDiscriminatorsRow rowDiscriminator = form.grdSelectedDiscriminators().getRows().newRow();
                    rowDiscriminator.setcolSelectedDiscriminatorName(discriminator.getcolDiscriminatorName());
                    rowDiscriminator.setcolSelected(true);
                    rowDiscriminator.setValue(discriminator.getValue());

                    if (firstPriority != null && firstPriority.getDefaultTriagePriority() != null && !firstPriority.getDefaultTriagePriority().equals(discriminator.getValue().getDefaultTriagePriority()))
                    {
                        form.cmbDefaultPriority().setValue(null);
                    }
                    else if (form.grdSelectedDiscriminators().getRows().size() == 1)
                    {
                        form.cmbDefaultPriority().setValue(discriminator.getValue().getDefaultTriagePriority());
                    }

                    form.grdDiscriminatorSelect().getRows().remove(i);
                    i--;
                }
                else
                {
                    form.grdDiscriminatorSelect().getRows().remove(i);
                    i--;
                }
            }
        }
        updateControlsState();
    }
项目:AvoinApotti    文件:DiscriminatorConfigurationImpl.java   
public DiscriminatorConfigVo saveDiscriminatorConfig(DiscriminatorConfigVo discriminatorConfig) throws UniqueKeyViolationException, StaleObjectException, DomainInterfaceException
{
    if (discriminatorConfig == null)
        throw new CodingRuntimeException("Cannot save null DiscriminatorConfig");

    if (!discriminatorConfig.isValidated())
        throw new DomainRuntimeException("discriminatorConfigVo Not Validated.");

    DomainFactory factory = getDomainFactory();

    discriminatorConfig.setDiscriminatorName(discriminatorConfig.getDiscriminatorName().trim());

    DiscriminatorConfigVo savedDiscriminator = null;

    DiscriminatorConfig domDiscriminator = DiscriminatorConfigVoAssembler.extractDiscriminatorConfig(factory, discriminatorConfig);

    if ((discriminatorConfig.getKeywords() == null || discriminatorConfig.getKeywords().size() == 0) && domDiscriminator.getDiscriminatorName() != null)
        domDiscriminator.setKeywords(Keywords.setupKeyWords((List<?>) domDiscriminator.getKeywords(), domDiscriminator.getDiscriminatorName()));

    if (domDiscriminator.getKeywords().size() <= 0)
        throw new DomainInterfaceException("No keywords were created. Please amend Discriminator name.");

    if (discriminatorConfig.getTaxonomyMapIsNotNull())
    {
        boolean found = false;

        StringBuilder errors = new StringBuilder();

        for (int i = 0; i < discriminatorConfig.getTaxonomyMap().size(); i++)
        {
            TaxonomyMap code = discriminatorConfig.getTaxonomyMap().get(i);
            DiscriminatorConfig discriminatorRole = getDiscriminatorRoleByTaxonomy(code.getTaxonomyCode(), code.getTaxonomyName());
            if (discriminatorRole != null && !discriminatorRole.getId().equals(discriminatorConfig.getID_DiscriminatorConfig()))
            {
                found = true;

                errors.append("\nDiscriminator '" + discriminatorRole.getDiscriminatorName() + "' already has mapped :");
                errors.append(" External Code Type '" + code.getTaxonomyName() + "' and code '" + code.getTaxonomyCode() + "'");
            }
        }

        if (found)
            throw new UniqueKeyViolationException(errors.toString());
    }

    factory.save(domDiscriminator);

    savedDiscriminator = DiscriminatorConfigVoAssembler.create(domDiscriminator);

    return savedDiscriminator;
}
项目:openMAXIMS    文件:Logic.java   
@Override
    protected void onBtnAddToListClick() throws PresentationLogicException
    {
        grdDiscriminatorSelectRowCollection rows = form.grdDiscriminatorSelect().getRows();
        DiscriminatorConfigVo firstPriority = null;

//      for (int i = rows.size() - 1; i >= 0; i--)
        for (int i = 0 ; i < rows.size() ; i++)
        {
            grdDiscriminatorSelectRow discriminator = rows.get(i);

            if (form.grdSelectedDiscriminators().getRows().size() >= 1)
            {
                if (form.grdSelectedDiscriminators().getRows().get(0) != null)
                {
                    firstPriority = form.grdSelectedDiscriminators().getRows().get(0).getValue();
                }
            }

            if (discriminator.getcolSelect() == true)
            {
                if (!isAlreadyAdded(discriminator))
                {
                    grdSelectedDiscriminatorsRow rowDiscriminator = form.grdSelectedDiscriminators().getRows().newRow();
                    rowDiscriminator.setcolSelectedDiscriminatorName(discriminator.getcolDiscriminatorName());
                    rowDiscriminator.setcolSelected(true);
                    rowDiscriminator.setValue(discriminator.getValue());

                    if (firstPriority != null && firstPriority.getDefaultTriagePriority() != null && !firstPriority.getDefaultTriagePriority().equals(discriminator.getValue().getDefaultTriagePriority()))
                    {
                        form.cmbDefaultPriority().setValue(null);
                    }
                    else if (form.grdSelectedDiscriminators().getRows().size() == 1)
                    {
                        form.cmbDefaultPriority().setValue(discriminator.getValue().getDefaultTriagePriority());
                    }

                    form.grdDiscriminatorSelect().getRows().remove(i);
                    i--;
                }
                else
                {
                    form.grdDiscriminatorSelect().getRows().remove(i);
                    i--;
                }
            }
        }
        updateControlsState();
    }
项目:openMAXIMS    文件:DiscriminatorConfigurationImpl.java   
public DiscriminatorConfigVo saveDiscriminatorConfig(DiscriminatorConfigVo discriminatorConfig) throws UniqueKeyViolationException, StaleObjectException, DomainInterfaceException
{
    if (discriminatorConfig == null)
        throw new CodingRuntimeException("Cannot save null DiscriminatorConfig");

    if (!discriminatorConfig.isValidated())
        throw new DomainRuntimeException("discriminatorConfigVo Not Validated.");

    DomainFactory factory = getDomainFactory();

    discriminatorConfig.setDiscriminatorName(discriminatorConfig.getDiscriminatorName().trim());

    DiscriminatorConfigVo savedDiscriminator = null;

    DiscriminatorConfig domDiscriminator = DiscriminatorConfigVoAssembler.extractDiscriminatorConfig(factory, discriminatorConfig);

    if ((discriminatorConfig.getKeywords() == null || discriminatorConfig.getKeywords().size() == 0) && domDiscriminator.getDiscriminatorName() != null)
        domDiscriminator.setKeywords(Keywords.setupKeyWords((List<?>) domDiscriminator.getKeywords(), domDiscriminator.getDiscriminatorName()));

    if (domDiscriminator.getKeywords().size() <= 0)
        throw new DomainInterfaceException("No keywords were created. Please amend Discriminator name.");

    if (discriminatorConfig.getTaxonomyMapIsNotNull())
    {
        boolean found = false;

        StringBuilder errors = new StringBuilder();

        for (int i = 0; i < discriminatorConfig.getTaxonomyMap().size(); i++)
        {
            TaxonomyMap code = discriminatorConfig.getTaxonomyMap().get(i);
            DiscriminatorConfig discriminatorRole = getDiscriminatorRoleByTaxonomy(code.getTaxonomyCode(), code.getTaxonomyName());
            if (discriminatorRole != null && !discriminatorRole.getId().equals(discriminatorConfig.getID_DiscriminatorConfig()))
            {
                found = true;

                errors.append("\nDiscriminator '" + discriminatorRole.getDiscriminatorName() + "' already has mapped :");
                errors.append(" External Code Type '" + code.getTaxonomyName() + "' and code '" + code.getTaxonomyCode() + "'");
            }
        }

        if (found)
            throw new UniqueKeyViolationException(errors.toString());
    }

    factory.save(domDiscriminator);

    savedDiscriminator = DiscriminatorConfigVoAssembler.create(domDiscriminator);

    return savedDiscriminator;
}
项目:openMAXIMS    文件:Logic.java   
@Override
    protected void onBtnAddToListClick() throws PresentationLogicException
    {
        grdDiscriminatorSelectRowCollection rows = form.grdDiscriminatorSelect().getRows();
        DiscriminatorConfigVo firstPriority = null;

//      for (int i = rows.size() - 1; i >= 0; i--)
        for (int i = 0 ; i < rows.size() ; i++)
        {
            grdDiscriminatorSelectRow discriminator = rows.get(i);

            if (form.grdSelectedDiscriminators().getRows().size() >= 1)
            {
                if (form.grdSelectedDiscriminators().getRows().get(0) != null)
                {
                    firstPriority = form.grdSelectedDiscriminators().getRows().get(0).getValue();
                }
            }

            if (discriminator.getcolSelect() == true)
            {
                if (!isAlreadyAdded(discriminator))
                {
                    grdSelectedDiscriminatorsRow rowDiscriminator = form.grdSelectedDiscriminators().getRows().newRow();
                    rowDiscriminator.setcolSelectedDiscriminatorName(discriminator.getcolDiscriminatorName());
                    rowDiscriminator.setcolSelected(true);
                    rowDiscriminator.setValue(discriminator.getValue());

                    if (firstPriority != null && firstPriority.getDefaultTriagePriority() != null && !firstPriority.getDefaultTriagePriority().equals(discriminator.getValue().getDefaultTriagePriority()))
                    {
                        form.cmbDefaultPriority().setValue(null);
                    }
                    else if (form.grdSelectedDiscriminators().getRows().size() == 1)
                    {
                        form.cmbDefaultPriority().setValue(discriminator.getValue().getDefaultTriagePriority());
                    }

                    form.grdDiscriminatorSelect().getRows().remove(i);
                    i--;
                }
                else
                {
                    form.grdDiscriminatorSelect().getRows().remove(i);
                    i--;
                }
            }
        }
        updateControlsState();
    }
项目:openMAXIMS    文件:DiscriminatorConfigurationImpl.java   
public DiscriminatorConfigVo saveDiscriminatorConfig(DiscriminatorConfigVo discriminatorConfig) throws UniqueKeyViolationException, StaleObjectException, DomainInterfaceException
{
    if (discriminatorConfig == null)
        throw new CodingRuntimeException("Cannot save null DiscriminatorConfig");

    if (!discriminatorConfig.isValidated())
        throw new DomainRuntimeException("discriminatorConfigVo Not Validated.");

    DomainFactory factory = getDomainFactory();

    discriminatorConfig.setDiscriminatorName(discriminatorConfig.getDiscriminatorName().trim());

    DiscriminatorConfigVo savedDiscriminator = null;

    DiscriminatorConfig domDiscriminator = DiscriminatorConfigVoAssembler.extractDiscriminatorConfig(factory, discriminatorConfig);

    if ((discriminatorConfig.getKeywords() == null || discriminatorConfig.getKeywords().size() == 0) && domDiscriminator.getDiscriminatorName() != null)
        domDiscriminator.setKeywords(Keywords.setupKeyWords((List<?>) domDiscriminator.getKeywords(), domDiscriminator.getDiscriminatorName()));

    if (domDiscriminator.getKeywords().size() <= 0)
        throw new DomainInterfaceException("No keywords were created. Please amend Discriminator name.");

    if (discriminatorConfig.getTaxonomyMapIsNotNull())
    {
        boolean found = false;

        StringBuilder errors = new StringBuilder();

        for (int i = 0; i < discriminatorConfig.getTaxonomyMap().size(); i++)
        {
            TaxonomyMap code = discriminatorConfig.getTaxonomyMap().get(i);
            DiscriminatorConfig discriminatorRole = getDiscriminatorRoleByTaxonomy(code.getTaxonomyCode(), code.getTaxonomyName());
            if (discriminatorRole != null && !discriminatorRole.getId().equals(discriminatorConfig.getID_DiscriminatorConfig()))
            {
                found = true;

                errors.append("\nDiscriminator '" + discriminatorRole.getDiscriminatorName() + "' already has mapped :");
                errors.append(" External Code Type '" + code.getTaxonomyName() + "' and code '" + code.getTaxonomyCode() + "'");
            }
        }

        if (found)
            throw new UniqueKeyViolationException(errors.toString());
    }

    factory.save(domDiscriminator);

    savedDiscriminator = DiscriminatorConfigVoAssembler.create(domDiscriminator);

    return savedDiscriminator;
}
项目:openmaxims-linux    文件:Logic.java   
@Override
    protected void onBtnAddToListClick() throws PresentationLogicException
    {
        grdDiscriminatorSelectRowCollection rows = form.grdDiscriminatorSelect().getRows();
        DiscriminatorConfigVo firstPriority = null;

//      for (int i = rows.size() - 1; i >= 0; i--)
        for (int i = 0 ; i < rows.size() ; i++)
        {
            grdDiscriminatorSelectRow discriminator = rows.get(i);

            if (form.grdSelectedDiscriminators().getRows().size() >= 1)
            {
                if (form.grdSelectedDiscriminators().getRows().get(0) != null)
                {
                    firstPriority = form.grdSelectedDiscriminators().getRows().get(0).getValue();
                }
            }

            if (discriminator.getcolSelect() == true)
            {
                if (!isAlreadyAdded(discriminator))
                {
                    grdSelectedDiscriminatorsRow rowDiscriminator = form.grdSelectedDiscriminators().getRows().newRow();
                    rowDiscriminator.setcolSelectedDiscriminatorName(discriminator.getcolDiscriminatorName());
                    rowDiscriminator.setcolSelected(true);
                    rowDiscriminator.setValue(discriminator.getValue());

                    if (firstPriority != null && firstPriority.getDefaultTriagePriority() != null && !firstPriority.getDefaultTriagePriority().equals(discriminator.getValue().getDefaultTriagePriority()))
                    {
                        form.cmbDefaultPriority().setValue(null);
                    }
                    else if (form.grdSelectedDiscriminators().getRows().size() == 1)
                    {
                        form.cmbDefaultPriority().setValue(discriminator.getValue().getDefaultTriagePriority());
                    }

                    form.grdDiscriminatorSelect().getRows().remove(i);
                    i--;
                }
                else
                {
                    form.grdDiscriminatorSelect().getRows().remove(i);
                    i--;
                }
            }
        }
        updateControlsState();
    }
项目:openmaxims-linux    文件:DiscriminatorConfigurationImpl.java   
public DiscriminatorConfigVo saveDiscriminatorConfig(DiscriminatorConfigVo discriminatorConfig) throws UniqueKeyViolationException, StaleObjectException, DomainInterfaceException
{
    if (discriminatorConfig == null)
        throw new CodingRuntimeException("Cannot save null DiscriminatorConfig");

    if (!discriminatorConfig.isValidated())
        throw new DomainRuntimeException("discriminatorConfigVo Not Validated.");

    DomainFactory factory = getDomainFactory();

    discriminatorConfig.setDiscriminatorName(discriminatorConfig.getDiscriminatorName().trim());

    DiscriminatorConfigVo savedDiscriminator = null;

    DiscriminatorConfig domDiscriminator = DiscriminatorConfigVoAssembler.extractDiscriminatorConfig(factory, discriminatorConfig);

    if ((discriminatorConfig.getKeywords() == null || discriminatorConfig.getKeywords().size() == 0) && domDiscriminator.getDiscriminatorName() != null)
        domDiscriminator.setKeywords(Keywords.setupKeyWords((List<?>) domDiscriminator.getKeywords(), domDiscriminator.getDiscriminatorName()));

    if (domDiscriminator.getKeywords().size() <= 0)
        throw new DomainInterfaceException("No keywords were created. Please amend Discriminator name.");

    if (discriminatorConfig.getTaxonomyMapIsNotNull())
    {
        boolean found = false;

        StringBuilder errors = new StringBuilder();

        for (int i = 0; i < discriminatorConfig.getTaxonomyMap().size(); i++)
        {
            TaxonomyMap code = discriminatorConfig.getTaxonomyMap().get(i);
            DiscriminatorConfig discriminatorRole = getDiscriminatorRoleByTaxonomy(code.getTaxonomyCode(), code.getTaxonomyName());
            if (discriminatorRole != null && !discriminatorRole.getId().equals(discriminatorConfig.getID_DiscriminatorConfig()))
            {
                found = true;

                errors.append("\nDiscriminator '" + discriminatorRole.getDiscriminatorName() + "' already has mapped :");
                errors.append(" External Code Type '" + code.getTaxonomyName() + "' and code '" + code.getTaxonomyCode() + "'");
            }
        }

        if (found)
            throw new UniqueKeyViolationException(errors.toString());
    }

    factory.save(domDiscriminator);

    savedDiscriminator = DiscriminatorConfigVoAssembler.create(domDiscriminator);

    return savedDiscriminator;
}