Package fr.norsys.mapper.console.model

Examples of fr.norsys.mapper.console.model.IdentifiantComponent


   * Service to add an identifiant component in the list in session
   * @param identifiant : identifiant component
   * @param identifiants : list of identifiant components
   */
  private void add(IdentifiantComponent identifiant, List identifiants)throws IdentifiantException {
    IdentifiantComponent ic = null;
    try {
      ic = (IdentifiantComponent) BeanUtils.cloneBean(identifiant);
    } catch (Exception e) {
      throw new IdentifiantException(e.toString());
    }
    ic.setId(UIDGenerator.generateId());
    getVariable(ic);
    identifiants.add(ic);
  }
View Full Code Here


   * Service to modify an identifiant component in the list in session
   * @param identifiant : identifiant component
   * @param identifiants : list of identifiant components
   */
  private void modify(IdentifiantComponent ident, List identifiants) {
    IdentifiantComponent identifiant = ident;
    for (Iterator it = identifiants.iterator(); it.hasNext();) {
      IdentifiantComponent ic = (IdentifiantComponent) it.next();
      if (identifiant.getId().equals(ic.getId())) {
        fr.norsys.mapper.console.utils.BeanUtils.copyFilledProperties(
            ic, identifiant);
        getVariable(ic);
        identifiant=ic;
        break;
View Full Code Here

  /**
   * Change the id value with ${] if it is a variable
   * @param idComp
   */
  private void getVariable(IdentifiantComponent idComp) {
    IdentifiantComponent ic = idComp;
    String value = null;
    if(ic.isIdVariable()){
      value = ic.getValue();
      value = "${"+value+"}";
      ic.setValue(value);
    }
   
  }
View Full Code Here

   * @param identifiant : identifiant component
   * @param identifiants : list of identifiant components
   */
  public void delete(String id, List identifiants) {
    for (Iterator it = identifiants.iterator(); it.hasNext();) {
      IdentifiantComponent v = (IdentifiantComponent) it.next();
      if (v.getId().equals(id)) {
        identifiants.remove(v);
        break;
      }
    }
  }
View Full Code Here

   * @param id : id of the identifiant component
   * @param identifiants : list of identifiant components
   * @return
   */
  public IdentifiantComponent get(String id, List identifiants) {
    IdentifiantComponent result = null;
    String value = null;
    for (Iterator it = identifiants.iterator(); it.hasNext();) {
      IdentifiantComponent c = (IdentifiantComponent) it.next();
      if (c.getId().equals(id)) {
        result = c;
        value= result.getValue();
        boolean isVar = result.isIdVariable();
        if(isVar){
          int idx = -1;
View Full Code Here

    String id;
    int idx;
    String name;
    String value;
    boolean isIdVariable;
    IdentifiantComponent identifiant = null;
    StringTokenizer st = new StringTokenizer(currentId, ",");
    while(st.hasMoreTokens()){
      isIdVariable = false;
      id=st.nextToken();
      idx = id.indexOf("=");
      if(idx>0){
        name=id.substring(0,idx);
        value=id.substring(idx+1);
        idx=value.indexOf("{");
        if(idx>-1) {
          isIdVariable = true;
        }
        identifiant = new IdentifiantComponent(name, value, isIdVariable);
        ids.add(identifiant);
      }
    }
   
    return ids;
View Full Code Here

   * @return
   */
  public String getCompleteId(List identifiants) {
    StringBuffer completeId = new StringBuffer();
    for(Iterator i=identifiants.iterator();i.hasNext();){
      IdentifiantComponent idComp = (IdentifiantComponent)i.next();
      String name = idComp.getName();
      String value = idComp.getValue();
      completeId.append(name).append("=");
      completeId.append(value);
      if(i.hasNext()){
        completeId.append(",");
      }
View Full Code Here

      log.debug("edit method called");
    }
    String id = request.getParameter("id");
    DynaActionForm identifiantForm = (DynaActionForm) form;
    if (id != null && !"".equals(id)) {
      IdentifiantComponent identifiant = identifiantService.get(id,
          (List) request.getSession().getAttribute(
              ConsoleCst.IDS_SESSION_BEAN));
      identifiantForm.set(ConsoleCst.ID_COMP_REQUEST_BEAN, identifiant);
    }
    return mapping.findForward("popup");
View Full Code Here

    resource.setIdentifiant(currentId);
    List ids=identifiantService.list(currentId);
   
    assertTrue("ids list must be not empty",ids.size()>0);
   
    IdentifiantComponent id1 = (IdentifiantComponent)ids.get(0);
    IdentifiantComponent id2 = (IdentifiantComponent)ids.get(1);
   
    assertEquals("name must be cn","cn",id1.getName());
    assertEquals("value must be id","id",id1.getValue());
    assertTrue("is identifiant a variable must be true",id1.isIdVariable());
    assertEquals("name must be givenName","givenName",id2.getName());
    assertEquals("value must be firstName","firstName",id2.getValue());
    assertFalse("is identifiant a variable must be false",id2.isIdVariable());
  }
View Full Code Here

  public void test02getCompleteId() {
    if(log.isDebugEnabled()) log.debug("*** test02getCompleteId ***");

    List ics=new ArrayList();

    IdentifiantComponent ic1 = new IdentifiantComponent("cn","id",true);
    IdentifiantComponent ic2 = new IdentifiantComponent("givenName","firstName",false);
   
    ics.add(ic1);
    ics.add(ic2);
     
    String currentId = identifiantService.getCompleteId(ics);
View Full Code Here

TOP

Related Classes of fr.norsys.mapper.console.model.IdentifiantComponent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.