Java 类java.io.Serializable 实例源码

项目:alfresco-repository    文件:ActivitiMultitenantWorkflowTest.java   
/**
 * ALF-15939: Call-activity should be multi-tenant aware.
 */
public void testSubProcessCallActivity() throws Exception
{
    // Run as User1 so tenant domain 1
    AuthenticationUtil.setFullyAuthenticatedUser(user1);

    // Deploy called sub-process on tenant domain 1
    InputStream input = getInputStream(CALLACTIVITY_SUBPROCESS_LOCATION);
    WorkflowDeployment deployment = workflowService.deployDefinition(getEngine(), input, XML);

    // Deploy called main-process on tenant domain 1
    input = getInputStream(CALLACTIVITY_MAINPROCESS_LOCATION);
    deployment = workflowService.deployDefinition(getEngine(), input, XML);
    WorkflowDefinition mainProcessDefinition = deployment.getDefinition();

    // Start a process, which immediately tries to call the sub-process before returning control to thread
    try {
        workflowService.startWorkflow(mainProcessDefinition.getId(), new HashMap<QName, Serializable>());
    } catch(Exception e) {
        e.printStackTrace();
        fail("No exception was expected while running process, but got: " + e.toString());
    }
}
项目:backbone    文件:BaseParser.java   
private String getSelectField(String field, Query<? extends Serializable> query, boolean inWhere) {
    Class<?> beanType = query.getBeanType();
    AnnotationHolder ah = AnnotationHelper.getAnnotationHolder(field, beanType);
    if (ah == null) throw new IllegalArgumentException(" Can't find field `"+ field +"` in class["+ beanType +"]");

    String name = ah.getField().getName();
    if (!inWhere) {
        String ref = ah.getColumn().referenceField();
        if (SqlUtils.isNotBlank(ah.getOgnl())) {
            name = "`" + name + "` as `" + ah.getOgnl() + "." + ah.getField().getName() + "`";
        } else if (SqlUtils.isNotBlank(ref)) {
            name = "`" + name + "` as `" + ah.getField().getName() + "." + ref + "`";
        }
    }

    return name;
}
项目:alfresco-repository    文件:NodePropertyValue.java   
@Override
Serializable convert(Serializable value)
{
    if (value == null)
    {
        return null;
    }
    else if (value instanceof Long)
    {
        return value;
    }
    else if (value instanceof ContentDataId)
    {
        return ((ContentDataId)value).getId();
    }
    else
    {
        return DefaultTypeConverter.INSTANCE.convert(ContentData.class, value);
    }
}
项目:alfresco-repository    文件:BaseNodeServiceTest.java   
public void testAddProperties() throws Exception
{
    Map<QName, Serializable> properties = nodeService.getProperties(rootNodeRef);
    // Add an aspect with a default value
    nodeService.addAspect(rootNodeRef, ASPECT_QNAME_TEST_TITLED, null);
    assertNull("Expected null property", nodeService.getProperty(rootNodeRef, PROP_QNAME_TEST_TITLE));
    assertNull("Expected null property", nodeService.getProperty(rootNodeRef, PROP_QNAME_TEST_DESCRIPTION));

    // Now add a map of two properties and check
    Map<QName, Serializable> addProperties = new HashMap<QName, Serializable>(11);
    addProperties.put(PROP_QNAME_TEST_TITLE, "Title");
    addProperties.put(PROP_QNAME_TEST_DESCRIPTION, "Description");
    nodeService.addProperties(rootNodeRef, addProperties);

    // Check
    Map<QName, Serializable> checkProperties = nodeService.getProperties(rootNodeRef);
    assertEquals("Title", checkProperties.get(PROP_QNAME_TEST_TITLE));
    assertEquals("Description", checkProperties.get(PROP_QNAME_TEST_DESCRIPTION));
}
项目:alfresco-repository    文件:TikaAutoMetadataExtracterTest.java   
private Map<String, Serializable> openAndCheck(String fileBase, String expMimeType) throws Throwable {
   // Get the mimetype via the MimeTypeMap 
   // (Uses Tika internally for the detection)
   File file = open(fileBase);
   ContentReader detectReader = new FileContentReader(file);
   String mimetype = mimetypeMap.guessMimetype(fileBase, detectReader);

   assertEquals("Wrong mimetype for " + fileBase, mimetype, expMimeType);

   // Ensure the Tika Auto parser actually handles this
   assertTrue("Mimetype should be supported but isn't: " + mimetype, extracter.isSupported(mimetype));

   // Now create our proper reader
   ContentReader sourceReader = new FileContentReader(file);
   sourceReader.setMimetype(mimetype);

   // And finally do the properties extraction
   return extracter.extractRaw(sourceReader);
}
项目:alfresco-remote-api    文件:NodesImpl.java   
private NodeRef createNodeImpl(NodeRef parentNodeRef, String nodeName, QName nodeTypeQName, Map<QName, Serializable> props, QName assocTypeQName)
{
    NodeRef newNode = null;
    if (props == null)
    {
        props = new HashMap<>(1);
    }
    props.put(ContentModel.PROP_NAME, nodeName);

    validatePropValues(props);

    QName assocQName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, QName.createValidLocalName(nodeName));
    try
    {
        newNode = nodeService.createNode(parentNodeRef, assocTypeQName, assocQName, nodeTypeQName, props).getChildRef();
    }
    catch (DuplicateChildNodeNameException dcne)
    {
        // duplicate - name clash
        throw new ConstraintViolatedException(dcne.getMessage());
    }

    ActivityInfo activityInfo =  getActivityInfo(parentNodeRef, newNode);
    postActivity(Activity_Type.ADDED, activityInfo, false);
    return newNode;
}
项目:lazycat    文件:XByteBuffer.java   
public static Serializable deserialize(byte[] data, int offset, int length, ClassLoader[] cls)
        throws IOException, ClassNotFoundException, ClassCastException {
    invokecount.addAndGet(1);
    Object message = null;
    if (cls == null)
        cls = new ClassLoader[0];
    if (data != null && length > 0) {
        InputStream instream = new ByteArrayInputStream(data, offset, length);
        ObjectInputStream stream = null;
        stream = (cls.length > 0) ? new ReplicationStream(instream, cls) : new ObjectInputStream(instream);
        message = stream.readObject();
        instream.close();
        stream.close();
    }
    if (message == null) {
        return null;
    } else if (message instanceof Serializable)
        return (Serializable) message;
    else {
        throw new ClassCastException("Message has the wrong class. It should implement Serializable, instead it is:"
                + message.getClass().getName());
    }
}
项目:Spring-Shiro-Spark    文件:ShiroSessionDao.java   
@Override
protected Session doReadSession(Serializable sessionId) {
    logger.debug("begin doReadSession {}", sessionId);
    Jedis jedis = jedisPool.getResource();
    Session session = null;
    try {
        String key = prefix + sessionId;
        String value = jedis.get(key);
        if(StringUtils.isNotBlank(value)){
            session = SerializeUtils.deserializeFromString(value);
            logger.info("sessionId {} ttl {}: ", sessionId, jedis.ttl(key));
            //重置Redis中缓存过期的时间
            jedis.expire(key,expireTime);
            logger.info("sessionId {} name {} 被读取", sessionId, session.getClass().getName());
        }
    } catch (Exception e){
        logger.warn("读取session失败");
    } finally {
        jedis.close();
    }
    return session;
}
项目:Equella    文件:ClusteredTaskServiceImpl.java   
protected Serializable[] getArgsForTask(ClusteredTaskWithArgs withArgs)
{
    String argsId = withArgs.getArgsId();
    if( argsId != null )
    {
        String nodeId = withArgs.getNodeId();
        if( nodeId.equals(ourNodeId) )
        {
            Serializable[] args = taskArgs.getIfPresent(argsId);
            taskArgs.invalidate(argsId);
            return args;
        }
        else
        {
            BlockingQueue<SimpleMessage> mq = createResponseQueue(argsId);
            clusterMessagingService.postMessage(nodeId, new ArgsMessage(argsId, ourNodeId));
            ArgsMessage argsResponse = waitForResponse(5000, mq);
            return argsResponse.getArgs();
        }
    }
    else
    {
        return withArgs.getArgs();
    }
}
项目:neoscada    文件:DataNode.java   
/**
 * Create a new data node and fill it with the serialized representation of
 * the data object provided.
 * 
 * @param id
 *            the node id
 * @param data
 *            the data to serialize
 */
