Exemple #1
0
 @Override
 public boolean onCommand(CommandSender sender, Command cmd, String tag, String[] args) {
   if (tag.equalsIgnoreCase("cancelauto")) {
     if (sender.hasPermission(Permission.AUTO_CANCEL)) {
       if (args.length == 0) {
         sender.sendMessage(ChatColor.YELLOW + "/cancelauto <player>");
         return true;
       } else {
         if (auto.contains(args[0].trim())) {
           auto.remove(args[0].trim());
           sender.sendMessage(
               ChatColor.YELLOW + "Autoban for " + args[0].trim() + " has been cancelled!");
           for (Player online : Bukkit.getOnlinePlayers()) {
             if (online != sender) {
               if (online.hasPermission(Permission.AUTO)) {
                 online.sendMessage(
                     ChatColor.GOLD + sender.getName() + " removed " + args[0] + "'s autoban!");
               }
             }
           }
         } else if (time.containsKey(UUID.fromString(args[0].trim()))) {
           time.put(UUID.fromString(args[0].trim()), 0);
           sender.sendMessage(ChatColor.YELLOW + "Autoban cancelled!");
         } else {
           sender.sendMessage(
               ChatColor.YELLOW + "This player does not have an autoban scheduled!");
         }
       }
     } else {
       sender.sendMessage(ChatColor.WHITE + "Unknown Command! Type \"/help\" for help.");
       return true;
     }
   }
   return true;
 }
  @Test
  public void testGetIdentifier_newEqual() {

    String pairwise1 = service.getIdentifier(userInfoRegular, pairwiseClient1);
    Mockito.verify(pairwiseIdentifierRepository, Mockito.atLeast(1))
        .save(Matchers.any(PairwiseIdentifier.class));

    PairwiseIdentifier pairwiseId = new PairwiseIdentifier();
    pairwiseId.setUserSub(regularSub);
    pairwiseId.setIdentifier(pairwise1);
    pairwiseId.setSectorIdentifier(sectorHost12);

    Mockito.when(pairwiseIdentifierRepository.getBySectorIdentifier(regularSub, sectorHost12))
        .thenReturn(pairwiseId);

    String pairwise2 = service.getIdentifier(userInfoRegular, pairwiseClient2);

    assertNotSame(pairwiseSub, pairwise1);
    assertNotSame(pairwiseSub, pairwise2);

    assertEquals(pairwise1, pairwise2);

    // see if the pairwise id's are actual UUIDs
    UUID uudi1 = UUID.fromString(pairwise1);
    UUID uuid2 = UUID.fromString(pairwise2);
  }
  /**
   * Enables or disables notification on a give characteristic.
   *
   * @param characteristic Characteristic to act on.
   * @param enabled If true, enable notification. False otherwise.
   */
  public void setCharacteristicNotification(
      BluetoothGattCharacteristic characteristic, boolean enabled) {
    if (mBluetoothAdapter == null || mBluetoothGatt == null) {
      Log.w(TAG, "BluetoothAdapter not initialized");
      return;
    }
    mBluetoothGatt.setCharacteristicNotification(characteristic, enabled);

    // This is specific to Heart Rate Measurement.
    if (UUID_HEART_RATE_MEASUREMENT.equals(characteristic.getUuid())) {
      BluetoothGattDescriptor descriptor =
          characteristic.getDescriptor(
              UUID.fromString(SampleGattAttributes.CLIENT_CHARACTERISTIC_CONFIG));
      descriptor.setValue(BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE);
      mBluetoothGatt.writeDescriptor(descriptor);
    }

    // specific for pm2.5
    if (UUID_FFE0.equals(characteristic.getUuid())) {
      BluetoothGattDescriptor descriptor =
          characteristic.getDescriptor(
              UUID.fromString(SampleGattAttributes.CLIENT_CHARACTERISTIC_CONFIG));
      descriptor.setValue(BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE);
      mBluetoothGatt.writeDescriptor(descriptor);
    }
  }
 @Override
 public void likeComment(String postId, String commentId) {
   UUID commentUUID = UUID.fromString(commentId);
   Integer numberOfLikes =
       cassandraCommentRepository.getNumberOfLikes(UUID.fromString(postId), commentUUID);
   cassandraCommentRepository.likeComment(++numberOfLikes, commentUUID);
 }
Exemple #5
0
    @Override
    public void readFromNBT(NBTTagCompound tagCom) {
      TEC.idToUsername.clear();
      NBTTagList idUsernameTag = tagCom.getTagList("idUsernames", 10);
      for (int i = 0; i < idUsernameTag.tagCount(); i++) {
        NBTTagCompound tag = idUsernameTag.getCompoundTagAt(i);
        TEC.idToUsername.put(
            UUID.fromString(tagCom.getString("UUID")), tagCom.getString("playerName"));
      }

      TEC.aspectBuffer.clear();
      NBTTagList bufferTag = tagCom.getTagList("bufferTag", 10);
      for (int i = 0; i < bufferTag.tagCount(); i++) {
        NBTTagCompound idedBuffer = bufferTag.getCompoundTagAt(i);
        UUID playerID = UUID.fromString(idedBuffer.getString("playerID"));
        NBTTagList playersBuffer = idedBuffer.getTagList("buffer", 10);
        for (int j = 0; j < playersBuffer.tagCount(); j++) {
          NBTTagCompound bufferEntry = playersBuffer.getCompoundTagAt(j);

          NBTTagCompound scanTag = bufferEntry.getCompoundTag("scan");
          ScanResult scan =
              new ScanResult(
                  scanTag.getByte("type"),
                  scanTag.getInteger("id"),
                  scanTag.getInteger("meta"),
                  EntityList.createEntityFromNBT(
                      scanTag.getCompoundTag("entityTag"), DimensionManager.getWorld(0)),
                  scanTag.getString("phenomena"));

          TEC.addAspect(
              playerID, scan, bufferEntry.getDouble("chance"), bufferEntry.getDouble("percent"));
        }
      }
    }
