Java 类org.apache.commons.collections.Factory 实例源码

项目:communote-server    文件:LdapConfigurationForm.java   
/**
 * Prepares the list of the group search base for a dynamic binding in Spring MVC.
 */
@SuppressWarnings("unchecked")
private void prepareGroupSearchBases() {
    List<LdapSearchBaseDefinition> searchBases = ListUtils.lazyList(
            new ArrayList<LdapSearchBaseDefinition>(), new Factory() {
                @Override
                public Object create() {
                    return LdapSearchBaseDefinition.Factory.newInstance();
                }
            });

    if (groupSyncConfig.getGroupSearch().getSearchBases().isEmpty()) {
        searchBases.add(LdapSearchBaseDefinition.Factory.newInstance());

    } else {
        searchBases.addAll(groupSyncConfig.getGroupSearch().getSearchBases());
    }
    groupSyncConfig.getGroupSearch().setSearchBases(searchBases);
}
项目:communote-server    文件:LdapConfigurationForm.java   
/**
 * Prepares the list of the user search base for a dynamic binding in Spring MVC.
 */
@SuppressWarnings("unchecked")
private void prepareUserSearchBases() {
    List<LdapSearchBaseDefinition> searchBases = ListUtils.lazyList(
            new ArrayList<LdapSearchBaseDefinition>(), new Factory() {
                @Override
                public Object create() {
                    return LdapSearchBaseDefinition.Factory.newInstance();
                }
            });

    if (config.getUserSearch().getSearchBases().isEmpty()) {
        searchBases.add(LdapSearchBaseDefinition.Factory.newInstance());

    } else {
        searchBases.addAll(config.getUserSearch().getSearchBases());
    }
    config.getUserSearch().setSearchBases(searchBases);
}
项目:communote-server    文件:LdapConfigurationForm.java   
/**
 * Sets the config.
 * 
 * @param configuration
 *            the new config (optional)
 */
private void setConfig(LdapConfiguration configuration) {
    Assert.notNull(configuration, "ldap config must be set");
    config = configuration;

    prepareUserSearchBases();
    prepareUserPropertyMapping();
    initAuthenticationMode(config.getSaslMode());

    // in case of a saved config with inactive groupSync
    if (config.getGroupSyncConfig() == null) {
        groupSyncConfig = LdapGroupSyncConfiguration.Factory.newInstance();
        groupSyncConfig.setGroupSearch(LdapSearchConfiguration.Factory.newInstance());
    } else {
        groupSyncConfig = config.getGroupSyncConfig();
    }

    prepareGroupSearchBases();
    prepareGroupPropertyMapping();
}
项目:screensaver    文件:CherryPickRequestPlateMapFilesBuilder.java   
private MultiMap getSourcePlateTypesForEachAssayPlate(CherryPickRequest cherryPickRequest)
{
  MultiMap assayPlateName2PlateTypes = MultiValueMap.decorate(new HashMap(),
                                                           new Factory()
  {
    public Object create() { return new HashSet(); }
  });

  for (LabCherryPick cherryPick : cherryPickRequest.getLabCherryPicks()) {
    if (cherryPick.isAllocated() && cherryPick.isMapped()) {
      assayPlateName2PlateTypes.put(cherryPick.getAssayPlate().getName(),
                                    cherryPick.getSourceCopy().findPlate(cherryPick.getSourceWell().getPlateNumber()).getPlateType());
    }
  }
  return assayPlateName2PlateTypes;
}
项目:OSCAR-ConCert    文件:BpmhFormBean.java   
@Override
@SuppressWarnings("unchecked")
public void reset(ActionMapping mapping, HttpServletRequest request) {
    super.reset(mapping, request);

    this.drugs = ListUtils.lazyList(new ArrayList<BpmhDrug>(), new Factory() {
        public BpmhDrug create() {
            return new BpmhDrug();
        }
    });

    setConfirm(false);
}
项目:communote-server    文件:LdapConfigurationForm.java   
/**
 * Instantiates a new ldap configuration form.
 * 
 * @param config
 *            the config
 */
public LdapConfigurationForm(LdapConfiguration config) {
    if (config == null) {
        config = LdapConfiguration.Factory.newInstance();
        config.setUserSearch(LdapSearchConfiguration.Factory.newInstance());
        configurationExists = false;
        passwordChanged = true;
    }
    this.setConfig(config);
}
项目:dddsample-core    文件:RouteAssignmentCommand.java   
public static Factory factory() {
  return LegCommand::new;
}
项目:screensaver    文件:CherryPickRequestPlateMapFilesBuilder.java   
@SuppressWarnings("unchecked")
/**
 * Normally, we create 1 file per assay plate. However, in the case where an
 * assay plate is comprised of wells from library copy plates that have
 * different plate types, we need to generate a separate file for each source
 * plate type (i.e., the assay plate will be defined over multiple files).
 * @return a MultiMap that partitions the cherry picks by file,
 * ordering both the file names and cherry picks for each file.
 */
private MultiMap/*<String,SortedSet<CherryPick>>*/ buildCherryPickFiles(CherryPickRequest cherryPickRequest,
                                                                        Set<CherryPickAssayPlate> forPlates)
{
  MultiMap assayPlate2SourcePlateTypes = getSourcePlateTypesForEachAssayPlate(cherryPickRequest);

  MultiMap result = MultiValueMap.decorate(new TreeMap<String,SortedSet<LabCherryPick>>(),
                                           new Factory()
  {
    public Object create() { return new TreeSet<LabCherryPick>(PlateMappingCherryPickComparator.getInstance()); }
  });

  // HACK: transform set of CPAP into a set of IDs, for purpose of checking
  // set membership; we can't rely upon CPAP.equals(), since we're comparing
  // non-managed entities with managed entities, and therefore we do not have
  // the guarantee of instance equality for entities with the same ID
  Set<Serializable> forPlateIds = new HashSet<Serializable>( forPlates .size());
  for (CherryPickAssayPlate cpap : forPlates) {
    if (cpap.getEntityId() == null) {
      throw new IllegalArgumentException("all members of 'forPlates' must already be persisted and have a database identifier");
    }
    forPlateIds.add(cpap.getEntityId());
  }

  for (LabCherryPick cherryPick : cherryPickRequest.getLabCherryPicks()) {
    if (cherryPick.isAllocated()) {
      CherryPickAssayPlate assayPlate = cherryPick.getAssayPlate();
      if (forPlates == null || (assayPlate != null && forPlateIds.contains(assayPlate.getEntityId()))) {
        Set<PlateType> sourcePlateTypes = (Set<PlateType>) assayPlate2SourcePlateTypes.get(assayPlate.getName());
        String fileName = makeFilename(cherryPick, sourcePlateTypes.size());
        result.put(fileName, cherryPick);
      }
    }
  }
  return result;
}