public DataNode ( final String id, final Serializable data )
{
    this.id = id;

    if ( data == null )
    {
        this.data = null;
    }
    else
    {
        final ByteArrayOutputStream bos = new ByteArrayOutputStream ();
        try
        {
            final ObjectOutputStream os = new ObjectOutputStream ( bos );
            os.writeObject ( data );
            os.close ();
            this.data = bos.toByteArray ();
        }
        catch ( final IOException e )
        {
            throw new RuntimeException ( "Failed to store data node", e );
        }
    }
}
项目:lazycat    文件:SerializablePrincipal.java   
public static void writePrincipal(GenericPrincipal p, ObjectOutput out) throws IOException {
    out.writeUTF(p.getName());
    out.writeBoolean(p.getPassword() != null);
    if (p.getPassword() != null)
        out.writeUTF(p.getPassword());
    String[] roles = p.getRoles();
    if (roles == null)
        roles = new String[0];
    out.writeInt(roles.length);
    for (int i = 0; i < roles.length; i++)
        out.writeUTF(roles[i]);
    boolean hasUserPrincipal = (p != p.getUserPrincipal() && p.getUserPrincipal() instanceof Serializable);
    out.writeBoolean(hasUserPrincipal);
    if (hasUserPrincipal)
        out.writeObject(p.getUserPrincipal());
}
项目:alfresco-repository    文件:CheckOutCheckInServiceImplTest.java   
/**
 * Test when the aspect is not set when check-in is performed
 */