Exemple #6
0
  public CommandList(HorseKeep plugin, CommandSender sender, String[] args) {
    if (!(sender instanceof Player)) {
      sender.sendMessage(plugin.lang.get("canOnlyExecByPlayer"));
      return;
    }

    Player player = (Player) sender;

    player.sendMessage(
        "=== "
            + ChatColor.GOLD
            + "["
            + ChatColor.GREEN
            + plugin.lang.get("ownedHorses")
            + ChatColor.GOLD
            + "] "
            + ChatColor.RESET
            + "===");

    List<String> horsesList = plugin.manager.getOwnedHorses(player.getUniqueId());
    String stored;
    for (String horseId : horsesList) {
      if (plugin.manager.isStored(UUID.fromString(horseId))) {
        stored = ChatColor.RED + " [" + plugin.lang.get("stored") + "]";
      } else stored = "";

      player.sendMessage(
          "- "
              + plugin.lang.get("identifier")
              + ": "
              + ChatColor.AQUA
              + plugin.manager.getHorseIdentifier(UUID.fromString(horseId))
              + stored);
    }
  }
  /** Tests getting a random story */
  public void testRandomStory() {
    sm = ServerManager.getInstance();
    sm.setTestServer();

    UUID id1 = UUID.fromString("f1bda3a9-4560-4530-befc-2d58db9419b7");
    UUID id2 = UUID.fromString("e4558e4e-5140-4838-be40-e4d5be0b5299");
    Story story = new Story(id1, "Harry Potter test", "oprah", "the emo boy", "232");
    Story story2 = new Story(id2, "Ugly Duckling test", "oprah", "the emo boy", "232");

    Chapter chap = new Chapter(story.getId(), "on a dark cold night");
    Chapter chap2 = new Chapter(story.getId(), "he lughe");
    Choice c1 = new Choice(chap.getId(), chap2.getId(), "hit me!");

    chap.getChoices().add(c1);
    story.getChapters().add(chap);
    story.getChapters().add(chap2);

    sm.insert(story);
    sm.insert(story2);

    story = sm.getRandom();
    assertNotNull(story);

    // Cleaning up server
    sm.remove(story.getId().toString());
    sm.remove(story2.getId().toString());
  }
 public StreamData getStream(UUID streamID) {
   // probably should do this over UDP.
   try {
     JSONRPC2Request jr = new JSONRPC2Request("getstream", id.getAndIncrement());
     Map<String, Object> params = new HashMap<String, Object>();
     params.put("streamid", streamID.toString());
     jr.setNamedParams(params);
     JSONRPC2Response jres = jsonSession.send(jr);
     if (jres.indicatesSuccess()) {
       Map<String, Object> jo = (Map<String, Object>) jres.getResult();
       if ((Boolean) jo.get("present")) {
         StreamData sd = new StreamData();
         sd.currentLog = UUID.fromString((String) jo.get("currentlog"));
         sd.startPos = (Long) jo.get("startpos");
         sd.epoch = (Long) jo.get("epoch");
         sd.startLog = UUID.fromString((String) jo.get("startlog"));
         return sd;
       } else {
         return null;
       }
     }
   } catch (Exception e) {
     log.error("other error", e);
     return null;
   }
   return null;
 }
 @Override
 public boolean fillModel(String elementName, String attrName, String attrValue) {
   if (isConsumableForAttributeItsFrame(elementName, attrName)) {
     IAsmElementUmlInteractive<ContainerFull<FrameUml>, ?, ?, ?> asmFrameFull =
         containerFramesUml.findFrameFullById(UUID.fromString(attrValue));
     asmFrameFull.getElementUml().getElements().add(asmMessageFull);
     getModel().setItsFrame(asmFrameFull);
     return true;
   }
   if (isConsumableForAttributeInteractionUseStart(elementName, attrName)) {
     IAsmElementUmlInteractive<? extends InteractionUse, ?, ?, ?> asmFrameFull =
         containerInteractionUses.findAsmInteractionUseById(UUID.fromString(attrValue));
     getModel().setAsmInteractionUseStart(asmFrameFull);
     return true;
   }
   if (isConsumableForAttributeInteractionUseEnd(elementName, attrName)) {
     IAsmElementUmlInteractive<? extends InteractionUse, ?, ?, ?> asmFrameFull =
         containerInteractionUses.findAsmInteractionUseById(UUID.fromString(attrValue));
     getModel().setAsmInteractionUseEnd(asmFrameFull);
     return true;
   }
   if (isConsumableForAttributeLifeLineStart(elementName, attrName)) {
     IAsmElementUmlInteractive<LifeLineFull<ShapeUmlWithName>, ?, ?, ?> asmLifeLineFull =
         containerAsmLifeLinesFull.findLifeLineFullById(UUID.fromString(attrValue));
     getModel().setAsmLifeLineFullStart(asmLifeLineFull);
     return true;
   }
   if (isConsumableForAttributeLifeLineEnd(elementName, attrName)) {
     IAsmElementUmlInteractive<LifeLineFull<ShapeUmlWithName>, ?, ?, ?> asmLifeLineFull =
         containerAsmLifeLinesFull.findLifeLineFullById(UUID.fromString(attrValue));
     getModel().setAsmLifeLineFullEnd(asmLifeLineFull);
     return true;
   }
   return super.fillModel(elementName, attrName, attrValue);
 }
  public void init(String record) {
    String[] fields = record.split("\\" + String.valueOf(this.delimiter));
    StringBuffer uuidStringBuffer = new StringBuffer();
    SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.S");

    if (fields[0].replace(String.valueOf(this.enclosure), "").equals("")) {
      uuidStringBuffer.setLength(0);
      this.opportunityid = null;
    } else {
      uuidStringBuffer.setLength(0);
      uuidStringBuffer.append(fields[0].replace(String.valueOf(this.enclosure), ""));
      uuidStringBuffer.insert(8, '-');
      uuidStringBuffer.insert(13, '-');
      uuidStringBuffer.insert(18, '-');
      uuidStringBuffer.insert(23, '-');
      this.opportunityid = UUID.fromString(uuidStringBuffer.toString());
    }

    if (fields[1].replace(String.valueOf(this.enclosure), "").equals("")) {
      uuidStringBuffer.setLength(0);
      this.lookupid = null;
    } else {
      uuidStringBuffer.setLength(0);
      uuidStringBuffer.append(fields[1].replace(String.valueOf(this.enclosure), ""));
      uuidStringBuffer.insert(8, '-');
      uuidStringBuffer.insert(13, '-');
      uuidStringBuffer.insert(18, '-');
      uuidStringBuffer.insert(23, '-');
      this.lookupid = UUID.fromString(uuidStringBuffer.toString());
    }
  }
 // TODO
 @GET
 @Path("/jobQueue/{jobID}")
 // @Produces(MediaType.TEXT_XML)
 public Response checkJobQueue(@PathParam("jobID") String jobID) {
   // does job exist?
   System.out.println("[checkJobQueue] queue length = " + jobqueue.size());
   System.out.println("[checkJobQueue] jobID = " + jobID);
   if (jobqueue.containsKey(UUID.fromString(jobID))) {
     System.out.println("Found job ID");
     // if job is not finished yet return 200
     if (jobqueue.get(UUID.fromString(jobID)).getStatus() == SFPGenJob.PROCESSING)
       return Response.status(Status.OK)
           .entity("Still processing - please check back later.")
           .build();
     // if job is finished and SFP has been created
     else {
       // return path to SFP resource
       URI sfp_uri;
       try {
         sfp_uri = new URI("SFP/sfplist/" + jobID);
         // update jobQueue
         SFPGenJob currjob = jobqueue.get(UUID.fromString(jobID));
         currjob.updateStatus(SFPGenJob.GONE);
         jobqueue.put(UUID.fromString(jobID), currjob);
         return Response.status(Status.SEE_OTHER).location(sfp_uri).build();
       } catch (URISyntaxException e) {
         // TODO Auto-generated catch block
         e.printStackTrace();
       }
       return Response.serverError().build();
     }
   } else return Response.serverError().entity("No such job ID").build();
 }
  /**
   * @param proposedUuid the value whose UUID prefix is being removed (cannot be <code>null</code>
   *     or empty)
   * @return the UUID or <code>null</code> if the proposedUuid is not a UUID
   */
  public String resolveInternalReference(final String proposedUuid) {
    CheckArg.isNotNull(proposedUuid, "proposedUuid");
    String mmuuid = null;
    final int index = proposedUuid.indexOf(CoreLexicon.ModelId.MM_HREF_PREFIX);

    if (index != -1) {
      // It's a local reference ...
      try {
        mmuuid =
            UUID.fromString(
                    proposedUuid.substring(index + CoreLexicon.ModelId.MM_HREF_PREFIX.length()))
                .toString();
      } catch (final IllegalArgumentException e) {
        // ignore
      }
    } else {
      try {
        mmuuid = UUID.fromString(proposedUuid).toString();
      } catch (final IllegalArgumentException e) {
        // ignore
      }
    }

    return mmuuid;
  }
  private Statement createDeleteStatementFor(String userId, String applicationId) {
    UUID appUuid = UUID.fromString(applicationId);
    UUID userUuid = UUID.fromString(userId);

    BatchStatement batch = new BatchStatement();

    Statement deleteFromAppFollowersTable =
        QueryBuilder.delete()
            .all()
            .from(Follow.TABLE_NAME_APP_FOLLOWERS)
            .where(eq(APP_ID, appUuid))
            .and(eq(USER_ID, userUuid));

    batch.add(deleteFromAppFollowersTable);

    Statement deleteFromUserFollowingsTable =
        QueryBuilder.delete()
            .all()
            .from(Follow.TABLE_NAME_USER_FOLLOWING)
            .where(eq(APP_ID, appUuid))
            .and(eq(USER_ID, userUuid));

    batch.add(deleteFromUserFollowingsTable);

    return batch;
  }
  private Statement createStatementToSaveFollowing(User user, Application app) {
    UUID userId = UUID.fromString(user.userId);
    UUID appId = UUID.fromString(app.applicationId);

    BatchStatement batch = new BatchStatement();

    Statement insertIntoAppFollowersTable =
        QueryBuilder.insertInto(Follow.TABLE_NAME_APP_FOLLOWERS)
            .value(APP_ID, appId)
            .value(USER_ID, userId)
            .value(APP_NAME, app.name)
            .value(USER_FIRST_NAME, user.firstName)
            .value(TIME_OF_FOLLOW, Instant.now().toEpochMilli());

    batch.add(insertIntoAppFollowersTable);

    Statement insertIntoUserFollowingsTable =
        QueryBuilder.insertInto(Follow.TABLE_NAME_USER_FOLLOWING)
            .value(APP_ID, appId)
            .value(USER_ID, userId)
            .value(APP_NAME, app.name)
            .value(USER_FIRST_NAME, user.firstName)
            .value(TIME_OF_FOLLOW, Instant.now().toEpochMilli());

    batch.add(insertIntoUserFollowingsTable);

    return batch;
  }
