package com.dbxml.db.enterprise.sync;

/*
 * dbXML - Native XML Database
 * Copyright (C) 1999-2004  The dbXML Group, L.L.C.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *
 * $Id: Constants.java,v 1.3 2004/02/12 00:17:57 bradford Exp $
 */

/**
 * Constants
 */

public final class Constants {
   private static final String[] STATUS_STRINGS = {"active", "inactive", "deleted"};

   public static final String MANIFEST = "manifest";
   public static final String GROUPS = "groups";
   public static final String GROUP = "group";
   public static final String VERSION = "version";
   public static final String CONTENT = "content";
   public static final String MODIFIED = "modified";
   public static final String NAME = "name";
   public static final String STATUS = "status";
   public static final String DATE = "date";
   public static final String PATH = "path";
   public static final String OWNER = "owner";
   public static final String CREATED = "created";
   public static final String SIZE = "size";
   public static final String TAGS = "tags";
   public static final String TAG = "tag";
   public static final String NOTES = "notes";
   public static final String NOTE = "note";
   public static final String COLLECTIONS = "collections";
   public static final String COLLECTION = "collection";

   public static final int STATUS_UNKNOWN = -1;
   public static final int STATUS_ACTIVE = 0;
   public static final int STATUS_INACTIVE = 1;
   public static final int STATUS_DELETED = 2;

   private Constants() {
   }

   public static int getStatusValue(String status) {
      for ( int i = 0; i < STATUS_STRINGS.length; i++ )
         if ( STATUS_STRINGS[i].equals(status) )
            return i;
      return STATUS_UNKNOWN;
   }

   public static String getStatusString(int status) {
      if ( status >= 0 && status < STATUS_STRINGS.length )
         return STATUS_STRINGS[status];
      else
         return "unknown";
   }
}