public void testVersionAspectNotSetOnCheckIn()
{
    // Create a bag of props
    Map<QName, Serializable> bagOfProps = createTypePropertyBag();
    bagOfProps.put(ContentModel.PROP_CONTENT, new ContentData(null, MimetypeMap.MIMETYPE_TEXT_PLAIN, 0L, "UTF-8"));

    // Create a new node 
    ChildAssociationRef childAssocRef = nodeService.createNode(
            rootNodeRef,
            ContentModel.ASSOC_CHILDREN,
            QName.createQName("test"),
            ContentModel.TYPE_CONTENT,
            bagOfProps);
    NodeRef noVersionNodeRef = childAssocRef.getChildRef();

    // Check out and check in
    NodeRef workingCopy = cociService.checkout(noVersionNodeRef);
    cociService.checkin(workingCopy, new HashMap<String, Serializable>());

    // Check that the origional node has no version history dispite sending verion props
    assertNull(this.versionService.getVersionHistory(noVersionNodeRef));        
}
项目:alfresco-repository    文件:AccessAuditorTest.java   
@Test
public final void test02OnCopyComplete() throws Exception
{
  serviceRegistry.getFileFolderService().copy(content2, folder1, null); // keep leaf name

  txn.commit();
  txn = null;

  // TODO do we record the parent or the full path? Do we need to?

  assertEquals(1, auditMapList.size());
  Map<String, Serializable> auditMap = auditMapList.get(0);
  assertEquals("COPY", auditMap.get("action"));
  assertContains("createNode", auditMap.get("sub-actions"));
  assertContains("updateNodeProperties", auditMap.get("sub-actions"));
  assertContains("addNodeAspect", auditMap.get("sub-actions"));
  assertContains("copyNode", auditMap.get("sub-actions"));
  assertEquals("/cm:homeFolder/cm:folder1/cm:content2", auditMap.get("path"));
  assertEquals("/cm:homeFolder/cm:folder2/cm:content2", auditMap.get("copy/from/path"));
  assertEquals("cm:content", auditMap.get("type"));
}
项目:alfresco-repository    文件:VersionServiceImplTest.java   
public void testAR807() 
{
    QName prop = QName.createQName("http://www.alfresco.org/test/versionstorebasetest/1.0", "intProp");

    ChildAssociationRef childAssociation = 
        nodeService.createNode(this.rootNodeRef, 
                                 ContentModel.ASSOC_CHILDREN, 
                                 QName.createQName("http://www.alfresco.org/test/versionstorebasetest/1.0", "integerTest"), 
                                 TEST_TYPE_QNAME);
    NodeRef newNode = childAssociation.getChildRef();
    nodeService.setProperty(newNode, prop, 1);

    Object editionCode = nodeService.getProperty(newNode, prop);
    assertEquals(editionCode.getClass(), Integer.class);

    Map<String, Serializable> versionProps = new HashMap<String, Serializable>(1);
    versionProps.put(VersionModel.PROP_VERSION_TYPE, VersionType.MAJOR);
    Version version = versionService.createVersion(newNode, versionProps);

    NodeRef versionNodeRef = version.getFrozenStateNodeRef();
    assertNotNull(versionNodeRef);

    Object editionCodeArchive = nodeService.getProperty(versionNodeRef, prop);
    assertEquals(editionCodeArchive.getClass(), Integer.class);
}
项目:parabuild-ci    文件:PersistentCollection.java   
static void identityRemove(Collection list, Object object, SessionImplementor session) 
throws HibernateException {

    if ( object!=null && session.isSaved(object) ) {

        Serializable idOfCurrent = session.getEntityIdentifierIfNotUnsaved(object);
        Iterator iter = list.iterator();
        while ( iter.hasNext() ) {
            Serializable idOfOld = session.getEntityIdentifierIfNotUnsaved( iter.next() );
            if ( idOfCurrent.equals(idOfOld) ) {
                iter.remove();
                break;
            }
        }

    }
}
项目:scanning    文件:SampleInformationTest.java   
@Test
public void testDialog() throws Exception {
    Shell shell = bot.shell("Sample").widget;

    List<Exception> errors = new ArrayList<>();
    shell.getDisplay().syncExec(()->{
        try {
            // Intentionally loose generics here because the
            // ModelCellEditor cannot type check so we mimik
            // what it does to reproduce an old defect
            IModelDialog dialog = interfaceService.createModelDialog(shell);
            dialog.create();
            dialog.setModel((Serializable)config);
        } catch (Exception ne) {
            errors.add(ne);
        }
    });
    if (errors.size()>0) throw errors.get(0);
}
项目:alfresco-repository    文件:ScriptAction.java   
/**
 * Return all the properties known about this node. The Map returned implements the Scriptable interface to allow access to the properties via JavaScript associative array
 * access. This means properties of a node can be access thus: <code>node.properties["name"]</code>
 * 
 * @return Map of properties for this Node.
 */