Exemple #15
0
  public void startAdvertising() {
    System.out.println("Start advertising");

    if (ContextCompat.checkSelfPermission(activity, Manifest.permission.BLUETOOTH_ADMIN)
        != PackageManager.PERMISSION_GRANTED) {
      System.out.println(" doesn't have permission");

    } else {
      System.out.println(" has permission");
      advertiser = bluetoothAdapter.getBluetoothLeAdvertiser();
      AdvertiseSettings.Builder settings = new AdvertiseSettings.Builder();
      settings.setConnectable(true);
      settings.setAdvertiseMode(AdvertiseSettings.ADVERTISE_MODE_LOW_LATENCY);
      settings.setTxPowerLevel(AdvertiseSettings.ADVERTISE_TX_POWER_HIGH);
      settings.setTimeout(120000);
      AdvertiseData.Builder data = new AdvertiseData.Builder();
      data.addServiceUuid(new ParcelUuid(UUID.fromString(B4UUID)));
      data.addServiceData(
          new ParcelUuid(UUID.fromString(B4UUID)), "a".getBytes(Charset.forName("UTF-8")));
      data.setIncludeDeviceName(true);
      advertiseCallback = new AdvertiseBack();
      advertiser.startAdvertising(settings.build(), data.build(), advertiseCallback);
      isAdvertising = true;
    }
  }
  private ActorNetworkServiceRecord(JsonObject jsonObject, Gson gson) {

    this.id = UUID.fromString(jsonObject.get("id").getAsString());
    this.actorSenderAlias =
        (jsonObject.get("actorSenderAlias") != null)
            ? jsonObject.get("actorSenderAlias").getAsString()
            : null;
    this.actorSenderProfileImage =
        Base64.decode(jsonObject.get("actorSenderProfileImage").getAsString(), Base64.DEFAULT);
    this.notificationDescriptor =
        gson.fromJson(
            jsonObject.get("notificationDescriptor").getAsString(), NotificationDescriptor.class);
    this.actorDestinationType =
        gson.fromJson(jsonObject.get("actorDestinationType").getAsString(), Actors.class);
    this.actorSenderType =
        gson.fromJson(jsonObject.get("actorSenderType").getAsString(), Actors.class);
    this.actorSenderPublicKey = jsonObject.get("actorSenderPublicKey").getAsString();
    this.actorDestinationPublicKey = jsonObject.get("actorDestinationPublicKey").getAsString();
    this.sentDate = jsonObject.get("sentDate").getAsLong();
    this.actorProtocolState =
        gson.fromJson(jsonObject.get("actorProtocolState").getAsString(), ActorProtocolState.class);
    this.flagReadead = jsonObject.get("flagReadead").getAsBoolean();
    this.sentCount = jsonObject.get("sentCount").getAsInt();
    this.actorSenderPhrase = jsonObject.get("actorSenderPhrase").getAsString();
    if (jsonObject.get("responseToNotificationId") != null)
      this.responseToNotificationId =
          UUID.fromString(jsonObject.get("responseToNotificationId").getAsString());
  }
  protected CFSecurityTSecGroupBuff unpackTSecGroupResultSetToBuff(ResultSet resultSet)
      throws SQLException {
    final String S_ProcName = "unpackTSecGroupResultSetToBuff";
    int idxcol = 1;
    CFSecurityTSecGroupBuff buff = schema.getFactoryTSecGroup().newBuff();
    {
      String colString = resultSet.getString(idxcol);
      if (resultSet.wasNull()) {
        buff.setCreatedAt(null);
      } else if ((colString == null) || (colString.length() <= 0)) {
        buff.setCreatedAt(null);
      } else {
        buff.setCreatedAt(CFSecurityMySqlSchema.convertTimestampString(colString));
      }
    }
    idxcol++;
    {
      String colString = resultSet.getString(idxcol);
      if (resultSet.wasNull()) {
        buff.setCreatedByUserId(null);
      } else if ((colString == null) || (colString.length() <= 0)) {
        buff.setCreatedByUserId(null);
      } else {
        buff.setCreatedByUserId(UUID.fromString(colString));
      }
    }
    idxcol++;
    {
      String colString = resultSet.getString(idxcol);
      if (resultSet.wasNull()) {
        buff.setUpdatedAt(null);
      } else if ((colString == null) || (colString.length() <= 0)) {
        buff.setUpdatedAt(null);
      } else {
        buff.setUpdatedAt(CFSecurityMySqlSchema.convertTimestampString(colString));
      }
    }
    idxcol++;
    {
      String colString = resultSet.getString(idxcol);
      if (resultSet.wasNull()) {
        buff.setUpdatedByUserId(null);
      } else if ((colString == null) || (colString.length() <= 0)) {
        buff.setUpdatedByUserId(null);
      } else {
        buff.setUpdatedByUserId(UUID.fromString(colString));
      }
    }
    idxcol++;
    buff.setRequiredTenantId(resultSet.getLong(idxcol));
    idxcol++;
    buff.setRequiredTSecGroupId(resultSet.getInt(idxcol));
    idxcol++;
    buff.setRequiredName(resultSet.getString(idxcol));
    idxcol++;

    buff.setRequiredRevision(resultSet.getInt(idxcol));
    return (buff);
  }
 @GET
 @Path("/sfplist/{jobID}")
 @Produces(MediaType.TEXT_XML)
 public Response fetchSFP(@PathParam("jobID") String jobID) {
   if (sfplist.containsKey(UUID.fromString(jobID))) {
     return Response.status(Status.OK).entity(sfplist.get(UUID.fromString(jobID))).build();
   } else return Response.status(Status.NOT_FOUND).entity("No such SFP ID").build();
 }
  protected CFAccFeeDetailBuff unpackFeeDetailResultSetToBuff(ResultSet resultSet)
      throws SQLException {
    final String S_ProcName = "unpackFeeDetailResultSetToBuff";
    int idxcol = 1;
    CFAccFeeDetailBuff buff = schema.getFactoryFeeDetail().newBuff();
    {
      String colString = resultSet.getString(idxcol);
      if (resultSet.wasNull()) {
        buff.setCreatedByUserId(null);
      } else if ((colString == null) || (colString.length() <= 0)) {
        buff.setCreatedByUserId(null);
      } else {
        buff.setCreatedByUserId(UUID.fromString(colString));
      }
      idxcol++;

      colString = resultSet.getString(idxcol);
      if (resultSet.wasNull()) {
        buff.setCreatedAt(null);
      } else if ((colString == null) || (colString.length() <= 0)) {
        buff.setCreatedAt(null);
      } else {
        buff.setCreatedAt(CFAccSybaseSchema.convertTimestampString(colString));
      }
      idxcol++;
      colString = resultSet.getString(idxcol);
      if (resultSet.wasNull()) {
        buff.setUpdatedByUserId(null);
      } else if ((colString == null) || (colString.length() <= 0)) {
        buff.setUpdatedByUserId(null);
      } else {
        buff.setUpdatedByUserId(UUID.fromString(colString));
      }
      idxcol++;

      colString = resultSet.getString(idxcol);
      if (resultSet.wasNull()) {
        buff.setUpdatedAt(null);
      } else if ((colString == null) || (colString.length() <= 0)) {
        buff.setUpdatedAt(null);
      } else {
        buff.setUpdatedAt(CFAccSybaseSchema.convertTimestampString(colString));
      }
      idxcol++;
    }
    buff.setRequiredTenantId(resultSet.getLong(idxcol));
    idxcol++;
    buff.setRequiredFeeId(resultSet.getLong(idxcol));
    idxcol++;
    buff.setRequiredFeeDetailId(resultSet.getLong(idxcol));
    idxcol++;
    buff.setRequiredDescription(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredAmountCharged(resultSet.getBigDecimal(idxcol));
    idxcol++;
    buff.setRequiredRevision(resultSet.getInt(idxcol));
    return (buff);
  }
  protected CFSecuritySecFormBuff unpackSecFormResultSetToBuff(ResultSet resultSet)
      throws SQLException {
    final String S_ProcName = "unpackSecFormResultSetToBuff";
    int idxcol = 1;
    CFSecuritySecFormBuff buff = schema.getFactorySecForm().newBuff();
    {
      String colString = resultSet.getString(idxcol);
      if (resultSet.wasNull()) {
        buff.setCreatedByUserId(null);
      } else if ((colString == null) || (colString.length() <= 0)) {
        buff.setCreatedByUserId(null);
      } else {
        buff.setCreatedByUserId(UUID.fromString(colString));
      }
      idxcol++;

      colString = resultSet.getString(idxcol);
      if (resultSet.wasNull()) {
        buff.setCreatedAt(null);
      } else if ((colString == null) || (colString.length() <= 0)) {
        buff.setCreatedAt(null);
      } else {
        buff.setCreatedAt(CFCrmDb2LUWSchema.convertTimestampString(colString));
      }
      idxcol++;
      colString = resultSet.getString(idxcol);
      if (resultSet.wasNull()) {
        buff.setUpdatedByUserId(null);
      } else if ((colString == null) || (colString.length() <= 0)) {
        buff.setUpdatedByUserId(null);
      } else {
        buff.setUpdatedByUserId(UUID.fromString(colString));
      }
      idxcol++;

      colString = resultSet.getString(idxcol);
      if (resultSet.wasNull()) {
        buff.setUpdatedAt(null);
      } else if ((colString == null) || (colString.length() <= 0)) {
        buff.setUpdatedAt(null);
      } else {
        buff.setUpdatedAt(CFCrmDb2LUWSchema.convertTimestampString(colString));
      }
      idxcol++;
    }
    buff.setRequiredClusterId(resultSet.getLong(idxcol));
    idxcol++;
    buff.setRequiredSecFormId(resultSet.getInt(idxcol));
    idxcol++;
    buff.setRequiredSecAppId(resultSet.getInt(idxcol));
    idxcol++;
    buff.setRequiredJEEServletMapName(resultSet.getString(idxcol));
    idxcol++;

    buff.setRequiredRevision(resultSet.getInt(idxcol));
    return (buff);
  }
  protected CFSecurityHostNodeBuff unpackHostNodeResultSetToBuff(ResultSet resultSet)
      throws SQLException {
    final String S_ProcName = "unpackHostNodeResultSetToBuff";
    int idxcol = 1;
    CFSecurityHostNodeBuff buff = schema.getFactoryHostNode().newBuff();
    {
      String colString = resultSet.getString(idxcol);
      if (resultSet.wasNull()) {
        buff.setCreatedByUserId(null);
      } else if ((colString == null) || (colString.length() <= 0)) {
        buff.setCreatedByUserId(null);
      } else {
        buff.setCreatedByUserId(UUID.fromString(colString));
      }
      idxcol++;

      colString = resultSet.getString(idxcol);
      if (resultSet.wasNull()) {
        buff.setCreatedAt(null);
      } else if ((colString == null) || (colString.length() <= 0)) {
        buff.setCreatedAt(null);
      } else {
        buff.setCreatedAt(CFSecurityPgSqlSchema.convertTimestampString(colString));
      }
      idxcol++;
      colString = resultSet.getString(idxcol);
      if (resultSet.wasNull()) {
        buff.setUpdatedByUserId(null);
      } else if ((colString == null) || (colString.length() <= 0)) {
        buff.setUpdatedByUserId(null);
      } else {
        buff.setUpdatedByUserId(UUID.fromString(colString));
      }
      idxcol++;

      colString = resultSet.getString(idxcol);
      if (resultSet.wasNull()) {
        buff.setUpdatedAt(null);
      } else if ((colString == null) || (colString.length() <= 0)) {
        buff.setUpdatedAt(null);
      } else {
        buff.setUpdatedAt(CFSecurityPgSqlSchema.convertTimestampString(colString));
      }
      idxcol++;
    }
    buff.setRequiredClusterId(resultSet.getLong(idxcol));
    idxcol++;
    buff.setRequiredHostNodeId(resultSet.getLong(idxcol));
    idxcol++;
    buff.setRequiredDescription(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredHostName(resultSet.getString(idxcol));
    idxcol++;

    buff.setRequiredRevision(resultSet.getInt(idxcol));
    return (buff);
  }
  protected CFSecurityISOCountryLanguageBuff unpackISOCountryLanguageResultSetToBuff(
      ResultSet resultSet) throws SQLException {
    final String S_ProcName = "unpackISOCountryLanguageResultSetToBuff";
    int idxcol = 1;
    CFSecurityISOCountryLanguageBuff buff = schema.getFactoryISOCountryLanguage().newBuff();
    {
      String colString = resultSet.getString(idxcol);
      if (resultSet.wasNull()) {
        buff.setCreatedAt(null);
      } else if ((colString == null) || (colString.length() <= 0)) {
        buff.setCreatedAt(null);
      } else {
        buff.setCreatedAt(CFCrmMySqlSchema.convertTimestampString(colString));
      }
    }
    idxcol++;
    {
      String colString = resultSet.getString(idxcol);
      if (resultSet.wasNull()) {
        buff.setCreatedByUserId(null);
      } else if ((colString == null) || (colString.length() <= 0)) {
        buff.setCreatedByUserId(null);
      } else {
        buff.setCreatedByUserId(UUID.fromString(colString));
      }
    }
    idxcol++;
    {
      String colString = resultSet.getString(idxcol);
      if (resultSet.wasNull()) {
        buff.setUpdatedAt(null);
      } else if ((colString == null) || (colString.length() <= 0)) {
        buff.setUpdatedAt(null);
      } else {
        buff.setUpdatedAt(CFCrmMySqlSchema.convertTimestampString(colString));
      }
    }
    idxcol++;
    {
      String colString = resultSet.getString(idxcol);
      if (resultSet.wasNull()) {
        buff.setUpdatedByUserId(null);
      } else if ((colString == null) || (colString.length() <= 0)) {
        buff.setUpdatedByUserId(null);
      } else {
        buff.setUpdatedByUserId(UUID.fromString(colString));
      }
    }
    idxcol++;
    buff.setRequiredISOCountryId(resultSet.getShort(idxcol));
    idxcol++;
    buff.setRequiredISOLanguageId(resultSet.getShort(idxcol));
    idxcol++;

    buff.setRequiredRevision(resultSet.getInt(idxcol));
    return (buff);
  }
  protected CFInternetURLProtocolBuff unpackURLProtocolResultSetToBuff(ResultSet resultSet)
      throws SQLException {
    final String S_ProcName = "unpackURLProtocolResultSetToBuff";
    int idxcol = 1;
    CFInternetURLProtocolBuff buff = schema.getFactoryURLProtocol().newBuff();
    {
      String colString = resultSet.getString(idxcol);
      if (resultSet.wasNull()) {
        buff.setCreatedByUserId(null);
      } else if ((colString == null) || (colString.length() <= 0)) {
        buff.setCreatedByUserId(null);
      } else {
        buff.setCreatedByUserId(UUID.fromString(colString));
      }
      idxcol++;

      colString = resultSet.getString(idxcol);
      if (resultSet.wasNull()) {
        buff.setCreatedAt(null);
      } else if ((colString == null) || (colString.length() <= 0)) {
        buff.setCreatedAt(null);
      } else {
        buff.setCreatedAt(CFDbTestPgSqlSchema.convertTimestampString(colString));
      }
      idxcol++;
      colString = resultSet.getString(idxcol);
      if (resultSet.wasNull()) {
        buff.setUpdatedByUserId(null);
      } else if ((colString == null) || (colString.length() <= 0)) {
        buff.setUpdatedByUserId(null);
      } else {
        buff.setUpdatedByUserId(UUID.fromString(colString));
      }
      idxcol++;

      colString = resultSet.getString(idxcol);
      if (resultSet.wasNull()) {
        buff.setUpdatedAt(null);
      } else if ((colString == null) || (colString.length() <= 0)) {
        buff.setUpdatedAt(null);
      } else {
        buff.setUpdatedAt(CFDbTestPgSqlSchema.convertTimestampString(colString));
      }
      idxcol++;
    }
    buff.setRequiredURLProtocolId(resultSet.getInt(idxcol));
    idxcol++;
    buff.setRequiredName(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredDescription(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredIsSecure(resultSet.getBoolean(idxcol));
    idxcol++;

    buff.setRequiredRevision(resultSet.getInt(idxcol));
    return (buff);
  }
  protected CFCrmMemoDataBuff unpackMemoDataResultSetToBuff(ResultSet resultSet)
      throws SQLException {
    final String S_ProcName = "unpackMemoDataResultSetToBuff";
    int idxcol = 1;
    CFCrmMemoDataBuff buff = schema.getFactoryMemoData().newBuff();
    {
      String colString = resultSet.getString(idxcol);
      if (resultSet.wasNull()) {
        buff.setCreatedByUserId(null);
      } else if ((colString == null) || (colString.length() <= 0)) {
        buff.setCreatedByUserId(null);
      } else {
        buff.setCreatedByUserId(UUID.fromString(colString));
      }
      idxcol++;

      colString = resultSet.getString(idxcol);
      if (resultSet.wasNull()) {
        buff.setCreatedAt(null);
      } else if ((colString == null) || (colString.length() <= 0)) {
        buff.setCreatedAt(null);
      } else {
        buff.setCreatedAt(CFCrmMSSqlSchema.convertTimestampString(colString));
      }
      idxcol++;
      colString = resultSet.getString(idxcol);
      if (resultSet.wasNull()) {
        buff.setUpdatedByUserId(null);
      } else if ((colString == null) || (colString.length() <= 0)) {
        buff.setUpdatedByUserId(null);
      } else {
        buff.setUpdatedByUserId(UUID.fromString(colString));
      }
      idxcol++;

      colString = resultSet.getString(idxcol);
      if (resultSet.wasNull()) {
        buff.setUpdatedAt(null);
      } else if ((colString == null) || (colString.length() <= 0)) {
        buff.setUpdatedAt(null);
      } else {
        buff.setUpdatedAt(CFCrmMSSqlSchema.convertTimestampString(colString));
      }
      idxcol++;
    }
    buff.setRequiredTenantId(resultSet.getLong(idxcol));
    idxcol++;
    buff.setRequiredMemoId(resultSet.getLong(idxcol));
    idxcol++;
    buff.setRequiredContactId(resultSet.getLong(idxcol));
    idxcol++;
    buff.setRequiredMemo(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredRevision(resultSet.getInt(idxcol));
    return (buff);
  }
  private Statement createStatementToCheckIfFollowingExists(String userId, String applicationId) {
    UUID appUuid = UUID.fromString(applicationId);
    UUID userUuid = UUID.fromString(userId);

    return QueryBuilder.select()
        .countAll()
        .from(Follow.TABLE_NAME_APP_FOLLOWERS)
        .where(eq(USER_ID, userUuid))
        .and(eq(APP_ID, appUuid));
  }
  public static ResidencePermissions load(ClaimedResidence res, Map<String, Object> root)
      throws Exception {
    ResidencePermissions newperms = new ResidencePermissions(res);
    // newperms.owner = (String) root.get("Owner");
    if (root.containsKey("OwnerUUID")) {
      newperms.ownerUUID = UUID.fromString((String) root.get("OwnerUUID")); // get owner UUID
      //			String name = Residence.getPlayerName(newperms.ownerUUID); //try to find the current name
      // of the owner
      newperms.ownerLastKnownName =
          (String) root.get("OwnerLastKnownName"); // otherwise load last known name from file

      if (newperms.ownerLastKnownName.equalsIgnoreCase("Server land")
          || newperms.ownerLastKnownName.equalsIgnoreCase(Residence.getServerLandname())) {
        newperms.ownerUUID = UUID.fromString(Residence.getServerLandUUID()); // UUID for server land
        newperms.ownerLastKnownName = Residence.getServerLandname();
      } else if (newperms
          .ownerUUID
          .toString()
          .equals(Residence.getTempUserUUID())) // check for fake UUID
      {
        UUID realUUID =
            Residence.getPlayerUUID(
                newperms
                    .ownerLastKnownName); // try to find the real UUID of the player if possible now
        if (realUUID != null) newperms.ownerUUID = realUUID;
      }
    } else if (root.containsKey("Owner")) // convert old owner name save format into uuid format
    {
      String owner = (String) root.get("Owner");
      newperms.ownerLastKnownName = owner;
      newperms.ownerUUID = Residence.getPlayerUUID(owner);
      if (newperms.ownerUUID == null)
        newperms.ownerUUID =
            UUID.fromString(
                Residence
                    .getTempUserUUID()); // set fake UUID until we can find real one for last known
                                         // player
    } else {
      newperms.ownerUUID =
          UUID.fromString(
              Residence
                  .getServerLandUUID()); // cant determine owner name or UUID... setting zero UUID
                                         // which is server land
      newperms.ownerLastKnownName = Residence.getServerLandname();
    }
    newperms.world = (String) root.get("World");
    FlagPermissions.load(root, newperms);
    if (newperms.getOwner() == null
        || newperms.world == null
        || newperms.playerFlags == null
        || newperms.groupFlags == null
        || newperms.cuboidFlags == null) throw new Exception("Invalid Residence Permissions...");
    return newperms;
  }
  /**
   * @param record with values from the table
   * @return WalletStoreNetworkServiceMessage setters the values from table
   */
  private WalletStoreNetworkServiceMessage constructFrom(DatabaseTableRecord record) {

    WalletStoreNetworkServiceMessage walletStoreNetworkServiceMessage =
        new WalletStoreNetworkServiceMessage();

    try {

      walletStoreNetworkServiceMessage.setId(
          record.getLongValue(
              WalletStoreNetworkServiceDatabaseConstants.INCOMING_MESSAGES_TABLE_ID_COLUMN_NAME));
      walletStoreNetworkServiceMessage.setSender(
          UUID.fromString(
              record.getStringValue(
                  WalletStoreNetworkServiceDatabaseConstants
                      .INCOMING_MESSAGES_TABLE_SENDER_ID_COLUMN_NAME)));
      walletStoreNetworkServiceMessage.setReceiver(
          UUID.fromString(
              record.getStringValue(
                  WalletStoreNetworkServiceDatabaseConstants
                      .INCOMING_MESSAGES_TABLE_RECEIVER_ID_COLUMN_NAME)));
      walletStoreNetworkServiceMessage.setTextContent(
          record.getStringValue(
              WalletStoreNetworkServiceDatabaseConstants
                  .INCOMING_MESSAGES_TABLE_TEXT_CONTENT_COLUMN_NAME));
      walletStoreNetworkServiceMessage.setMessageType(
          MessagesTypes.getByCode(
              record.getStringValue(
                  WalletStoreNetworkServiceDatabaseConstants
                      .INCOMING_MESSAGES_TABLE_TYPE_COLUMN_NAME)));
      walletStoreNetworkServiceMessage.setShippingTimestamp(
          new Timestamp(
              record.getLongValue(
                  WalletStoreNetworkServiceDatabaseConstants
                      .INCOMING_MESSAGES_TABLE_SHIPPING_TIMESTAMP_COLUMN_NAME)));
      walletStoreNetworkServiceMessage.setDeliveryTimestamp(
          new Timestamp(
              record.getLongValue(
                  WalletStoreNetworkServiceDatabaseConstants
                      .INCOMING_MESSAGES_TABLE_DELIVERY_TIMESTAMP_COLUMN_NAME)));
      walletStoreNetworkServiceMessage.setStatus(
          MessagesStatus.getByCode(
              record.getStringValue(
                  WalletStoreNetworkServiceDatabaseConstants
                      .INCOMING_MESSAGES_TABLE_STATUS_COLUMN_NAME)));

    } catch (InvalidParameterException e) {
      // TODO METODO CON RETURN NULL - OJO: solo INFORMATIVO de ayuda VISUAL para DEBUG - Eliminar
      // si molesta
      // this should not happen, but if it happens return null
      return null;
    }

    return walletStoreNetworkServiceMessage;
  }
/** Created by user on 2/27/14. */
public class GattAttributes {

  public static final UUID CLIENT_CHARACTERISTIC_CONFIG =
      UUID.fromString("00002902-0000-1000-8000-00805f9b34fb");
  public static final UUID BLE_SHIELD_TX = UUID.fromString("713d0003-503e-4c75-ba94-3148f18d941e");
  public static final UUID BLE_SHIELD_RX = UUID.fromString("713d0002-503e-4c75-ba94-3148f18d941e");
  public static final UUID BLE_SHIELD_SERVICE =
      UUID.fromString("713d0000-503e-4c75-ba94-3148f18d941e");
  // public static final UUID BLE_SHIELD_SERVICE =
  // UUID.fromString("00001800-0000-1000-8000-00805f9b34fb");
}
  /**
   * Test the {@link PersonJournalEntryController#create(UUID, JournalEntryTO)} action.
   *
   * @throws ObjectNotFoundException Should not be thrown for this test.
   * @throws ValidationException Should not be thrown for this test.
   */
  @Test()
  public void testControllerCreateMultiple() throws ValidationException, ObjectNotFoundException {
    // Now create JournalEntry for testing
    final JournalEntryTO obj = new JournalEntryTO();
    obj.setPersonId(PERSON_ID);
    obj.setEntryDate(new Date());
    obj.setJournalSource(
        new ReferenceLiteTO<JournalSource>(
            UUID.fromString("b2d07973-5056-a51a-8073-1d3641ce507f"), ""));
    obj.setJournalTrack(
        new ReferenceLiteTO<JournalTrack>(
            UUID.fromString("b2d07a7d-5056-a51a-80a8-96ae5188a188"), ""));
    obj.setConfidentialityLevel(new ConfidentialityLevelLiteTO(CONFIDENTIALITY_LEVEL_ID, ""));
    obj.setObjectStatus(ObjectStatus.ACTIVE);

    final ReferenceLiteTO<JournalStep> journalStep =
        new ReferenceLiteTO<JournalStep>(JOURNAL_STEP_ID, "");
    final Set<JournalEntryDetailTO> journalEntryDetails = Sets.newHashSet();
    final Set<ReferenceLiteTO<JournalStepDetail>> details = Sets.newHashSet();

    final JournalEntryDetailTO journalEntryDetail = new JournalEntryDetailTO();
    journalEntryDetail.setJournalStep(journalStep);
    details.add(new ReferenceLiteTO<JournalStepDetail>(JOURNAL_STEP_DETAIL_ID, ""));

    final JournalEntryDetailTO journalEntryDetail2 = new JournalEntryDetailTO();
    journalEntryDetail2.setJournalStep(journalStep);
    details.add(new ReferenceLiteTO<JournalStepDetail>(JOURNAL_STEP_DETAIL_ID2, ""));

    journalEntryDetail.setJournalStepDetails(details);
    journalEntryDetails.add(journalEntryDetail);
    obj.setJournalEntryDetails(journalEntryDetails);

    final JournalEntryTO saved = controller.create(PERSON_ID, obj);
    final Session session = sessionFactory.getCurrentSession();
    session.flush();

    final UUID savedId = saved.getId();
    assertNotNull("Saved instance identifier should not have been null.", savedId);
    assertEquals("PersonIds did not match.", PERSON_ID, saved.getPersonId());
    assertFalse(
        "JournalEntryDetails should have had entries.", saved.getJournalEntryDetails().isEmpty());

    session.clear();

    final JournalEntryTO reloaded = controller.get(savedId, PERSON_ID);
    assertFalse(
        "JournalEntryDetails should have had entries.",
        reloaded.getJournalEntryDetails().isEmpty());
    assertEquals(
        "Details list did not have the expected item count.",
        2,
        reloaded.getJournalEntryDetails().size());
  }
 public static BluetoothSocket createSocket(final BluetoothDevice device) throws IOException {
   if (Build.VERSION.SDK_INT >= 10) {
     // We're trying to create an insecure socket, which is only
     // supported in API 10 and up. Otherwise, we try a secure socket
     // which is in API 7 and up.
     return device.createInsecureRfcommSocketToServiceRecord(
         UUID.fromString("00001101-0000-1000-8000-00805F9B34FB"));
   } else {
     return device.createRfcommSocketToServiceRecord(
         UUID.fromString("00001101-0000-1000-8000-00805F9B34FB"));
   }
 }