Exemplo n.º 1
0
  /** Public singleton access method. */
  public static synchronized PhotoFactory getInstance() {
    if (instance == null) {
      log.config(
          LogBuilder.createSystemMessage().addAction("setting AirplanePhotoFactory").toString());
      setInstance(new AirplanePhotoFactory());
    }

    return instance;
  }
Exemplo n.º 2
0
  protected void startUp(String rootDir) throws Exception {
    super.startUp(rootDir);
    log.info("AbstractMain.startUp completed");

    log.config(LogBuilder.createSystemMessage().addAction("load image storage").toString());
    // GcsAdapter.Builder gcsAdapterBuilder = new GcsAdapter.Builder();
    ImageStorage.setInstance(new DatastoreAdapter());

    log.config(LogBuilder.createSystemMessage().addAction("load globals").toString());
    GlobalsManager.getInstance().loadGlobals();

    log.config(LogBuilder.createSystemMessage().addAction("load user").toString());
    UserManager.getInstance().init();

    log.config(LogBuilder.createSystemMessage().addAction("init PhotoFactory").toString());
    DrumcymbalPhotoFactory.initialize();
    CoordinateFactory.initialize();

    log.config(LogBuilder.createSystemMessage().addAction("load Photos").toString());
    // PhotoManager.getInstance().init();
    DrumcymbalPhotoManager.getInstance().init();
  }
Exemplo n.º 3
0
  /** @methodtype initialization */
  protected void initialize(
      String id,
      String nickName,
      EmailAddress emailAddress,
      AccessRights accessRights,
      Client previousClient) {
    super.initialize(id, nickName, emailAddress, accessRights, previousClient);

    log.config(
        LogBuilder.createSystemMessage()
            .addAction("initialize user")
            .addParameter("id", id)
            .addParameter("name", nickName)
            .addParameter("E-Mail", emailAddress.asString())
            .toString());
    incWriteCount();
  }
  protected String doHandlePost(UserSession us, Map args) {
    PhotoFilter filter = us.getPhotoFilter();

    String un = us.getAsString(args, PhotoFilter.USER_NAME);
    if (StringUtil.isLegalUserName(un)) {
      filter.setUserName(un);
    }

    String tags = us.getAsString(args, PhotoFilter.TAGS);
    if (StringUtil.isLegalTagsString(tags)) {
      filter.setTags(new Tags(tags));
    }

    log.info(
        LogBuilder.createUserMessage()
            .addAction("Filter Photos")
            .addParameter("Tags", filter.getTags().asString())
            .toString());

    return PartUtil.SHOW_PHOTO_PAGE_NAME;
  }
  protected String doHandlePost(UserSession us, Map args) {
    String id = us.getAndSaveAsString(args, "photoId");
    Photo photo = PhotoManager.getInstance().getPhoto(id);

    String tags = us.getAndSaveAsString(args, Photo.TAGS);
    photo.setTags(new Tags(tags));
    String status = us.getAndSaveAsString(args, Photo.STATUS);
    photo.setStatus(PhotoStatus.getFromString(status));

    AsyncTaskExecutor.savePhotoAsync(id);

    log.info(
        LogBuilder.createUserMessage()
            .addAction("AdminUserPhoto")
            .addParameter("Photo", photo.getId().asString())
            .toString());

    us.setMessage(us.getClient().getLanguageConfiguration().getPhotoUpdateSucceeded());

    return PartUtil.SHOW_ADMIN_PAGE_NAME;
  }
Exemplo n.º 6
0
  public void loadExistingUsers() {
    ObjectifyService.run(
        new Work<Void>() {
          @Override
          public Void run() {
            Collection<User> existingUser = new ArrayList<User>();
            readObjects(existingUser, User.class);

            for (User user : existingUser) {
              if (!hasClientById(user.getId())) {
                doAddClient(user);
              } else {
                log.config(
                    LogBuilder.createSystemMessage()
                        .addParameter("user has been loaded", user.getId())
                        .toString());
              }
            }
            return null;
          }
        });

    log.info(LogBuilder.createSystemMessage().addMessage("loaded all clients").toString());
  }