@SuppressWarnings("synthetic-access")
public Map<String, Serializable> getParameters()
{
    if (this.parameters == null)
    {
        // this Map implements the Scriptable interface for native JS syntax property access
        this.parameters = new ScriptableParameterMap<String, Serializable>();
        Map<String, Serializable> actionParams = this.action.getParameterValues();
        for (Map.Entry<String, Serializable> entry : actionParams.entrySet())
        {
            String name = entry.getKey();
            this.parameters.put(name, converter.convertActionParamForScript(name, entry.getValue()));
        }
        this.parameters.setModified(false);
    }
    return this.parameters;
}
项目:alfresco-repository    文件:ActivitiDueDatePropertyHandler.java   
/**
* {@inheritDoc}
*/
@Override
protected Object handleDelegateTaskProperty(DelegateTask task, TypeDefinition type, QName key, Serializable value)
{
    checkType(key, value, Date.class);
    task.setDueDate((Date) value);
    return DO_NOT_ADD;
}
项目:rekit-game    文件:LevelManager.java   
private static Serializable fromBase64(String s) {
    try {
        byte[] data = Base64.getDecoder().decode(s);
        ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(data));
        Object o = ois.readObject();
        ois.close();
        return (Serializable) o;
    } catch (IOException | IllegalArgumentException | ClassNotFoundException e) {
        GameConf.GAME_LOGGER.error(e.getMessage());
        return null;
    }
}
项目:lams    文件:PersistentArrayHolder.java   
@Override
public void initializeFromCache(CollectionPersister persister, Serializable disassembled, Object owner)
        throws HibernateException {
    final Serializable[] cached = (Serializable[]) disassembled;
    array = Array.newInstance( persister.getElementClass(), cached.length );

    for ( int i=0; i<cached.length; i++ ) {
        Array.set( array, i, persister.getElementType().assemble( cached[i], getSession(), owner ) );
    }
}
项目:apache-tomcat-7.0.73-with-comment    文件:RpcChannel.java   
/**
 * Send a message and wait for the response.
 * @param destination Member[] - the destination for the message, and the members you request a reply from
 * @param message Serializable - the message you are sending out
 * @param rpcOptions int - FIRST_REPLY, MAJORITY_REPLY or ALL_REPLY
 * @param channelOptions channel sender options
 * @param timeout long - timeout in milliseconds, if no reply is received within this time null is returned
 * @return Response[] - an array of response objects.
 * @throws ChannelException
 */
