Package fr.norsys.mapper.console.model

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


   * @param application (Application) : application of the current resource
   * @return (Resource)
   */
  public Resource get(String currentResourceId, Application application) {
   
    Resource resource=null;
    Collection resources = application.getResources();
    for(Iterator it=resources.iterator();it.hasNext();){
     
      Resource r = (Resource)it.next();
      if(r.getId().equals(currentResourceId)){
        resource=r;
      }
    }
   
    return resource;
View Full Code Here


   *            bean of the resource
   * @param application :
   *            bean of the application
   */
  private void add(Resource resource, Application application) {
    Resource r = null;
    try {
      r = (Resource) BeanUtils.cloneBean(resource);
    } catch (Exception e) {
    }
    r.setId(UIDGenerator.generateId());
    application.getResources().add(r);
    ExecutionContext.get().getSession().setAttribute(ConsoleCst.CURRENT_RESOURCE,r);
  }
View Full Code Here

   *            bean of the resource
   * @param application :
   *            bean of the application
   */
  private void modify(Resource res, Application currentAppli) {
    Resource currentResource = res;
    Resource r= get(currentResource.getId(),currentAppli);
    Collection attributes = r.getAttributes();
    fr.norsys.mapper.console.utils.BeanUtils.copyFilledProperties(r, currentResource);
    currentResource = r;
    currentResource.setAttributes(attributes);
    ExecutionContext.get().getSession().setAttribute(ConsoleCst.CURRENT_RESOURCE,currentResource);
  }
View Full Code Here

public class TreeSetTest extends TestCase {
  private final static Log log = LogFactory.getLog(TreeSetTest.class);
  protected void setUp() throws Exception {
  }
  public void testBase() throws Exception {
    Resource r1 = new Resource("res1");
    Resource r2 = new Resource("res2");
    Resource r3 = new Resource("res3");
    Set resources = new TreeSet(new ResourceNameComparator());
    resources.add(r3);
    resources.add(r1);
    resources.add(r2);
    assertEquals("res1",((Resource)((TreeSet) resources).first()).getName());
View Full Code Here

import fr.norsys.mapper.console.model.Resource;

public class ResourceNameComparator implements Comparator {
public int compare(Object o1, Object o2) {
  if(o1 != null && o2 != null && o1 instanceof Resource && o2 instanceof Resource) {
    Resource r1 = (Resource) o1;
    Resource r2 = (Resource) o2;
    if(r1.getName()!=null && r2.getName()!=null)
      return r1.getName().compareTo(r2.getName());
  }
  return 0;
}
View Full Code Here

      HttpServletRequest request, HttpServletResponse response)
      throws Exception {
    if (log.isDebugEnabled()) {
      log.debug("edit method called");
    }
    Resource currentResource = (Resource) request.getSession()
        .getAttribute(ConsoleCst.CURRENT_RESOURCE);
    String currentAttrId = (String) request
        .getParameter(ConsoleCst.CURRENT_ATTRIBUTE_ID);

    DynaActionForm attributeForm = (DynaActionForm) form;
    Attribute currentAttribute = new Attribute();
    if (currentAttrId != null && !"".equals(currentAttrId)) {

      currentAttribute = attributeService.get(currentAttrId,
          currentResource);
      if (log.isDebugEnabled()) {
        log.debug(currentAttribute);
      }
    }
    attributeForm.set(ConsoleCst.ATTRIBUTE_REQUEST_BEAN, currentAttribute);
    request.setAttribute(ConsoleCst.ATTRIBUTES_SESSION_BEAN,currentResource.getAttributes());
    request.getSession().setAttribute(ConsoleCst.CURRENT_ATTRIBUTE,
        currentAttribute);

    return mapping.findForward(ConsoleCst.ATTRIBUTE_PAGE_FORWARD);
  }
View Full Code Here

  public void test01List() {
    if(log.isDebugEnabled()) log.debug("*** test01List ***");
   
    Identifiant id = new Identifiant("cn=${id},givenName=firstName");
    String currentId =id.getValue();
    Resource resource = new Resource("test");
    resource.setIdentifiant(currentId);
    List ids=identifiantService.list(currentId);
   
    assertTrue("ids list must be not empty",ids.size()>0);
   
    IdentifiantComponent id1 = (IdentifiantComponent)ids.get(0);
View Full Code Here

      Search s = (Search) it.next();
      if(LOG.isDebugEnabled()) {
        LOG.debug("Search mapper mapped: " + s.getName());
      }
      regexps.addAll(s.getRegexps());
      Resource r = new Resource(s.getName(), s.getRoot(), null,
          ConsoleCst.SEARCH_MAPPER_TYPE, s.getFilter(), s
              .getSearchScope());
      Vector inputAttr = new Vector();
      Vector outputAttr = new Vector();
      for (Iterator it2 = maps.iterator(); it2.hasNext();) {
View Full Code Here

      Add a = (Add) it.next();
      if(LOG.isDebugEnabled()) {
        LOG.debug("Add mapper mapped: " + a.getName());
      }
      regexps.addAll(a.getRegexps());
      Resource r = new Resource(a.getName(), getBaseDn(a.getRoot()), getIdentifiant(a.getRoot()),
          ConsoleCst.ADD_MAPPER_TYPE, null, null);
      Vector inputAttr = new Vector();
      Vector outputAttr = new Vector();
      for (Iterator it2 = maps.iterator(); it2.hasNext();) {
        Map m = (Map) it2.next();
View Full Code Here

      Delete d = (Delete) it.next();
      if(LOG.isDebugEnabled()) {
        LOG.debug("Delete mapper mapped: " + d.getName());
      }
      regexps.addAll(d.getRegexps());
      Resource r = new Resource(d.getName(), getBaseDn(d.getRoot()), getIdentifiant(d.getRoot()),
          ConsoleCst.DELETE_MAPPER_TYPE, null, null);
      Vector inputAttr = new Vector();
      Vector outputAttr = new Vector();
      for (Iterator it2 = maps.iterator(); it2.hasNext();) {
        Map m = (Map) it2.next();
View Full Code Here

TOP

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

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.