Package org.apache.cayenne

Examples of org.apache.cayenne.ObjectContext


        // TODO: andrus, 3/28/2006 - 'SnapshotEventDecorator' serves as a bridge (or
        // rather a noop wrapper) between old snapshot events and new GraphEvents. Once
        // SnapshotEvents are replaced with GraphEvents (in 2.0) we won't need it
        GraphDiff diff = new SnapshotEventDecorator(event);

        ObjectContext originatingContext = (event.getPostedBy() instanceof ObjectContext)
                ? (ObjectContext) event.getPostedBy()
                : null;
        context.fireDataChannelChanged(originatingContext, diff);
    }
View Full Code Here


        Object target = doResolveFault(sourceObject, relationshipName);

        // must update the diff for the object

        ObjectContext context = sourceObject.getObjectContext();
        if ((state == PersistenceState.MODIFIED || state == PersistenceState.DELETED)
                && context instanceof DataContext) {

            ObjectDiff diff = ((DataContext) context)
                    .getObjectStore()
View Full Code Here

    lastToString = null;
    lastToStringTime = 0;
  }

  private String getShortPrettyName() {
    ObjectContext context = DatabaseContext.getContext();
    if(context == null)
      return shortLogonName;

    String shortPrettyName = shortLogonName;
    try {
View Full Code Here

  /**
   * Equivalent to getShortLogonName if there is no database or if the user isn't in it;
   * @return User[#N][@Realm] or [Prefix ][Account (]FullLogonName[)]
   */
  private String getPrettyName() {
    ObjectContext context = DatabaseContext.getContext();
    if(context == null)
      return shortLogonName;

    String prettyName = shortLogonName;
    try {
View Full Code Here

  /**
   * Equivalent to getShortLogonName if there is no database or if the user isn't in it;
   * @return User[#N][@Realm] or <Account> [(FullLogonName)]
   */
  private String getAccountAndLogin() {
    ObjectContext context = DatabaseContext.getContext();
    if(context == null)
      return shortLogonName;

    String prettyName = shortLogonName;
    try {
View Full Code Here

  /**
   * Equivalent to getShortLogonName if there is no database or if the user isn't in it;
   * @return User[#N][@Realm] or <Account>
   */
  private String getAccountOrLogin() {
    ObjectContext context = DatabaseContext.getContext();
    if(context == null)
      return shortLogonName;

    String prettyName = shortLogonName;
    try {
View Full Code Here

  }

  public void setFlags(int flags) {
    this.flags = flags;

    ObjectContext context = DatabaseContext.getContext();
    if(context != null)
      try {
        Account account = Account.get(this);
        if(account != null)
          this.flags |= account.getFlagSpoof();
View Full Code Here

        if((rsMail.size() >= id) && (id >= 1)) {
          Mail m = rsMail.get(id-1);
          String response = "Deleted " + constructMessage(id, rsMail.size(), m);

          try {
            ObjectContext context = commanderAccount.getObjectContext();
            context.deleteObject(m);
            commanderAccount.updateRow();
            user.sendChat(response, true);

            context.performQuery(new RefreshQuery(commanderAccount));
          } catch(Exception e) {
            throw new CommandFailedWithDetailsException("Failed to delete mail", e);
          }
        } else {
          throw new CommandFailedWithDetailsException("You only have " + rsMail.size() + " messages!");
        }

      } else if(params[0].equals("empty")
          ||params[0].equals("clear")) {
        //empty
        if(params.length != 1)
          throw new InvalidUseException();

        if(Mail.getUnreadCount(commanderAccount) > 0)
          throw new CommandFailedWithDetailsException("You have unread mail!");

        try {
          ObjectContext context = commanderAccount.getObjectContext();
          for(Mail m : commanderAccount.getRecievedMail())
            context.deleteObject(m);
          commanderAccount.updateRow();
          user.sendChat("Mailbox cleaned!", whisperBack);
        } catch(Exception e) {
          throw new CommandFailedWithDetailsException("Failed to delete mail", e);
        }
View Full Code Here

    triviaEnabled = false;
  }

  private void showLeaderBoard(Connection source) {
    try {
      ObjectContext context = DatabaseContext.getContext();
      if(context == null)
        return;

      List<Account> leaders = Account.getTriviaLeaders();
      if(leaders == null)
View Full Code Here

   * @throws Exception If a commit error occurs
   */
  public static Account create(String name, Rank access, Account recruiter) throws Exception {
    Date now = new Date(System.currentTimeMillis());

    ObjectContext context = DatabaseContext.getContext();
    Account account = context.newObject(Account.class);
    account.setCreated(now);
    account.setLastRankChange(now);
    account.setName(name);
    account.setRank(access);
    account.setRecruiter(recruiter);
View Full Code Here

TOP

Related Classes of org.apache.cayenne.ObjectContext

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.