public Response[] send(Member[] destination, 
                       Serializable message,
                       int rpcOptions, 
                       int channelOptions,
                       long timeout) throws ChannelException {

    if ( destination==null || destination.length == 0 ) return new Response[0];

    //avoid dead lock
    int sendOptions =
        channelOptions & ~Channel.SEND_OPTIONS_SYNCHRONIZED_ACK;

    RpcCollectorKey key = new RpcCollectorKey(UUIDGenerator.randomUUID(false));
    RpcCollector collector = new RpcCollector(key,rpcOptions,destination.length);
    try {
        synchronized (collector) {
            if ( rpcOptions != NO_REPLY ) responseMap.put(key, collector);
            RpcMessage rmsg = new RpcMessage(rpcId, key.id, message);
            channel.send(destination, rmsg, sendOptions);
            if ( rpcOptions != NO_REPLY ) collector.wait(timeout);
        }
    } catch ( InterruptedException ix ) {
        Thread.currentThread().interrupt();
    } finally {
        responseMap.remove(key);
    }
    return collector.getResponses();
}
项目:alfresco-repository    文件:JscriptWorkflowTask.java   
/**
 * Gets the value of the <code>properties</code> property
 * 
 * @return the properties
 */
public Scriptable getProperties()
{
    // instantiate ScriptableQNameMap<String, Serializable> properties
    // from WorkflowTasks's Map<QName, Serializable> properties
    ScriptableQNameMap<String, Serializable> properties = new ScriptableQNameMap<String, Serializable>(namespaceProvider);
    properties.putAll(task.getProperties());
    return properties;
}
项目:sucok-framework    文件:BaseDao.java   
/**
 * 通过Ids列表查询对象列表
 *
 * @param ids
 * @return 返回查询出的所有列表
 */
public List<T> findByIds(List<ID> ids) {
    List<T> list = new ArrayList<>(ids.size());
    for (Serializable id : ids) {
        T item = em.find(entityClass, id);
        if (item != null) {
            list.add(item);
        }
    }
    return list;
}
项目:alfresco-repository    文件:ActivitiWorkflowEngine.java   
private boolean checkPropertiesPresent(Map<QName, Object> expectedProperties, Map<QName, Serializable> props)
{
    for(Map.Entry<QName, Object> entry : expectedProperties.entrySet())
    {
        if(props.containsKey(entry.getKey())) 
        {
            Object requiredValue = entry.getValue();
            Object actualValue = props.get(entry.getKey());

            if(requiredValue != null)
            {
                if(!requiredValue.equals(actualValue))
                {
                    return false;
                }
                break;
            }
            else
            {
                if(actualValue != null)
                {
                    return false;
                }
                break;
            }
        }
        if(entry.getValue() != null)
        {
            // If variable is not found and required value is non null, start-task doesn't match
            return false;                    
        }
    }

    return true;
}
项目:beaker-notebook-archive    文件:CommMsgHandler.java   
private void handleMsg(Message message) {
  Map<String, Serializable> commMap = message.getContent();
  Comm comm = kernel.getComm(getString(commMap, COMM_ID));
  logger.debug("Comm message handling, target name: " + (comm != null ? comm.getTargetName() : "undefined"));
  if (comm != null) {
    comm.handleMsg(message);
  }
}
项目:openjdk-jdk10    文件:PropertyChangeSupport.java   
/**
 * @serialData Null terminated list of {@code PropertyChangeListeners}.
 * <p>
 * At serialization time we skip non-serializable listeners and
 * only serialize the serializable listeners.
 */
private void writeObject(ObjectOutputStream s) throws IOException {
    Hashtable<String, PropertyChangeSupport> children = null;
    PropertyChangeListener[] listeners = null;
    synchronized (this.map) {
        for (Entry<String, PropertyChangeListener[]> entry : this.map.getEntries()) {
            String property = entry.getKey();
            if (property == null) {
                listeners = entry.getValue();
            } else {
                if (children == null) {
                    children = new Hashtable<>();
                }
                PropertyChangeSupport pcs = new PropertyChangeSupport(this.source);
                pcs.map.set(null, entry.getValue());
                children.put(property, pcs);
            }
        }
    }
    ObjectOutputStream.PutField fields = s.putFields();
    fields.put("children", children);
    fields.put("source", this.source);
    fields.put("propertyChangeSupportSerializedDataVersion", 2);
    s.writeFields();

    if (listeners != null) {
        for (PropertyChangeListener l : listeners) {
            if (l instanceof Serializable) {
                s.writeObject(l);
            }
        }
    }
    s.writeObject(null);
}
项目:alfresco-repository    文件:CheckOutCheckInServiceImpl.java   
@Override
@Extend(traitAPI=CheckOutCheckInServiceTrait.class,extensionAPI=CheckOutCheckInServiceExtension.class)
public NodeRef checkin(
        NodeRef workingCopyNodeRef,
        Map<String, Serializable> versionProperties, 
        String contentUrl) 
{
    return checkin(workingCopyNodeRef, versionProperties, contentUrl, false);
}
项目:beaker-notebook-archive    文件:MessageFactoryTest.java   
public static Message getExecuteRequestMessage(String code) {
  Message message = new Message();
  Header header = new Header();
  header.setTypeEnum(JupyterMessages.EXECUTE_REQUEST);
  message.setHeader(header);
  HashMap<String, Serializable> content = new HashMap<>();
  content.put("code", code);
  message.setContent(content);
  return message;
}
项目:EasyTransaction    文件:DubboEasyTransRpcConsumerImpl.java   
@Override
public <P extends EasyTransRequest<R, ?>, R extends Serializable> void callWithNoReturn(
        String appId, String busCode, String innerMethod, Map<String,Object> header, P params) {
    GenericService caller = getCaller(appId, busCode,params);
    caller.$invoke(innerMethod, new String[]{params.getClass().getName(), header.getClass().getName()}, new Object[]{params,header});
    return;
}
项目:ArchUnit    文件:FirstClassWithDependency.java   
void first() {
    ClassHoldingDependencies instanceOne = new ClassHoldingDependencies();
    Object someOtherObject = new Object();
    Serializable someSerializable = new Serializable() {
    };
    instanceOne.setSomeInt(1);
    someOtherObject.toString();
    someSerializable.hashCode();
    instanceOne.someInt = 5;
}
项目:objectbox-java    文件:TestUtils.java   
public static <T extends Serializable> T serializeDeserialize(T entity) throws IOException, ClassNotFoundException {
    ByteArrayOutputStream bytesOut = new ByteArrayOutputStream();
    ObjectOutputStream out = new ObjectOutputStream(bytesOut);
    out.writeObject(entity);
    out.close();
    ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(bytesOut.toByteArray()));
    Object entityDeserialized = in.readObject();
    in.close();
    return (T) entityDeserialized;
}
项目:ipf-flow-manager    文件:RenderedMessageEncryptEventListener.java   
protected void encrypt(Object entityObject, Serializable id, Object[] state) {
    if (entityObject instanceof TextMessage) {
        TextMessage entity = (TextMessage) entityObject;
        if (state[0] instanceof String) {
                String decrypted = ((String) state[0]);
                String encryptedString = stringEncryptor.encrypt(decrypted);
                state[0] = encryptedString;
                entity.setText(encryptedString);
        }
    }
}
项目:open-rmbt    文件:SmoothGraph.java   
@Override
public GraphData getGraphData() {
    final Bundle options = new Bundle();
    options.putLong(OPTION_STARTTIME, startTime);
    options.putSerializable(OPTION_VALUELIST, (Serializable) valueList);
    options.putParcelable(OPTION_FIRSTPOINT, firstPoint);

    return new GraphData(pathStroke, pathFill, paintStroke, paintFill, options);
}
项目:tomcat7    文件:AbstractReplicatedMap.java   
@Override
public boolean accept(Serializable msg, Member sender) {
    boolean result = false;
    if (msg instanceof MapMessage) {
        if ( log.isTraceEnabled() ) log.trace("Map["+mapname+"] accepting...."+msg);
        result = Arrays.equals(mapContextName, ( (MapMessage) msg).getMapId());
        if ( log.isTraceEnabled() ) log.trace("Msg["+mapname+"] accepted["+result+"]...."+msg);
    }
    return result;
}
项目:alfresco-repository    文件:TransitionSimpleWorkflowActionExecuterTest.java   
private void addWorkflowAspect(NodeRef node, NodeRef destinationFolder, Boolean moveOnApprove, Boolean moveOnReject)
{
    // Set up workflow details on the node
    Map<QName, Serializable> propertyValues = createWorkflowProperties(destinationFolder, moveOnApprove, moveOnReject);

    // Apply the simple workflow aspect to the node
    this.nodeService.addAspect(node, ApplicationModel.ASPECT_SIMPLE_WORKFLOW, propertyValues);
}
项目:gitplex-mit    文件:HibernateInterceptor.java   
@Override
public boolean onLoad(Object entity, Serializable id, Object[] state, String[] propertyNames,
        Type[] types) throws CallbackException {
    boolean changed = false;
    for (PersistListener listener: listeners) {
        if (listener.onLoad(entity, id, state, propertyNames, types))
            changed = true;
    }

    return changed;
}
项目:NotifyTools    文件:BeanContextSupport.java   
/**
 * Serializes children to the given object input stream.
 * <p>
 * The implementation iterates through all children and writes out pairs 
 * of child object and <code>BCSChild</code> object if the child is 
 * serializable (implements <code>Serialization</code>.</p>
 * <p>
 * This method is called by <code>writeObject()</code> if the context
 * works standalone. Or if this support object is a delegate of another 
 * <code>BeanContext</code> implementation, then this method should be 
 * called by the peer to avoid the 'chicken and egg' problem during
 * deserialization.</p>
 * 
 * @param oos   the stream to write
 * @throws IOException if I/O exception occurs
 */
public final void writeChildren(ObjectOutputStream oos) throws IOException {
    boolean origSer = serializing;
    serializing = true;

    try {
        int count = 0;
        synchronized (children) {
            for (Iterator iter = children.values().iterator(); iter
                    .hasNext();) {
                BCSChild bcsc = (BCSChild) iter.next();
                if (bcsc.child instanceof Serializable
                        && (bcsc.proxyPeer == null || bcsc.proxyPeer instanceof Serializable)) {
                    oos.writeObject(bcsc.child);
                    oos.writeObject(bcsc);
                    count++;
                }
            }
        }

        // what if count not equals to serializable?
        if (count != serializable) {
            throw new IOException(Messages.getString("beans.6F"));
        }
    } finally {
        serializing = origSer;
    }
}
项目:alfresco-repository    文件:PersonServiceImpl.java   
/**
 * Determine if the updated properties constitute a valid user update.
 * Currently we only check for updates to the user firstname, lastname
 * 
 * @param before Map<QName, Serializable>
 * @param after Map<QName, Serializable>
 * @return boolean
 */
private boolean validUserUpdateEvent(Map<QName, Serializable> before, Map<QName, Serializable> after)
{
    final String firstnameBefore = (String)before.get(ContentModel.PROP_FIRSTNAME);
    final String lastnameBefore  = (String)before.get(ContentModel.PROP_LASTNAME);
    final String firstnameAfter  = (String)after.get(ContentModel.PROP_FIRSTNAME);
    final String lastnameAfter   = (String)after.get(ContentModel.PROP_LASTNAME);

    boolean updatedFirstName = !EqualsHelper.nullSafeEquals(firstnameBefore, firstnameAfter);
    boolean updatedLastName  = !EqualsHelper.nullSafeEquals(lastnameBefore, lastnameAfter);

    return updatedFirstName || updatedLastName;
}
项目:alfresco-repository    文件:ResetPasswordServiceImpl.java   
@Override
public void requestReset(String userId, String clientName)
{
    ParameterCheck.mandatoryString("userId", userId);
    ParameterCheck.mandatoryString("clientName", clientName);

    String userEmail = validateUserAndGetEmail(userId);

    // Get the (latest) workflow definition for reset-password.
    WorkflowDefinition wfDefinition = workflowService.getDefinitionByName(WorkflowModelResetPassword.WORKFLOW_DEFINITION_NAME);

    // create workflow properties
    Map<QName, Serializable> props = new HashMap<>(7);
    props.put(WorkflowModel.PROP_WORKFLOW_DESCRIPTION, I18NUtil.getMessage(WORKFLOW_DESCRIPTION_KEY));
    props.put(WorkflowModelResetPassword.WF_PROP_USERNAME, userId);
    props.put(WorkflowModelResetPassword.WF_PROP_USER_EMAIL, userEmail);
    props.put(WorkflowModelResetPassword.WF_PROP_CLIENT_NAME, clientName);
    props.put(WorkflowModel.ASSOC_PACKAGE, workflowService.createPackage(null));

    String guid = GUID.generate();
    props.put(WorkflowModelResetPassword.WF_PROP_KEY, guid);
    props.put(WorkflowModelResetPassword.WF_PROP_TIMER_END, timerEnd);

    // start the workflow
    WorkflowPath path = workflowService.startWorkflow(wfDefinition.getId(), props);
    if (path.isActive())
    {
        WorkflowTask startTask = workflowService.getStartTask(path.getInstance().getId());
        workflowService.endTask(startTask.getId(), null);
    }
}
项目:ArchUnit    文件:HasParameterTypesTest.java   
@Test
public void predicate_on_parameters_by_Class() {
    HasParameterTypes hasParameterTypes = newHasParameterTypes(String.class, Serializable.class);

    assertThat(parameterTypes(String.class, Serializable.class).apply(hasParameterTypes)).as("predicate matches").isTrue();
    assertThat(parameterTypes(String.class).apply(hasParameterTypes)).as("predicate matches").isFalse();
    assertThat(parameterTypes(Serializable.class).apply(hasParameterTypes)).as("predicate matches").isFalse();
    assertThat(parameterTypes(Object.class).apply(hasParameterTypes)).as("predicate matches").isFalse();
    assertThat(parameterTypes(String.class, Serializable.class).getDescription())
            .isEqualTo("parameter types [java.lang.String, java.io.Serializable]");
}